diff options
author | DR695H <dr695h@att.com> | 2019-06-20 15:04:04 -0400 |
---|---|---|
committer | DR695H <dr695h@att.com> | 2019-06-20 15:04:04 -0400 |
commit | 3bb6cf4b938d3e725860606d3ddaa8eecd872151 (patch) | |
tree | e03ccb5b30413d9fc7b3cef8c5ef0827d2e641d2 /robot/resources | |
parent | 3440942ef2c78e1a8eb07c70c1a03b3834beaecf (diff) |
replace aai, closeloop, sdc with jinja
Issue-ID: TEST-158
Change-Id: I95a783f26e28512cb4fc98e50931d62001c489c6
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robot/resources')
26 files changed, 211 insertions, 231 deletions
diff --git a/robot/resources/aai/add-relationship-list.robot b/robot/resources/aai/add-relationship-list.robot index 056b896f..7b353498 100644 --- a/robot/resources/aai/add-relationship-list.robot +++ b/robot/resources/aai/add-relationship-list.robot @@ -3,17 +3,14 @@ Documentation Operations on relationship-list sub-object in AAI, ... using specified base URL path including API version where it is implemented, ... relies on system to choose default EdgeRule for the pair of object classes -Resource ../json_templater.robot Resource aai_interface.robot -Resource api_version_properties.robot -Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** -${AAI_RELATIONSHIPLIST_PATH}= relationship-list +${AAI_RELATIONSHIPLIST_PATH} relationship-list ${AAI_RELATIONSHIP_PATH}= ${AAI_RELATIONSHIPLIST_PATH}/relationship -${AAI_ADD_RELATIONSHIP_BODY}= robot/assets/templates/aai/add-relationship.template +${AAI_ADD_RELATIONSHIP_BODY} aai/add-relationship.jinja ${AAI_RELATIONSHIP_DEPTH}= ?depth=1 *** Keywords *** @@ -21,7 +18,8 @@ Add Relationship [Documentation] Adds Relationship sub-object to existing object in AAI [Arguments] ${api_version_base_object_url} ${related_class_name} ${related_object_url} ${arguments}= Create Dictionary related_class_name=${related_class_name} related_object_url=${related_object_url} - ${data}= Fill JSON Template File ${AAI_ADD_RELATIONSHIP_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_RELATIONSHIP_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${api_version_base_object_url}/${AAI_RELATIONSHIP_PATH} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ @@ -39,5 +37,4 @@ Get Object With Depth ${resp}= Run A&AI Get Request ${api_version_base_object_url}${AAI_RELATIONSHIP_DEPTH} Should Be Equal As Strings ${resp.status_code} 200 Log Returning response ${resp.json()} - [Return] ${resp.json()} - + [Return] ${resp.json()}
\ No newline at end of file diff --git a/robot/resources/aai/ccvpn-connectivities.robot b/robot/resources/aai/ccvpn-connectivities.robot index 3f4dc0b2..7e18709c 100644 --- a/robot/resources/aai/ccvpn-connectivities.robot +++ b/robot/resources/aai/ccvpn-connectivities.robot @@ -1,19 +1,18 @@ *** Settings *** Documentation Operations on connectivities in AAI for CCVPN use case, using earliest API version where it is implemented and latest API version where it is not implemented -Resource ../json_templater.robot Resource aai_interface.robot Resource api_version_properties.robot Resource add-relationship-list.robot Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${AAI_CONN_ROOT_PATH} /network/connectivities/connectivity ${AAI_CONN_EXAMPLES_PATH} /examples/connectivities ${AAI_CONN_NODES_PATH} /nodes/connectivities -${AAI_ADD_CONNECTIVITY_BODY}= robot/assets/templates/aai/add-connectivity.template +${AAI_ADD_CONNECTIVITY_BODY}= aai/add-connectivity.jinja ${AAI_CONN_API_NA_INDEX_PATH}= ${AAI_BEIJING_INDEX_PATH} ${AAI_CONN_API_IMPL_INDEX_PATH}= ${AAI_CASABLANCA_INDEX_PATH} @@ -29,7 +28,8 @@ Create Connectivity [Documentation] Creates Connectivity in AAI [Arguments] ${connectivity_id} ${arguments}= Create Dictionary connectivity_id=${connectivity_id} - ${data}= Fill JSON Template File ${AAI_ADD_CONNECTIVITY_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_CONNECTIVITY_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ diff --git a/robot/resources/aai/ccvpn-vpn-bindings.robot b/robot/resources/aai/ccvpn-vpn-bindings.robot index c139f7cc..67789e27 100644 --- a/robot/resources/aai/ccvpn-vpn-bindings.robot +++ b/robot/resources/aai/ccvpn-vpn-bindings.robot @@ -3,19 +3,18 @@ Documentation Operations on vpn-bindings in AAI for CCVPN use case, ... using earliest API version where changes are implemented and ... latest API version where changes are not implemented -Resource ../json_templater.robot Resource aai_interface.robot Resource api_version_properties.robot Resource add-relationship-list.robot Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${AAI_VPNB_ROOT_PATH} /network/vpn-bindings/vpn-binding ${AAI_VPNB_EXAMPLES_PATH} /examples/vpn-bindings ${AAI_VPNB_NODES_PATH} /nodes/vpn-bindings -${AAI_ADD_VPNBINDING_BODY}= robot/assets/templates/aai/add-vpn-binding.template +${AAI_ADD_VPNBINDING_BODY}= aai/add-vpn-binding.jinja ${AAI_VPNB_API_NA_INDEX_PATH}= ${AAI_BEIJING_INDEX_PATH} ${AAI_VPNB_API_IMPL_INDEX_PATH}= ${AAI_CASABLANCA_INDEX_PATH} @@ -31,7 +30,8 @@ Create VPN Binding [Documentation] Creates VPN Binding in AAI [Arguments] ${vpn_id} ${arguments}= Create Dictionary vpn_id=${vpn_id} - ${data}= Fill JSON Template File ${AAI_ADD_VPNBINDING_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_VPNBINDING_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ diff --git a/robot/resources/aai/create_availability_zone.robot b/robot/resources/aai/create_availability_zone.robot index d8b6111e..8bc7b640 100644 --- a/robot/resources/aai/create_availability_zone.robot +++ b/robot/resources/aai/create_availability_zone.robot @@ -1,17 +1,16 @@ *** Settings *** Documentation Create availability zone in A&AI. -Resource ../json_templater.robot Resource aai_interface.robot Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${AZ_ROOT_PATH} /cloud-infrastructure/cloud-regions/cloud-region ${AZ_ZONE_PATH} /availability-zones/availability-zone -${AAI_ADD_AVAILABILITY_ZONE_BODY}= robot/assets/templates/aai/add_availability_zone_body.template +${AAI_ADD_AVAILABILITY_ZONE_BODY} aai/add_availability_zone_body.jinja *** Keywords *** Create Availability Zone If Not Exists @@ -25,7 +24,8 @@ Create Availability Zone [Documentation] Creates availability zone in A&AI [Arguments] ${availability_zone_name} ${cloud-owner} ${cloud-region-id} ${arguments}= Create Dictionary availability_zone_name=${availability_zone_name} - ${data}= Fill JSON Template File ${AAI_ADD_AVAILABILITY_ZONE_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_AVAILABILITY_ZONE_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${GLOBAL_AAI_INDEX_PATH}${AZ_ROOT_PATH}/${cloud-owner}/${cloud-region-id}${AZ_ZONE_PATH}/${availability_zone_name} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ diff --git a/robot/resources/aai/create_complex.robot b/robot/resources/aai/create_complex.robot index e1be288a..8fed0c79 100644 --- a/robot/resources/aai/create_complex.robot +++ b/robot/resources/aai/create_complex.robot @@ -1,13 +1,10 @@ *** Settings *** Documentation Create A&AI Customer API. -... -... Create A&AI Customer API -Resource ../json_templater.robot Resource aai_interface.robot Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** @@ -15,8 +12,7 @@ ${COMPLEX_INDEX_PATH} /aai/v11 ${ROOT_COMPLEXES_PATH} /cloud-infrastructure/complexes ${ROOT_COMPLEX_PATH} /cloud-infrastructure/complexes/complex -${SYSTEM USER} robot-ete -${AAI_ADD_COMPLEX_BODY}= robot/assets/templates/aai/add_complex_body.template +${AAI_ADD_COMPLEX_BODY} aai/add_complex_body.jinja *** Keywords *** Inventory Complex If Not Exists @@ -27,14 +23,15 @@ Inventory Complex If Not Exists Inventory Complex ${complex_name} ${physical_location_id} ${cloud_owner} ${region} ${owner_defined_type} Inventory Complex - [Documentation] Inventorys a COmplex in A&AI + [Documentation] Inventorys a Complex in A&AI [Arguments] ${complex_name} ${physical_location_id} ${cloud_owner} ${region} ${owner_defined_type} ${arguments}= Create Dictionary complex_name=${complex_name} Set To Dictionary ${arguments} physical_location_id=${physical_location_id} Set To Dictionary ${arguments} cloud_owner=${cloud_owner} Set To Dictionary ${arguments} region=${region} Set To Dictionary ${arguments} owner_defined_type=${owner_defined_type} - ${data}= Fill JSON Template File ${AAI_ADD_COMPLEX_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_COMPLEX_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEX_PATH}/${physical_location_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ diff --git a/robot/resources/aai/create_customer.robot b/robot/resources/aai/create_customer.robot index 78547758..ecae4d3a 100644 --- a/robot/resources/aai/create_customer.robot +++ b/robot/resources/aai/create_customer.robot @@ -1,25 +1,23 @@ *** Settings *** Documentation Create A&AI Customer API. -... -... Create A&AI Customer API Resource aai_interface.robot -Resource ../json_templater.robot Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${INDEX PATH} /aai/v11 ${ROOT_CUSTOMER_PATH} /business/customers/customer/ ${SYSTEM USER} robot-ete -${A&AI ADD CUSTOMER BODY} robot/assets/templates/aai/add_customer.template +${A&AI ADD CUSTOMER BODY} aai/add_customer.jinja *** Keywords *** Create Customer [Documentation] Creates a customer in A&AI [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${clouder_owner} ${cloud_region_id} ${tenant_id} ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner1=${clouder_owner} cloud_region_id1=${cloud_region_id} tenant_id1=${tenant_id} service1=${service_type} - ${data}= Fill JSON Template File ${A&AI ADD CUSTOMER BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${A&AI ADD CUSTOMER BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} Should Be Equal As Strings ${put_resp.status_code} 201 [Return] ${put_resp.status_code} diff --git a/robot/resources/aai/create_service.robot b/robot/resources/aai/create_service.robot index 0584a2a1..cbf04676 100644 --- a/robot/resources/aai/create_service.robot +++ b/robot/resources/aai/create_service.robot @@ -1,13 +1,10 @@ *** Settings *** Documentation Create A&AI Customer API. -... -... Create A&AI Customer API -Resource ../json_templater.robot Resource aai_interface.robot Library Collections -Library ONAPLibrary.Utilities - +Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating *** Variables *** @@ -15,7 +12,7 @@ ${INDEX PATH} /aai/v11 ${ROOT_SERVICE_PATH} /service-design-and-creation/services ${SYSTEM USER} robot-ete -${AAI_ADD_SERVICE_BODY}= robot/assets/templates/aai/add_service_body.template +${AAI_ADD_SERVICE_BODY}= aai/add_service_body.jinja *** Keywords *** Create Service If Not Exists @@ -30,7 +27,8 @@ Create Service [Arguments] ${service_type} ${uuid}= Generate UUID4 ${arguments}= Create Dictionary service_type=${service_type} UUID=${uuid} - ${data}= Fill JSON Template File ${AAI_ADD_SERVICE_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_SERVICE_BODY} ${arguments} ${fullpath}= Catenate ${INDEX PATH}${ROOT_SERVICE_PATH}/service/${uuid} ${put_resp}= Run A&AI Put Request ${fullpath} ${data} Should Be Equal As Strings ${put_resp.status_code} 201 diff --git a/robot/resources/aai/create_tenant.robot b/robot/resources/aai/create_tenant.robot index 24cb4d4d..1e9fa802 100644 --- a/robot/resources/aai/create_tenant.robot +++ b/robot/resources/aai/create_tenant.robot @@ -1,20 +1,16 @@ *** Settings *** Documentation Create A&AI Customer API. -... -... Create A&AI Customer API -Resource ../json_templater.robot Resource aai_interface.robot Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${INDEX PATH} /aai/v11 ${ROOT_TENANT_PATH} /cloud-infrastructure/cloud-regions/cloud-region/ -${SYSTEM USER} robot-ete -${AAI_ADD_TENANT_BODY}= robot/assets/templates/aai/add_tenant_body.template +${AAI_ADD_TENANT_BODY}= aai/add_tenant_body.jinja *** Keywords *** Inventory Tenant If Not Exists @@ -29,7 +25,8 @@ Inventory Tenant [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} ${json_resource_version}= Get Resource Version If Exists ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${arguments}= Create Dictionary cloud_owner=${cloud_owner} cloud_region_id=${cloud_region_id} cloud_type=${cloud_type} owner_defined_type=${owner_defined_type} cloud_region_version=${cloud_region_version} cloud_zone=${cloud_zone} tenant_id=${tenant_id} tenant_name=${tenant_name} resource_version=${json_resource_version} - ${data}= Fill JSON Template File ${AAI_ADD_TENANT_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_TENANT_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ diff --git a/robot/resources/aai/create_vnfc.robot b/robot/resources/aai/create_vnfc.robot index 359c62d5..de79f468 100644 --- a/robot/resources/aai/create_vnfc.robot +++ b/robot/resources/aai/create_vnfc.robot @@ -1,16 +1,15 @@ *** Settings *** Documentation Create VNFC in AAI -Resource ../json_templater.robot Resource aai_interface.robot Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${VNFC_ROOT_PATH} /network/vnfcs/vnfc -${AAI_ADD_VNFC_BODY}= robot/assets/templates/aai/add_vnfc_body.template +${AAI_ADD_VNFC_BODY}= aai/add_vnfc_body.jinja *** Keywords *** Create VNFC If Not Exists @@ -24,7 +23,8 @@ Create VNFC [Documentation] Creates VNFC in A&AI [Arguments] ${vnfc_name} ${vnfc_nc} ${vnfc_func} ${arguments}= Create Dictionary vnfc_name=${vnfc_name} vnfc_nc=${vnfc_nc} vnfc_func=${vnfc_func} - ${data}= Fill JSON Template File ${AAI_ADD_VNFC_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_VNFC_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${GLOBAL_AAI_INDEX_PATH}${VNFC_ROOT_PATH}/${vnfc_name} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ diff --git a/robot/resources/aai/create_zone.robot b/robot/resources/aai/create_zone.robot index 09d6ea6e..644817c9 100644 --- a/robot/resources/aai/create_zone.robot +++ b/robot/resources/aai/create_zone.robot @@ -1,21 +1,17 @@ *** Settings *** Documentation Create A&AI Customer API. -... -... Create A&AI Customer API -Resource ../json_templater.robot Resource aai_interface.robot Library OperatingSystem Library Collections - +Library ONAPLibrary.Templating *** Variables *** ${ZONE_INDEX_PATH} /aai/v11 ${ROOT_ZONE_PATH} /network/zones/zone -${SYSTEM USER} robot-ete -${AAI_ADD_ZONE_BODY}= robot/assets/templates/aai/add_zone_body.template +${AAI_ADD_ZONE_BODY}= aai/add_zone_body.jinja *** Keywords *** Inventory Zone If Not Exists @@ -29,7 +25,8 @@ Inventory Zone [Documentation] Inventorys a Tenant in A&AI [Arguments] ${zone_id} ${zone_name} ${design_type} ${zone_context} ${arguments}= Create Dictionary zone_id=${zone_id} zone_name=${zone_name} design_type=${design_type} zone_context=${zone_context} - ${data}= Fill JSON Template File ${AAI_ADD_ZONE_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${AAI_ADD_ZONE_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${ZONE_INDEX_PATH}${ROOT_ZONE_PATH}/${zone_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|200)$ @@ -52,8 +49,3 @@ Get Zone ${resp}= Run A&AI Get Request ${ZONE_INDEX_PATH}${ROOT_ZONE_PATH}/${zone_id} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} - - - - - diff --git a/robot/resources/aai/network.robot b/robot/resources/aai/network.robot index a3fd7737..8229a7e4 100644 --- a/robot/resources/aai/network.robot +++ b/robot/resources/aai/network.robot @@ -1,30 +1,20 @@ *** Settings *** Documentation Validate A&AI Serivce Instance -... -... Validate A&AI Serivce Instance Resource aai_interface.robot Library Collections -Library OperatingSystem -Library RequestsLibrary -Library ONAPLibrary.JSON - -Resource ../json_templater.robot *** Variables *** -${INDEX PATH} /aai/v11 -${GENERIC_QUERY_PATH} /search/generic-query? -${SYSTEM USER} robot-ete -${CUSTOMER SPEC PATH} /business/customers/customer/ -${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ -${SERVICE INSTANCE} /service-instances?service-instance-name= -${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${INDEX_PATH} /aai/v11 +${CUSTOMER_SPEC_PATH} /business/customers/customer/ +${SERVICE_SUBSCRIPTIONS} /service-subscriptions/service-subscription/ +${SERVICE_INSTANCE} /service-instances?service-instance-name= *** Keywords *** Validate Network [Documentation] Query and Validates A&AI Service Instance [Arguments] ${service_instance_name} ${service_type} ${customer_id} - ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_name} + ${resp}= Run A&AI Get Request ${INDEX_PATH}${CUSTOMER_SPEC_PATH}${customer_id}${SERVICE_SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE}${service_instance_name} Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} @@ -32,9 +22,9 @@ Validate Network *** Keywords *** Create Network [Documentation] Query and Validates A&AI Service Instance - [Arguments] ${CUSTOMER ID} + [Arguments] ${customer_id} ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]} - ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/VDNS ${json_string} + ${put_resp}= Run A&AI Put Request ${INDEX_PATH}${CUSTOMER_SPEC_PATH}${customer_id}${SERVICE_SUBSCRIPTIONS}/VDNS ${json_string} Should Be Equal As Strings ${put_resp.status_code} 201 [Return] ${put_resp.status_code} diff --git a/robot/resources/aai/service_instance.robot b/robot/resources/aai/service_instance.robot index 52212f2a..5a4c4573 100644 --- a/robot/resources/aai/service_instance.robot +++ b/robot/resources/aai/service_instance.robot @@ -8,8 +8,8 @@ Library Collections Library OperatingSystem Library RequestsLibrary Library ONAPLibrary.JSON +Library ONAPLibrary.Templating Library StringTemplater -Resource ../json_templater.robot Resource ../stack_validation/validate_vlb.robot Resource ../stack_validation/validate_vfw.robot Resource ../stack_validation/validate_vvg.robot @@ -22,11 +22,11 @@ ${SYSTEM USER} robot-ete ${CUSTOMER SPEC PATH} /business/customers/customer/ ${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ ${SERVICE INSTANCE} /service-instances?service-instance-id= -${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${SERVCE INSTANCE TEMPLATE} aai/service_subscription.jinja ${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id} ${GENERIC_VNF_QUERY_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module?vf-module-name=\${vf_module_name} -${VLB_CLOSED_LOOP_HACK_BODY} robot/assets/templates/aai/vlb_closed_loop_hack.template +${VLB_CLOSED_LOOP_HACK_BODY} aai/vlb_closed_loop_hack.jinja #*************** Test Case Variables ************* ${VLB_CLOSED_LOOP_DELETE} @@ -39,8 +39,6 @@ Validate Service Instance ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_name} Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} - #Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-id - #Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-version Validate Generic VNF [Documentation] Query and Validates A&AI Service Instance @@ -65,7 +63,8 @@ VLB Closed Loop Hack ${dummy}= Catenate dummy_${vnf_id} ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=${dummy} persona_model_id=${persona_model_id} persona_model_version=${persona_model_version} ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} - ${data}= Fill JSON Template File ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|412)$ diff --git a/robot/resources/aai/volume_group.robot b/robot/resources/aai/volume_group.robot index 94ad3b7b..c9fc0f84 100644 --- a/robot/resources/aai/volume_group.robot +++ b/robot/resources/aai/volume_group.robot @@ -1,29 +1,17 @@ *** Settings *** Documentation Validate A&AI Serivce Instance -... -... Validate A&AI Serivce Instance Resource aai_interface.robot Library Collections -Library OperatingSystem -Library RequestsLibrary -Library ONAPLibrary.JSON - -Resource ../json_templater.robot *** Variables *** -${INDEX PATH} /aai/v11 -${GENERIC_QUERY_PATH} /search/generic-query? -${SYSTEM USER} robot-ete -${CUSTOMER SPEC PATH} /business/customers/customer/ -${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ -${SERVICE INSTANCE} /service-instances?service-instance-name= -${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${INDEX_PATH} /aai/v11 +${CUSTOMER_SPEC_PATH} /business/customers/customer/ +${SERVICE_SUBSCRIPTIONS} /service-subscriptions/service-subscription/ +${SERVICE_INSTANCE} /service-instances?service-instance-name= *** Keywords *** Validate Volume Group [Arguments] ${service_instance_name} ${service_type} ${customer_id} - ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_name} - Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} - - + ${resp}= Run A&AI Get Request ${INDEX_PATH}${CUSTOMER_SPEC_PATH}${customer_id}${SERVICE_SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE}${service_instance_name} + Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name}
\ No newline at end of file diff --git a/robot/resources/asdc_interface.robot b/robot/resources/asdc_interface.robot index d91786ca..80ecc35f 100644 --- a/robot/resources/asdc_interface.robot +++ b/robot/resources/asdc_interface.robot @@ -12,9 +12,9 @@ Library ArchiveLibrary Library ONAPLibrary.Openstack Library DateTime Library ONAPLibrary.ServiceMapping +Library ONAPLibrary.Templating Resource global_properties.robot Resource browser_setup.robot -Resource json_templater.robot *** Variables *** ${ASDC_DESIGNER_USER_ID} cs0008 @@ -44,24 +44,24 @@ ${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state ${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH} /distribution ${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve ${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} /distribution/PROD/activate -${ASDC_LICENSE_MODEL_TEMPLATE} robot/assets/templates/asdc/license_model.template -${ASDC_KEY_GROUP_TEMPLATE} robot/assets/templates/asdc/key_group.template -${ASDC_ENTITLEMENT_POOL_TEMPLATE} robot/assets/templates/asdc/entitlement_pool.template -${ASDC_FEATURE_GROUP_TEMPLATE} robot/assets/templates/asdc/feature_group.template -${ASDC_LICENSE_AGREEMENT_TEMPLATE} robot/assets/templates/asdc/license_agreement.template -${ASDC_ACTION_TEMPLATE} robot/assets/templates/asdc/action.template -${ASDC_SOFTWARE_PRODUCT_TEMPLATE} robot/assets/templates/asdc/software_product.template -${ASDC_ARTIFACT_UPLOAD_TEMPLATE} robot/assets/templates/asdc/artifact_upload.template -${ASDC_CATALOG_RESOURCE_TEMPLATE} robot/assets/templates/asdc/catalog_resource.template -${ASDC_USER_REMARKS_TEMPLATE} robot/assets/templates/asdc/user_remarks.template -${ASDC_CATALOG_SERVICE_TEMPLATE} robot/assets/templates/asdc/catalog_service.template -${ASDC_RESOURCE_INSTANCE_TEMPLATE} robot/assets/templates/asdc/resource_instance.template -${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} robot/assets/templates/asdc/catalog_vnf_properties.template -${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} robot/assets/templates/asdc/catalog_vnf_inputs.template -${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} robot/assets/templates/asdc/catalog_net_input_properties.template -${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} robot/assets/templates/asdc/catalog_resource_alloted_resource.template -${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} robot/assets/templates/asdc/catalog_allotted_properties.template -${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} robot/assets/templates/asdc/catalog_allotted_inputs.template +${ASDC_LICENSE_MODEL_TEMPLATE} asdc/license_model.jinja +${ASDC_KEY_GROUP_TEMPLATE} asdc/key_group.jinja +${ASDC_ENTITLEMENT_POOL_TEMPLATE} asdc/entitlement_pool.jinja +${ASDC_FEATURE_GROUP_TEMPLATE} asdc/feature_group.jinja +${ASDC_LICENSE_AGREEMENT_TEMPLATE} asdc/license_agreement.jinja +${ASDC_ACTION_TEMPLATE} asdc/action.jinja +${ASDC_SOFTWARE_PRODUCT_TEMPLATE} asdc/software_product.jinja +${ASDC_ARTIFACT_UPLOAD_TEMPLATE} asdc/artifact_upload.jinja +${ASDC_CATALOG_RESOURCE_TEMPLATE} asdc/catalog_resource.jinja +${ASDC_USER_REMARKS_TEMPLATE} asdc/user_remarks.jinja +${ASDC_CATALOG_SERVICE_TEMPLATE} asdc/catalog_service.jinja +${ASDC_RESOURCE_INSTANCE_TEMPLATE} asdc/resource_instance.jinja +${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} asdc/catalog_vnf_properties.jinja +${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} asdc/catalog_vnf_inputs.jinja +${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} asdc/catalog_net_input_properties.jinja +${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} asdc/catalog_resource_alloted_resource.jinja +${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} asdc/catalog_allotted_properties.jinja +${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} asdc/catalog_allotted_inputs.jinja ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH} robot/assets/asdc/blueprints/ ${ASDC_FE_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_FE_IP_ADDR}:${GLOBAL_ASDC_FE_PORT} ${ASDC_BE_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_IP_ADDR}:${GLOBAL_ASDC_BE_PORT} @@ -320,11 +320,11 @@ Setup SDC Catalog Resource Deployment Artifact Properties [Documentation] Set up Deployment Artiface properties [Arguments] ${catalog_service_id} ${catalog_parent_service_id} ${catalog_resource_unique_id} ${blueprint_file} ${resp}= Get ASDC Catalog Resource Component Instances Properties ${catalog_service_id} - #${resp}= Get ASDC Catalog Resource Deployment Artifact Properties ${catalog_service_id} ${blueprint_data} OperatingSystem.Get File ${SDC_CATALOG_DEPLOYMENT_ARTIFACT_PATH}${blueprint_file} ${payloadData}= Evaluate base64.b64encode('''${blueprint_data}'''.encode('utf-8')) modules=base64 ${dict}= Create Dictionary artifactLabel=blueprint artifactName=${blueprint_file} artifactType=DCAE_INVENTORY_BLUEPRINT artifactGroupType=DEPLOYMENT description=${blueprint_file} payloadData=${payloadData} - ${data}= Fill JSON Template File ${ASDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} # POST artifactUpload to resource ${artifact_upload_path}= Catenate ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/resourceInstance/${catalog_resource_unique_id}${ASDC_CATALOG_SERVICE_RESOURCE_ARTIFACT_PATH} ${resp}= Run ASDC MD5 Post Request ${artifact_upload_path} ${data} ${ASDC_DESIGNER_USER_ID} @@ -357,7 +357,8 @@ Setup SDC Catalog Resource GenericNeutronNet Properties \ ${ownerId} Set Variable ${comp['ownerId']} \ ${dict}= Create Dictionary parentUniqueId=${parentUniqueId} ownerId=${ownerId} uniqueId=${uniqueId} description=${description} \ Run Keyword If '${name}'=='network_role' Set To Dictionary ${dict} name=${name} value=${nf_role} - \ ${data}= Fill JSON Template File ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict} + \ Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + \ ${data}= Apply Template sdc ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict} \ ${response}= Set ASDC Catalog Resource Component Instance Properties ${catalog_parent_service_id} ${catalog_service_id} ${data} @@ -392,7 +393,8 @@ Setup SDC Catalog Resource AllottedResource Properties \ ${uniqueId} Set Variable ${comp['uniqueId']} \ ${uniqueId} Fetch From Left ${uniqueId} . \ Set To Dictionary ${dict} uniqueId=${uniqueId} - ${data}= Fill JSON Template File ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict} ${response}= Set ASDC Catalog Resource Component Instance Properties For Resource ${catalog_resource_id} ${componentInstance1} ${data} Log To Console resp=${response} @@ -408,7 +410,8 @@ Setup SDC Catalog Resource AllottedResource Inputs \ ${uid} Set Variable ${comp['uniqueId']} \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=${nf_role} nf_type_uid=${uid} \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=${nf_role} nf_role_uid=${uid} - ${data}= Fill JSON Template File ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict} ${response}= Set ASDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data} [Return] ${response} @@ -428,7 +431,8 @@ Setup ASDC Catalog Resource CDS Properties \ Run Keyword If '${name}'=='abstract_vfw' Set To Dictionary ${dict} nfc_function=vfw nfc_naming_policy=SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP \ Run Keyword If '${name}'=='abstract_vpg' Set To Dictionary ${dict} nfc_function=vpg nfc_naming_policy=SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP \ Run Keyword If '${name}'=='abstract_vsn' Set To Dictionary ${dict} nfc_function=vsn nfc_naming_policy=SDNC_Policy.ONAP_VSN_NAMING_TIMESTAMP - \ ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict} + \ Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + \ ${data}= Apply Template sdc ${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict} \ ${response}= Set ASDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${data} \ Log To Console resp=${response} @@ -443,7 +447,8 @@ Setup ASDC Catalog Resource CDS Properties \ Run Keyword If '${name}'=='nf_naming_code' Set To Dictionary ${dict} nf_naming_code=vfw nf_naming_code_uid=${uid} \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=vFW nf_role_uid=${uid} \ Run Keyword If '${name}'=='cloud_env' Set To Dictionary ${dict} cloud_env=openstack cloud_env_uid=${uid} - ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict} ${response}= Set ASDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data} Add ASDC License Model @@ -451,7 +456,8 @@ Add ASDC License Model ${uuid}= Generate UUID4 ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${map}= Create Dictionary vendor_name=${shortened_uuid} - ${data}= Fill JSON Template File ${ASDC_LICENSE_MODEL_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_LICENSE_MODEL_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']} @@ -470,7 +476,8 @@ Checkin ASDC License Model [Documentation] Checks in an ASDC License Model by its id [Arguments] ${id} ${version_id}=0.1 ${map}= Create Dictionary action=Checkin - ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ACTION_TEMPLATE} ${map} ${resp}= Run ASDC Put Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -479,7 +486,8 @@ Submit ASDC License Model [Documentation] Submits an ASDC License Model by its id [Arguments] ${id} ${version_id}=0.1 ${map}= Create Dictionary action=Submit - ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ACTION_TEMPLATE} ${map} ${resp}= Run ASDC Put Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -488,7 +496,8 @@ Checkin ASDC Software Product [Documentation] Checks in an ASDC Software Product by its id [Arguments] ${id} ${version_id}=0.1 ${map}= Create Dictionary action=Checkin - ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ACTION_TEMPLATE} ${map} ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -505,7 +514,8 @@ Submit ASDC Software Product [Documentation] Submits an ASDC Software Product by its id [Arguments] ${id} ${version_id}=0.1 ${map}= Create Dictionary action=Submit - ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ACTION_TEMPLATE} ${map} ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -514,7 +524,8 @@ Package ASDC Software Product [Documentation] Creates a package of an ASDC Software Product by its id [Arguments] ${id} ${version_id}=0.1 ${map}= Create Dictionary action=Create_Package - ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ACTION_TEMPLATE} ${map} ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -525,7 +536,8 @@ Add ASDC Entitlement Pool ${uuid}= Generate UUID4 ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${map}= Create Dictionary entitlement_pool_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date} - ${data}= Fill JSON Template File ${ASDC_ENTITLEMENT_POOL_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ENTITLEMENT_POOL_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['value']} @@ -542,7 +554,8 @@ Add ASDC License Group ${uuid}= Generate UUID4 ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${map}= Create Dictionary key_group_name=${shortened_uuid} license_start_date=${license_start_date} license_end_date=${license_end_date} - ${data}= Fill JSON Template File ${ASDC_KEY_GROUP_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_KEY_GROUP_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_KEY_GROUP_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['value']} @@ -559,7 +572,8 @@ Add ASDC Feature Group ${uuid}= Generate UUID4 ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${map}= Create Dictionary feature_group_name=${shortened_uuid} key_group_id=${key_group_id} entitlement_pool_id=${entitlement_pool_id} manufacturer_reference_number=mrn${shortened_uuid} - ${data}= Fill JSON Template File ${ASDC_FEATURE_GROUP_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_FEATURE_GROUP_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_FEATURE_GROUP_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['value']} @@ -576,7 +590,8 @@ Add ASDC License Agreement ${uuid}= Generate UUID4 ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${map}= Create Dictionary license_agreement_name=${shortened_uuid} feature_group_id=${feature_group_id} - ${data}= Fill JSON Template File ${ASDC_LICENSE_AGREEMENT_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_LICENSE_AGREEMENT_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['value']} @@ -594,7 +609,8 @@ Add ASDC Software Product ${shortened_uuid}= Evaluate str("${uuid}")[:13] ${software_product_name}= Catenate ${name_prefix} ${shortened_uuid} ${map}= Create Dictionary software_product_name=${software_product_name} feature_group_id=${feature_group_id} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} vendor_id=${license_model_id} version_id=${license_model_version_id} - ${data}= Fill JSON Template File ${ASDC_SOFTWARE_PRODUCT_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_SOFTWARE_PRODUCT_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']} @@ -609,7 +625,8 @@ Add ASDC Catalog Resource [Documentation] Creates an ASDC Catalog Resource and returns its id [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} - ${data}= Fill JSON Template File ${ASDC_CATALOG_RESOURCE_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_CATALOG_RESOURCE_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} @@ -618,7 +635,8 @@ Add ASDC Allotted Resource Catalog Resource [Documentation] Creates an ASDC Allotted Resource Catalog Resource and returns its id [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${subcategory} ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} subcategory=${subcategory} - ${data}= Fill JSON Template File ${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} @@ -736,7 +754,8 @@ Checkin ASDC Catalog Resource [Documentation] Checks in an ASDC Catalog Resource by its id [Arguments] ${catalog_resource_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -745,7 +764,8 @@ Request Certify ASDC Catalog Resource [Documentation] Requests certification of an ASDC Catalog Resource by its id [Arguments] ${catalog_resource_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -761,7 +781,8 @@ Certify ASDC Catalog Resource [Documentation] Certifies an ASDC Catalog Resource by its id and returns the new id [Arguments] ${catalog_resource_id} ${user_id}=${ASDC_TESTER_USER_ID} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uniqueId']} @@ -781,7 +802,8 @@ Add ASDC Catalog Service ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name} ${map}= Create Dictionary service_name=${catalog_service_name} - ${data}= Fill JSON Template File ${ASDC_CATALOG_SERVICE_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_CATALOG_SERVICE_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} @@ -809,7 +831,8 @@ Checkin ASDC Catalog Service [Documentation] Checks in an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -818,7 +841,8 @@ Request Certify ASDC Catalog Service [Documentation] Requests certification of an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -834,7 +858,8 @@ Certify ASDC Catalog Service [Documentation] Certifies an ASDC Catalog Service by its id and returns the new id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${ASDC_TESTER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uniqueId']} @@ -843,7 +868,8 @@ Approve ASDC Catalog Service [Documentation] Approves an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_USER_REMARKS_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${ASDC_GOVERNOR_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -861,7 +887,8 @@ Add ASDC Resource Instance ${xoffset}= Set Variable ${xoffset+306} ${yoffset}= Set Variable ${yoffset+248} ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType} - ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} @@ -873,7 +900,8 @@ Add ASDC Resource Instance To Resource ${xoffset}= Set Variable ${xoffset+306} ${yoffset}= Set Variable ${yoffset+248} ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType} - ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} + Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdc ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${parent_catalog_resource_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index 410e2262..0c5229a9 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -15,10 +15,11 @@ Library Collections Library OperatingSystem Library SeleniumLibrary Library RequestsLibrary +Library ONAPLibrary.Templating *** Variables *** -${ADD_DEMO_CUSTOMER_BODY} robot/assets/templates/aai/add_demo_customer.template +${ADD_DEMO_CUSTOMER_BODY} aai/add_demo_customer.jinja ${AAI_INDEX_PATH} /aai/v8 ${VF_MODULES_NAME} _Demo_VFModules.json ${FILE_CACHE} /share/ @@ -100,7 +101,8 @@ Create Customer For VNF Demo Create Service If Not Exists gNB ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner=${clouder_owner} cloud_region_id=${cloud_region_id} tenant_id=${tenant_id} Set To Dictionary ${arguments} service1=vFWCL service2=vLB service3=vCPE service4=vIMS service5=gNB service6=vFW - ${data}= Fill JSON Template File ${ADD_DEMO_CUSTOMER_BODY} ${arguments} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template aai ${ADD_DEMO_CUSTOMER_BODY} ${arguments} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(200|201|412)$ diff --git a/robot/resources/heatbridge.robot b/robot/resources/heatbridge.robot index 3574b951..90725177 100644 --- a/robot/resources/heatbridge.robot +++ b/robot/resources/heatbridge.robot @@ -3,7 +3,8 @@ Library HeatBridge Library Collections Library StringTemplater Library OperatingSystem -Library ONAPLibrary.ServiceMapping +Library ONAPLibrary.ServiceMapping +Library ONAPLibrary.Templating Resource openstack/keystone_interface.robot Resource openstack/heat_interface.robot @@ -15,7 +16,7 @@ Resource aai/create_vnfc.robot *** Variables *** ${MULTIPART_PATH} /bulkadd ${NAMED_QUERY_PATH} /aai/search/named-query -${NAMED_QUERY_TEMPLATE} robot/assets/templates/aai/named_query.template +${NAMED_QUERY_TEMPLATE} aai/named_query.jinja ${BASE_URI} /cloud-infrastructure/cloud-regions/cloud-region/\${cloud}/\${region} ${IMAGE_URI} ${BASE_URI}/images/image/\${image_id} @@ -93,8 +94,8 @@ Run Vserver Query [Documentation] Run A&AI query to validate the bulk add [Arguments] ${vserver_name} ${dict}= Create Dictionary vserver_name=${vserver_name} - ${request}= OperatingSystem.Get File ${NAMED_QUERY_TEMPLATE} - ${request}= Template String ${request} ${dict} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${request}= Apply Template aai ${NAMED_QUERY_TEMPLATE} ${dict} ${resp}= Run A&AI Post Request ${NAMED_QUERY_PATH} ${request} Should Be Equal As Strings ${resp.status_code} 200 diff --git a/robot/resources/json_templater.robot b/robot/resources/json_templater.robot deleted file mode 100644 index b0572511..00000000 --- a/robot/resources/json_templater.robot +++ /dev/null @@ -1,20 +0,0 @@ -*** Settings *** -Documentation This resource is filling out json string templates and returning the json back -Library RequestsLibrary -Library StringTemplater -Library OperatingSystem - -*** Keywords *** -Fill JSON Template - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json} ${arguments} - ${returned_string}= Template String ${json} ${arguments} - ${returned_json}= To Json ${returned_string} - [Return] ${returned_json} - -Fill JSON Template File - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json_file} ${arguments} - ${json}= OperatingSystem.Get File ${json_file} - ${returned_json}= Fill JSON Template ${json} ${arguments} - [Return] ${returned_json}
\ No newline at end of file diff --git a/robot/resources/openstack/cinder_interface.robot b/robot/resources/openstack/cinder_interface.robot index 41667999..ca6e62b7 100644 --- a/robot/resources/openstack/cinder_interface.robot +++ b/robot/resources/openstack/cinder_interface.robot @@ -3,8 +3,8 @@ Documentation The main interface for interacting with Openstack. It handles Library ONAPLibrary.Openstack Library RequestsLibrary Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating Resource ../global_properties.robot -Resource ../json_templater.robot Resource openstack_common.robot @@ -12,7 +12,7 @@ Resource openstack_common.robot ${OPENSTACK_CINDER_API_VERSION} /v1 ${OPENSTACK_CINDER_TYPES_PATH} /types ${OPENSTACK_CINDER_VOLUMES_PATH} /volumes -${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE} robot/assets/templates/cinder_add_volume.template +${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE} openstack/cinder_add_volume.jinja ${OPENSTACK_CINDER_VOLUMES_TYPE} SSD ${OPENSTACK_CINDER_AVAILABILITY_ZONE} nova @@ -34,7 +34,8 @@ Add Openstack Volume [Arguments] ${alias} ${name} ${size} ${uuid}= Generate UUID4 ${arguments}= Create Dictionary name=${name} description=${GLOBAL_APPLICATION_ID}${uuid} size=${size} type=${OPENSTACK_CINDER_VOLUMES_TYPE} availability_zone=${OPENSTACK_CINDER_AVAILABILITY_ZONE} - ${data}= Fill JSON Template File ${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE} ${arguments} + Create Environment cinder ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template cinder ${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE} ${arguments} ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${OPENSTACK_CINDER_VOLUMES_PATH} data_path= data=${data} Should Be Equal As Strings 200 ${resp.status_code} [Return] ${resp.json()['volume']['id']} diff --git a/robot/resources/openstack/heat_interface.robot b/robot/resources/openstack/heat_interface.robot index 471c2a9f..0362d3eb 100644 --- a/robot/resources/openstack/heat_interface.robot +++ b/robot/resources/openstack/heat_interface.robot @@ -2,17 +2,16 @@ Documentation The interface for interacting with Openstack Heat API. Library ONAPLibrary.Openstack Library RequestsLibrary -Library OperatingSystem -Library StringTemplater -Library Collections +Library OperatingSystem +Library Collections +Library ONAPLibrary.Templating Resource ../global_properties.robot -Resource ../json_templater.robot Resource openstack_common.robot *** Variables *** ${OPENSTACK_HEAT_API_VERSION} /v1 ${OPENSTACK_HEAT_STACK_PATH} /stacks -${OPENSTACK_HEAT_ADD_STACK_TEMPLATE} robot/assets/templates/heat_add_stack.template +${OPENSTACK_HEAT_ADD_STACK_TEMPLATE} openstack/heat_add_stack.jinja *** Keywords *** @@ -40,9 +39,9 @@ Make Add Stack Request ${templatedata}= Template Yaml To Json ${template} ${envdata}= Env Yaml To Json ${env} ${dict}= Create Dictionary template=${templatedata} parameters=${envdata} stack_name=${name} - ${resp}= OperatingSystem.Get File ${OPENSTACK_HEAT_ADD_STACK_TEMPLATE} - ${request}= Template String ${resp} ${dict} - Log $request + Create Environment heat ${GLOBAL_TEMPLATE_FOLDER} + ${request}= Apply Template heat ${OPENSTACK_HEAT_ADD_STACK_TEMPLATE} ${dict} + Log ${request} [Return] ${request} Delete Openstack Stack diff --git a/robot/resources/openstack/keystone_interface.robot b/robot/resources/openstack/keystone_interface.robot index ceb43e8d..1df6ac91 100644 --- a/robot/resources/openstack/keystone_interface.robot +++ b/robot/resources/openstack/keystone_interface.robot @@ -4,10 +4,10 @@ Library ONAPLibrary.Openstack Library RequestsLibrary Library ONAPLibrary.Utilities Library Collections -Library OperatingSystem -Library String +Library OperatingSystem +Library String +Library ONAPLibrary.Templating Resource ../global_properties.robot -Resource ../json_templater.robot Resource openstack_common.robot *** Variables *** @@ -15,8 +15,8 @@ ${OPENSTACK_KEYSTONE_API_v3_VERSION} /v3 ${OPENSTACK_KEYSTONE_API_v2_VERSION} /v2.0 ${OPENSTACK_KEYSTONE_AUTH_v3_PATH} /auth/tokens ${OPENSTACK_KEYSTONE_AUTH_v2_PATH} /tokens -${OPENSTACK_KEYSTONE_AUTH_v2_BODY_FILE} robot/assets/templates/keystone_get_v2_auth.template -${OPENSTACK_KEYSTONE_AUTH_v3_BODY_FILE} robot/assets/templates/keystone_get_v3_auth.template +${OPENSTACK_KEYSTONE_AUTH_v2_BODY_FILE} openstack/keystone_get_v2_auth.jinja +${OPENSTACK_KEYSTONE_AUTH_v3_BODY_FILE} openstack/keystone_get_v3_auth.jinja ${OPENSTACK_KEYSTONE_TENANT_PATH} /tenants *** Keywords *** @@ -67,7 +67,8 @@ Get KeyStoneAuthv2 Data [Documentation] Returns all the data for keystone auth v2 api [Arguments] ${username} ${password} ${path} ${arguments}= Create Dictionary username=${username} password=${password} tenantId=${GLOBAL_INJECTED_OPENSTACK_TENANT_ID} - ${data}= Fill JSON Template File ${OPENSTACK_KEYSTONE_AUTH_v2_BODY_FILE} ${arguments} + Create Environment keystone ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template keystone ${OPENSTACK_KEYSTONE_AUTH_v2_BODY_FILE} ${arguments} ${data_path}= Catenate ${path}${OPENSTACK_KEYSTONE_AUTH_v2_PATH} [Return] ${data_path} ${data} @@ -75,7 +76,8 @@ Get KeyStoneAuthv3 Data [Documentation] Returns all the data for keystone auth v3 api [Arguments] ${username} ${password} ${path} ${arguments}= Create Dictionary username=${username} password=${password} domain_id=${GLOBAL_INJECTED_OPENSTACK_DOMAIN_ID} project_name=${GLOBAL_INJECTED_OPENSTACK_PROJECT_NAME} - ${data}= Fill JSON Template File ${OPENSTACK_KEYSTONE_AUTH_v3_BODY_FILE} ${arguments} + Create Environment keystone ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template keystone ${OPENSTACK_KEYSTONE_AUTH_v3_BODY_FILE} ${arguments} ${data_path}= Catenate ${path}${OPENSTACK_KEYSTONE_AUTH_v3_PATH} [Return] ${data_path} ${data} diff --git a/robot/resources/openstack/neutron_interface.robot b/robot/resources/openstack/neutron_interface.robot index 640a237a..058809de 100644 --- a/robot/resources/openstack/neutron_interface.robot +++ b/robot/resources/openstack/neutron_interface.robot @@ -3,16 +3,16 @@ Documentation The main interface for interacting with Openstack. It handles Library ONAPLibrary.Openstack Library RequestsLibrary Library Collections +Library ONAPLibrary.Templating Resource ../global_properties.robot -Resource ../json_templater.robot Resource openstack_common.robot *** Variables *** ${OPENSTACK_NEUTRON_API_VERSION} /v2.0 ${OPENSTACK_NEUTRON_NETWORK_PATH} /networks -${OPENSTACK_NEUTRON_NETWORK_ADD_BODY_FILE} robot/assets/templates/neutron_add_network.template +${OPENSTACK_NEUTRON_NETWORK_ADD_BODY_FILE} openstack/neutron_add_network.jinja ${OPENSTACK_NEUTRON_SUBNET_PATH} /subnets -${OPENSTACK_NEUTRON_SUBNET_ADD_BODY_FILE} robot/assets/templates/neutron_add_subnet.template +${OPENSTACK_NEUTRON_SUBNET_ADD_BODY_FILE} openstack/neutron_add_subnet.jinja ${OPENSTACK_NEUTRON_PORT_PATH} /ports *** Keywords *** @@ -44,7 +44,8 @@ Add Openstack Network [Documentation] Runs an Openstack Request to add a network and returns that network id of the created network [Arguments] ${alias} ${name} ${arguments}= Create Dictionary name=${name} - ${data}= Fill JSON Template File ${OPENSTACK_NEUTRON_NETWORK_ADD_BODY_FILE} ${arguments} + Create Environment openstack ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template openstack ${OPENSTACK_NEUTRON_NETWORK_ADD_BODY_FILE} ${arguments} ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_NETWORK_PATH} data_path= data=${data} Should Be Equal As Strings 201 ${resp.status_code} [Return] ${resp.json()['network']['id']} @@ -73,7 +74,8 @@ Add Openstack Network With Subnet [Arguments] ${alias} ${name} ${cidr} ${network_id}= Add Openstack Network ${alias} ${name} ${arguments}= Create Dictionary network_id=${network_id} cidr=${cidr} subnet_name=${name} - ${data}= Fill JSON Template File ${OPENSTACK_NEUTRON_SUBNET_ADD_BODY_FILE} ${arguments} + Create Environment openstack ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template openstack ${OPENSTACK_NEUTRON_SUBNET_ADD_BODY_FILE} ${arguments} ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_SUBNET_PATH} data_path= data=${data} Should Be Equal As Strings 201 ${resp.status_code} [Return] ${network_id} diff --git a/robot/resources/openstack/nova_interface.robot b/robot/resources/openstack/nova_interface.robot index 94a07479..b1f07f86 100644 --- a/robot/resources/openstack/nova_interface.robot +++ b/robot/resources/openstack/nova_interface.robot @@ -3,22 +3,22 @@ Documentation The main interface for interacting with Openstack. It handles Library ONAPLibrary.Openstack Library RequestsLibrary Library ONAPLibrary.JSON +Library ONAPLibrary.Templating Library OperatingSystem Library Collections Resource ../global_properties.robot -Resource ../json_templater.robot Resource openstack_common.robot *** Variables *** ${OPENSTACK_NOVA_API_VERSION} /v2 ${OPENSTACK_NOVA_KEYPAIR_PATH} /os-keypairs -${OPENSTACK_NOVA_KEYPAIR_ADD_BODY_FILE} robot/assets/templates/nova_add_keypair.template +${OPENSTACK_NOVA_KEYPAIR_ADD_BODY_FILE} openstack/nova_add_keypair.jinja ${OPENSTACK_NOVA_KEYPAIR_SSH_KEY} robot/assets/keys/robot_ssh_public_key.txt ${OPENSTACK_NOVA_FLAVORS_PATH} /flavors ${OPENSTACK_NOVA_SERVERS_PATH} /servers ${OPENSTACK_NOVA_IMAGES_PATH} /images ${OPENSTACK_NOVA_SERVERS_REBOOT_BODY} {"reboot" : { "type" : "SOFT" }} -${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} robot/assets/templates/nova_add_server.template +${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} openstack/nova_add_server.jinja *** Keywords *** @@ -33,7 +33,8 @@ Add Openstack Keypair [Arguments] ${alias} ${name} ${ssh_key}= OperatingSystem.Get File ${OPENSTACK_NOVA_KEYPAIR_SSH_KEY} ${arguments}= Create Dictionary name=${name} publickey=${ssh_key} - ${data}= Fill JSON Template File ${OPENSTACK_NOVA_KEYPAIR_ADD_BODY_FILE} ${arguments} + Create Environment openstack ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template openstack ${OPENSTACK_NOVA_KEYPAIR_ADD_BODY_FILE} ${arguments} ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_KEYPAIR_PATH} data_path= data=${data} Should Be Equal As Strings 200 ${resp.status_code} [Return] ${resp.json()['keypair']['name']} @@ -84,7 +85,8 @@ Add Server [Documentation] Adds a server for the passed if [Arguments] ${alias} ${name} ${imageRef} ${flavorRef} ${dict}= Create Dictionary name=${name} imageRef=${imageRef} flavorRef=${flavorRef} - ${data}= Fill JSON Template File ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict} + Create Environment openstack ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template openstack ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict} ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} data_path= data=${data} [Return] ${resp} @@ -98,7 +100,8 @@ Add Server For Image Name ${imageRef}= Get Id For Name ${images} ${imageName} ${flavorRef}= Get Id For Name ${flavors} ${flavorName} ${dict}= Create Dictionary name=${name} imageRef=${imageRef} flavorRef=${flavorRef} public_net_id=${public_net_id} - ${data}= Fill JSON Template File ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict} + Create Environment openstack ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template openstack ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict} ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} data_path= data=${data} ${status_string}= Convert To String ${resp.status_code} Should Match Regexp ${status_string} ^(202)$ diff --git a/robot/resources/sdngc_interface.robot b/robot/resources/sdngc_interface.robot index db544482..988fe4c9 100644 --- a/robot/resources/sdngc_interface.robot +++ b/robot/resources/sdngc_interface.robot @@ -7,16 +7,15 @@ Library Collections Library String Library StringTemplater Library ONAPLibrary.ServiceMapping - +Library ONAPLibrary.Templating Resource global_properties.robot -Resource ../resources/json_templater.robot Resource browser_setup.robot *** Variables *** ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} /operations/VNF-API:preload-vnf-topology-operation ${PRELOAD_VNF_CONFIG_PATH} /config/VNF-API:preload-vnfs/vnf-preload-list -${PRELOAD_VNF_TOPOLOGY_OPERATION_BODY} robot/assets/templates/sdnc/ +${PRELOAD_VNF_TOPOLOGY_OPERATION_BODY} sdnc ${SDNGC_INDEX_PATH} /restconf ${SDNCGC_HEALTHCHECK_OPERATION_PATH} /operations/SLI-API:healthcheck ${SDNGC_REST_ENDPOINT} ${GLOBAL_SDNGC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDNC_IP_ADDR}:${GLOBAL_SDNGC_REST_PORT} @@ -137,7 +136,8 @@ Preload One Vnf Topology Return From Keyword If '${filename}' == '' ${parameters}= Get Template Parameters ${generic_vnf_name} ${filename} ${uuid} 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} - ${data}= Fill JSON Template File ${PRELOAD_VNF_TOPOLOGY_OPERATION_BODY}/preload.template ${parameters} + Create Environment sdnc ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template sdnc ${PRELOAD_VNF_TOPOLOGY_OPERATION_BODY}/preload.jinja ${parameters} ${put_resp}= Run SDNGC Post Request ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} ${data} Should Be Equal As Strings ${put_resp.json()['output']['response-code']} 200 ${get_resp}= Run SDNGC Get Request ${SDNGC_INDEX_PATH}${PRELOAD_VNF_CONFIG_PATH}/${vf_module_name}/${vf_module_type} diff --git a/robot/resources/stack_validation/policy_check_vfw.robot b/robot/resources/stack_validation/policy_check_vfw.robot index 7ac8ef72..2be3995d 100644 --- a/robot/resources/stack_validation/policy_check_vfw.robot +++ b/robot/resources/stack_validation/policy_check_vfw.robot @@ -14,7 +14,6 @@ Resource ../openstack/keystone_interface.robot Resource ../openstack/nova_interface.robot Resource ../openstack/heat_interface.robot Resource ../ssh/files.robot -Resource ../ssh/processes.robot Resource ../demo_preload.robot Resource packet_generator_interface.robot Resource validate_common.robot diff --git a/robot/resources/stack_validation/validate_common.robot b/robot/resources/stack_validation/validate_common.robot index 383a0146..9c5be62c 100644 --- a/robot/resources/stack_validation/validate_common.robot +++ b/robot/resources/stack_validation/validate_common.robot @@ -10,7 +10,6 @@ Resource ../../resources/openstack/keystone_interface.robot Resource ../../resources/openstack/nova_interface.robot Resource ../../resources/openstack/heat_interface.robot Resource ../../resources/ssh/files.robot -Resource ../../resources/ssh/processes.robot Resource packet_generator_interface.robot diff --git a/robot/resources/test_templates/closedloop_test_template.robot b/robot/resources/test_templates/closedloop_test_template.robot index 90d5f8cf..7354dc1a 100644 --- a/robot/resources/test_templates/closedloop_test_template.robot +++ b/robot/resources/test_templates/closedloop_test_template.robot @@ -7,18 +7,19 @@ Resource ../stack_validation/packet_generator_interface.robot Resource vnf_orchestration_test_template.robot Library String -LIbrary Process +Library Process +Library ONAPLibrary.Templating *** Variables *** ${RESOURCE_PATH_CREATE} /pdp/createPolicy ${RESOURCE_PATH_CREATE_PUSH} /pdp/pushPolicy ${RESOURCE_PATH_CREATE_DELETE} /pdp/deletePolicy ${RESOURCE_PATH_GET_CONFIG} /pdp/getConfig -${CREATE_CONFIG_TEMPLATE} robot/assets/templates/policy/closedloop_configpolicy.template -${CREATE_OPS_TEMPLATE} robot/assets/templates/policy/closedloop_opspolicy.template -${PUSH_POLICY_TEMPLATE} robot/assets/templates/policy/closedloop_pushpolicy.template -${DEL_POLICY_TEMPLATE} robot/assets/templates/policy/closedloop_deletepolicy.template -${GECONFIG_VFW_TEMPLATE} robot/assets/templates/policy/closedloop_getconfigpolicy.template +${CREATE_CONFIG_TEMPLATE} policy/closedloop_configpolicy.jinja +${CREATE_OPS_TEMPLATE} policy/closedloop_opspolicy.jinja +${PUSH_POLICY_TEMPLATE} policy/closedloop_pushpolicy.jinja +${DEL_POLICY_TEMPLATE} policy/closedloop_deletepolicy.jinja +${GECONFIG_VFW_TEMPLATE} policy/closedloop_getconfigpolicy.jinja # 'Normal' number of pg streams that will be set when policy is triggered ${VFWPOLICYRATE} 5 @@ -78,7 +79,8 @@ Get Configs VFW Policy [Documentation] Get Config Policy for VFW ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_NAME}* ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} Should Be Equal As Strings ${get_resp.status_code} 200 ${config}= Catenate ${get_resp.json()[0]["config"]} @@ -98,7 +100,8 @@ Get Configs VDNS Policy [Documentation] Get Config Policy for VDNS ${getconfigpolicy}= Catenate .*MicroServicevDNS* ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} Should Be Equal As Strings ${get_resp.status_code} 200 ${config}= Catenate ${get_resp.json()[0]["config"]} @@ -121,7 +124,8 @@ Create Config Policy ${policyname1}= Catenate com.${randompolicyname} ${CONFIG_POLICY_NAME}= Set Test Variable ${policyname1} ${configpolicy}= Create Dictionary policy_name=${CONFIG_POLICY_NAME} - ${output} = Fill JSON Template File ${CREATE_CONFIG_TEMPLATE} ${configpolicy} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${CREATE_CONFIG_TEMPLATE} ${configpolicy} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -138,8 +142,8 @@ Create Ops Policy ${policyname1}= Catenate com.${randompolicyname} ${OPS_POLICY_NAME}= Set Test Variable ${policyname1} ${dict}= Create Dictionary policy_name=${OPS_POLICY_NAME} - #${NEWPOLICY1}= Create Dictionary policy_name=com.${OPS_POLICY_NAME} - ${output} = Fill JSON Template File ${CREATE_OPS_TEMPLATE} ${dict} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${CREATE_OPS_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Log ${put_resp} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -148,7 +152,8 @@ Push Ops Policy [Documentation] Push Ops Policy [Arguments] ${policyname} ${policytype} ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${PUSH_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -156,7 +161,8 @@ Push Config Policy [Documentation] Push Config Policy [Arguments] ${policyname} ${policytype} ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${PUSH_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -166,7 +172,8 @@ Delete Config Policy [Arguments] ${policy_name} ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template File ${DEL_POLICY_TEMPLATE} ${dict} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${DEL_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -175,7 +182,8 @@ Delete Ops Policy [Arguments] ${policy_name} ${policyname3}= Catenate com.Config_MS_com.vFirewall.1.xml ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template File ${DEL_POLICY_TEMPLATE} ${dict} + Create Environment cl ${GLOBAL_TEMPLATE_FOLDER} + ${output}= Apply Template cl ${DEL_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 |