From 7ef613de6d9cd794fd10ae43d98ffa9312418e68 Mon Sep 17 00:00:00 2001 From: krishnaa96 Date: Thu, 8 Apr 2021 14:14:48 +0530 Subject: Update AAI query to DSL query - Slice termination Issue-ID: OPTFRA-936 Signed-off-by: krishnaa96 Change-Id: I7a2bba7d23645c8bff9f503361a93fd3ac3ebc3a --- csit/scripts/osdf-properties/osdf_config.yaml | 11 +++- csit/scripts/osdf_script.sh | 4 +- csit/tests/osdf/data/termination_request.json | 14 +++++ csit/tests/osdf/optf_osdf_nxi_termination.robot | 69 +++++++++++++++++++++++++ csit/tests/osdf/optf_osdf_setup.robot | 2 +- csit/tests/osdf/optf_osdf_test.robot | 6 --- csit/tests/osdf/resources/common-keywords.robot | 1 + 7 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 csit/tests/osdf/data/termination_request.json create mode 100644 csit/tests/osdf/optf_osdf_nxi_termination.robot (limited to 'csit') diff --git a/csit/scripts/osdf-properties/osdf_config.yaml b/csit/scripts/osdf-properties/osdf_config.yaml index 95856df..3ca4cd1 100755 --- a/csit/scripts/osdf-properties/osdf_config.yaml +++ b/csit/scripts/osdf-properties/osdf_config.yaml @@ -41,12 +41,21 @@ aaf_user_roles: aaf_sms_url: http://aaf-sms.onap:10443 aaf_sms_timeout: 30 secret_domain: osdf -aaf_ca_certs: ssl_certs/aaf_root_ca.cer +aaf_ca_certs: /opt/aaf_root_ca.cer # config db api configDbUrl: http://127.0.0.1:5000/simulated/configdb configDbGetCellListUrl: 'getCellList' configDbGetNbrListUrl: 'getNbrList' +#aai api +aaiUrl: "http://127.0.0.1:5000" +aaiGetLinksUrl: "/aai/v16/network/logical-links" +aaiServiceInstanceUrl : "/aai/v20/nodes/service-instances/service-instance/" +aaiGetControllersUrl: /aai/v19/external-system/esr-thirdparty-sdnc-list +controllerQueryUrl: /aai/v19/query?format=resource +aaiGetInterDomainLinksUrl: /aai/v19/network/logical-links?link-type=inter-domain&operational-status=up +dslQueryPath: /simulated/aai/v23/dsl?format= + #key appkey: diff --git a/csit/scripts/osdf_script.sh b/csit/scripts/osdf_script.sh index fe0b743..0d86a63 100755 --- a/csit/scripts/osdf_script.sh +++ b/csit/scripts/osdf_script.sh @@ -33,6 +33,7 @@ cd ${DIR} # create directory for volume and copy configuration file # run docker containers OSDF_CONF=/tmp/osdf/properties/osdf_config.yaml +AAF_CER=/tmp/osdf/properties/aaf_root_ca.cer IMAGE_NAME=nexus3.onap.org:10003/onap/optf-osdf IMAGE_VER=latest @@ -40,6 +41,7 @@ mkdir -p /tmp/osdf/properties mkdir -p /tmp/sms/properties cp ${WORKSPACE}/scripts/osdf-properties/*.yaml /tmp/osdf/properties/. +cp ${WORKSPACE}/scripts/osdf-properties/aaf_root_ca.cer /tmp/osdf/properties/. cp ${WORKSPACE}/scripts/osdf-properties/osdf.json /tmp/sms/properties/. #change conductor/configdb simulator urls @@ -57,7 +59,7 @@ docker cp /tmp/sms/properties/osdf.json sms:/preload/config/osdf.json docker exec --user root -i sms /bin/sh -c "/sms/bin/preload -cacert /sms/certs/aaf_root_ca.cer -jsondir /preload/config -serviceport 10443 -serviceurl http://localhost" docker logs vault -docker run -d --name optf-osdf -v ${OSDF_CONF}:/opt/osdf/config/osdf_config.yaml -p "8698:8699" ${IMAGE_NAME}:${IMAGE_VER} +docker run -d --name optf-osdf -v ${AAF_CER}:/opt/aaf_root_ca.cer -v ${OSDF_CONF}:/opt/osdf/config/osdf_config.yaml -p "8698:8699" ${IMAGE_NAME}:${IMAGE_VER} sleep 20 diff --git a/csit/tests/osdf/data/termination_request.json b/csit/tests/osdf/data/termination_request.json new file mode 100644 index 0000000..b219645 --- /dev/null +++ b/csit/tests/osdf/data/termination_request.json @@ -0,0 +1,14 @@ +{ + "requestInfo": { + "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851", + "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851", + "callbackUrl": "http://0.0.0.0:9000/osdfCallback/", + "sourceId": "SO", + "timeout": 5, + "addtnlArgs": {} + }, + "type":"NSI", + "NxIId":"9629e36c-a3d9-4aed-8368-f72b8be1cd34", + "UUID":"9629e36c-a3d9-4aed-8368-f72b8be1cd34", + "invariantUUID":"9629e36c-a3d9-4aed-8368-f72b8be1cd34" +} \ No newline at end of file diff --git a/csit/tests/osdf/optf_osdf_nxi_termination.robot b/csit/tests/osdf/optf_osdf_nxi_termination.robot new file mode 100644 index 0000000..da6836e --- /dev/null +++ b/csit/tests/osdf/optf_osdf_nxi_termination.robot @@ -0,0 +1,69 @@ +*** Settings *** +Library copy +Library json +Library Collections +Library OperatingSystem +Resource ./resources/common-keywords.robot + +Suite Teardown Delete All Sessions + +*** Variables *** +&{placement_auth} = username=test password=testpwd + +*** Keywords *** + +NxiTerminationRequest + [Documentation] Sends request to NxiTermination API + [Arguments] ${data} + ${data_str}= json.dumps ${data} + ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/terminate/nxi/v1 data=${data_str} auth=${placement_auth} + ${response_json} json.loads ${resp.content} + Should Be Equal As Integers ${resp.status_code} 200 + [Return] ${response_json} + +*** Test Cases *** + +TerminationRequestGeneration + [Documentation] This test case will generate request json for different scenarios + ${data}= Get Binary File ${CURDIR}${/}data${/}termination_request.json + ${nsi_termination_request}= json.loads ${data} + Set Global Variable ${nsi_termination_request} + ${nssi_termination_request}= copy.deepcopy ${nsi_termination_request} + Set To Dictionary ${nssi_termination_request} type=NSSI + Set Global Variable ${nssi_termination_request} + ${nsi_termination_request_args}= copy.deepcopy ${nsi_termination_request} + ${request_info}= Set Variable ${nsi_termination_request_args["requestInfo"]} + ${addtnl_args}= Create Dictionary serviceProfileId=660ca85c-1a0f-4521-a559-65f23e794699 + Set To Dictionary ${request_info} addtnlArgs=${addtnl_args} + Set To Dictionary ${nsi_termination_request_args} requestInfo=${request_info} + Set Global Variable ${nsi_termination_request_args} + ${nssi_termination_request_args}= copy.deepcopy ${nssi_termination_request} + ${request_info}= Set Variable ${nssi_termination_request_args["requestInfo"]} + ${addtnl_args}= Create Dictionary serviceInstanceId=660ca85c-1a0f-4521-a559-65f23e794699 + Set To Dictionary ${request_info} addtnlArgs=${addtnl_args} + Set To Dictionary ${nssi_termination_request_args} requestInfo=${request_info} + Set Global Variable ${nssi_termination_request_args} + +NSITermination + [Documentation] It sends a NSI termination request with no additional arguments + ${response_json}= NxiTerminationRequest ${nsi_termination_request} + Should Be Equal success ${response_json['requestStatus']} + Should Be True ${response_json['terminateResponse']} + +NSSITermination + [Documentation] It sends a NSSI termination request with no additional arguments + ${response_json}= NxiTerminationRequest ${nssi_termination_request} + Should Be Equal success ${response_json['requestStatus']} + Should Be True ${response_json['terminateResponse']} + +NSITerminationWithAddtnlArgs + [Documentation] It sends a NSSI termination request with additional arguments + ${response_json}= NxiTerminationRequest ${nsi_termination_request_args} + Should Be Equal success ${response_json['requestStatus']} + Should Be True ${response_json['terminateResponse']} + +NSSITerminationWithAddtnlArgs + [Documentation] It sends a NSSI termination request with additional arguments + ${response_json}= NxiTerminationRequest ${nssi_termination_request_args} + Should Be Equal success ${response_json['requestStatus']} + Should Be True ${response_json['terminateResponse']} diff --git a/csit/tests/osdf/optf_osdf_setup.robot b/csit/tests/osdf/optf_osdf_setup.robot index fdf7f3e..ae3c271 100644 --- a/csit/tests/osdf/optf_osdf_setup.robot +++ b/csit/tests/osdf/optf_osdf_setup.robot @@ -9,4 +9,4 @@ Check OSDF_SIM Docker Container Check OSDF Docker Container [Documentation] It checks optf-osdf docker container is running - Verify Docker RC Status optf-osdf \ No newline at end of file + Verify Docker RC Status optf-osdf diff --git a/csit/tests/osdf/optf_osdf_test.robot b/csit/tests/osdf/optf_osdf_test.robot index 79a5750..292df64 100644 --- a/csit/tests/osdf/optf_osdf_test.robot +++ b/csit/tests/osdf/optf_osdf_test.robot @@ -6,7 +6,6 @@ Resource ./resources/common-keywords.robot Suite Teardown Delete All Sessions *** Variables *** -${osdf_host} ${OSDF_HOSTNAME}:${OSDF_PORT} &{placement_auth} = username=test password=testpwd &{wrong_authorization} = username=test password=test &{pci_auth}= username=pci_test password=pci_testpwd @@ -41,8 +40,3 @@ SendPCIOptimizationWithAuth ${response_json} json.loads ${resp.content} Should Be Equal As Integers ${resp.status_code} 202 Should Be Equal accepted ${response_json['requestStatus']} - - - - - diff --git a/csit/tests/osdf/resources/common-keywords.robot b/csit/tests/osdf/resources/common-keywords.robot index 74232c5..114c8a0 100644 --- a/csit/tests/osdf/resources/common-keywords.robot +++ b/csit/tests/osdf/resources/common-keywords.robot @@ -6,6 +6,7 @@ Library json Library RequestsLibrary *** Variables *** &{headers}= Content-Type=application/json Accept=application/json +${osdf_host} ${OSDF_HOSTNAME}:${OSDF_PORT} *** Keywords *** Verify Docker RC Status [Documentation] Method to verify whether docker instance is up and running -- cgit 1.2.3-korg