From 3440942ef2c78e1a8eb07c70c1a03b3834beaecf Mon Sep 17 00:00:00 2001 From: DR695H Date: Thu, 20 Jun 2019 10:56:46 -0400 Subject: move portal, pgn, pnf policy to jinja Issue-ID: TEST-158 Change-Id: Ie27f2cf976e76471bf65f0ffd506a82f0e9caf09 Signed-off-by: DR695H --- .../templates/aai/add_pnf_registration_info.jinja | 12 ++++ .../aai/add_pnf_registration_info.template | 12 ---- .../templates/policy/FirewallPolicy_delete.jinja | 6 ++ .../policy/FirewallPolicy_delete.template | 6 -- .../templates/policy/FirewallPolicy_push.jinja | 5 ++ .../templates/policy/FirewallPolicy_push.template | 5 -- .../templates/policy/FirewallPolicy_update.jinja | 16 ++++++ .../policy/FirewallPolicy_update.template | 16 ------ .../vFirewall_policy_monitoring_input_tosca.jinja | 50 ++++++++++++++++ ...Firewall_policy_monitoring_input_tosca.template | 50 ---------------- ..._policy_operational_url_enc_content_input.jinja | 4 ++ ...licy_operational_url_enc_content_input.template | 4 -- robot/assets/templates/policy/vFirewall_push.jinja | 12 ++++ .../templates/policy/vFirewall_push.template | 12 ---- robot/assets/templates/portal-sdk/portal.template | 34 ----------- robot/assets/templates/portal/portal.jinja | 34 +++++++++++ .../templates/ves/pnf_registration_request.jinja | 36 ++++++++++++ .../ves/pnf_registration_request.template | 36 ------------ .../templates/vfw/vfw_pg_stream_enable.jinja | 4 ++ .../templates/vfw/vfw_pg_streams_enable.jinja | 7 +++ robot/assets/templates/vfw/vfw_pg_streams_v2.jinja | 5 ++ .../assets/templates/vfw_pg_stream_enable.template | 4 -- .../templates/vfw_pg_streams_enable.template | 7 --- robot/assets/templates/vfw_pg_streams_v2.template | 5 -- robot/resources/policy_interface.robot | 67 +++++++++++----------- robot/resources/portal-sdk/portalDef.robot | 7 ++- .../packet_generator_interface.robot | 21 ++++--- .../pnf_registration_without_SO_template.robot | 12 ++-- 28 files changed, 248 insertions(+), 241 deletions(-) create mode 100644 robot/assets/templates/aai/add_pnf_registration_info.jinja delete mode 100644 robot/assets/templates/aai/add_pnf_registration_info.template create mode 100644 robot/assets/templates/policy/FirewallPolicy_delete.jinja delete mode 100644 robot/assets/templates/policy/FirewallPolicy_delete.template create mode 100644 robot/assets/templates/policy/FirewallPolicy_push.jinja delete mode 100644 robot/assets/templates/policy/FirewallPolicy_push.template create mode 100644 robot/assets/templates/policy/FirewallPolicy_update.jinja delete mode 100644 robot/assets/templates/policy/FirewallPolicy_update.template create mode 100644 robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.jinja delete mode 100644 robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template create mode 100644 robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.jinja delete mode 100644 robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.template create mode 100644 robot/assets/templates/policy/vFirewall_push.jinja delete mode 100644 robot/assets/templates/policy/vFirewall_push.template delete mode 100644 robot/assets/templates/portal-sdk/portal.template create mode 100644 robot/assets/templates/portal/portal.jinja create mode 100644 robot/assets/templates/ves/pnf_registration_request.jinja delete mode 100644 robot/assets/templates/ves/pnf_registration_request.template create mode 100644 robot/assets/templates/vfw/vfw_pg_stream_enable.jinja create mode 100644 robot/assets/templates/vfw/vfw_pg_streams_enable.jinja create mode 100644 robot/assets/templates/vfw/vfw_pg_streams_v2.jinja delete mode 100644 robot/assets/templates/vfw_pg_stream_enable.template delete mode 100644 robot/assets/templates/vfw_pg_streams_enable.template delete mode 100644 robot/assets/templates/vfw_pg_streams_v2.template diff --git a/robot/assets/templates/aai/add_pnf_registration_info.jinja b/robot/assets/templates/aai/add_pnf_registration_info.jinja new file mode 100644 index 00000000..0403228a --- /dev/null +++ b/robot/assets/templates/aai/add_pnf_registration_info.jinja @@ -0,0 +1,12 @@ +{ + "pnf-name": "{{correlation_id}}", + "pnf-name2": "example-pnf-name2-val-78244", + "pnf-name2-source": "example-pnf-name2-source-val-99275", + "pnf-id": "example-pnf-id-val-7989", + "equip-type": "example-equip-type-val-20348", + "equip-vendor": "example-equip-vendor-val-52182", + "equip-model": "example-equip-model-val-8370", + "management-option": "example-management-option-val-72881", + "ipaddress-v4-oam": "", + "ipaddress-v6-oam": "" +} diff --git a/robot/assets/templates/aai/add_pnf_registration_info.template b/robot/assets/templates/aai/add_pnf_registration_info.template deleted file mode 100644 index 2122ef24..00000000 --- a/robot/assets/templates/aai/add_pnf_registration_info.template +++ /dev/null @@ -1,12 +0,0 @@ -{ - "pnf-name": "${correlation_id}", - "pnf-name2": "example-pnf-name2-val-78244", - "pnf-name2-source": "example-pnf-name2-source-val-99275", - "pnf-id": "example-pnf-id-val-7989", - "equip-type": "example-equip-type-val-20348", - "equip-vendor": "example-equip-vendor-val-52182", - "equip-model": "example-equip-model-val-8370", - "management-option": "example-management-option-val-72881", - "ipaddress-v4-oam": "", - "ipaddress-v6-oam": "" -} diff --git a/robot/assets/templates/policy/FirewallPolicy_delete.jinja b/robot/assets/templates/policy/FirewallPolicy_delete.jinja new file mode 100644 index 00000000..996b175a --- /dev/null +++ b/robot/assets/templates/policy/FirewallPolicy_delete.jinja @@ -0,0 +1,6 @@ +{ + "pdpGroup": "default", + "policyComponent" : "PDP", + "policyName": "{{policyName}}", + "policyType": "BRMS_Param" +} diff --git a/robot/assets/templates/policy/FirewallPolicy_delete.template b/robot/assets/templates/policy/FirewallPolicy_delete.template deleted file mode 100644 index c88d718a..00000000 --- a/robot/assets/templates/policy/FirewallPolicy_delete.template +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pdpGroup": "default", - "policyComponent" : "PDP", - "policyName": "com.BRMSParamvFirewall", - "policyType": "BRMS_Param" -} diff --git a/robot/assets/templates/policy/FirewallPolicy_push.jinja b/robot/assets/templates/policy/FirewallPolicy_push.jinja new file mode 100644 index 00000000..46033f84 --- /dev/null +++ b/robot/assets/templates/policy/FirewallPolicy_push.jinja @@ -0,0 +1,5 @@ +{ + "pdpGroup": "default", + "policyName": "com.BRMSParamvFirewall", + "policyType": "BRMS_Param" +} diff --git a/robot/assets/templates/policy/FirewallPolicy_push.template b/robot/assets/templates/policy/FirewallPolicy_push.template deleted file mode 100644 index 46033f84..00000000 --- a/robot/assets/templates/policy/FirewallPolicy_push.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pdpGroup": "default", - "policyName": "com.BRMSParamvFirewall", - "policyType": "BRMS_Param" -} diff --git a/robot/assets/templates/policy/FirewallPolicy_update.jinja b/robot/assets/templates/policy/FirewallPolicy_update.jinja new file mode 100644 index 00000000..4adb1ce4 --- /dev/null +++ b/robot/assets/templates/policy/FirewallPolicy_update.jinja @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "com.BRMSParamvFirewall", + "policyDescription": "BRMS Param vFirewall policy", + "policyScope": "com", + "attributes": { + "MATCHING": { + "controller": "amsterdam" + }, + "RULE": { + "templateName": "ClosedLoopControlName", + "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", + "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+{{RESOURCE_ID}}%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" + } + } +} diff --git a/robot/assets/templates/policy/FirewallPolicy_update.template b/robot/assets/templates/policy/FirewallPolicy_update.template deleted file mode 100644 index a5709f56..00000000 --- a/robot/assets/templates/policy/FirewallPolicy_update.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "com.BRMSParamvFirewall", - "policyDescription": "BRMS Param vFirewall policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller": "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+${RESOURCE_ID}%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -} diff --git a/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.jinja b/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.jinja new file mode 100644 index 00000000..470195f0 --- /dev/null +++ b/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.jinja @@ -0,0 +1,50 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "onap.vfirewall.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "metadata": { + "policy-id": "onap.vfirewall.tca" + }, + "properties": { + "tca_policy": { + "domain": "measurementsForVfScaling", + "metricsPerEventName": [ + { + "eventName": "vFirewallBroadcastPackets", + "controlLoopSchemaType": "VM", + "policyScope": "DCAE", + "policyName": "DCAE.Config_tca-hi-lo", + "policyVersion": "v0.0.1", + "thresholds": [ + { + "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", + "thresholdValue": 300, + "direction": "LESS_OR_EQUAL", + "severity": "MAJOR" + }, + { + "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", + "thresholdValue": 700, + "direction": "GREATER_OR_EQUAL", + "severity": "CRITICAL" + } + ] + } + ] + } + } + } + } + ] + } +} diff --git a/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template b/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template deleted file mode 100644 index 470195f0..00000000 --- a/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template +++ /dev/null @@ -1,50 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "topology_template": { - "policies": [ - { - "onap.vfirewall.tca": { - "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", - "version": "1.0.0", - "metadata": { - "policy-id": "onap.vfirewall.tca" - }, - "properties": { - "tca_policy": { - "domain": "measurementsForVfScaling", - "metricsPerEventName": [ - { - "eventName": "vFirewallBroadcastPackets", - "controlLoopSchemaType": "VM", - "policyScope": "DCAE", - "policyName": "DCAE.Config_tca-hi-lo", - "policyVersion": "v0.0.1", - "thresholds": [ - { - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", - "thresholdValue": 300, - "direction": "LESS_OR_EQUAL", - "severity": "MAJOR" - }, - { - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", - "thresholdValue": 700, - "direction": "GREATER_OR_EQUAL", - "severity": "CRITICAL" - } - ] - } - ] - } - } - } - } - ] - } -} diff --git a/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.jinja b/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.jinja new file mode 100644 index 00000000..414180cd --- /dev/null +++ b/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.jinja @@ -0,0 +1,4 @@ +{ + "policy-id" : "operational.modifyconfig", + "content" : "{{URL_ENCODED_CONTENT}}" +} diff --git a/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.template b/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.template deleted file mode 100644 index b971a89b..00000000 --- a/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.template +++ /dev/null @@ -1,4 +0,0 @@ -{ - "policy-id" : "operational.modifyconfig", - "content" : "${URL_ENCODED_CONTENT}" -} diff --git a/robot/assets/templates/policy/vFirewall_push.jinja b/robot/assets/templates/policy/vFirewall_push.jinja new file mode 100644 index 00000000..7c4a2c9d --- /dev/null +++ b/robot/assets/templates/policy/vFirewall_push.jinja @@ -0,0 +1,12 @@ +{ + "policies": [ + { + "policy-id": "onap.vfirewall.tca", + "policy-version": 1 + }, + { + "policy-id": "operational.modifyconfig", + "policy-version": "{{OP_POLICY_VERSION}}.0.0" + } + ] +} diff --git a/robot/assets/templates/policy/vFirewall_push.template b/robot/assets/templates/policy/vFirewall_push.template deleted file mode 100644 index 35813a1e..00000000 --- a/robot/assets/templates/policy/vFirewall_push.template +++ /dev/null @@ -1,12 +0,0 @@ -{ - "policies": [ - { - "policy-id": "onap.vfirewall.tca", - "policy-version": 1 - }, - { - "policy-id": "operational.modifyconfig", - "policy-version": "${OP_POLICY_VERSION}.0.0" - } - ] -} diff --git a/robot/assets/templates/portal-sdk/portal.template b/robot/assets/templates/portal-sdk/portal.template deleted file mode 100644 index 57a3b798..00000000 --- a/robot/assets/templates/portal-sdk/portal.template +++ /dev/null @@ -1,34 +0,0 @@ -{ -"application" : "${jira_id}", -"event" : { -"body" : { -"ticketStatePhrase" : "We recently detected a problem with the equipment at your site. The event is in queue for immediate work.", -"ivrNotificationFlag" : "1", -"expectedRestoreDate" : 0, -"bridgeTransport" : "AOTS", -"reptRequestType" : 0, -"ticketNum" : "PORTAL-104", -"assetID" : "JIRA notification from demo", -"eventAbstract" : "This is the place to enter notification contents!!! ", -"severity" : "2 - Major", -"ticketPriority" : "3", -"reportedCustomerImpact" : 0, -"testAutoIndicator" : 0, -"supportGroupName" : "US-TEST-ORT", -"messageGroup" : "SNMP", -"csi" : 0, -"mfabRestoredTime" : 0 -}, -"header" : { -"timestamp" : "2017-04-10T14:35:05.219+0000", -"eventSource" : "JIRA", -"entityId" : "000002000857405", -"sequenceNumber" : 2 -}, -"blinkMsgId" : "f38c071e-1a47-4b55-9e72-1db830100a61", -"sourceIP" : "130.4.165.158" -}, -"SubscriberInfo" : { -"UserList" : ["demo"] -} -} diff --git a/robot/assets/templates/portal/portal.jinja b/robot/assets/templates/portal/portal.jinja new file mode 100644 index 00000000..005cb50b --- /dev/null +++ b/robot/assets/templates/portal/portal.jinja @@ -0,0 +1,34 @@ +{ +"application" : "{{jira_id}}", +"event" : { +"body" : { +"ticketStatePhrase" : "We recently detected a problem with the equipment at your site. The event is in queue for immediate work.", +"ivrNotificationFlag" : "1", +"expectedRestoreDate" : 0, +"bridgeTransport" : "AOTS", +"reptRequestType" : 0, +"ticketNum" : "PORTAL-104", +"assetID" : "JIRA notification from demo", +"eventAbstract" : "This is the place to enter notification contents!!! ", +"severity" : "2 - Major", +"ticketPriority" : "3", +"reportedCustomerImpact" : 0, +"testAutoIndicator" : 0, +"supportGroupName" : "US-TEST-ORT", +"messageGroup" : "SNMP", +"csi" : 0, +"mfabRestoredTime" : 0 +}, +"header" : { +"timestamp" : "2017-04-10T14:35:05.219+0000", +"eventSource" : "JIRA", +"entityId" : "000002000857405", +"sequenceNumber" : 2 +}, +"blinkMsgId" : "f38c071e-1a47-4b55-9e72-1db830100a61", +"sourceIP" : "130.4.165.158" +}, +"SubscriberInfo" : { +"UserList" : ["demo"] +} +} diff --git a/robot/assets/templates/ves/pnf_registration_request.jinja b/robot/assets/templates/ves/pnf_registration_request.jinja new file mode 100644 index 00000000..ddbbf14d --- /dev/null +++ b/robot/assets/templates/ves/pnf_registration_request.jinja @@ -0,0 +1,36 @@ +{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1538407540940, + "sourceId": "val13", + "eventId": "registration_38407540", + "nfcNamingCode": "oam", + "internalHeaderFields": {}, + "eventType": "pnfRegistration", + "priority": "Normal", + "version": "4.0.1", + "reportingEntityName": "NOK6061ZW3", + "sequence": 0, + "domain": "pnfRegistration", + "lastEpochMicrosec": 1538407540940, + "eventName": "pnfRegistration_Nokia_5gDu", + "vesEventListenerVersion": "7.0.1", + "sourceName": "{{correlation_id}}", + "nfNamingCode": "gNB" + }, + "pnfRegistrationFields": { + "unitType": "val8", + "serialNumber": "6061ZW3", + "pnfRegistrationFieldsVersion": "2.0", + "manufactureDate": "1538407540942", + "modelNumber": "val6", + "lastServiceDate": "1538407540942", + "unitFamily": "BBU", + "vendorName": "Nokia", + "oamV4IpAddress": "{{PNF_IPv4_address}}", + "oamV6IpAddress": "{{PNF_IPv6_address}}", + "softwareVersion": "val7" + } + } +} + diff --git a/robot/assets/templates/ves/pnf_registration_request.template b/robot/assets/templates/ves/pnf_registration_request.template deleted file mode 100644 index 61b46d16..00000000 --- a/robot/assets/templates/ves/pnf_registration_request.template +++ /dev/null @@ -1,36 +0,0 @@ -{ - "event": { - "commonEventHeader": { - "startEpochMicrosec": 1538407540940, - "sourceId": "val13", - "eventId": "registration_38407540", - "nfcNamingCode": "oam", - "internalHeaderFields": {}, - "eventType": "pnfRegistration", - "priority": "Normal", - "version": "4.0.1", - "reportingEntityName": "NOK6061ZW3", - "sequence": 0, - "domain": "pnfRegistration", - "lastEpochMicrosec": 1538407540940, - "eventName": "pnfRegistration_Nokia_5gDu", - "vesEventListenerVersion": "7.0.1", - "sourceName": "${correlation_id}", - "nfNamingCode": "gNB" - }, - "pnfRegistrationFields": { - "unitType": "val8", - "serialNumber": "6061ZW3", - "pnfRegistrationFieldsVersion": "2.0", - "manufactureDate": "1538407540942", - "modelNumber": "val6", - "lastServiceDate": "1538407540942", - "unitFamily": "BBU", - "vendorName": "Nokia", - "oamV4IpAddress": "${PNF_IPv4_address}", - "oamV6IpAddress": "${PNF_IPv6_address}", - "softwareVersion": "val7" - } - } -} - diff --git a/robot/assets/templates/vfw/vfw_pg_stream_enable.jinja b/robot/assets/templates/vfw/vfw_pg_stream_enable.jinja new file mode 100644 index 00000000..9611d58f --- /dev/null +++ b/robot/assets/templates/vfw/vfw_pg_stream_enable.jinja @@ -0,0 +1,4 @@ + { + "id" : "{{stream}}", + "is-enabled" : "true" + } diff --git a/robot/assets/templates/vfw/vfw_pg_streams_enable.jinja b/robot/assets/templates/vfw/vfw_pg_streams_enable.jinja new file mode 100644 index 00000000..247d5506 --- /dev/null +++ b/robot/assets/templates/vfw/vfw_pg_streams_enable.jinja @@ -0,0 +1,7 @@ +{ + "pg-streams" : { + "pg-stream" : [ +{{pgstreams}} + ] + } +} diff --git a/robot/assets/templates/vfw/vfw_pg_streams_v2.jinja b/robot/assets/templates/vfw/vfw_pg_streams_v2.jinja new file mode 100644 index 00000000..333faabc --- /dev/null +++ b/robot/assets/templates/vfw/vfw_pg_streams_v2.jinja @@ -0,0 +1,5 @@ +{ + "streams": { + "active-streams": {{number_streams}} + } +} diff --git a/robot/assets/templates/vfw_pg_stream_enable.template b/robot/assets/templates/vfw_pg_stream_enable.template deleted file mode 100644 index c5036334..00000000 --- a/robot/assets/templates/vfw_pg_stream_enable.template +++ /dev/null @@ -1,4 +0,0 @@ - { - "id" : "${stream}", - "is-enabled" : "true" - } diff --git a/robot/assets/templates/vfw_pg_streams_enable.template b/robot/assets/templates/vfw_pg_streams_enable.template deleted file mode 100644 index 8f5fec61..00000000 --- a/robot/assets/templates/vfw_pg_streams_enable.template +++ /dev/null @@ -1,7 +0,0 @@ -{ - "pg-streams" : { - "pg-stream" : [ -${pgstreams} - ] - } -} diff --git a/robot/assets/templates/vfw_pg_streams_v2.template b/robot/assets/templates/vfw_pg_streams_v2.template deleted file mode 100644 index 81626144..00000000 --- a/robot/assets/templates/vfw_pg_streams_v2.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "streams": { - "active-streams": ${number_streams} - } -} diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot index cc693224..c326760f 100644 --- a/robot/resources/policy_interface.robot +++ b/robot/resources/policy_interface.robot @@ -5,7 +5,7 @@ Library String Library Collections Library SSHLibrary Library OperatingSystem -Resource json_templater.robot +Library ONAPLibrary.Templating Resource global_properties.robot Resource ssh/files.robot @@ -13,7 +13,7 @@ Resource ssh/files.robot ${POLICY_HEALTH_CHECK_PATH} /healthcheck ${POLICY_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_POLICY_SERVER_PORT} ${POLICY_HEALTHCHECK_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_HEALTHCHECK_IP_ADDR}:${GLOBAL_POLICY_HEALTHCHECK_PORT} -${POLICY_TEMPLATES} robot/assets/templates/policy +${POLICY_TEMPLATES} policy ${DROOLS_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_DROOLS_SERVER_PORT} ${POLICY_API_IP} ${GLOBAL_INJECTED_POLICY_API_IP_ADDR} ${POLICY_PAP_IP} ${GLOBAL_INJECTED_POLICY_PAP_IP_ADDR} @@ -172,22 +172,26 @@ Update vVFWCL Policy Delete vFWCL Policy - ${data}= OperatingSystem.Get File ${POLICY_TEMPLATES}/FirewallPolicy_delete.template - ${resp}= Run Policy Delete Request /pdp/api/deletePolicy ${data} - Should Be Equal As Strings ${resp.status_code} 200 + Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} + ${dict}= Create Dictionary policyName=com.BRMSParamvFirewall + ${data}= Apply Template policy ${POLICY_TEMPLATES}/FirewallPolicy_delete.jinja ${dict} + ${resp}= Run Policy Delete Request /pdp/api/deletePolicy ${data} + Should Be Equal As Strings ${resp.status_code} 200 Create vFWCL Policy [Arguments] ${resource_id} ${dict}= Create Dictionary RESOURCE_ID=${resource_id} - ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/FirewallPolicy_update.template ${dict} + Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template policy ${POLICY_TEMPLATES}/FirewallPolicy_update.jinja ${dict} ${resp}= Run Policy Put Request /pdp/api/updatePolicy ${data} Should Be Equal As Strings ${resp.status_code} 200 Push vFWCL Policy - ${dict}= Create Dictionary - ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/FirewallPolicy_push.template ${dict} - ${resp}= Run Policy Put Request /pdp/api/pushPolicy ${data} - Should Be Equal As Strings ${resp.status_code} 200 + Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} + ${dict}= Create Dictionary + ${data}= Apply Template policy ${POLICY_TEMPLATES}/FirewallPolicy_push.jinja ${dict} + ${resp}= Run Policy Put Request /pdp/api/pushPolicy ${data} + Should Be Equal As Strings ${resp.status_code} 200 Reboot Drools ${stop}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy stop" @@ -217,35 +221,32 @@ Validate the vFWCL Policy Create vFirewall Monitoring Policy ${dict}= Create Dictionary - ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_monitoring_input_tosca.template ${dict} + Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template policy ${POLICY_TEMPLATES}/vFirewall_policy_monitoring_input_tosca.jinja ${dict} ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies ${data} Should Be Equal As Strings ${resp.status_code} 200 Create vFirewall Operational Policy - [Arguments] ${resource_id} - ${dict}= Create Dictionary RESOURCE_ID=${resource_id} - ${content_data} OperatingSystem.Get File ${POLICY_TEMPLATES}/vFirewall_policy_operational_content.yaml - ${content_data}= Replace String Using Regexp ${content_data} __RESOURCE_ID__ ${resource_id} - ${encoded_content_data}= Evaluate urllib.quote_plus('''${content_data}''') urllib - ${content_dictionary}= Create Dictionary URL_ENCODED_CONTENT ${encoded_content_data} - ${data_2}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_operational_url_enc_content_input.template ${content_dictionary} - Log To Console ${data_2} - ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data_2} - # - # pre-encoded content version - #${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_operational_input.template ${dict} - #${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data} - # - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()['policy-version']} + [Arguments] ${resource_id} + ${dict}= Create Dictionary RESOURCE_ID=${resource_id} + Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} + ${content_data} OperatingSystem.Get File ${POLICY_TEMPLATES}/vFirewall_policy_operational_content.yaml + ${content_data}= Replace String Using Regexp ${content_data} __RESOURCE_ID__ ${resource_id} + ${encoded_content_data}= Evaluate urllib.quote_plus('''${content_data}''') urllib + ${content_dictionary}= Create Dictionary URL_ENCODED_CONTENT ${encoded_content_data} + ${data_2}= Apply Template policy ${POLICY_TEMPLATES}/vFirewall_policy_operational_url_enc_content_input.jinja ${content_dictionary} + Log To Console ${data_2} + ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data_2} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()['policy-version']} Push vFirewall Policies To PDP Group - [Arguments] ${op_policy_version} - ${dict}= Create Dictionary OP_POLICY_VERSION=${op_policy_version} - ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_push.template ${dict} - #${resp}= Run Policy Post Request /policy/pap/v1/pdps/policies ${data} - ${resp}= Run Policy Pap Post Request /policy/pap/v1/pdps/policies ${data} - Should Be Equal As Strings ${resp.status_code} 200 + [Arguments] ${op_policy_version} + ${dict}= Create Dictionary OP_POLICY_VERSION=${op_policy_version} + Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Apply Template policy ${POLICY_TEMPLATES}/vFirewall_push.jinja ${dict} + ${resp}= Run Policy Pap Post Request /policy/pap/v1/pdps/policies ${data} + Should Be Equal As Strings ${resp.status_code} 200 Run Policy API Healthcheck [Documentation] Runs Policy Api Health check diff --git a/robot/resources/portal-sdk/portalDef.robot b/robot/resources/portal-sdk/portalDef.robot index 59808357..3cd2a6f4 100644 --- a/robot/resources/portal-sdk/portalDef.robot +++ b/robot/resources/portal-sdk/portalDef.robot @@ -7,8 +7,8 @@ Library DateTime Library Collections Library StringTemplater Library String +Library ONAPLibrary.Templating -Resource ../json_templater.robot Resource ../browser_setup.robot *** Variables *** @@ -30,7 +30,7 @@ ${GLOBAL_BUILD_NUMBER} 0 ${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt ${jira} jira ${RESOURCE_PATH} ${PORTAL_URL}/auxapi/ticketevent -${portal_Template} ${CURDIR}/portal.template +${portal_Template} portal/portal.jinja ${download_link_id} 0 @@ -859,7 +859,8 @@ Enhanced Notification on ONAP Portal Notification on ONAP Portal [Documentation] Create Config portal ${configportal}= Create Dictionary jira_id=${jira} - ${output} = Fill JSON Template File ${portal_Template} ${configportal} + Create Environment portal ${GLOBAL_TEMPLATE_FOLDER} + ${output} = Apply Template portal ${portal_Template} ${configportal} ${post_resp} = Enhanced Notification on ONAP Portal ${RESOURCE_PATH} ${output} Should Be Equal As Strings ${post_resp.status_code} 200 diff --git a/robot/resources/stack_validation/packet_generator_interface.robot b/robot/resources/stack_validation/packet_generator_interface.robot index 2a30ba2a..5482aaa3 100644 --- a/robot/resources/stack_validation/packet_generator_interface.robot +++ b/robot/resources/stack_validation/packet_generator_interface.robot @@ -3,17 +3,17 @@ Documentation The main interface for interacting with A&AI. It handles low l Library RequestsLibrary Library StringTemplater Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating Library OperatingSystem Resource ../global_properties.robot -Resource ../json_templater.robot *** Variables *** ${PGN_URL_TEMPLATE} http://\${host}:\${port} ${PGN_PATH} /restconf/config/sample-plugin:sample-plugin ${PGN_PATH_V2} /restconf/config/stream-count:stream-count -${PGN_ENABLE_STREAM_TEMPLATE} robot/assets/templates/vfw_pg_stream_enable.template -${PGN_ENABLE_STREAMS_TEMPLATE} robot/assets/templates/vfw_pg_streams_enable.template -${PGN_ENABLE_STREAMS_V2_TEMPLATE} robot/assets/templates/vfw_pg_streams_v2.template +${PGN_ENABLE_STREAM_TEMPLATE} vfw/vfw_pg_stream_enable.jinja +${PGN_ENABLE_STREAMS_TEMPLATE} vfw/vfw_pg_streams_enable.jinja +${PGN_ENABLE_STREAMS_V2_TEMPLATE} vfw/vfw_pg_streams_v2.jinja *** Keywords *** Connect To Packet Generator @@ -32,10 +32,11 @@ Enable Stream ${headers}= Create Headers ${data_path}= Catenate ${PGN_PATH}/pg-streams ${map}= Create Dictionary stream=${stream} - ${streams}= Fill JSON Template File ${PGN_ENABLE_STREAM_TEMPLATE} ${map} + Create Environment pgi ${GLOBAL_TEMPLATE_FOLDER} + ${streams}= Apply Template pgi ${PGN_ENABLE_STREAM_TEMPLATE} ${map} ${streams}= evaluate json.dumps(${streams}) json ${map}= Create Dictionary pgstreams=${streams} - ${data}= Fill JSON Template File ${PGN_ENABLE_STREAMS_TEMPLATE} ${map} + ${data}= Apply Template pgi ${PGN_ENABLE_STREAMS_TEMPLATE} ${map} ${resp}= Put Request ${alias} ${data_path} data=${data} headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp} @@ -49,15 +50,16 @@ Enable Streams ${streams}= Set Variable ${comma}= Set Variable ${stream_count}= Evaluate ${stream_count}+1 + Create Environment pgi ${GLOBAL_TEMPLATE_FOLDER} :FOR ${i} IN RANGE 1 ${stream_count} \ ${name}= Catenate ${prefix}${i} \ ${map}= Create Dictionary stream=${name} - \ ${one}= Fill JSON Template File ${PGN_ENABLE_STREAM_TEMPLATE} ${map} + \ ${one}= Apply Template pgi ${PGN_ENABLE_STREAM_TEMPLATE} ${map} \ ${one}= evaluate json.dumps(${one}) json \ ${streams}= Set Variable ${streams}${comma}${one} \ ${comma}= Set Variable , ${map}= Create Dictionary pgstreams=${streams} - ${data}= Fill JSON Template File ${PGN_ENABLE_STREAMS_TEMPLATE} ${map} + ${data}= Apply Template pgi ${PGN_ENABLE_STREAMS_TEMPLATE} ${map} ${resp}= Put Request ${alias} ${data_path} data=${data} headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp} @@ -68,10 +70,11 @@ Enable Streams V2 ... Enable number of streams on the passed packet generator host IP [Arguments] ${host} ${stream_count}=5 ${alias}=pgn ${prefix}=fw_udp Connect To Packet Generator ${host} alias=${alias} + Create Environment pgi ${GLOBAL_TEMPLATE_FOLDER} ${headers}= Create Headers ${data_path}= Catenate ${PGN_PATH_V2}/streams ${map}= Create Dictionary number_streams=${stream_count} - ${data}= Fill JSON Template File ${PGN_ENABLE_STREAMS_V2_TEMPLATE} ${map} + ${data}= Apply Template pgi ${PGN_ENABLE_STREAMS_V2_TEMPLATE} ${map} ${resp}= Put Request ${alias} ${data_path} data=${data} headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 diff --git a/robot/resources/test_templates/pnf_registration_without_SO_template.robot b/robot/resources/test_templates/pnf_registration_without_SO_template.robot index ae8ab2b9..497bbeb2 100644 --- a/robot/resources/test_templates/pnf_registration_without_SO_template.robot +++ b/robot/resources/test_templates/pnf_registration_without_SO_template.robot @@ -2,18 +2,18 @@ Documentation PNF Registration Handler (PRH) test cases Resource ../aai/aai_interface.robot Resource ../mr_interface.robot -Resource ../json_templater.robot Library ONAPLibrary.Openstack Library OperatingSystem Library RequestsLibrary Library Collections Library ONAPLibrary.JSON Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating *** Variables *** -${aai_so_registration_entry_template}= robot/assets/templates/aai/add_pnf_registration_info.template -${pnf_ves_integration_request}= robot/assets/templates/ves/pnf_registration_request.template +${aai_so_registration_entry_template}= aai/add_pnf_registration_info.jinja +${pnf_ves_integration_request}= ves/pnf_registration_request.jinja ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} /events/unauthenticated.PNF_READY/2/1 ${VES_ENDPOINT} ${GLOBAL_DCAE_VES_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_SERVER_PORT} ${VES_data_path} /eventListener/v7 @@ -30,7 +30,8 @@ Create A&AI antry without SO and succesfully registrate PNF Create PNF initial entry in A&AI [Documentation] Creates PNF initial entry in A&AI registry. Entry contains only correlation id (pnf-name) [Arguments] ${PNF_entry_dict} - ${template}= Fill Json Template File ${aai_so_registration_entry_template} ${PNF_entry_dict} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${template}= Apply Template aai ${aai_so_registration_entry_template} ${PNF_entry_dict} Log Filled A&AI entry template ${template} ${correlation_id}= Get From Dictionary ${PNF_entry_dict} correlation_id ${del_resp}= Delete A&AI Entity /network/pnfs/pnf/${PNF_entry_dict.correlation_id} @@ -41,7 +42,8 @@ Create PNF initial entry in A&AI Send VES integration request [Documentation] Send VES integration request. Request contains correlation id (sourceName), oamV4IpAddress and oamV6IpAddress [Arguments] ${PNF_entry_dict} - ${template}= Fill Json Template File ${pnf_ves_integration_request} ${PNF_entry_dict} + Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} + ${template}= Apply Template aai ${pnf_ves_integration_request} ${PNF_entry_dict} ${post_resp}= Run VES HTTP Post Request ${template} Should Be Equal As Strings ${post_resp.status_code} 202 Log VES integration request has been send -- cgit 1.2.3-korg