From 369e51562f068d5e653211902efc69220508eca1 Mon Sep 17 00:00:00 2001 From: DR695H Date: Wed, 19 Jun 2019 21:16:58 -0400 Subject: move so, clamp, oof to jinja Issue-ID: TEST-158 Change-Id: I88798326879463103a66a97d4ddbc53e864be01a Signed-off-by: DR695H --- robot/resources/clamp_interface.robot | 11 +++--- robot/resources/oof_interface.robot | 44 +++++++++++----------- robot/resources/so/create_cloud_config.robot | 15 +++++--- robot/resources/so_interface.robot | 1 - .../vnf_orchestration_with_cds_test_template.robot | 1 - 5 files changed, 38 insertions(+), 34 deletions(-) (limited to 'robot/resources') diff --git a/robot/resources/clamp_interface.robot b/robot/resources/clamp_interface.robot index b8ec12bf..a83bc4d3 100644 --- a/robot/resources/clamp_interface.robot +++ b/robot/resources/clamp_interface.robot @@ -4,9 +4,8 @@ Library RequestsLibrary Library Collections Library String Library ONAPLibrary.JSON - +Library ONAPLibrary.Templating Resource global_properties.robot -Resource json_templater.robot *** Variables *** ${CLAMP_HEALTH_CHECK_PATH} /restservices/clds/v1/healthcheck @@ -15,7 +14,7 @@ ${CLAMP_BASE_PATH} /restservices/clds/v1 ${CLAMP_CLIENT_KEY} robot/assets/keys/org.onap.clamp.key.clear.pem ${CLAMP_CLIENT_CERT} robot/assets/keys/org.onap.clamp.cert.pem -${CLAMP_TEMPLATE_PATH} robot/assets/templates/clamp +${CLAMP_TEMPLATE_PATH} clamp *** Keywords *** @@ -23,7 +22,8 @@ Run CLAMP Create Model [Documentation] Create a new CLAMP Model [Arguments] ${model_name} ${template_name} ${dict}= Create Dictionary MODEL_NAME=${model_name} TEMPLATE_NAME=${template_name} - ${data}= Fill JSON Template File ${CLAMP_TEMPLATE_PATH}/create_model.template ${dict} + Create Environment clamp ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template clamp ${CLAMP_TEMPLATE_PATH}/create_model.jinja ${dict} ${data_path}= Set Variable ${CLAMP_BASE_PATH}/clds/model/${model_name} ${resp}= Run CLAMP HTTPS Put Request ${data_path} ${data} Should Be Equal As Strings ${resp.status_code} 200 @@ -35,7 +35,8 @@ Run CLAMP Save vLB Model [Documentation] Save CLAMP Model [Arguments] ${model_name} ${template_name} ${policy_name} ${dict}= Create Dictionary MODEL_NAME=${model_name} TEMPLATE_NAME=${template_name} POLICY_NAME=${policy_name} DOLLAR_SIGN=$ - ${data}= Fill JSON Template File ${CLAMP_TEMPLATE_PATH}/save_model_vlb.template ${dict} + Create Environment clamp ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template clamp ${CLAMP_TEMPLATE_PATH}/save_model_vlb.jinja ${dict} ${data_path}= Set Variable ${CLAMP_BASE_PATH}/clds/model/${model_name} ${resp}= Run CLAMP HTTPS Put Request ${data_path} ${data} Should Be Equal As Strings ${resp.status_code} 200 diff --git a/robot/resources/oof_interface.robot b/robot/resources/oof_interface.robot index ad002f4b..eaf91b28 100644 --- a/robot/resources/oof_interface.robot +++ b/robot/resources/oof_interface.robot @@ -7,46 +7,47 @@ Library String Library DateTime Library Collections Library ONAPLibrary.JSON +Library ONAPLibrary.Templating Resource global_properties.robot -Resource json_templater.robot *** Variables *** ${OOF_HOMING_HEALTH_CHECK_PATH} /v1/plans/healthcheck ${OOF_SNIRO_HEALTH_CHECK_PATH} /api/oof/v1/healthcheck ${OOF_CMSO_HEALTH_CHECK_PATH} /cmso/v1/health?checkInterfaces=true -${OOF_CMSO_TEMPLATE_FOLDER} robot/assets/templates/cmso +${OOF_CMSO_TEMPLATE_FOLDER} cmso ${OOF_CMSO_UTC} %Y-%m-%dT%H:%M:%SZ -${OOF_HOMING_PLAN_FOLDER} robot/assets/templates/optf-has -${OOF_OSDF_TEMPLATE_FOLDER} robot/assets/templates/optf-osdf +${OOF_HOMING_PLAN_FOLDER} robot/assets/oof/optf-has +${OOF_OSDF_TEMPLATE_FOLDER} robot/assets/oof/optf-osdf ${OOF_HOMING_ENDPOINT} ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_HOMING_IP_ADDR}:${GLOBAL_OOF_HOMING_SERVER_PORT} ${OOF_SNIRO_ENDPOINT} ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_SNIRO_IP_ADDR}:${GLOBAL_OOF_SNIRO_SERVER_PORT} ${OOF_CMSO_ENDPOINT} ${GLOBAL_OOF_CMSO_PROTOCOL}://${GLOBAL_INJECTED_OOF_CMSO_IP_ADDR}:${GLOBAL_OOF_CMSO_SERVER_PORT} ${OOF_OSDF_ENDPOINT} ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_HOMING_IP_ADDR}:${GLOBAL_OOF_HOMING_SERVER_PORT} -${OOF_HOMING_AUTH} Basic YWRtaW4xOnBsYW4uMTU= *** Keywords *** Run OOF-Homing Health Check - [Documentation] Runs OOF-Homing Health check - ${resp}= Run OOF-Homing Get Request ${OOF_HOMING_HEALTH_CHECK_PATH} - Should Be Equal As Integers ${resp.status_code} 200 + [Documentation] Runs OOF-Homing Health check + ${resp}= Run OOF-Homing Get Request ${OOF_HOMING_HEALTH_CHECK_PATH} + Should Be Equal As Integers ${resp.status_code} 200 Run OOF-Homing Get Request - [Documentation] Runs OOF-Homing Get request - [Arguments] ${data_path} - ${session}= Create Session session ${OOF_HOMING_ENDPOINT} - ${resp}= Get Request session ${data_path} - Should Be Equal As Integers ${resp.status_code} 200 - Log Received response from OOF-Homing ${resp.text} - [Return] ${resp} + [Documentation] Runs OOF-Homing Get request + [Arguments] ${data_path} + ${session}= Create Session session ${OOF_HOMING_ENDPOINT} + ${resp}= Get Request session ${data_path} + Should Be Equal As Integers ${resp.status_code} 200 + Log Received response from OOF-Homing ${resp.text} + [Return] ${resp} RUN OOF-Homing SendPlanWithWrongVersion - [Documentation] It sends a POST request to conductor + [Documentation] It sends a POST request to conductor ${session}= Create Session optf-cond ${OOF_HOMING_ENDPOINT} ${data}= Get Binary File ${OOF_HOMING_PLAN_FOLDER}${/}plan_with_wrong_version.json - &{headers}= Create Dictionary Authorization=${OOF_HOMING_Auth} Content-Type=application/json Accept=application/json + ${auth}= Create List ${GLOBAL_OOF_HOMING_USERNAME} ${GLOBAL_OOF_HOMING_PASSWORD} + ${session}= Create Session session ${OOF_CMSO_ENDPOINT} auth=${auth} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} Log ********************* Log response = ${resp} @@ -99,7 +100,7 @@ Run OOF-CMSO Post Scheduler Run OOF-CMSO Future Schedule [Documentation] Runs CMSO Future Schedule ETE test. One VNF, One Change Window - [Arguments] ${request_file}=OneVnfOneChangeWindow.json.template ${workflow}=Replace ${minutesFromNow}=3 + [Arguments] ${request_file}=OneVnfOneChangeWindow.jinja ${workflow}=Replace ${minutesFromNow}=3 ${uuid}= Generate UUID4 ${resp}= OOF-CMSO Create Schedule ${uuid} ${request_file} workflow=${workflow} minutesFromNow=${minutesFromNow} Should Be Equal as Strings ${resp.status_code} 202 @@ -126,16 +127,17 @@ OOF-CMSO Create Schedule \ ${end_time}= Get Current Date UTC + ${tomorrow} minutes result_format=${OOF_CMSO_UTC} \ Set To Dictionary ${map} start_time${i}=${start_time} end_time${i}=${end_time} ${requestList}= Create List + Create Environment oof ${GLOBAL_TEMPLATE_FOLDER} :FOR ${vnf} IN @{nodelist} \ Set To Dictionary ${map} node${nn} ${vnf} \ ${nn}= Evaluate ${nn}+1 - \ Set To DIctionary ${dict} vnfName=${vnf} - \ ${requestInfo}= Fill JSON Template File ${OOF_CMSO_TEMPLATE_FOLDER}/VidCallbackData.json.template ${dict} + \ Set To DIctionary ${dict} vnfName=${vnf} + \ ${requestInfo}= Apply Template oof ${OOF_CMSO_TEMPLATE_FOLDER}/VidCallbackData.jinja ${dict} \ Append To List ${requestList} ${requestInfo} ${callBackDataMap}= Create Dictionary requestType=Update requestDetails=${requestList} ${callbackDataString}= OOF-CMSO Json Escape ${callbackDataMap} Set To Dictionary ${map} callbackData=${callbackDataString} - ${data}= Fill JSON Template File ${OOF_CMSO_TEMPLATE_FOLDER}/${request_file} ${map} + ${data}= Apply Template oof ${OOF_CMSO_TEMPLATE_FOLDER}/${request_file} ${map} ${resp}= Run OOF-CMSO Post Scheduler cmso/v1/schedules/${uuid} data=${data} [Return] ${resp} diff --git a/robot/resources/so/create_cloud_config.robot b/robot/resources/so/create_cloud_config.robot index 8762d415..9c310fd0 100644 --- a/robot/resources/so/create_cloud_config.robot +++ b/robot/resources/so/create_cloud_config.robot @@ -1,25 +1,26 @@ *** Settings *** Documentation Create Cloud Config -Resource ../json_templater.robot Resource ../so_interface.robot Library OperatingSystem Library Collections +Library ONAPLibrary.Templating *** Variables *** ${CLOUD_CONFIG_PATH} /cloudSite ${SYSTEM USER} robot-ete -${SO_ADD_CLOUD_CONFIG}= robot/assets/templates/so/create_cloud_config.template -${SO_ADD_CLOUD_CONFIG_V3}= robot/assets/templates/so/cloud_config_v3.template +${SO_ADD_CLOUD_CONFIG}= so/create_cloud_config.jinja +${SO_ADD_CLOUD_CONFIG_V3}= so/cloud_config_v3.jinja *** Keywords *** Create Cloud Configuration [Documentation] Creates a cloud configuration in SO, so it knows how to talk to an openstack cloud [Arguments] ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} ${arguments}= Create Dictionary site_name=${site_name} region_id=${region_id} clli=${clli} identity_id=${identity_id} identity_url=${identity_url} mso_id=${mso_id} mso_pass=${mso_pass} admin_tenant=${admin_tenant} member_role=${member_role} identity_server_type=${identity_server_type} authentication_type=${authentication_type} - ${data}= Fill JSON Template File ${SO_ADD_CLOUD_CONFIG} ${arguments} + Create Environment so ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template so ${SO_ADD_CLOUD_CONFIG} ${arguments} ${get_resp}= Run SO Catalog Post request ${CLOUD_CONFIG_PATH}/${site_name} ${data} ${get_resp}= Run Keyword If '${get_resp.status_code}'=='404' Update Cloud Configuration ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} @@ -31,7 +32,8 @@ Create Cloud Configuration v3 [Arguments] ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} ${project_domain_name} ${user_domain_Name} ${arguments}= Create Dictionary site_name=${site_name} region_id=${region_id} clli=${clli} identity_id=${identity_id} identity_url=${identity_url} mso_id=${mso_id} mso_pass=${mso_pass} admin_tenant=${admin_tenant} member_role=${member_role} identity_server_type=${identity_server_type} authentication_type=${authentication_type} project_domain_name=${project_domain_name} user_domain_name=${user_domain_name} Log ${arguments} - ${data}= Fill JSON Template File ${SO_ADD_CLOUD_CONFIG_V3} ${arguments} + Create Environment so ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template so ${SO_ADD_CLOUD_CONFIG_V3} ${arguments} ${get_resp}= Run SO Catalog Post request ${CLOUD_CONFIG_PATH} ${data} ${status_string}= Convert To String ${get_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ @@ -40,7 +42,8 @@ Update Cloud Configuration [Documentation] Updates a cloud configuration in SO [Arguments] ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} ${arguments}= Create Dictionary site_name=${site_name} region_id=${region_id} clli=${clli} identity_id=${identity_id} identity_url=${identity_url} mso_id=${mso_id} mso_pass=${mso_pass} admin_tenant=${admin_tenant} member_role=${member_role} identity_server_type=${identity_server_type} authentication_type=${authentication_type} - ${data}= Fill JSON Template File ${SO_ADD_CLOUD_CONFIG} ${arguments} + Create Environment so ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template so ${SO_ADD_CLOUD_CONFIG} ${arguments} ${get_resp}= Run SO Catalog Put request ${CLOUD_CONFIG_PATH}/${site_name} ${data} Should Be Equal As Strings ${get_resp.status_code} 200 [Return] ${get_resp} diff --git a/robot/resources/so_interface.robot b/robot/resources/so_interface.robot index 6c4fd26e..1e555dbf 100644 --- a/robot/resources/so_interface.robot +++ b/robot/resources/so_interface.robot @@ -5,7 +5,6 @@ Library ONAPLibrary.Utilities Library OperatingSystem Library Collections Resource global_properties.robot -Resource ../resources/json_templater.robot *** Variables *** ${MSO_HEALTH_CHECK_PATH} /manage/health ${MSO_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_SERVER_PORT} diff --git a/robot/resources/test_templates/vnf_orchestration_with_cds_test_template.robot b/robot/resources/test_templates/vnf_orchestration_with_cds_test_template.robot index e5ffc97e..f11715e3 100644 --- a/robot/resources/test_templates/vnf_orchestration_with_cds_test_template.robot +++ b/robot/resources/test_templates/vnf_orchestration_with_cds_test_template.robot @@ -18,7 +18,6 @@ Resource ../openstack/neutron_interface.robot Resource ../heatbridge.robot Resource ../global_properties.robot -Resource ../json_templater.robot Resource ../so_interface.robot Library ONAPLibrary.Openstack -- cgit 1.2.3-korg