cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s011_add_cm.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 #################
21 # Add CM to CLM #
22 #################
23 from scripts.s003_install_services import wi_net_wi_clm, clm_net_wi_clm, ssh_key, cm_net_clm_cm, cm_net_cm_cluster, clm_net_clm_cm, rm
24 import hashlib
25 
26 from predefined.macros import MACRO_GET_CM_ID, MACRO_GET_CM_ID
27 from predefined.users import u_admin
28 from predefined.actions import *
29 
30 actions = []
31 
32 # Add cluster with wrong IP
33 actions.append({'u': u_admin,
34  'fname': 'cluster.admin_clm.add',
35  'args': [{'password': hashlib.sha1(u_admin['cm_p']).hexdigest(),
36  'port': 8001,
37  'address': '0.0.0.0',
38  'name': 'TestAddress'}],
39  'estatus': 'cluster_add_admin'})
40 
41 # Add cluster
42 actions.append({'u': u_admin,
43  'fname': 'cluster.admin_clm.add',
44  'args': [{'password': hashlib.sha1(u_admin['cm_p']).hexdigest(),
45  'port': 8001,
46  'address': cm_net_clm_cm,
47  'name': 'TestCM'}],
48  'estatus': 'ok'})
49 
50 # Add second cm, with duplicated ip
51 actions.append({'u': u_admin,
52  'fname': 'cluster.admin_clm.add',
53  'args': [{'password': hashlib.sha1(u_admin['cm_p']).hexdigest(),
54  'port': 8001,
55  'address': cm_net_clm_cm,
56  'name': 'TestDuplicate'}],
57  'estatus': 'cluster_add_admin'})
58 
59 
60 # List clusters
61 actions.append(list_clusters)
62 
63 # Try to lock and unlock last CM
64 actions.append({'u': u_admin,
65  'fname': 'cluster.admin_clm.lock',
66  'args': [MACRO_GET_CM_ID("TestCM")]})
67 actions.append({'u': u_admin,
68  'fname': 'cluster.admin_clm.unlock',
69  'args': [MACRO_GET_CM_ID("TestCM")]})
70 
71 
72 # Try to lock and unlock non-existing clusters
73 actions.append({'u': u_admin,
74  'fname': 'cluster.admin_clm.lock',
75  'args': [999],
76  'estatus': 'cluster_get'})
77 
78 
79 actions.append({'u': u_admin,
80  'fname': 'cluster.admin_clm.unlock',
81  'args': [999],
82  'estatus': 'cluster_get'})
83 
84 # Edit third CM informations
85 actions.append({'u': u_admin,
86  'fname': 'cluster.admin_clm.edit',
87  'args': [MACRO_GET_CM_ID("TestCM"),
88  {'address': "127.0.0.1", 'port': 8003, 'name': 'TestCM'}]})
89 
90 # Edit non-existing CM informations
91 actions.append({'u': u_admin,
92  'fname': 'cluster.admin_clm.edit',
93  'args': [999,
94  {'address': clm_net_wi_clm, 'port': 1234, 'name': 'FakeCM'}],
95  'estatus': 'cluster_edit'})
96