cc1
v2.1
CC1 source code docs
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
macros.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
# Before using it, add predefined action list_clusters to actions list!
21
22
# Required actions: list_storages, list_clusters, list_templates, list_users
23
def
MACRO_GET_CM_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["clusters"])[0]["id"]'
% name
24
def
MACRO_GET_USER_ID
(login):
return
'@filter(lambda x: x["login"] == "%s", r["clm_user_list"])[0]["id"]'
% login
25
def
MACRO_GET_TEMPLATE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["templates"])[0]["id"]'
% name
26
def
MACRO_GET_STORAGE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["storages"])[0]["id"]'
% name
27
28
# Required actions: list_admin_public_ip, list_user_public_ip, list_available_networks, list_user_networks
29
def
MACRO_GET_PUBLIC_IP_ID
(address):
return
'@filter(lambda x: x["ip"] == "%s", r["admin_public_ip"])[0]["id"]'
% address
30
def
MACRO_GET_AVAILABLE_NETWORK_ID
(address):
return
'@filter(lambda x: x["address"] == "%s", r["available_networks"])[0]["id"]'
% address
31
def
MACRO_GET_USER_NETWORK_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["user_networks"])[0]["id"]'
% name
32
33
# Required actions: list_private_vm_images, list_public_vm_images, list_group_vm_images, list_private_storage_images
34
def
MACRO_GET_PUBLIC_VM_IMAGE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["public_vm_images"])[0]["id"]'
% name
35
def
MACRO_GET_GROUP_VM_IMAGE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["group_vm_images"])[0]["id"]'
% name
36
def
MACRO_GET_PRIVATE_VM_IMAGE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["private_vm_images"])[0]["id"]'
% name
37
def
MACRO_GET_PRIVATE_STORAGE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["private_storage_images"])[0]["id"]'
% name
38
def
MACRO_GET_DISK_STORAGE_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["storage_images"])[0]["id"]'
% name
39
def
MACRO_GET_PRIVATE_CD_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["private_cd_images"])[0]["id"]'
% name
40
41
# Required actions: list_filesystems, list_network_devices, list_video_devices, list_disk_controllers
42
def
MACRO_GET_FILESYSTEM_ID
(filesystem):
return
'@filter(lambda x: x["name"] == "%s", r["filesystems"])[0]["id"]'
% filesystem
43
def
MACRO_GET_VIDEO_DEVICE_ID
(video_device):
return
'@filter(lambda x: x["name"] == "%s", r["video_devices"])[0]["id"]'
% video_device
44
def
MACRO_GET_NETWORK_DEVICE_ID
(network_device):
return
'@filter(lambda x: x["name"] == "%s", r["network_devices"])[0]["id"]'
% network_device
45
def
MACRO_GET_DISK_CONTROLLER_ID
(disk_controller):
return
'@filter(lambda x: x["name"] == "%s", r["disk_controllers"])[0]["id"]'
% disk_controller
46
47
# Required actions: list_admin_vms, list_user_vms
48
def
MACRO_GET_USER_VM_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["user_vms"])[0]["id"]'
% name
49
def
MACRO_GET_USER_VM_ID_STR
(name):
return
'@str(filter(lambda x: x["name"] == "%s", r["user_vms"])[0]["id"])'
% name
50
def
MACRO_GET_ADMIN_VM_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["admin_vms"])[0]["id"]'
% name
51
def
MACRO_GET_ADMIN_LIBVIRT_ID
(name):
return
'@filter(lambda x: x["name"] == "%s", r["admin_vms"])[0]["libvirt_id"]'
% name
52
def
MACRO_GET_USER_VM_IP
(name, lease=0):
return
'@filter(lambda x: x["name"] == "%s", r["user_vms"])[0]["leases"][%d]["address"]'
% (name, lease)
53
54
# Required predefined actions: list_admin_vms
55
def
MACRO_GET_VM_NODE_IP
(vm_name):
return
'@filter(lambda x: x["name"] == "%s", r["admin_vms"])[0]["node"]'
% vm_name
56
clm
old-tests
predefined
macros.py
Generated on Wed Jun 18 2014 13:32:54 for cc1 by
1.8.1.2