diff options
author | Brian Freeman <bf1936@att.com> | 2019-05-17 17:46:56 -0500 |
---|---|---|
committer | Brian Freeman <bf1936@att.com> | 2019-05-17 22:58:58 +0000 |
commit | 88fbb99d3a5c919db31cee1d0f151f9329a21e39 (patch) | |
tree | 6afdf7c0332c2272839e30f85ace443c6198ec05 /robot/resources/policy_interface.robot | |
parent | e8941da13d2bf245a147ebdcbee938eae1e1648c (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/resources/policy_interface.robot')
-rw-r--r-- | robot/resources/policy_interface.robot | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot index 9922638f..fc2a2059 100644 --- a/robot/resources/policy_interface.robot +++ b/robot/resources/policy_interface.robot @@ -26,6 +26,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 @@ -227,11 +228,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} |