1 # -*- coding: utf-8 -*-
4 # Copyright 2019 Tech Mahindra Limited
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
22 # 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019
26 Library OperatingSystem
29 Library ../custom_lib.py
33 ${success_return_code} 0
34 ${name} "helloworld-os"
37 ${authurl} "https://127.0.0.1/"
40 ${tenant} "robottest2"
45 [Documentation] Create a new vim account
47 ${rc} ${stdout}= Run and Return RC and Output osm vim-create --name ${name} --user ${user} --password ${password} --auth_url ${authurl} --tenant ${tenant} --account_type ${type} --description ${desc}
49 Should Be Equal As Integers ${rc} ${success_return_code}
53 [Documentation] Get a vim account list
55 ${rc} ${stdout}= Run and Return RC and Output osm vim-list
57 Log To Console ${stdout}
58 Should Be Equal As Integers ${rc} ${success_return_code}
62 [Documentation] delete vim account details
64 ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${name}
66 Should Be Equal As Integers ${rc} ${success_return_code}
69 VIM Setup To Launch Network Services
70 [Documentation] Setup a VIM to launch network services
72 set global variable @{vim}
73 ${vmware_url}= Get Environment Variable VCD_AUTH_URL ${EMPTY}
74 ${openstack_url}= Get Environment Variable OS_AUTH_URL ${EMPTY}
75 ${vmware_vim}= Run Keyword And Return If '${vmware_url}'!='${EMPTY}' Setup Vmware Vim ${vmware_url} 'vmware' 'pytest system test'
76 ${openstack_vim}= Run Keyword And Return If '${openstack_url}'!='${EMPTY}' Setup Openstack Vim ${openstack_url} 'openstack' 'pytest system test'
77 Should Not Be Empty ${vim} VIM details not provided
82 [Documentation] Openstack Vim Account Setup
84 [Arguments] ${authurl} ${type} ${desc}
86 ${user}= Get Environment Variable OS_USERNAME ''
87 ${password}= Get Environment Variable OS_PASSWORD ''
88 ${tenant}= Get Environment Variable OS_PROJECT_NAME ''
89 ${vim-config}= Get Environment Variable OS_VIM_CONFIG ''
90 ${vim_name}= GENERATE NAME
92 ${rc} ${stdout}= Run and Return RC and Output osm vim-create --name ${vim_name} --user ${user} --password ${password} --auth_url ${authurl} --tenant ${tenant} --account_type ${type} --description ${desc} --config ${vim-config}
94 Should Be Equal As Integers ${rc} ${success_return_code}
95 Sleep 30s Wait for to get vim ready
96 ${rc} ${vim_detail}= Run and Return RC and Output osm vim-show ${vim_name}
97 Should Contain ${vim_detail} "operationalState": "ENABLED" msg=Openstack vim is not available values=False
98 Append To List ${vim} ${stdout}
104 [Documentation] Vmware Vim Account Setup
106 [Arguments] ${authurl} ${type} ${desc}
108 ${user}= Get Environment Variable VCD_USERNAME ''
109 ${password}= Get Environment Variable VCD_PASSWORD ''
110 ${tenant}= Get Environment Variable VCD_TENANT_NAME ''
111 ${vcd-org}= Get Environment Variable VCD_ORGANIZATION ''
112 ${vim-config}= Get Environment Variable VCD_VIM_CONFIG ''
113 ${vim_name}= GENERATE NAME
115 ${rc} ${stdout}= Run and Return RC and Output osm vim-create --name ${vim_name} --user ${user} --password ${password} --auth_url ${authurl} --tenant ${tenant} --account_type ${type} --description ${desc} --config ${vim-config}
117 Should Be Equal As Integers ${rc} ${success_return_code}
118 Sleep 30s Wait for to get vim ready
119 ${rc} ${vim_detail}= Run and Return RC and Output osm vim-show ${vim_name}
120 Should Contain ${vim_detail} "operationalState": "ENABLED" msg=VMWare VCD vim is not available values=False
121 Append To List ${vim} ${stdout}
126 Force Delete Vim Account
127 [Documentation] delete vim account details
128 [Arguments] ${vim_name}
130 ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${vim_name}
132 Should Be Equal As Integers ${rc} ${success_return_code}