aboutsummaryrefslogtreecommitdiffstats
path: root/robot
diff options
context:
space:
mode:
authorBrian Freeman <bf1936@att.com>2019-05-17 17:46:56 -0500
committerBrian Freeman <bf1936@att.com>2019-05-17 17:57:30 -0500
commitfdc215c50f5affe4582bc1659748bd76c70f21ba (patch)
treed2015fa4a03a46181439f5fc4ba9feaf926b9424 /robot
parent0d449b71ebba9f62d2ca9fa72d9e1174cfbeb527 (diff)
Use policy yaml and encode it
Leaving old urlencoded tempalte in case we need to revert Issue-ID: POLICY-1685 Change-Id: I25bbf86193863ff0787b0b6e9987227360ed6a88 Signed-off-by: Brian Freeman <bf1936@att.com>
Diffstat (limited to 'robot')
-rw-r--r--robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template2
-rw-r--r--robot/assets/templates/policy/vFirewall_policy_operational_content.yaml25
-rw-r--r--robot/assets/templates/policy/vFirewall_policy_operational_input.template2
-rw-r--r--robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.template4
-rw-r--r--robot/resources/policy_interface.robot30
5 files changed, 61 insertions, 2 deletions
diff --git a/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template b/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template
index 8ac5a9ed..470195f0 100644
--- a/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template
+++ b/robot/assets/templates/policy/vFirewall_policy_monitoring_input_tosca.template
@@ -15,7 +15,7 @@
"metricsPerEventName": [
{
"eventName": "vFirewallBroadcastPackets",
- "controlLoopSchemaType": "VNF",
+ "controlLoopSchemaType": "VM",
"policyScope": "DCAE",
"policyName": "DCAE.Config_tca-hi-lo",
"policyVersion": "v0.0.1",
diff --git a/robot/assets/templates/policy/vFirewall_policy_operational_content.yaml b/robot/assets/templates/policy/vFirewall_policy_operational_content.yaml
new file mode 100644
index 00000000..f5ae3bc5
--- /dev/null
+++ b/robot/assets/templates/policy/vFirewall_policy_operational_content.yaml
@@ -0,0 +1,25 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ trigger_policy: unique-policy-id-1-modifyConfig
+ timeout: 1200
+ abatement: false
+policies:
+ - id: unique-policy-id-1-modifyConfig
+ name: modify_packet_gen_config
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ resourceID: __RESOURCE_ID__
+ type: VNF
+ payload:
+ streams: '{"active-streams":5}'
+ retry: 0
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
diff --git a/robot/assets/templates/policy/vFirewall_policy_operational_input.template b/robot/assets/templates/policy/vFirewall_policy_operational_input.template
index 948a5891..5020b097 100644
--- a/robot/assets/templates/policy/vFirewall_policy_operational_input.template
+++ b/robot/assets/templates/policy/vFirewall_policy_operational_input.template
@@ -1,4 +1,4 @@
{
"policy-id" : "operational.modifyconfig",
- "content" : "controlLoop%3A%0A%20%20%20%20version%3A%202.0.0%0A%20%20%20%20controlLoopName%3A%20ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0A%20%20%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20timeout%3A%201200%0A%20%20%20%20abatement%3A%20false%0Apolicies%3A%0A%20%20%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20name%3A%20modify_packet_gen_config%0A%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20actor%3A%20APPC%0A%20%20%20%20%20%20recipe%3A%20ModifyConfig%0A%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20resourceID%3A%20${RESOURCE_ID}%0A%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20timeout%3A%20300%0A%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20failure_guard%3A%20final_failure_guard"
+ "content" : "controlLoop%3A%0A%20%20%20%20version%3A%202.0.0%0A%20%20%20%20controlLoopName%3A%20ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0A%20%20%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20timeout%3A%201200%0A%20%20%20%20abatement%3A%20false%0Apolicies%3A%0A%20%20%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20name%3A%20modify_packet_gen_config%0A%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20actor%3A%20APPC%0A%20%20%20%20%20%20recipe%3A%20ModifyConfig%0A%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20resourceID%3A%20${RESOURCE_ID}%0A%20%20%20%20%20%20%20%20%20%20type%3A%20VM%0A%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20timeout%3A%20300%0A%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20failure_guard%3A%20final_failure_guard"
}
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
new file mode 100644
index 00000000..b971a89b
--- /dev/null
+++ b/robot/assets/templates/policy/vFirewall_policy_operational_url_enc_content_input.template
@@ -0,0 +1,4 @@
+{
+ "policy-id" : "operational.modifyconfig",
+ "content" : "${URL_ENCODED_CONTENT}"
+}
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot
index 11984500..4ac6ae9d 100644
--- a/robot/resources/policy_interface.robot
+++ b/robot/resources/policy_interface.robot
@@ -21,6 +21,7 @@ ${POLICY_APEX_PDP_IP} ${GLOBAL_INJECTED_POLICY_APEX_PDP_IP_ADDR}
${POLICY_HEALTHCHECK_USERNAME} ${GLOBAL_POLICY_HEALTHCHECK_USERNAME}
${POLICY_HEALTHCHECK_PASSWORD} ${GLOBAL_POLICY_HEALTHCHECK_PASSWORD}
+
*** Keywords ***
Run Policy Health Check
@@ -222,11 +223,40 @@ Create vFirewall Monitoring Policy
Create vFirewall Operational Policy
[Arguments] ${resource_id}
${dict}= Create Dictionary RESOURCE_ID=${resource_id}
+ #vFirewall_policy_operational_content.yaml
+ #vFirewall_policy_operational_url_enc_content_input.template
+ ${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.urlencode('''${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 ${dict_2}
+ Log To Console ${data_2}
${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']}
+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']}
+
+
+
+
Push vFirewall Policies To PDP Group
[Arguments] ${op_policy_version}