blob: 76e6ff14b59b68b7e3cb3e789ea232bf65678991 [file] [log] [blame]
yadavmr58af6b12019-09-18 15:33:25 +05301# -*- coding: utf-8 -*-
2
3##
4# Copyright 2019 Tech Mahindra Limited
5#
6# All Rights Reserved.
7#
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
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
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
18# under the License.
19##
20
21## Change log:
22# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019
23##
24
yadavmrf21d9da2019-11-05 11:42:57 +053025*** Settings ***
26Library OperatingSystem
27Library String
28Library Collections
29Library ../custom_lib.py
30
yadavmr58af6b12019-09-18 15:33:25 +053031
32*** Variables ***
33${success_return_code} 0
34${name} "helloworld-os"
35${user} "robottest"
36${password} "fred"
yadavmrf21d9da2019-11-05 11:42:57 +053037${authurl} "https://127.0.0.1/"
yadavmr58af6b12019-09-18 15:33:25 +053038${type} "openstack"
39${desc} "a test vim"
40${tenant} "robottest2"
41
42
43*** Keywords ***
44Create Vim Account
45 [Documentation] Create a new vim account
46
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}
48 log ${stdout}
49 Should Be Equal As Integers ${rc} ${success_return_code}
50
51
52Get Vim List
53 [Documentation] Get a vim account list
54
55 ${rc} ${stdout}= Run and Return RC and Output osm vim-list
56 log ${stdout}
57 Log To Console ${stdout}
58 Should Be Equal As Integers ${rc} ${success_return_code}
59
60
61Delete Vim Account
62 [Documentation] delete vim account details
63
64 ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${name}
65 log ${stdout}
66 Should Be Equal As Integers ${rc} ${success_return_code}
67
68
69VIM Setup To Launch Network Services
70 [Documentation] Setup a VIM to launch network services
71
yadavmrf21d9da2019-11-05 11:42:57 +053072 set global variable @{vim}
yadavmr58af6b12019-09-18 15:33:25 +053073 ${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'
yadavmrf21d9da2019-11-05 11:42:57 +053077 Should Not Be Empty ${vim} VIM details not provided
yadavmr58af6b12019-09-18 15:33:25 +053078 Log Many @{vim}
79
80
81Setup Openstack Vim
82 [Documentation] Openstack Vim Account Setup
yadavmrf21d9da2019-11-05 11:42:57 +053083 [Tags] vim-setup
yadavmr58af6b12019-09-18 15:33:25 +053084 [Arguments] ${authurl} ${type} ${desc}
85
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
91
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}
93 log ${stdout}
94 Should Be Equal As Integers ${rc} ${success_return_code}
yadavmrf21d9da2019-11-05 11:42:57 +053095 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
yadavmr58af6b12019-09-18 15:33:25 +053098 Append To List ${vim} ${stdout}
yadavmrf21d9da2019-11-05 11:42:57 +053099
yadavmr58af6b12019-09-18 15:33:25 +0530100 [Return] ${stdout}
101
102
103Setup Vmware Vim
104 [Documentation] Vmware Vim Account Setup
yadavmrf21d9da2019-11-05 11:42:57 +0530105 [Tags] vim-setup
yadavmr58af6b12019-09-18 15:33:25 +0530106 [Arguments] ${authurl} ${type} ${desc}
107
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
114
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}
116 log ${stdout}
117 Should Be Equal As Integers ${rc} ${success_return_code}
yadavmrf21d9da2019-11-05 11:42:57 +0530118 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
yadavmr58af6b12019-09-18 15:33:25 +0530121 Append To List ${vim} ${stdout}
yadavmrf21d9da2019-11-05 11:42:57 +0530122
yadavmr58af6b12019-09-18 15:33:25 +0530123 [Return] ${stdout}
124
125
126Force Delete Vim Account
127 [Documentation] delete vim account details
128 [Arguments] ${vim_name}
129
130 ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${vim_name}
131 log ${stdout}
132 Should Be Equal As Integers ${rc} ${success_return_code}