2 Documentation The main interface for interacting with SDN-GC. It handles low level stuff like managing the http request library and SDN-GC required fields
3 Library RequestsLibrary
4 Library ONAPLibrary.Utilities
5 Library SeleniumLibrary
6 Library OperatingSystem
9 Library ONAPLibrary.ServiceMapping
10 Library ONAPLibrary.Templating
11 Library ONAPLibrary.SDNC
12 Resource global_properties.robot
13 Resource browser_setup.robot
17 ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} /operations/VNF-API:preload-vnf-topology-operation
18 ${PRELOAD_NETWORK_TOPOLOGY_OPERATION_PATH} /operations/VNF-API:preload-network-topology-operation
19 ${PRELOAD_GR_TOPOLOGY_OPERATION_PATH} /operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation
20 ${PRELOAD_VNF_CONFIG_PATH} /config/VNF-API:preload-vnfs/vnf-preload-list
21 ${PRELOAD_TOPOLOGY_OPERATION_BODY} sdnc
22 ${SDNGC_INDEX_PATH} /restconf
23 ${SDNCGC_HEALTHCHECK_OPERATION_PATH} /operations/SLI-API:healthcheck
24 ${SDNGC_REST_ENDPOINT} ${GLOBAL_SDNGC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDNC_IP_ADDR}:${GLOBAL_SDNGC_REST_PORT}
25 ${SDNGC_ADMIN_ENDPOINT} ${GLOBAL_SDNGC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDNC_PORTAL_IP_ADDR}:${GLOBAL_SDNGC_ADMIN_PORT}
26 ${SDNGC_ADMIN_SIGNUP_URL} ${SDNGC_ADMIN_ENDPOINT}/signup
27 ${SDNGC_ADMIN_LOGIN_URL} ${SDNGC_ADMIN_ENDPOINT}/login
28 ${SDNGC_ADMIN_VNF_PROFILE_URL} ${SDNGC_ADMIN_ENDPOINT}/mobility/getVnfProfile
29 ${VNF_KEYPAIR_SSH_KEY} robot/assets/keys/onap_dev_public.txt
32 Run SDNGC Health Check
33 [Documentation] Runs an SDNGC healthcheck
34 ${resp}= Run SDNGC Post Request ${SDNGC_INDEX PATH}${SDNCGC_HEALTHCHECK_OPERATION_PATH} ${None}
35 Should Be Equal As Strings ${resp.status_code} 200
36 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200
39 [Documentation] Runs an SDNGC get request
40 [Arguments] ${data_path}
41 ${auth}= Create List ${GLOBAL_SDNGC_USERNAME} ${GLOBAL_SDNGC_PASSWORD}
42 ${resp}= Run Get Request ${SDNGC_REST_ENDPOINT} ${data_path} auth=${auth}
46 [Documentation] Runs an SDNGC put request
47 [Arguments] ${data_path} ${data}
48 ${auth}= Create List ${GLOBAL_SDNGC_USERNAME} ${GLOBAL_SDNGC_PASSWORD}
49 ${resp}= Run Put Request ${SDNGC_REST_ENDPOINT} ${data_path} data=${data} auth=${auth}
52 Run SDNGC Post Request
53 [Documentation] Runs an SDNGC post request
54 [Arguments] ${data_path} ${data}
55 ${auth}= Create List ${GLOBAL_SDNGC_USERNAME} ${GLOBAL_SDNGC_PASSWORD}
56 ${resp}= Run Post Request ${SDNGC_REST_ENDPOINT} ${data_path} data=${data} auth=${auth}
60 Preload Network cpe_public 10.2.0.2 10.2.0.1
61 Preload Network cpe_signal 10.4.0.2 10.4.0.1
62 Preload Network brg_bng 10.3.0.2 10.3.0.1
63 Preload Network bng_mux 10.1.0.10 10.1.0.1
64 Preload Network mux_gw 10.5.0.10 10.5.0.1
67 [Arguments] ${network_role} ${subnet_start_ip} ${subnet_gateway}
68 ${name_suffix}= Generate Timestamp
69 ${network_name}= Catenate SEPARATOR=_ net ${network_role} ${name_suffix}
70 ${subnet_name}= Catenate SEPARATOR=_ net ${network_role} subnet ${name_suffix}
71 ${parameters}= Create Dictionary network_role=${network_role} service_type=vCPE network_type=Generic NeutronNet network_name=${network_name} subnet_start_ip=${subnet_start_ip} subnet_gateway=${subnet_gateway}
72 Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
73 ${data}= Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.network.jinja ${parameters}
74 ${post_resp}= Run SDNGC Post Request ${SDNGC_INDEX_PATH}${PRELOAD_NETWORK_TOPOLOGY_OPERATION_PATH} ${data}
75 [Return] ${network_name} ${subnet_name}
78 [Arguments] ${brg_mac} ${cpe_network_name} ${cpe_subnet_name} ${mux_gw_net} ${mux_gw_subnet}
79 ${name_suffix}= Generate Timestamp
80 ${ssh_key}= OperatingSystem.Get File ${VNF_KEYPAIR_SSH_KEY}
81 ${parameters}= Create Dictionary pub_key=${ssh_key} brg_mac=${brg_mac} cpe_public_net=${cpe_network_name} cpe_public_subnet=${cpe_subnet_name} mux_gw_net=${mux_gw_net} mux_gw_subnet=${mux_gw_subnet} suffix=${name_suffix} oam_onap_net=oam_network_2No2 oam_onap_subnet=oam_network_2No2 public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
82 Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
83 ${data}= Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_vgw_vfmodule.jinja ${parameters}
84 ${post_resp}= Run SDNGC Post Request ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} ${data}
87 [Arguments] ${brg_mac} ${cpe_public_network_name} ${cpe_public_subnet_name} ${mux_gw_net} ${mux_gw_subnet}
88 ${name_suffix}= Generate Timestamp
89 ${ssh_key}= OperatingSystem.Get File ${VNF_KEYPAIR_SSH_KEY}
90 ${parameters}= Create Dictionary pub_key=${ssh_key} brg_mac=${brg_mac} cpe_public_net=${cpe_public_network_name} cpe_public_subnet=${cpe_public_subnet_name} mux_gw_net=${mux_gw_net} mux_gw_subnet=${mux_gw_subnet} suffix=${name_suffix} oam_onap_net=oam_network_2No2 oam_onap_subnet=oam_network_2No2 public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
91 Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
92 ${data}= Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_gwgra_vfmodule.jinja ${parameters}
93 ${post_resp}= Run SDNGC Post Request ${SDNGC_INDEX_PATH}${PRELOAD_GR_TOPOLOGY_OPERATION_PATH} ${data}
95 Preload Generic VfModule
96 [Arguments] ${service_instance_id} ${vnf_model} ${model_customization_name} ${short_model_customization_name} ${cpe_public_network_name}=None ${cpe_public_subnet_name}=None ${cpe_signal_network_name}=None ${cpe_signal_subnet_name}=None
97 ${name_suffix}= Generate Timestamp
98 ${ssh_key}= OperatingSystem.Get File ${VNF_KEYPAIR_SSH_KEY}
99 ${vfmodule_name}= Catenate SEPARATOR=_ vf ${short_model_customization_name} ${name_suffix}
100 #TODO this became a mess, need to fix
101 ${parameters}= Create Dictionary pub_key=${ssh_key} suffix=${name_suffix} mr_ip_addr=${GLOBAL_INJECTED_MR_IP_ADDR} mr_ip_port=${GLOBAL_MR_SERVER_PORT}
102 Set To Dictionary ${parameters} oam_onap_net=oam_network_2No2 oam_onap_subnet=oam_network_2No2 cpe_public_net=${cpe_public_network_name} cpe_public_subnet=${cpe_public_subnet_name}
103 Set To Dictionary ${parameters} cpe_signal_subnet=${cpe_signal_subnet_name} cpe_signal_net=${cpe_signal_network_name} public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
104 # vnf_type and generic_vnf_type are identical
105 Set To Dictionary ${parameters} vnf_type=${model_customization_name} generic_vnf_type=${model_customization_name} generic_vnf_name=${model_customization_name} vnf_name=${vfmodule_name}
106 Set To Dictionary ${parameters} service_type=${service_instance_id} sdnc_oam_ip=${GLOBAL_INJECTED_SDNC_IP_ADDR}
107 ${post_resp}= Preload Vfmodule ${SDNGC_REST_ENDPOINT} ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} ${GLOBAL_TEMPLATE_FOLDER} ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_infra_vfmodule.jinja ${parameters}
108 [Return] ${post_resp}
111 [Arguments] ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_module_name} ${vf_modules} ${service} ${uuid}
112 ${base_vf_module_type}= Catenate
113 ${closedloop_vf_module}= Create Dictionary
114 Set Directory default ./demo/service_mapping
115 ${templates}= Get Service Template Mapping default ${service} ${generic_vnf_type}
116 :FOR ${vf_module} IN @{vf_modules}
117 \ ${vf_module_type}= Get From Dictionary ${vf_module} name
118 # need to pass in vnf_index if non-zero
119 \ ${dict} Run Keyword If "${generic_vnf_name}".endswith('0') Get From Mapping With Index ${templates} ${vf_module} 0
120 \ ... ELSE IF "${generic_vnf_name}".endswith('1') Get From Mapping With Index ${templates} ${vf_module} 1
121 \ ... ELSE IF "${generic_vnf_name}".endswith('2') Get From Mapping With Index ${templates} ${vf_module} 2
122 \ ... ELSE Get From Mapping ${templates} ${vf_module}
123 # skip this iteration if no template
124 \ ${test_dict_length} = Get Length ${dict}
125 \ Continue For Loop If ${test_dict_length} == 0
126 \ ${filename}= Get From Dictionary ${dict} template
127 \ ${base_vf_module_type}= Set Variable If '${dict['isBase']}' == 'true' ${vf_module_type} ${base_vf_module_type}
128 \ ${closedloop_vf_module}= Set Variable If '${dict['isBase']}' == 'false' ${vf_module} ${closedloop_vf_module}
129 \ ${vf_name}= Update Module Name ${dict} ${vf_module_name}
130 # Admin portal update no longer
131 #\ Preload Vnf Profile ${vf_module_type}
132 \ Preload One Vnf Topology ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_name} ${vf_module_type} ${service} ${filename} ${uuid}
133 [Return] ${base_vf_module_type} ${closedloop_vf_module}
136 [Arguments] ${dict} ${vf_module_name}
137 Return From Keyword If 'prefix' not in ${dict} ${vf_module_name}
138 Return From Keyword If '${dict['prefix']}' == '' ${vf_module_name}
139 ${name}= Replace String ${vf_module_name} Vfmodule_ ${dict['prefix']}
142 Get From Mapping With Index
143 [Documentation] Retrieve the appropriate prelad template entry for the passed vf_module
144 [Arguments] ${templates} ${vf_module} ${vnf_index}=0
145 ${vf_module_name}= Get From DIctionary ${vf_module} name
146 :FOR ${template} IN @{templates}
147 \ Return From Keyword If '${template['name_pattern']}' in '${vf_module_name}' and ('${template['vnf_index']}' == '${vnf_index}') ${template}
148 ${result}= Create Dictionary
152 [Documentation] Retrieve the appropriate prelad template entry for the passed vf_module
153 [Arguments] ${templates} ${vf_module}
154 ${vf_module_name}= Get From DIctionary ${vf_module} name
155 :FOR ${template} IN @{templates}
156 \ Return From Keyword If '${template['name_pattern']}' in '${vf_module_name}' ${template}
157 ${result}= Create Dictionary
160 Preload One Vnf Topology
161 [Arguments] ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_module_name} ${vf_module_type} ${service} ${filename} ${uuid}
162 Return From Keyword If '${filename}' == ''
163 ${parameters}= Get Template Parameters ${generic_vnf_name} ${filename} ${uuid}
164 Set To Dictionary ${parameters} generic_vnf_name=${generic_vnf_name} generic_vnf_type=${generic_vnf_type} service_type=${service_type_uuid} vf_module_name=${vf_module_name} vf_module_type=${vf_module_type}
165 Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
166 ${data}= Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/preload.jinja ${parameters}
167 ${put_resp}= Run SDNGC Post Request ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} ${data}
168 Should Be Equal As Strings ${put_resp.json()['output']['response-code']} 200
169 ${get_resp}= Run SDNGC Get Request ${SDNGC_INDEX_PATH}${PRELOAD_VNF_CONFIG_PATH}/${vf_module_name}/${vf_module_type}
171 Get Template Parameters
172 [Arguments] ${generic_vnf_name} ${template} ${uuid}
173 ${rest} ${suite}= Split String From Right ${SUITE NAME} . 1
174 ${uuid}= Catenate ${uuid}
175 ${hostid}= Get Substring ${uuid} -4
176 ${ecompnet}= Evaluate (${GLOBAL_BUILD_NUMBER}%128)+128
179 # Initialize the value map with the properties generated from the Robot VM /opt/config folder
180 ${valuemap}= Copy Dictionary ${GLOBAL_INJECTED_PROPERTIES}
182 # These should be deprecated by the above....
183 Set To Dictionary ${valuemap} artifacts_version=${GLOBAL_INJECTED_ARTIFACTS_VERSION}
184 Set To Dictionary ${valuemap} network=${GLOBAL_INJECTED_NETWORK}
185 Set To Dictionary ${valuemap} public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
186 Set To Dictionary ${valuemap} cloud_env=${GLOBAL_INJECTED_CLOUD_ENV}
187 Set To Dictionary ${valuemap} install_script_version=${GLOBAL_INJECTED_SCRIPT_VERSION}
188 Set To Dictionary ${valuemap} vm_image_name=${GLOBAL_INJECTED_VM_IMAGE_NAME}
189 Set To Dictionary ${valuemap} vm_flavor_name=${GLOBAL_INJECTED_VM_FLAVOR}
192 # update the value map with unique values.
193 Set To Dictionary ${valuemap} uuid=${uuid} hostid=${hostid} ecompnet=${ecompnet} generic_vnf_name=${generic_vnf_name}
196 # Mash together the defaults dict with the test case dict to create the set of
199 ${suite_templates}= Get From Dictionary ${GLOBAL_PRELOAD_PARAMETERS} ${suite}
200 ${template}= Get From Dictionary ${suite_templates} ${template}
201 ${defaults}= Get From Dictionary ${GLOBAL_PRELOAD_PARAMETERS} defaults
202 # add all of the defaults to template...
203 @{keys}= Get Dictionary Keys ${defaults}
204 :FOR ${key} IN @{keys}
205 \ ${value}= Get From Dictionary ${defaults} ${key}
206 \ Set To Dictionary ${template} ${key} ${value}
209 # Get the vnf_parameters to preload
211 ${vnf_parameters}= Resolve VNF Parameters Into Array ${valuemap} ${template}
212 ${vnf_parameters_json}= Evaluate json.dumps(${vnf_parameters}) json
213 ${parameters}= Create Dictionary vnf_parameters=${vnf_parameters_json}
214 [Return] ${parameters}
216 Resolve Values Into Dictionary
217 [Arguments] ${valuemap} ${from} ${to}
218 ${keys}= Get Dictionary Keys ${from}
219 :FOR ${key} IN @{keys}
220 \ ${value}= Get From Dictionary ${from} ${key}
221 \ ${value}= Template String ${value} ${valuemap}
222 \ Set To Dictionary ${to} ${key} ${value}
224 Resolve VNF Parameters Into Array
225 [Arguments] ${valuemap} ${from}
226 ${vnf_parameters}= Create List
227 ${keys}= Get Dictionary Keys ${from}
228 :FOR ${key} IN @{keys}
229 \ ${value}= Get From Dictionary ${from} ${key}
230 \ ${value}= Template String ${value} ${valuemap}
231 \ ${parameter}= Create Dictionary vnf-parameter-name=${key} vnf-parameter-value=${value}
232 \ Append To List ${vnf_parameters} ${parameter}
233 [Return] ${vnf_parameters}
236 [Arguments] ${vnf_name}
237 Login To SDNGC Admin GUI
238 Go To ${SDNGC_ADMIN_VNF_PROFILE_URL}
239 Click Button xpath=//button[@data-target='#add_vnf_profile']
240 Input Text xpath=//input[@id='nf_vnf_type'] ${vnf_name}
241 Input Text xpath=//input[@id='nf_availability_zone_count'] 999
242 Input Text xpath=//input[@id='nf_equipment_role'] robot-ete-test
243 Click Button xpath=//button[contains(.,'Submit')]
244 Page Should Contain VNF Profile
245 Input Text xpath=//div[@id='vnf_profile_filter']//input ${vnf_name}
246 Page Should Contain ${vnf_name}
249 [Arguments] ${vnf_name}
250 Login To SDNGC Admin GUI
251 Go To ${SDNGC_ADMIN_VNF_PROFILE_URL}
252 Page Should Contain VNF Profile
253 Input Text xpath=//div[@id='vnf_profile_filter']//input ${vnf_name}
254 Page Should Contain ${vnf_name}
255 Click Button xpath=//button[contains(@onclick, '${vnf_name}')]
256 Page Should Contain Are you sure you want to delete VNF_PROFILE
257 Click Button xpath=//button[contains(text(), 'Yes')]
258 Page Should Not Contain ${vnf_name}
260 Login To SDNGC Admin GUI
261 [Documentation] Login To SDNGC Admin GUI
262 ## Setup Browser is now being managed by the test case
264 Go To ${SDNGC_ADMIN_SIGNUP_URL}
265 ##Maximize Browser Window
266 Set Selenium Speed ${GLOBAL_SELENIUM_DELAY}
267 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
268 Log Logging in to ${SDNGC_ADMIN_LOGIN_URL}
270 Title Should Be AdminPortal
271 ${uuid}= Generate UUID4
272 ${shortened_uuid}= Evaluate str("${uuid}")[:12]
273 ${email}= Catenate ${shortened_uuid}@robotete.com
274 Input Text xpath=//input[@id='nf_email'] ${email}
275 Input Password xpath=//input[@id='nf_password'] ${shortened_uuid}
276 Click Button xpath=//button[@type='submit']
277 Wait Until Page Contains User created 20s
278 Go To ${SDNGC_ADMIN_LOGIN_URL}
279 Input Text xpath=//input[@id='email'] ${email}
280 Input Password xpath=//input[@id='password'] ${shortened_uuid}
281 Click Button xpath=//button[@type='submit']
282 Title Should Be SDN-C AdminPortal
283 Log Logged in to ${SDNGC_ADMIN_LOGIN_URL}