blob: d8a73cf27e8acf180d8323c78a1d72c0560bee43 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with SDN-GC. It handles low level stuff like managing the http request library and SDN-GC required fields
3Library RequestsLibrary
DR695H18872bc2019-06-13 16:16:52 -04004Library ONAPLibrary.Utilities
DR695H910097e2019-05-08 13:55:32 -04005Library SeleniumLibrary
DR695H8a610132019-07-01 16:16:02 -04006Library OperatingSystem
DR695Hccff30b2017-02-17 18:44:24 -05007Library Collections
8Library String
DR695Hf6948fa2019-07-11 18:03:00 -04009Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping
DR695Hcccad652019-09-16 13:21:47 -040010Library ONAPLibrary.PreloadData WITH NAME PreloadData
DR695Ha6ce9512019-07-19 14:25:43 -040011Library ONAPLibrary.Templating WITH NAME Templating
DR695Hf0ff3b82019-07-19 11:08:13 -040012Library ONAPLibrary.SDNC WITH NAME SDNC
DR695Hccff30b2017-02-17 18:44:24 -050013Resource global_properties.robot
DR695Hccff30b2017-02-17 18:44:24 -050014Resource browser_setup.robot
15
DR695Hccff30b2017-02-17 18:44:24 -050016
17*** Variables ***
18${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} /operations/VNF-API:preload-vnf-topology-operation
DR695H8a610132019-07-01 16:16:02 -040019${PRELOAD_NETWORK_TOPOLOGY_OPERATION_PATH} /operations/VNF-API:preload-network-topology-operation
DR695Hccff30b2017-02-17 18:44:24 -050020${PRELOAD_VNF_CONFIG_PATH} /config/VNF-API:preload-vnfs/vnf-preload-list
Brian Freeman059963c2019-10-24 09:55:40 -050021${PRELOAD_GRA_TOPOLOGY_OPERATION_PATH} /operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation
22${PRELOAD_GRA_CONFIG_PATH} /config/GENERIC-RESOURCE-API:preload-information
DR695H8a610132019-07-01 16:16:02 -040023${PRELOAD_TOPOLOGY_OPERATION_BODY} sdnc
DR695H87b84d02019-08-02 17:18:13 -040024${SDNC_INDEX_PATH} /restconf
DR695Hccff30b2017-02-17 18:44:24 -050025${SDNCGC_HEALTHCHECK_OPERATION_PATH} /operations/SLI-API:healthcheck
DR695H87b84d02019-08-02 17:18:13 -040026${SDNC_REST_ENDPOINT} ${GLOBAL_SDNC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDNC_IP_ADDR}:${GLOBAL_SDNC_REST_PORT}
27${SDNC_ADMIN_ENDPOINT} ${GLOBAL_SDNC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDNC_PORTAL_IP_ADDR}:${GLOBAL_SDNC_ADMIN_PORT}
28${SDNC_ADMIN_SIGNUP_URL} ${SDNC_ADMIN_ENDPOINT}/signup
29${SDNC_ADMIN_LOGIN_URL} ${SDNC_ADMIN_ENDPOINT}/login
30${SDNC_ADMIN_VNF_PROFILE_URL} ${SDNC_ADMIN_ENDPOINT}/mobility/getVnfProfile
DR695Hccff30b2017-02-17 18:44:24 -050031
32*** Keywords ***
DR695H87b84d02019-08-02 17:18:13 -040033Run SDNC Health Check
34 [Documentation] Runs an SDNC healthcheck
35 ${resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX PATH}${SDNCGC_HEALTHCHECK_OPERATION_PATH} data=${None} auth=${GLOBAL_SDNC_AUTHENTICATION}
DR695Hccff30b2017-02-17 18:44:24 -050036 Should Be Equal As Strings ${resp.status_code} 200
Jerry Floodd40619e2017-08-24 09:38:48 -040037 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200
DR695Hccff30b2017-02-17 18:44:24 -050038
DR695H8a610132019-07-01 16:16:02 -040039Preload Vcpe Networks
40 Preload Network cpe_public 10.2.0.2 10.2.0.1
41 Preload Network cpe_signal 10.4.0.2 10.4.0.1
42 Preload Network brg_bng 10.3.0.2 10.3.0.1
43 Preload Network bng_mux 10.1.0.10 10.1.0.1
44 Preload Network mux_gw 10.5.0.10 10.5.0.1
DR695Hccff30b2017-02-17 18:44:24 -050045
DR695H8a610132019-07-01 16:16:02 -040046Preload Network
47 [Arguments] ${network_role} ${subnet_start_ip} ${subnet_gateway}
48 ${name_suffix}= Generate Timestamp
49 ${network_name}= Catenate SEPARATOR=_ net ${network_role} ${name_suffix}
50 ${subnet_name}= Catenate SEPARATOR=_ net ${network_role} subnet ${name_suffix}
51 ${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}
DR695Ha6ce9512019-07-19 14:25:43 -040052 Templating.Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
53 ${data}= Templating.Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.network.jinja ${parameters}
DR695H87b84d02019-08-02 17:18:13 -040054 ${post_resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_NETWORK_TOPOLOGY_OPERATION_PATH} data=${data} auth=${GLOBAL_SDNC_AUTHENTICATION}
DR695H8a610132019-07-01 16:16:02 -040055 [Return] ${network_name} ${subnet_name}
DR695Hccff30b2017-02-17 18:44:24 -050056
DR695H8a610132019-07-01 16:16:02 -040057Preload Vcpe vGW
58 [Arguments] ${brg_mac} ${cpe_network_name} ${cpe_subnet_name} ${mux_gw_net} ${mux_gw_subnet}
59 ${name_suffix}= Generate Timestamp
DR695H97fec222019-07-15 13:32:20 -040060 ${parameters}= Create Dictionary pub_key=${GLOBAL_INJECTED_PUBLIC_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}
DR695Ha6ce9512019-07-19 14:25:43 -040061 Templating.Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
62 ${data}= Templating.Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_vgw_vfmodule.jinja ${parameters}
DR695H87b84d02019-08-02 17:18:13 -040063 ${post_resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} data=${data} auth=${GLOBAL_SDNC_AUTHENTICATION}
DR695H8a610132019-07-01 16:16:02 -040064
65Preload Vcpe vGW Gra
66 [Arguments] ${brg_mac} ${cpe_public_network_name} ${cpe_public_subnet_name} ${mux_gw_net} ${mux_gw_subnet}
67 ${name_suffix}= Generate Timestamp
DR695H97fec222019-07-15 13:32:20 -040068 ${parameters}= Create Dictionary pub_key=${GLOBAL_INJECTED_PUBLIC_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}
DR695Ha6ce9512019-07-19 14:25:43 -040069 Templating.Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
70 ${data}= Templating.Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_gwgra_vfmodule.jinja ${parameters}
Brian Freeman059963c2019-10-24 09:55:40 -050071 ${post_resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_GRA_TOPOLOGY_OPERATION_PATH} data=${data} auth=${GLOBAL_SDNC_AUTHENTICATION}
DR695H8a610132019-07-01 16:16:02 -040072
73Preload Generic VfModule
74 [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
75 ${name_suffix}= Generate Timestamp
DR695H8a610132019-07-01 16:16:02 -040076 ${vfmodule_name}= Catenate SEPARATOR=_ vf ${short_model_customization_name} ${name_suffix}
77 #TODO this became a mess, need to fix
DR695H97fec222019-07-15 13:32:20 -040078 ${parameters}= Create Dictionary pub_key=${GLOBAL_INJECTED_PUBLIC_KEY} suffix=${name_suffix} mr_ip_addr=${GLOBAL_INJECTED_MR_IP_ADDR} mr_ip_port=${GLOBAL_MR_SERVER_PORT}
mrichomme3256fa22020-03-09 11:23:35 +010079 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}
DR695H8a610132019-07-01 16:16:02 -040080 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}
81 # vnf_type and generic_vnf_type are identical
mrichomme3256fa22020-03-09 11:23:35 +010082 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}
DR695H8a610132019-07-01 16:16:02 -040083 Set To Dictionary ${parameters} service_type=${service_instance_id} sdnc_oam_ip=${GLOBAL_INJECTED_SDNC_IP_ADDR}
DR695H87b84d02019-08-02 17:18:13 -040084 ${post_resp}= SDNC.Preload Vfmodule ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} ${GLOBAL_TEMPLATE_FOLDER} ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_infra_vfmodule.jinja ${parameters}
DR695H8a610132019-07-01 16:16:02 -040085 [Return] ${post_resp}
mrichomme3256fa22020-03-09 11:23:35 +010086
DR695Hccff30b2017-02-17 18:44:24 -050087Preload Vnf
DR695H581981e2019-10-11 16:02:37 -040088 [Arguments] ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_module_name} ${vf_modules} ${vnf} ${uuid} ${service} ${server_id}
Jerry Flood3a169a32017-12-01 12:39:10 -050089 ${base_vf_module_type}= Catenate
DR695Hccff30b2017-02-17 18:44:24 -050090 ${closedloop_vf_module}= Create Dictionary
DR695H102f3202019-05-24 15:05:03 -040091 ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
DR695H1496bf52019-07-31 16:28:55 -040092 ${templates}= ServiceMapping.Get Service Template Mapping default ${service} ${vnf}
DR695H910097e2019-05-08 13:55:32 -040093 :FOR ${vf_module} IN @{vf_modules}
DR695Hccff30b2017-02-17 18:44:24 -050094 \ ${vf_module_type}= Get From Dictionary ${vf_module} name
Brian Freeman12ff1842019-02-13 13:54:48 -050095 # need to pass in vnf_index if non-zero
96 \ ${dict} Run Keyword If "${generic_vnf_name}".endswith('0') Get From Mapping With Index ${templates} ${vf_module} 0
DR695H67afaca2019-07-23 17:13:23 -040097 ... ELSE IF "${generic_vnf_name}".endswith('1') Get From Mapping With Index ${templates} ${vf_module} 1
98 ... ELSE IF "${generic_vnf_name}".endswith('2') Get From Mapping With Index ${templates} ${vf_module} 2
99 ... ELSE Get From Mapping ${templates} ${vf_module}
mrichomme3256fa22020-03-09 11:23:35 +0100100 # skip this iteration if no template
Brian Freemanea834f72019-04-22 14:34:02 -0500101 \ ${test_dict_length} = Get Length ${dict}
102 \ Continue For Loop If ${test_dict_length} == 0
DR695Hccff30b2017-02-17 18:44:24 -0500103 \ ${filename}= Get From Dictionary ${dict} template
104 \ ${base_vf_module_type}= Set Variable If '${dict['isBase']}' == 'true' ${vf_module_type} ${base_vf_module_type}
105 \ ${closedloop_vf_module}= Set Variable If '${dict['isBase']}' == 'false' ${vf_module} ${closedloop_vf_module}
Jerry Floodd40619e2017-08-24 09:38:48 -0400106 \ ${vf_name}= Update Module Name ${dict} ${vf_module_name}
mrichomme3256fa22020-03-09 11:23:35 +0100107 # Admin portal update no longer
Brian Freemanf38a8342019-04-18 10:50:19 -0500108 #\ Preload Vnf Profile ${vf_module_type}
DR695H581981e2019-10-11 16:02:37 -0400109 \ Preload One Vnf Topology ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_name} ${vf_module_type} ${service} ${filename} ${uuid} ${server_id}
Jerry Floodd40619e2017-08-24 09:38:48 -0400110 [Return] ${base_vf_module_type} ${closedloop_vf_module}
DR695Hccff30b2017-02-17 18:44:24 -0500111
Brian Freeman059963c2019-10-24 09:55:40 -0500112Preload Gra
113 [Arguments] ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_module_name} ${vf_modules} ${vnf} ${uuid} ${service} ${server_id}
114 ${base_vf_module_type}= Catenate
115 ${closedloop_vf_module}= Create Dictionary
116 ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY}
117 ${templates}= ServiceMapping.Get Service Template Mapping default ${service} ${vnf}
118 :FOR ${vf_module} IN @{vf_modules}
119 \ ${vf_module_type}= Get From Dictionary ${vf_module} name
120 # need to pass in vnf_index if non-zero
121 \ ${dict} Run Keyword If "${generic_vnf_name}".endswith('0') Get From Mapping With Index ${templates} ${vf_module} 0
122 ... ELSE IF "${generic_vnf_name}".endswith('1') Get From Mapping With Index ${templates} ${vf_module} 1
123 ... ELSE IF "${generic_vnf_name}".endswith('2') Get From Mapping With Index ${templates} ${vf_module} 2
124 ... ELSE Get From Mapping ${templates} ${vf_module}
125 # skip this iteration if no template
126 \ ${test_dict_length} = Get Length ${dict}
127 \ Continue For Loop If ${test_dict_length} == 0
128 \ ${filename}= Get From Dictionary ${dict} template
129 \ ${base_vf_module_type}= Set Variable If '${dict['isBase']}' == 'true' ${vf_module_type} ${base_vf_module_type}
130 \ ${closedloop_vf_module}= Set Variable If '${dict['isBase']}' == 'false' ${vf_module} ${closedloop_vf_module}
131 \ ${vf_name}= Update Module Name ${dict} ${vf_module_name}
132 \ Preload One Gra Topology ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_name} ${vf_module_type} ${service} ${filename} ${uuid} ${server_id}
133 [Return] ${base_vf_module_type} ${closedloop_vf_module}
134
135
136
DR695Hccff30b2017-02-17 18:44:24 -0500137Update Module Name
138 [Arguments] ${dict} ${vf_module_name}
139 Return From Keyword If 'prefix' not in ${dict} ${vf_module_name}
140 Return From Keyword If '${dict['prefix']}' == '' ${vf_module_name}
Jerry Floodd40619e2017-08-24 09:38:48 -0400141 ${name}= Replace String ${vf_module_name} Vfmodule_ ${dict['prefix']}
142 [Return] ${name}
DR695Hccff30b2017-02-17 18:44:24 -0500143
Brian Freeman12ff1842019-02-13 13:54:48 -0500144Get From Mapping With Index
145 [Documentation] Retrieve the appropriate prelad template entry for the passed vf_module
146 [Arguments] ${templates} ${vf_module} ${vnf_index}=0
147 ${vf_module_name}= Get From DIctionary ${vf_module} name
DR695H910097e2019-05-08 13:55:32 -0400148 :FOR ${template} IN @{templates}
Brian Freeman12ff1842019-02-13 13:54:48 -0500149 \ Return From Keyword If '${template['name_pattern']}' in '${vf_module_name}' and ('${template['vnf_index']}' == '${vnf_index}') ${template}
Brian Freeman37daa802019-04-26 12:06:11 -0500150 ${result}= Create Dictionary
151 [Return] ${result}
Brian Freeman12ff1842019-02-13 13:54:48 -0500152
DR695Hccff30b2017-02-17 18:44:24 -0500153Get From Mapping
Jerry Floodd40619e2017-08-24 09:38:48 -0400154 [Documentation] Retrieve the appropriate prelad template entry for the passed vf_module
DR695Hccff30b2017-02-17 18:44:24 -0500155 [Arguments] ${templates} ${vf_module}
156 ${vf_module_name}= Get From DIctionary ${vf_module} name
DR695H910097e2019-05-08 13:55:32 -0400157 :FOR ${template} IN @{templates}
Jerry Floodd40619e2017-08-24 09:38:48 -0400158 \ Return From Keyword If '${template['name_pattern']}' in '${vf_module_name}' ${template}
Brian Freeman37daa802019-04-26 12:06:11 -0500159 ${result}= Create Dictionary
160 [Return] ${result}
Jerry Floodd40619e2017-08-24 09:38:48 -0400161
DR695Hccff30b2017-02-17 18:44:24 -0500162Preload One Vnf Topology
DR695H581981e2019-10-11 16:02:37 -0400163 [Arguments] ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_module_name} ${vf_module_type} ${service} ${filename} ${uuid} ${server_id}
DR695Hccff30b2017-02-17 18:44:24 -0500164 Return From Keyword If '${filename}' == ''
DR695H581981e2019-10-11 16:02:37 -0400165 ${parameters}= Get Template Parameters ${generic_vnf_name} ${filename} ${uuid} ${service} ${server_id}
Jerry Flood81d33fb2017-11-21 16:21:21 -0500166 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}
DR695Ha6ce9512019-07-19 14:25:43 -0400167 Templating.Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
168 ${data}= Templating.Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/preload.jinja ${parameters}
DR695H87b84d02019-08-02 17:18:13 -0400169 ${post_resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} data=${data} auth=${GLOBAL_SDNC_AUTHENTICATION}
DR695H31480282019-07-12 18:34:15 -0400170 Should Be Equal As Strings ${post_resp.json()['output']['response-code']} 200
DR695H87b84d02019-08-02 17:18:13 -0400171 ${get_resp}= SDNC.Run Get Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_VNF_CONFIG_PATH}/${vf_module_name}/${vf_module_type} auth=${GLOBAL_SDNC_AUTHENTICATION}
DR695Hccff30b2017-02-17 18:44:24 -0500172
Brian Freeman059963c2019-10-24 09:55:40 -0500173
174Preload One Gra Topology
175 [Arguments] ${service_type_uuid} ${generic_vnf_name} ${generic_vnf_type} ${vf_module_name} ${vf_module_type} ${service} ${filename} ${uuid} ${server_id}
176 Return From Keyword If '${filename}' == ''
177 ${parameters}= Get Template Parameters ${generic_vnf_name} ${filename} ${uuid} ${service} ${server_id} gr_api
178 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}
179 Templating.Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER}
180 ${data}= Templating.Apply Template sdnc ${PRELOAD_TOPOLOGY_OPERATION_BODY}/preload.GRA.jinja ${parameters}
181 ${post_resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_GRA_TOPOLOGY_OPERATION_PATH} data=${data} auth=${GLOBAL_SDNC_AUTHENTICATION}
182 Should Be Equal As Strings ${post_resp.json()['output']['response-code']} 200
183 ${get_resp}= SDNC.Run Get Request ${SDNC_REST_ENDPOINT} ${SDNC_INDEX_PATH}${PRELOAD_GRA_CONFIG_PATH}/preload-list/${vf_module_name}/vf-module auth=${GLOBAL_SDNC_AUTHENTICATION}
184 Should Be Equal As Strings ${get_resp.status_code} 200
185
186
187
DR695Hccff30b2017-02-17 18:44:24 -0500188Get Template Parameters
Brian Freeman059963c2019-10-24 09:55:40 -0500189 [Arguments] ${generic_vnf_name} ${template} ${uuid} ${service} ${server_id} ${api_type}=vnf_api
DR695Hccff30b2017-02-17 18:44:24 -0500190 ${hostid}= Get Substring ${uuid} -4
Brian Freeman59186522020-04-15 13:02:07 -0500191 # in Azure the ONAP OAM network is a /24 on 10.0.200 so 10.0 CIDR is too short
192 # ecompnet should be 200 if AKS
193 # Check GLOBAL VARIABLE for Openstack OAM Network 3RD_OCTET and if specified use it instead of
194 # dyanmic ecompnet (Decompnet)
195 ${Decompnet}= Evaluate (${GLOBAL_BUILD_NUMBER}%128)+128
196 ${ecompnet}= Set Variable If "${GLOBAL_INJECTED_OPENSTACK_OAM_NETWORK_3RD_OCTET}"=="${EMPTY}" ${Decompnet} ${GLOBAL_INJECTED_OPENSTACK_OAM_NETWORK_3RD_OCTET}
DR695H2d8bd802019-08-02 10:56:54 -0400197 ${valuemap}= Get Globally Injected Parameters
DR695Hccff30b2017-02-17 18:44:24 -0500198 # update the value map with unique values.
DR695H581981e2019-10-11 16:02:37 -0400199 Set To Dictionary ${valuemap} uuid=${uuid} hostid=${hostid} ecompnet=${ecompnet} generic_vnf_name=${generic_vnf_name} server_id=${server_id}
Jerry Flood81d33fb2017-11-21 16:21:21 -0500200
201 #
202 # Mash together the defaults dict with the test case dict to create the set of
203 # preload parameters
204 #
DR695Hcccad652019-09-16 13:21:47 -0400205 PreloadData.Set Directory preload ./demo/preload_data
206 ${defaults}= PreloadData.Get Default Preload Data preload
207 ${template}= PreloadData.Get Preload Data preload ${service} ${template}
Jerry Flood81d33fb2017-11-21 16:21:21 -0500208 # add all of the defaults to template...
209 @{keys}= Get Dictionary Keys ${defaults}
DR695H910097e2019-05-08 13:55:32 -0400210 :FOR ${key} IN @{keys}
Jerry Flood81d33fb2017-11-21 16:21:21 -0500211 \ ${value}= Get From Dictionary ${defaults} ${key}
212 \ Set To Dictionary ${template} ${key} ${value}
213
214 #
215 # Get the vnf_parameters to preload
216 #
Brian Freeman059963c2019-10-24 09:55:40 -0500217 ${vnf_parameters}= Run Keyword If '${api_type}'=='gr_api' Resolve GRA Parameters Into Array ${valuemap} ${template}
218 ... ELSE Resolve VNF Parameters Into Array ${valuemap} ${template}
Jerry Floodd40619e2017-08-24 09:38:48 -0400219 ${vnf_parameters_json}= Evaluate json.dumps(${vnf_parameters}) json
Jerry Flood81d33fb2017-11-21 16:21:21 -0500220 ${parameters}= Create Dictionary vnf_parameters=${vnf_parameters_json}
DR695Hccff30b2017-02-17 18:44:24 -0500221 [Return] ${parameters}
Jerry Floodd40619e2017-08-24 09:38:48 -0400222
Jerry Floodd40619e2017-08-24 09:38:48 -0400223Resolve VNF Parameters Into Array
Jerry Flood81d33fb2017-11-21 16:21:21 -0500224 [Arguments] ${valuemap} ${from}
Jerry Floodd40619e2017-08-24 09:38:48 -0400225 ${vnf_parameters}= Create List
226 ${keys}= Get Dictionary Keys ${from}
DR695H910097e2019-05-08 13:55:32 -0400227 :FOR ${key} IN @{keys}
Jerry Floodd40619e2017-08-24 09:38:48 -0400228 \ ${value}= Get From Dictionary ${from} ${key}
DR695Ha6ce9512019-07-19 14:25:43 -0400229 \ ${value}= Templating.Template String ${value} ${valuemap}
Jerry Floodd40619e2017-08-24 09:38:48 -0400230 \ ${parameter}= Create Dictionary vnf-parameter-name=${key} vnf-parameter-value=${value}
231 \ Append To List ${vnf_parameters} ${parameter}
232 [Return] ${vnf_parameters}
233
Brian Freeman059963c2019-10-24 09:55:40 -0500234Resolve GRA Parameters Into Array
235 [Arguments] ${valuemap} ${from}
236 ${vnf_parameters}= Create List
237 ${keys}= Get Dictionary Keys ${from}
238 :FOR ${key} IN @{keys}
239 \ ${value}= Get From Dictionary ${from} ${key}
240 \ ${value}= Templating.Template String ${value} ${valuemap}
241 \ ${parameter}= Create Dictionary name=${key} value=${value}
242 \ Append To List ${vnf_parameters} ${parameter}
243 [Return] ${vnf_parameters}
244
245
DR695Hccff30b2017-02-17 18:44:24 -0500246Preload Vnf Profile
247 [Arguments] ${vnf_name}
DR695H87b84d02019-08-02 17:18:13 -0400248 Login To SDNC Admin GUI
249 Go To ${SDNC_ADMIN_VNF_PROFILE_URL}
DR695Hccff30b2017-02-17 18:44:24 -0500250 Click Button xpath=//button[@data-target='#add_vnf_profile']
251 Input Text xpath=//input[@id='nf_vnf_type'] ${vnf_name}
252 Input Text xpath=//input[@id='nf_availability_zone_count'] 999
253 Input Text xpath=//input[@id='nf_equipment_role'] robot-ete-test
254 Click Button xpath=//button[contains(.,'Submit')]
Jerry Floodd40619e2017-08-24 09:38:48 -0400255 Page Should Contain VNF Profile
DR695Hccff30b2017-02-17 18:44:24 -0500256 Input Text xpath=//div[@id='vnf_profile_filter']//input ${vnf_name}
Jerry Floodd40619e2017-08-24 09:38:48 -0400257 Page Should Contain ${vnf_name}
DR695Hccff30b2017-02-17 18:44:24 -0500258
259Delete Vnf Profile
260 [Arguments] ${vnf_name}
DR695H87b84d02019-08-02 17:18:13 -0400261 Login To SDNC Admin GUI
262 Go To ${SDNC_ADMIN_VNF_PROFILE_URL}
Jerry Floodd40619e2017-08-24 09:38:48 -0400263 Page Should Contain VNF Profile
DR695Hccff30b2017-02-17 18:44:24 -0500264 Input Text xpath=//div[@id='vnf_profile_filter']//input ${vnf_name}
265 Page Should Contain ${vnf_name}
Jerry Floodd40619e2017-08-24 09:38:48 -0400266 Click Button xpath=//button[contains(@onclick, '${vnf_name}')]
DR695Hccff30b2017-02-17 18:44:24 -0500267 Page Should Contain Are you sure you want to delete VNF_PROFILE
268 Click Button xpath=//button[contains(text(), 'Yes')]
269 Page Should Not Contain ${vnf_name}
Jerry Floodd40619e2017-08-24 09:38:48 -0400270
DR695H87b84d02019-08-02 17:18:13 -0400271Login To SDNC Admin GUI
272 [Documentation] Login To SDNC Admin GUI
Jerry Floodd40619e2017-08-24 09:38:48 -0400273 ## Setup Browser is now being managed by the test case
DR695Hccff30b2017-02-17 18:44:24 -0500274 ## Setup Browser
DR695H87b84d02019-08-02 17:18:13 -0400275 Go To ${SDNC_ADMIN_SIGNUP_URL}
Jerry Flood81d33fb2017-11-21 16:21:21 -0500276 ##Maximize Browser Window
DR695Hccff30b2017-02-17 18:44:24 -0500277 Set Selenium Speed ${GLOBAL_SELENIUM_DELAY}
278 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
DR695H87b84d02019-08-02 17:18:13 -0400279 Log Logging in to ${SDNC_ADMIN_LOGIN_URL}
DR695Hccff30b2017-02-17 18:44:24 -0500280 Handle Proxy Warning
281 Title Should Be AdminPortal
DR695H18872bc2019-06-13 16:16:52 -0400282 ${uuid}= Generate UUID4
DR695Hccff30b2017-02-17 18:44:24 -0500283 ${shortened_uuid}= Evaluate str("${uuid}")[:12]
284 ${email}= Catenate ${shortened_uuid}@robotete.com
285 Input Text xpath=//input[@id='nf_email'] ${email}
286 Input Password xpath=//input[@id='nf_password'] ${shortened_uuid}
287 Click Button xpath=//button[@type='submit']
288 Wait Until Page Contains User created 20s
DR695H87b84d02019-08-02 17:18:13 -0400289 Go To ${SDNC_ADMIN_LOGIN_URL}
DR695Hccff30b2017-02-17 18:44:24 -0500290 Input Text xpath=//input[@id='email'] ${email}
291 Input Password xpath=//input[@id='password'] ${shortened_uuid}
292 Click Button xpath=//button[@type='submit']
293 Title Should Be SDN-C AdminPortal
DR695H87b84d02019-08-02 17:18:13 -0400294 Log Logged in to ${SDNC_ADMIN_LOGIN_URL}
stark, stevenea4af0c2019-08-28 16:11:53 -0700295
296Create Preload From JSON
297 [Documentation] Fill vf-module parameters in an already created preload json file.
298 [Arguments] ${preload_file} ${api_type} ${vf_module_name} ${vf_module_type} ${vnf_name} ${generic_vnf_type}
299 Log To Console Uploading ${preload_file} to SDNC
300
Brian Freeman059963c2019-10-24 09:55:40 -0500301 ${preload_vnf}= Run keyword if "${api_type}"=="gr_api" Preload GR API ${vf_module_name} ${vf_module_type} ${vnf_name} ${generic_vnf_type} ${preload_file}
302 ... ELSE Preload VNF API ${vf_module_name} ${vf_module_type} ${vnf_name} ${generic_vnf_type} ${preload_file}
stark, stevenea4af0c2019-08-28 16:11:53 -0700303
Brian Freeman059963c2019-10-24 09:55:40 -0500304 ${uri}= Set Variable If "${api_type}"=="gr_api" ${SDNC_INDEX_PATH}${PRELOAD_GRA_TOPOLOGY_OPERATION_PATH} ${SDNC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}
stark, stevenea4af0c2019-08-28 16:11:53 -0700305
306 ${post_resp}= SDNC.Run Post Request ${SDNC_REST_ENDPOINT} ${uri} data=${preload_vnf} auth=${GLOBAL_SDNC_AUTHENTICATION}
307 Should Be Equal As Strings ${post_resp.json()['output']['response-code']} 200
308 [Return] ${post_resp}
309
310Preload GR API
311 [Documentation] Retrieves a preload JSON file and fills in service instance values.
312 [Arguments] ${vnf_name} ${vnf_type} ${generic_vnf_name} ${generic_vnf_type} ${preload_path}
313
314 ${json}= OperatingSystem.Get File ${preload_path}
315 ${object}= Evaluate json.loads('''${json}''') json
316 ${req_dict} Create Dictionary vnf-name=${generic_vnf_name} vnf-type=${generic_vnf_type}
317 set to dictionary ${object["input"]["preload-vf-module-topology-information"]} vnf-topology-identifier-structure=${req_dict}
318 ${req_dict_new} Create Dictionary vf-module-name=${vnf_name}
319 set to dictionary ${object["input"]["preload-vf-module-topology-information"]["vf-module-topology"]} vf-module-topology-identifier=${req_dict_new}
320 ${req_json} Evaluate json.dumps(${object}) json
321 [Return] ${req_json}
322
323Preload VNF API
324 [Documentation] Retrieves a preload JSON file and fills in service instance values.
325 [Arguments] ${vnf_name} ${vnf_type} ${generic_vnf_name} ${generic_vnf_type} ${preload_path}
326
327 ${json}= OperatingSystem.Get File ${preload_path}
328 ${object}= Evaluate json.loads('''${json}''') json
329 ${req_dict} Create Dictionary vnf-name=${vnf_name} vnf-type=${vnf_type} generic-vnf-type=${generic_vnf_type} generic-vnf-name=${generic_vnf_name}
330 set to dictionary ${object["input"]["vnf-topology-information"]} vnf-topology-identifier=${req_dict}
331
332 ${req_json} Evaluate json.dumps(${object}) json
333 [Return] ${req_json}