summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Ptacek <m.ptacek@partner.samsung.com>2019-07-08 16:13:02 +0200
committerMichal Ptacek <m.ptacek@partner.samsung.com>2019-07-10 18:47:28 +0000
commit6880b65aa62c010b837d8731e14c55f8b227895d (patch)
tree5f757b9f9f0a1424c107de362bcb66ade247c2a4
parent8e7028b3ee4d18ec1916f9a68dd8587377452376 (diff)
Automating tca microservice CLname change
tca microservice has hardcoded closedLoopControlName, this change is to adjust it to one generated during operational policy update. Change-Id: Id4de425a6141fb0f6a564c4efa24478e5e6e1f59 Issue-ID: TEST-168 Signed-off-by: Michal Ptacek <m.ptacek@partner.samsung.com>
-rw-r--r--robot/resources/consul_interface.robot47
-rw-r--r--robot/resources/demo_preload.robot5
-rw-r--r--robot/resources/policy_interface.robot8
3 files changed, 54 insertions, 6 deletions
diff --git a/robot/resources/consul_interface.robot b/robot/resources/consul_interface.robot
new file mode 100644
index 00000000..00f4334b
--- /dev/null
+++ b/robot/resources/consul_interface.robot
@@ -0,0 +1,47 @@
+*** Settings ***
+Documentation The main interface for interacting with Consul.
+Library RequestsLibrary
+
+Resource global_properties.robot
+
+*** Variables ***
+${CONSUL_ENDPOINT} http://consul.onap:8500
+
+
+*** Keywords ***
+Run Consul Get Request
+ [Documentation] Runs Consul Get Request
+ [Arguments] ${data_path}
+ ${session}= Create Session consul ${CONSUL_ENDPOINT}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request consul ${data_path} headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ [Return] ${resp}
+
+Run Consul Put Request
+ [Documentation] Runs Consul Put request
+ [Arguments] ${data_path} ${data}
+ ${session}= Create Session consul ${CONSUL_ENDPOINT}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Put Request consul ${data_path} data=${data} headers=${headers}
+ Log Received response from consul ${resp.text}
+ [Return] ${resp}
+
+Update Tca ControlLoopName
+ [Arguments] ${resource_id}
+ ${closedLoopControlName}= Set Variable ControlLoop-vFirewall-${resource_id}
+ Log Obtained closedLoopControlName ${closedLoopControlName}
+ ${resp}= Run Consul Get Request /v1/kv/dcae-tca-analytics
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${base64Obj}= Set Variable ${resp.json()[0]["Value"]}
+ ${binObj}= Evaluate base64.b64decode("${base64Obj}") modules=base64
+ ${escaped}= Replace String ${binObj} \\ \\\\
+ ${dict}= Evaluate json.loads('${escaped}') json
+ ${tca_policy}= Set Variable ${dict['app_preferences']['tca_policy']}
+ ${mdf_tca_policy}= Replace String Using Regexp ${tca_policy} ControlLoop-vFirewall[^"]* ${closedLoopControlName}
+ Set To Dictionary ${dict['app_preferences']} tca_policy=${mdf_tca_policy}
+ ${json}= Evaluate json.dumps(${dict}) json
+ ${resp}= Run Consul Put Request /v1/kv/dcae-tca-analytics data=${json}
+ Should Be Equal As Strings ${resp.status_code} 200
+
diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot
index 3219fa7d..938465f7 100644
--- a/robot/resources/demo_preload.robot
+++ b/robot/resources/demo_preload.robot
@@ -7,7 +7,8 @@ Resource test_templates/vnf_orchestration_test_template.robot
Resource asdc_interface.robot
Resource so_interface.robot
Resource vid/vid_interface.robot
-Resource policy_interface.robot
+Resource consul_interface.robot
+Resource policy_interface.robot
Resource aai/create_availability_zone.robot
Library ONAPLibrary.Utilities
@@ -197,6 +198,8 @@ Instantiate VNF
:FOR ${vf_module_name} IN @{vf_module_name_list}
\ Log APPC Mount Point for VNF Module Name=${vf_module_name}
\ ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name}
+ Log Update Tca ControlLoopName
+ Update Tca ControlLoopName ${model_invariant_id}
Instantiate Demo VNF
[Arguments] ${service} ${vf_module_label}=NULL
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot
index 077edd75..06d9e0f8 100644
--- a/robot/resources/policy_interface.robot
+++ b/robot/resources/policy_interface.robot
@@ -12,9 +12,9 @@ Resource ssh/files.robot
*** Variables ***
${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_HEALTHCHECK_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_DROOLS_IP_ADDR}:${GLOBAL_POLICY_HEALTHCHECK_PORT}
${POLICY_TEMPLATES} policy
-${DROOLS_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_DROOLS_SERVER_PORT}
+${DROOLS_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_DROOLS_IP_ADDR}:${GLOBAL_DROOLS_SERVER_PORT}
${POLICY_API_IP} ${GLOBAL_INJECTED_POLICY_API_IP_ADDR}
${POLICY_PAP_IP} ${GLOBAL_INJECTED_POLICY_PAP_IP_ADDR}
${POLICY_DISTRIBUTION_IP} ${GLOBAL_INJECTED_POLICY_DISTRIBUTION_IP_ADDR}
@@ -45,7 +45,7 @@ Run Drools Get Request
[Documentation] Runs Drools Get Request
[Arguments] ${data_path}
${auth}= Create List ${GLOBAL_DROOLS_USERNAME} ${GLOBAL_DROOLS_PASSWORD}
- Log Creating session ${POLICY_ENDPOINT}
+ Log Creating session ${DROOLS_ENDPOINT}
${session}= Create Session policy ${DROOLS_ENDPOINT} auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= Get Request policy ${data_path} headers=${headers}
@@ -138,8 +138,6 @@ Run Policy Get Configs Request
Log Received response from policy ${resp.text}
[Return] ${resp}
-
-
Update vVFWCL Policy Old
[Arguments] ${resource_id}
Run Keyword and Ignore Error Delete vFWCL Policy