cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s012_add_templates.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.macros import MACRO_GET_TEMPLATE_ID
23 from predefined.actions import *
24 
25 actions = []
26 actions.append(list_clusters)
27 
28 actions.append({'u': u_admin_cm,
29  'as_cmadmin': True,
30  'fname': 'template.admin_cm.add',
31  'args': [{'ec2name': '1',
32  'description': 'Small test template',
33  'points': 1,
34  'memory': 2000,
35  'cpu': 1,
36  'name': 'Small'}
37  ]})
38 actions.append({'u': u_admin_cm,
39  'as_cmadmin': True,
40  'fname': 'template.admin_cm.add',
41  'args': [{'ec2name': '1',
42  'description': 'Small test ec2 duplicate',
43  'points': 1,
44  'memory': 2000,
45  'cpu': 1,
46  'name': 'Duplicate'}
47  ],
48  'estatus': 'template_exists'})
49 actions.append({'u': u_admin_cm,
50  'as_cmadmin': True,
51  'fname': 'template.admin_cm.add',
52  'args': [{'ec2name': '2',
53  'description': 'Medium test template',
54  'points': 2,
55  'memory': 4000,
56  'cpu': 2,
57  'name': 'Medium'}
58  ]})
59 actions.append({'u': u_admin_cm,
60  'as_cmadmin': True,
61  'fname': 'template.admin_cm.add',
62  'args': [{'ec2name': '3',
63  'description': 'Large test template',
64  'points': 4,
65  'memory': 8000,
66  'cpu': 4,
67  'name': 'Large'}
68  ]})
69 
70 actions.append({'u': u_admin_cm,
71  'as_cmadmin': True,
72  'fname': 'template.admin_cm.add',
73  'args': [{'ec2name': '4',
74  'description': 'Extra large test template',
75  'points': 12,
76  'memory': 24000,
77  'cpu': 12,
78  'name': 'Extra large'}
79  ]})
80 
81 # List templates and remove all large
82 actions.append(list_templates)
83 
84 # Edit template
85 actions.append({'u': u_admin_cm,
86  'as_cmadmin': True,
87  'fname': 'template.admin_cm.edit',
88  'args': [MACRO_GET_TEMPLATE_ID("Extra large"),
89  {'ec2name': '4',
90  'description': 'Extra large test template',
91  'points': 12,
92  'memory': 2400,
93  'cpu': 12,
94  'name': 'Extra large'}
95  ]})
96 
97 # Delete template
98 actions.append({'u': u_admin_cm,
99  'as_cmadmin': True,
100  'fname': 'template.admin_cm.delete',
101  'args': [MACRO_GET_TEMPLATE_ID("Extra large")]})
102 
103 # Edit non-existing template
104 actions.append({'u': u_admin_cm,
105  'as_cmadmin': True,
106  'fname': 'template.admin_cm.edit',
107  'args': [9999999,
108  {'ec2name': '4',
109  'description': 'Extra large test template',
110  'points': 12,
111  'memory': 2400,
112  'cpu': 12,
113  'name': 'Extra large'}
114  ],
115  'estatus': 'template_get'})
116 
117 # Delete non-existing template
118 actions.append({'u': u_admin_cm,
119  'as_cmadmin': True,
120  'fname': 'template.admin_cm.delete',
121  'args': [999999],
122  'estatus': 'template_get'})
123