cc1
v2.1
CC1 source code docs
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
s014_add_networks.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
# @COPYRIGHT_begin
3
#
4
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
#
10
# http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
#
18
# @COPYRIGHT_end
19
20
import
hashlib
21
from
predefined.users
import
*
22
from
predefined.actions
import
*
23
from
predefined.macros
import
*
24
25
actions = []
26
actions.append(list_clusters)
27
28
######################
29
# Add available pool #
30
######################
31
32
# Register new, test network pool
33
actions.append({
'
u': u_admin_cm,
34
'as_cmadmin'
:
True
,
35
'fname'
:
'network.admin_cm.add'
,
36
'args'
: [{
'mask'
: 16,
'address'
:
'10.255.0.0'
}],
37
'estatus'
:
'ok'
})
38
# Try to add again the same network
39
actions.append({
'
u': u_admin_cm,
40
'as_cmadmin'
:
True
,
41
'fname'
:
'network.admin_cm.add'
,
42
'args'
: [{
'mask'
: 16,
'address'
:
'10.255.0.0'
}],
43
'estatus'
:
'network_exists'
})
44
# Try to add network, inside this, not giving network addres, but host inside network
45
actions.append({
'
u': u_admin_cm,
46
'as_cmadmin'
:
True
,
47
'fname'
:
'network.admin_cm.add'
,
48
'args'
: [{
'mask'
: 16,
'address'
:
'10.255.1.0'
}],
49
'estatus'
:
'network_exists'
})
50
# Try to add smaller network, inside existing
51
actions.append({
'
u': u_admin_cm,
52
'as_cmadmin'
:
True
,
53
'fname'
:
'network.admin_cm.add'
,
54
'args'
: [{
'mask'
: 24,
'address'
:
'10.255.2.0'
}],
55
'estatus'
:
'network_exists'
})
56
# Try to add network bewore existing, but convering existing net
57
actions.append({
'
u': u_admin_cm,
58
'as_cmadmin'
:
True
,
59
'fname'
:
'network.admin_cm.add'
,
60
'args'
: [{
'mask'
: 15,
'address'
:
'10.254.0.0'
}],
61
'estatus'
:
'network_exists'
})
62
63
64
########################
65
# Store available pool #
66
########################
67
68
# List available networks
69
actions.append(list_available_networks)
70
71
72
##########################################
73
# Add user_network in various situations #
74
##########################################
75
76
# Request new user_network before unlocking
77
actions.append({
'
u': u_new,
78
'fname'
:
'network.user.request'
,
79
'args'
: [{
'name'
:
'test_network'
,
'size'
: 32}],
80
'estatus'
:
'network_not_available'
})
81
# Unclock new pool
82
actions.append({
'
u': u_admin_cm,
83
'as_cmadmin'
:
True
,
84
'fname'
:
'network.admin_cm.unlock'
,
85
'args'
: [
'@r["available_networks"][0]["id"]'
]})
86
87
# Request new user_network
88
actions.append({
'
u': u_new,
89
'fname'
:
'network.user.request'
,
90
'args'
: [{
'name'
:
'test_network'
,
'size'
: 32}]})
91
# Request new too large user_network
92
actions.append({
'
u': u_new,
93
'fname'
:
'network.user.request'
,
94
'args'
: [{
'name'
:
'test_network'
,
'size'
: 1024}],
95
'estatus'
:
'network_quota'
})
96
# Request new too small user_network
97
actions.append({
'
u': u_new,
98
'fname'
:
'network.user.request'
,
99
'args'
: [{
'name'
:
'test_network'
,
'size'
: 1}],
100
'estatus'
:
'network_size'
})
101
clm
old-tests
scripts
s014_add_networks.py
Generated on Wed Jun 18 2014 13:32:55 for cc1 by
1.8.1.2