aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources
diff options
context:
space:
mode:
authorKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>2020-10-07 09:23:18 +0200
committerMarcin Przybysz <marcin.przybysz@nokia.com>2020-10-12 12:27:03 +0000
commit590d66fda7ae1fb5d59555bd9af4cf212c2e7856 (patch)
treef5fab0b4f5b7df42b4c3af8755471bf07ec7cf50 /robot/resources
parent70902ea6a8086368524fef892ad52a951138e7c1 (diff)
Add CMPv2 E2E test case in robot test suite
Issue-ID: INT-1731 Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com> Change-Id: I79ac8cfc4755b134fa214d21cc71cc2b2067461b
Diffstat (limited to 'robot/resources')
-rw-r--r--robot/resources/dcae/deployment.robot36
-rw-r--r--robot/resources/dcae/inventory.robot43
-rw-r--r--robot/resources/test_templates/cmpv2.robot45
3 files changed, 124 insertions, 0 deletions
diff --git a/robot/resources/dcae/deployment.robot b/robot/resources/dcae/deployment.robot
new file mode 100644
index 00000000..30a5efce
--- /dev/null
+++ b/robot/resources/dcae/deployment.robot
@@ -0,0 +1,36 @@
+*** Settings ***
+Documentation The main interface for interacting with 5G Bulkpm.
+Library RequestsLibrary
+Library OperatingSystem
+Library String
+
+*** Variables ***
+${DEPLOYMENT_SERVER} ${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PROTOCOL}://${GLOBAL_DEPLOYMENT_HANDLER_SERVER_NAME}:${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PORT}
+${DEPLOYMENT_ENDPOINT} dcae-deployments
+
+*** Keywords ***
+Deploy Service
+ [Arguments] ${inputs} ${deployment_name} ${wait_time}=5 minute
+ Disable Warnings
+ ${headers}= Create Dictionary content-type=application/json
+ ${deployment_data}= Set Variable ${inputs}
+ ${session}= Create Session deployment_session ${DEPLOYMENT_SERVER}
+ ${resp}= Put Request deployment_session /${DEPLOYMENT_ENDPOINT}/${deployment_name} data=${deployment_data} headers=${headers}
+ ${operationLink} Set Variable ${resp.json().get('links').get('status')}
+ ${operationId} Fetch From Right ${operationLink} /
+ Wait Until Keyword Succeeds ${wait_time} 20 sec Deployment Status ${deployment_name} ${operationId}
+
+Deployment Status
+ [Arguments] ${deployment_name} ${operationId}
+ Disable Warnings
+ ${session}= Create Session deployment_session ${DEPLOYMENT_SERVER}
+ ${resp}= Get Request deployment_session /${DEPLOYMENT_ENDPOINT}/${deployment_name}/operation/${operationId}
+ ${status} Set Variable ${resp.json().get('status')}
+ Should Be Equal As Strings ${status} succeeded
+
+Undeploy Service
+ [Arguments] ${deployment_name}
+ Disable Warnings
+ ${session}= Create Session deployment_session ${DEPLOYMENT_SERVER}
+ ${resp}= Delete Request deployment_session /${DEPLOYMENT_ENDPOINT}/${deployment_name}
+ [Return] ${resp}
diff --git a/robot/resources/dcae/inventory.robot b/robot/resources/dcae/inventory.robot
new file mode 100644
index 00000000..647c3780
--- /dev/null
+++ b/robot/resources/dcae/inventory.robot
@@ -0,0 +1,43 @@
+*** Settings ***
+Documentation The main interface for interacting with 5G Bulkpm.
+Library RequestsLibrary
+Library OperatingSystem
+Library String
+Library ONAPLibrary.Templating WITH NAME Templating
+Resource ../global_properties.robot
+
+
+*** Variables ***
+${INVENTORY_SERVER} ${GLOBAL_INVENTORY_SERVER_PROTOCOL}://${GLOBAL_INVENTORY_SERVER_NAME}:${GLOBAL_INVENTORY_SERVER_PORT}
+${INVENTORY_ENDPOINT} /dcae-service-types
+${BLUEPRINT_TEMPLATE} ${EXECDIR}/robot/assets/cmpv2/blueprintTemplate.json
+*** Keywords ***
+
+Load Blueprint To Inventory
+ [Arguments] ${blueprint_path} ${typeName}
+ Disable Warnings
+ ${blueprint}= OperatingSystem.Get File ${blueprint_path}
+ ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE}
+ ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint}
+ ${templatejson}= Update Value To Json ${templatejson} typeName ${typeName}
+ ${data} Convert JSON To String ${templatejson}
+ ${headers}= Create Dictionary content-type=application/json
+ ${session}= Create Session inventory_session ${INVENTORY_SERVER}
+ ${resp}= Post Request inventory_session ${INVENTORY_ENDPOINT} data=${data} headers=${headers}
+ ${serviceTypeId}= Set Variable ${resp.json().get('typeId')}
+ [Return] ${serviceTypeId}
+
+Delete Blueprint From Inventory
+ [Arguments] ${serviceTypeId}
+ Disable Warnings
+ ${session}= Create Session inventory_session ${INVENTORY_SERVER}
+ ${resp}= Delete Request inventory_session ${INVENTORY_ENDPOINT}/${serviceTypeId}
+ [Return] ${resp}
+
+Get Blueprint From Inventory
+ [Arguments] ${typeName}
+ Disable Warnings
+ ${headers}= Create Dictionary content-type=application/json
+ ${session}= Create Session inventory_session ${INVENTORY_SERVER}
+ ${resp}= Get Request inventory_session ${INVENTORY_ENDPOINT}?typeName=${typeName} headers=${headers}
+ [Return] ${resp} \ No newline at end of file
diff --git a/robot/resources/test_templates/cmpv2.robot b/robot/resources/test_templates/cmpv2.robot
new file mode 100644
index 00000000..685306f5
--- /dev/null
+++ b/robot/resources/test_templates/cmpv2.robot
@@ -0,0 +1,45 @@
+*** Settings ***
+Documentation CMPv2 test cases
+Library OperatingSystem
+Library RequestsLibrary
+Library Collections
+Library ONAPLibrary.JSON
+Library ONAPLibrary.Utilities
+Library ONAPLibrary.Templating WITH NAME Templating
+Resource pnf_registration_without_SO_template.robot
+Resource ../dcae/deployment.robot
+Resource ../dcae/inventory.robot
+Resource ../global_properties.robot
+
+
+*** Variables ***
+${pnf_simulator_single_event}= ves/pnf_simulator_single_event.jinja
+${VES_ENDPOINT} ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT}
+${VES_data_path} eventListener/v7
+${single_event_data_path} /simulator/event
+${users} ${EXECDIR}/robot/assets/cmpv2/mongo-users.json
+
+
+*** Keywords ***
+Pnf simulator send single VES event
+ [Arguments] ${event} ${ves_host} ${ves_port} ${pnf_sim_host} ${pnf_sim_port}
+ ${pnf_sim_endpoint}= Set Variable http://${pnf_sim_host}:${pnf_sim_port}
+ ${ves_url}= Set Variable ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${ves_host}:${ves_port}/${VES_data_path}
+ ${single_event}= Create Dictionary event=${event} ves_url=${ves_url}
+ Templating.Create Environment pnf ${GLOBAL_TEMPLATE_FOLDER}
+ ${data}= Templating.Apply Template pnf ${pnf_simulator_single_event} ${single_event}
+ ${pnf_sim_endpoint}= Set Variable http://${pnf_sim_host}:${pnf_sim_port}
+ ${session}= Create Session pnf_sim ${pnf_sim_endpoint}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${post_resp}= Post Request pnf_sim ${single_event_data_path} data=${data} headers=${headers}
+ Log PNF registration request ${data}
+ Should Be Equal As Strings ${post_resp.status_code} 202
+ Log VES has accepted event with status code ${post_resp.status_code}
+
+
+Usecase Teardown
+ Undeploy Service mongo-dep
+ Undeploy Service pnf-simulator-dep
+ Undeploy Service ves-collector-cmpv2-dep
+ Delete Blueprint From Inventory ${serviceTypeIdMongo}
+ Delete Blueprint From Inventory ${serviceTypeIdPnfSimulator} \ No newline at end of file