aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/aaf/certservice/cert-service-test.robot5
-rw-r--r--tests/aaf/certservice/libraries/CertClientManager.py47
-rw-r--r--tests/aaf/certservice/libraries/EnvsReader.py11
-rw-r--r--tests/aaf/certservice/libraries/JksFilesValidator.py70
-rw-r--r--tests/aaf/certservice/resources/cert-service-keywords.robot16
-rw-r--r--tests/aaf/certservice/resources/cert-service-properties.robot1
-rwxr-xr-xtests/usecases/pnf-sw-upgrade/.gitignore22
-rw-r--r--tests/usecases/pnf-sw-upgrade/__init__.robot2
-rw-r--r--tests/usecases/pnf-sw-upgrade/data/blueprint_archive.zipbin0 -> 18151 bytes
-rw-r--r--tests/usecases/pnf-sw-upgrade/data/distributeServiceTemplate.json35
-rwxr-xr-xtests/usecases/pnf-sw-upgrade/data/mount.json18
-rw-r--r--tests/usecases/pnf-sw-upgrade/data/serviceInstantiationActivationRequest.json43
-rw-r--r--tests/usecases/pnf-sw-upgrade/data/serviceInstantiationDownloadRequest.json43
-rw-r--r--tests/usecases/pnf-sw-upgrade/pnf-sw-upgrade.robot202
14 files changed, 475 insertions, 40 deletions
diff --git a/tests/aaf/certservice/cert-service-test.robot b/tests/aaf/certservice/cert-service-test.robot
index f9fc0910..90ee1a37 100644
--- a/tests/aaf/certservice/cert-service-test.robot
+++ b/tests/aaf/certservice/cert-service-test.robot
@@ -53,6 +53,11 @@ Cert Service Client successfully creates keystore and truststore
[Documentation] Run with correct env and expected exit code 0
Run Cert Service Client And Validate JKS File Creation And Client Exit Code ${VALID_ENV_FILE} 0
+Cert Service Client successfully creates keystore and truststore with expected data
+ [Tags] AAF-CERT-SERVICE
+ [Documentation] Run with correct env and JKS files created with correct data
+ Run Cert Service Client And Validate JKS Files Contain Expected Data ${VALID_ENV_FILE} 0
+
Run Cert Service Client Container And Validate Exit Code And API Response
[Tags] AAF-CERT-SERVICE
[Documentation] Run with invalid CaName env and expected exit code 5
diff --git a/tests/aaf/certservice/libraries/CertClientManager.py b/tests/aaf/certservice/libraries/CertClientManager.py
index 792b6939..a959c9ee 100644
--- a/tests/aaf/certservice/libraries/CertClientManager.py
+++ b/tests/aaf/certservice/libraries/CertClientManager.py
@@ -2,22 +2,23 @@ import docker
import os
import shutil
import re
-from OpenSSL import crypto
+from EnvsReader import EnvsReader
from docker.types import Mount
ARCHIVES_PATH = os.getenv("WORKSPACE") + "/archives/"
-MOUNT_PATH = os.getenv("WORKSPACE") + "/tests/aaf/certservice/tmp"
ERROR_API_REGEX = 'Error on API response.*[0-9]{3}'
RESPONSE_CODE_REGEX = '[0-9]{3}'
-
class CertClientManager:
+ def __init__(self, mount_path):
+ self.mount_path = mount_path
+
def run_client_container(self, client_image, container_name, path_to_env, request_url, network):
self.create_mount_dir()
client = docker.from_env()
- environment = self.read_list_env_from_file(path_to_env)
+ environment = EnvsReader().read_env_list_from_file(path_to_env)
environment.append("REQUEST_URL=" + request_url)
container = client.containers.run(
image=client_image,
@@ -25,55 +26,27 @@ class CertClientManager:
environment=environment,
network=network,
user='root', #Run container as root to avoid permission issues with volume mount access
- mounts=[Mount(target='/var/certs', source=MOUNT_PATH, type='bind')],
+ mounts=[Mount(target='/var/certs', source=self.mount_path, type='bind')],
detach=True
)
exitcode = container.wait()
return exitcode
- def read_list_env_from_file(self, path):
- f = open(path, "r")
- r_list = []
- for line in f:
- line = line.strip()
- if line[0] != "#":
- r_list.append(line)
- return r_list
-
def remove_client_container_and_save_logs(self, container_name, log_file_name):
client = docker.from_env()
container = client.containers.get(container_name)
- text_file = open(ARCHIVES_PATH + "container_" + log_file_name + ".log", "w")
+ text_file = open(ARCHIVES_PATH + "client_container_" + log_file_name + ".log", "w")
text_file.write(container.logs())
text_file.close()
container.remove()
self.remove_mount_dir()
- def can_open_keystore_and_truststore_with_pass(self):
- keystore_pass_path = MOUNT_PATH + '/keystore.pass'
- keystore_jks_path = MOUNT_PATH + '/keystore.jks'
- can_open_keystore = self.can_open_jks_file_by_pass_file(keystore_pass_path, keystore_jks_path)
-
- truststore_pass_path = MOUNT_PATH + '/truststore.pass'
- truststore_jks_path = MOUNT_PATH + '/truststore.jks'
- can_open_truststore = self.can_open_jks_file_by_pass_file(truststore_pass_path, truststore_jks_path)
-
- return can_open_keystore & can_open_truststore
-
- def can_open_jks_file_by_pass_file(self, pass_file_path, jks_file_path):
- try:
- password = open(pass_file_path, 'rb').read()
- crypto.load_pkcs12(open(jks_file_path, 'rb').read(), password)
- return True
- except:
- return False
-
def create_mount_dir(self):
- if not os.path.exists(MOUNT_PATH):
- os.makedirs(MOUNT_PATH)
+ if not os.path.exists(self.mount_path):
+ os.makedirs(self.mount_path)
def remove_mount_dir(self):
- shutil.rmtree(MOUNT_PATH)
+ shutil.rmtree(self.mount_path)
def can_find_api_response_in_logs(self, container_name):
logs = self.get_container_logs(container_name)
diff --git a/tests/aaf/certservice/libraries/EnvsReader.py b/tests/aaf/certservice/libraries/EnvsReader.py
new file mode 100644
index 00000000..cc60eed6
--- /dev/null
+++ b/tests/aaf/certservice/libraries/EnvsReader.py
@@ -0,0 +1,11 @@
+
+class EnvsReader:
+
+ def read_env_list_from_file(self, path):
+ f = open(path, "r")
+ r_list = []
+ for line in f:
+ line = line.strip()
+ if line[0] != "#":
+ r_list.append(line)
+ return r_list
diff --git a/tests/aaf/certservice/libraries/JksFilesValidator.py b/tests/aaf/certservice/libraries/JksFilesValidator.py
new file mode 100644
index 00000000..8c150de4
--- /dev/null
+++ b/tests/aaf/certservice/libraries/JksFilesValidator.py
@@ -0,0 +1,70 @@
+from OpenSSL import crypto
+from cryptography.x509.oid import ExtensionOID
+from cryptography import x509
+from EnvsReader import EnvsReader
+
+class JksFilesValidator:
+
+ def __init__(self, mount_path):
+ self.keystorePassPath = mount_path + '/keystore.pass'
+ self.keystoreJksPath = mount_path + '/keystore.jks'
+ self.truststorePassPath = mount_path + '/truststore.pass'
+ self.truststoreJksPath = mount_path + '/truststore.jks'
+
+ def get_and_compare_data(self, path_to_env):
+ data = self.get_data(path_to_env)
+ return data, self.contains_expected_data(data)
+
+ def can_open_keystore_and_truststore_with_pass(self):
+ can_open_keystore = self.can_open_jks_file_with_pass_file(self.keystorePassPath, self.keystoreJksPath)
+ can_open_truststore = self.can_open_jks_file_with_pass_file(self.truststorePassPath, self.truststoreJksPath)
+
+ return can_open_keystore & can_open_truststore
+
+ def can_open_jks_file_with_pass_file(self, pass_file_path, jks_file_path):
+ try:
+ self.get_certificate(pass_file_path, jks_file_path)
+ return True
+ except:
+ return False
+
+ def get_data(self, path_to_env):
+ envs = self.get_envs_as_dict(EnvsReader().read_env_list_from_file(path_to_env))
+ certificate = self.get_certificate(self.keystorePassPath, self.keystoreJksPath)
+ data = self.get_owner_data_from_certificate(certificate)
+ data['SANS'] = self.get_sans(certificate)
+ return type('', (object,), {"expectedData": envs, "actualData": data})
+
+ def contains_expected_data(self, data):
+ expectedData = data.expectedData
+ actualData = data.actualData
+ return cmp(expectedData, actualData) == 0
+
+ def get_owner_data_from_certificate(self, certificate):
+ list = certificate.get_subject().get_components()
+ return dict((k, v) for k, v in list)
+
+ def get_certificate(self, pass_file_path, jks_file_path):
+ password = open(pass_file_path, 'rb').read()
+ crypto.load_pkcs12(open(jks_file_path, 'rb').read(), password)
+ return crypto.load_pkcs12(open(jks_file_path, 'rb').read(), password).get_certificate()
+
+ def get_sans(self, cert):
+ extension = cert.to_cryptography().extensions.get_extension_for_oid(ExtensionOID.SUBJECT_ALTERNATIVE_NAME)
+ dnsList = extension.value.get_values_for_type(x509.DNSName)
+ return ':'.join(map(lambda dns: dns.encode('ascii','ignore'), dnsList))
+
+ def get_envs_as_dict(self, list):
+ envs = self.get_list_of_pairs_by_mappings(list)
+ return self.remove_nones_from_dict(envs)
+
+ def remove_nones_from_dict(self, dictionary):
+ return dict((k, v) for k, v in dictionary.iteritems() if k is not None)
+
+ def get_list_of_pairs_by_mappings(self, list):
+ mappings = self.get_mappings()
+ listOfEnvs = map(lambda k: k.split('='), list)
+ return dict((mappings.get(a[0]), a[1]) for a in listOfEnvs)
+
+ def get_mappings(self):
+ return {'COMMON_NAME':'CN', 'ORGANIZATION':'O', 'ORGANIZATION_UNIT':'OU', 'LOCATION':'L', 'STATE':'ST', 'COUNTRY':'C', 'SANS':'SANS'}
diff --git a/tests/aaf/certservice/resources/cert-service-keywords.robot b/tests/aaf/certservice/resources/cert-service-keywords.robot
index 75cebadc..a128178c 100644
--- a/tests/aaf/certservice/resources/cert-service-keywords.robot
+++ b/tests/aaf/certservice/resources/cert-service-keywords.robot
@@ -1,11 +1,12 @@
*** Settings ***
+Resource ../../../common.robot
+Resource ./cert-service-properties.robot
Library RequestsLibrary
Library HttpLibrary.HTTP
Library Collections
-Library ../libraries/CertClientManager.py
-Resource ../../../common.robot
-Resource ./cert-service-properties.robot
+Library ../libraries/CertClientManager.py ${MOUNT_PATH}
+Library ../libraries/JksFilesValidator.py ${MOUNT_PATH}
*** Keywords ***
@@ -92,6 +93,15 @@ Run Cert Service Client And Validate JKS File Creation And Client Exit Code
Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return: ${exitcode} exit code, but expected: ${expected_exit_code}
Should Be True ${can_open} Cannot Open Keystore/TrustStore by passpshase
+Run Cert Service Client And Validate JKS Files Contain Expected Data
+ [Documentation] Run Cert Service Client Container And Validate JKS Files Contain Expected Data
+ [Arguments] ${env_file} ${expected_exit_code}
+ ${exit_code}= Run Client Container ${DOCKER_CLIENT_IMAGE} ${CLIENT_CONTAINER_NAME} ${env_file} ${CERT_SERVICE_ADDRESS}${CERT_SERVICE_ENDPOINT} ${CERT_SERVICE_NETWORK}
+ ${data} ${isEqual}= Get And Compare Data ${env_file}
+ Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} positive_path_with_data
+ Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return: ${exitcode} exit code, but expected: ${expected_exit_code}
+ Should Be True ${isEqual} Keystore doesn't contain ${data.expectedData}. Actual data is: ${data.actualData}
+
Run Cert Service Client And Validate Http Response Code And Client Exit Code
[Documentation] Run Cert Service Client Container And Validate Exit Code
[Arguments] ${env_file} ${expected_api_response_code} ${expected_exit_code}
diff --git a/tests/aaf/certservice/resources/cert-service-properties.robot b/tests/aaf/certservice/resources/cert-service-properties.robot
index 5fd2d8af..0dd8b066 100644
--- a/tests/aaf/certservice/resources/cert-service-properties.robot
+++ b/tests/aaf/certservice/resources/cert-service-properties.robot
@@ -19,3 +19,4 @@ ${INVALID_ENV_FILE} %{WORKSPACE}/tests/aaf/certservice/asse
${DOCKER_CLIENT_IMAGE} nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-client:latest
${CLIENT_CONTAINER_NAME} %{ClientContainerName}
${CERT_SERVICE_NETWORK} certservice_certservice
+${MOUNT_PATH} %{WORKSPACE}/tests/aaf/certservice/tmp
diff --git a/tests/usecases/pnf-sw-upgrade/.gitignore b/tests/usecases/pnf-sw-upgrade/.gitignore
new file mode 100755
index 00000000..44793d73
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/.gitignore
@@ -0,0 +1,22 @@
+target
+**/.settings
+**/.classpath
+**/.project
+**/.buildpath
+**/.factorypath
+**/.springBeans
+.idea
+.checkstyle
+.DS_Store
+.*~
+*.iml
+*.class
+*.swp
+*.log
+*.tmp
+**/bin/
+/.metadata/
+temp/
+**/temp/**
+test_lab/
+**/test_lab/**
diff --git a/tests/usecases/pnf-sw-upgrade/__init__.robot b/tests/usecases/pnf-sw-upgrade/__init__.robot
new file mode 100644
index 00000000..a721a88f
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/__init__.robot
@@ -0,0 +1,2 @@
+1 *** Settings ***
+2 Documentation PNF - pnf-sw-upgrade
diff --git a/tests/usecases/pnf-sw-upgrade/data/blueprint_archive.zip b/tests/usecases/pnf-sw-upgrade/data/blueprint_archive.zip
new file mode 100644
index 00000000..4edc9ded
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/data/blueprint_archive.zip
Binary files differ
diff --git a/tests/usecases/pnf-sw-upgrade/data/distributeServiceTemplate.json b/tests/usecases/pnf-sw-upgrade/data/distributeServiceTemplate.json
new file mode 100644
index 00000000..c13eb8d5
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/data/distributeServiceTemplate.json
@@ -0,0 +1,35 @@
+{
+ "distributionID": "05fd08d8-c452-429a-a1ad-806c8d05e7c8",
+ "serviceName": "Demo_svc",
+ "serviceVersion": "1.0",
+ "serviceUUID": "cd4decf6-4f27-4775-9561-0e683ed43635",
+ "serviceDescription": "aaaa",
+ "serviceInvariantUUID": "fe41489e-1563-46a3-b90a-1db629e4375b",
+ "resources": [
+ {
+ "resourceInstanceName": "Demo_pnf 0",
+ "resourceCustomizationUUID": "36b46817-2eaf-41b3-bfa3-11a7e0fd9bb2",
+ "resourceName": "Demo_pnf",
+ "resourceVersion": "1.0",
+ "resoucreType": "PNF",
+ "resourceUUID": "a42f6566-6a29-43e1-bac9-b91a59d702ac",
+ "resourceInvariantUUID": "fdf44827-35db-4ee5-bd70-7500e633576e",
+ "category": "Network L4+",
+ "subcategory": "Common Network Resources",
+ "artifacts": []
+ }
+ ],
+ "serviceArtifacts": [
+ {
+ "artifactName": "service-DemoSvc-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "//unzipped_sdc_csar/v1/catalog/services/DemoSvc/1.0/artifacts/service-DemoSvc-csar.csar",
+ "artifactChecksum": "Njk4NDM4YTdjYmM4NWFkN2M1YWZiM2IzYzdmNWZjZTU\u003d",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactVersion": "1",
+ "artifactUUID": "e2640671-a5ed-40a6-b231-8f33084b1c1a"
+ }
+ ],
+ "workloadContext": "Production"
+ } \ No newline at end of file
diff --git a/tests/usecases/pnf-sw-upgrade/data/mount.json b/tests/usecases/pnf-sw-upgrade/data/mount.json
new file mode 100755
index 00000000..58925b1a
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/data/mount.json
@@ -0,0 +1,18 @@
+{
+ "node": [
+ {
+ "node-id": "PNFDemo",
+ "netconf-node-topology:protocol": {
+ "name": "TLS"
+ },
+ "netconf-node-topology:host": "pnfaddr",
+ "netconf-node-topology:key-based": {
+ "username": "netconf",
+ "key-id": "ODL_private_key_0"
+ },
+ "netconf-node-topology:port": 6513,
+ "netconf-node-topology:tcp-only": false,
+ "netconf-node-topology:max-connection-attempts": 5
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/usecases/pnf-sw-upgrade/data/serviceInstantiationActivationRequest.json b/tests/usecases/pnf-sw-upgrade/data/serviceInstantiationActivationRequest.json
new file mode 100644
index 00000000..a25ebfda
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/data/serviceInstantiationActivationRequest.json
@@ -0,0 +1,43 @@
+{
+ "requestDetails":{
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false,
+ "requestorId":"demo"
+ },
+ "modelInfo":{
+ "modelType":"service",
+ "modelInvariantUuid":"fe41489e-1563-46a3-b90a-1db629e4375b",
+ "modelInvariantId" : "fe41489e-1563-46a3-b90a-1db629e4375b",
+ "modelUuid":"cd4decf6-4f27-4775-9561-0e683ed43635",
+ "modelVersionId" : "cd4decf6-4f27-4775-9561-0e683ed43635",
+ "modelName":"Demo_svc",
+ "modelVersion":"1.0"
+ },
+ "requestParameters":{
+ "userParams":[
+ {
+ "name":"targetSoftwareVersion",
+ "value":"pnf_sw_version-3.0.0"
+ },
+ {
+ "name":"pnfName",
+ "value":"PNFDemo"
+ }
+ ],
+ "subscriptionServiceType":"vCPE",
+ "aLaCarte":false
+
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "DemoCustomer"
+ },
+ "project": {
+ "projectName": "pnfSWUProject"
+ },
+ "owningEntity": {
+ "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a",
+ "owningEntityName": "OE-Demonstration"
+ }
+ }
+ } \ No newline at end of file
diff --git a/tests/usecases/pnf-sw-upgrade/data/serviceInstantiationDownloadRequest.json b/tests/usecases/pnf-sw-upgrade/data/serviceInstantiationDownloadRequest.json
new file mode 100644
index 00000000..0042ac26
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/data/serviceInstantiationDownloadRequest.json
@@ -0,0 +1,43 @@
+{
+ "requestDetails":{
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false,
+ "requestorId":"demo"
+ },
+ "modelInfo":{
+ "modelType":"service",
+ "modelInvariantUuid":"fe41489e-1563-46a3-b90a-1db629e4375b",
+ "modelInvariantId" : "fe41489e-1563-46a3-b90a-1db629e4375b",
+ "modelUuid":"cd4decf6-4f27-4775-9561-0e683ed43635",
+ "modelVersionId" : "cd4decf6-4f27-4775-9561-0e683ed43635",
+ "modelName":"Demo_svc",
+ "modelVersion":"1.0"
+ },
+ "requestParameters":{
+ "userParams":[
+ {
+ "name":"targetSoftwareVersion",
+ "value":"pnf_sw_version-2.0.0"
+ },
+ {
+ "name":"pnfName",
+ "value":"PNFDemo"
+ }
+ ],
+ "subscriptionServiceType":"vCPE",
+ "aLaCarte":false
+
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "DemoCustomer"
+ },
+ "project": {
+ "projectName": "pnfSWUProject"
+ },
+ "owningEntity": {
+ "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a",
+ "owningEntityName": "OE-Demonstration"
+ }
+ }
+ } \ No newline at end of file
diff --git a/tests/usecases/pnf-sw-upgrade/pnf-sw-upgrade.robot b/tests/usecases/pnf-sw-upgrade/pnf-sw-upgrade.robot
new file mode 100644
index 00000000..70408366
--- /dev/null
+++ b/tests/usecases/pnf-sw-upgrade/pnf-sw-upgrade.robot
@@ -0,0 +1,202 @@
+*** Settings ***
+Library Collections
+Library RequestsLibrary
+Library OperatingSystem
+Library json
+Library String
+
+*** Variables ***
+${SDNC_KEYSTORE_CONFIG_PATH} /restconf/config/netconf-keystore:keystore
+${SDNC_MOUNT_PATH} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo
+${PNFSIM_MOUNT_PATH} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo/yang-ext:mount/pnf-sw-upgrade:software-upgrade
+${PNFSIM_DELETE_PATH} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo
+${BP_UPLOAD_URL} /api/v1/blueprint-model/publish
+${BP_PROCESS_URL} /api/v1/execution-service/process
+${BP_ARCHIVE_PATH} ${CURDIR}/data/blueprint_archive.zip
+${SLEEP_INTERVAL_SEC}= 5
+${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 20
+
+
+*** Test Cases ***
+Test SDNC Keystore
+ [Documentation] Checking keystore after SDNC installation
+ Create Session sdnc http://${REPO_IP}:8282
+ &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json
+ ${resp}= Get Request sdnc ${SDNC_KEYSTORE_CONFIG_PATH} headers=${headers}
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${keystoreContent}= Convert To String ${resp.content}
+ Log to console *************************
+ Log to console ${resp.content}
+ Log to console *************************
+
+Test BP-PROC upload blueprint archive
+ [Documentation] Upload Blueprint archive to BP processor
+ Create Session blueprint http://${REPO_IP}:8000
+ ${bp_archive}= Get Binary File ${BP_ARCHIVE_PATH}
+ &{bp_file}= create Dictionary file ${bp_archive}
+ &{headers}= Create Dictionary Authorization=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+ ${resp}= Post Request blueprint ${BP_UPLOAD_URL} files=${bp_file} headers=${headers}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Distribute Service Template
+ Create Session sdc_controller_session http://${REPO_IP}:8085
+ ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json
+ &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/app/distribution-test-zip/unzipped/ Content-Type=application/json Accept=application/json
+ ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers}
+ Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${resp.status_code}' '200'
+ ${serviceInstanceId}= Set Variable cd4decf6-4f27-4775-9561-0e683ed43635
+ SET GLOBAL VARIABLE ${serviceInstanceId}
+ ${pnfName}= Set Variable PNFDemo
+ SET GLOBAL VARIABLE ${pnfName}
+
+Get pnf workflow
+ Create Session api_handler_session http://${REPO_IP}:8080
+ &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json
+ ${get_pnfworkflows_request}= Get Request api_handler_session /onap/so/infra/workflowSpecifications/v1/pnfWorkflows headers=${headers}
+ Run Keyword If '${get_pnfworkflows_request.status_code}' == '200' log to console \nexecuted with expected result
+ log to console ${get_pnfworkflows_request.content}
+ ${pnfworkflows_json_response}= Evaluate json.loads(r"""${get_pnfworkflows_request.content}""", strict=False) json
+ ${all_wf_members}= Set Variable ${pnfworkflows_json_response['workflowSpecificationList']}
+ ${activate_workflow_uuid}= Set Variable ""
+ ${activate_workflow_name}= Set Variable ""
+ ${download_workflow_uuid}= Set Variable ""
+ ${download_workflow_name}= Set Variable ""
+
+ :FOR ${member} IN @{all_wf_members}
+ \ ${workflow_uuid}= Set Variable ${member}[workflowSpecification][artifactInfo][artifactUuid]
+ \ ${workflow_name}= Set Variable ${member}[workflowSpecification][artifactInfo][artifactName]
+ \ Log to console The workflow ${workflow_name} has uuid : ${workflow_uuid}
+ \ ${activate_workflow_uuid}= Set Variable If '${workflow_name}' == 'PNFSoftwareUpgrade' ${workflow_uuid} ${activate_workflow_uuid}
+ \ ${activate_workflow_name}= Set Variable If '${workflow_name}' == 'PNFSoftwareUpgrade' ${workflow_name} ${activate_workflow_name}
+ \ ${download_workflow_uuid}= Set Variable If '${workflow_name}' == 'PNFSWUPDownload' ${workflow_uuid} ${download_workflow_uuid}
+ \ ${download_workflow_name}= Set Variable If '${workflow_name}' == 'PNFSWUPDownload' ${workflow_name} ${download_workflow_name}
+
+ SET GLOBAL VARIABLE ${activate_workflow_uuid}
+ SET GLOBAL VARIABLE ${download_workflow_uuid}
+
+ Run Keyword If '${activate_workflow_name}' == 'PNFSoftwareUpgrade' log to console \nexecuted with expected result
+ Run Keyword If '${download_workflow_name}' == 'PNFSWUPDownload' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${activate_workflow_name}' 'PNFSoftwareUpgrade'
+ Should Be Equal As Strings '${download_workflow_name}' 'PNFSWUPDownload'
+
+Invoke Service Instantiation for pnf software download
+ Create Session api_handler_session http://${REPO_IP}:8080
+ ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationDownloadRequest.json
+ &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json X-ONAP-RequestID=0ddc448d-5513-44bc-8b02-5759d84600d5 X-ONAP-PartnerName=ONAP X-RequestorID=VID
+ ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/instanceManagement/v1/serviceInstances/${serviceInstanceId}/pnfs/${pnfName}/workflows/${download_workflow_uuid} data=${data} headers=${headers}
+ Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result
+ log to console ${service_instantiation_request.content}
+ ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json
+ ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId]
+ ${actual_request_state}= Set Variable ""
+
+ : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
+ \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result
+ \ log to console ${orchestration_status_request.content}
+ \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json
+ \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState]
+ \ Log To Console Received actual repsonse status:${actual_request_state}
+ \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETED' or '${actual_request_state}' == 'FAILED' Exit For Loop
+ \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
+ \ SLEEP ${SLEEP_INTERVAL_SEC}s
+
+ Log To Console final repsonse status received: ${actual_request_state}
+ Run Keyword If '${actual_request_state}' == 'COMPLETED' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${actual_request_state}' 'COMPLETED'
+
+Test verify PNF Configuration for software download
+ [Documentation] Checking PNF configuration params
+
+ Create Session sdnc http://${REPO_IP}:8282
+ &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json
+ ${mount}= Get File ${CURDIR}${/}data${/}mount.json
+ Log to console ${mount}
+ ${pnf_mount_resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers}
+ Should Be Equal As Strings ${pnf_mount_resp.status_code} 201
+ SLEEP 10
+ ${pnfsim_software_resp}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers}
+ Should Be Equal As Strings ${pnfsim_software_resp.status_code} 200
+ Log to console ${pnfsim_software_resp.content}
+ ${pnfsim_software_resp_json}= Evaluate json.loads(r"""${pnfsim_software_resp.content}""", strict=False) json
+ ${all_upgp_members}= Set Variable ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
+
+ :FOR ${member} IN @{all_upgp_members}
+ \ ${soft_ver}= Get From Dictionary ${member} software-version
+ \ ${soft_status}= Get From Dictionary ${member} current-status
+ \ Log to console The node ${pnfName} has software version ${soft_ver} : ${soft_status}
+ \ Run Keyword If '${soft_ver}' == 'pnf_sw_version-2.0.0' Exit For Loop
+
+ Run Keyword If '${soft_ver}' == 'pnf_sw_version-2.0.0' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${soft_ver}' 'pnf_sw_version-2.0.0'
+ Should Be Equal As Strings '${soft_status}' 'DOWNLOAD_COMPLETED'
+
+Invoke Service Instantiation for pnf software activation
+ Create Session api_handler_session http://${REPO_IP}:8080
+ ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationActivationRequest.json
+ &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json X-ONAP-RequestID=4e104e12-5539-4557-b31e-00369398c214 X-ONAP-PartnerName=ONAP X-RequestorID=VID
+ ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/instanceManagement/v1/serviceInstances/${serviceInstanceId}/pnfs/${pnfName}/workflows/${activate_workflow_uuid} data=${data} headers=${headers}
+ Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result
+ log to console ${service_instantiation_request.content}
+ ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json
+ ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId]
+ ${actual_request_state}= Set Variable ""
+ : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
+ \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result
+ \ log to console ${orchestration_status_request.content}
+ \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json
+ \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState]
+ \ Log To Console Received actual repsonse status:${actual_request_state}
+ \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETED' or '${actual_request_state}' == 'FAILED' Exit For Loop
+ \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
+ \ SLEEP ${SLEEP_INTERVAL_SEC}s
+
+ Log To Console final repsonse status received: ${actual_request_state}
+ Run Keyword If '${actual_request_state}' == 'COMPLETED' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${actual_request_state}' 'COMPLETED'
+
+Test verify PNF Configuration for software activate
+ [Documentation] Checking PNF configuration params
+
+ Create Session sdnc http://${REPO_IP}:8282
+ &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json
+ ${mount}= Get File ${CURDIR}${/}data${/}mount.json
+ Log to console ${mount}
+ ${pnf_mount_resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers}
+ Should Be Equal As Strings ${pnf_mount_resp.status_code} 201
+ SLEEP 10
+ ${pnfsim_software_resp}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers}
+ Should Be Equal As Strings ${pnfsim_software_resp.status_code} 200
+ Log to console ${pnfsim_software_resp.content}
+ ${pnfsim_software_resp_json}= Evaluate json.loads(r"""${pnfsim_software_resp.content}""", strict=False) json
+ ${all_upgp_members}= Set Variable ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
+
+ :FOR ${member} IN @{all_upgp_members}
+ \ ${soft_ver}= Get From Dictionary ${member} software-version
+ \ ${soft_status}= Get From Dictionary ${member} current-status
+ \ Log to console The node ${pnfName} has software version ${soft_ver} : ${soft_status}
+ \ Run Keyword If '${soft_ver}' == 'pnf_sw_version-3.0.0' Exit For Loop
+
+ Run Keyword If '${soft_ver}' == 'pnf_sw_version-3.0.0' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${soft_ver}' 'pnf_sw_version-3.0.0'
+ Should Be Equal As Strings '${soft_status}' 'ACTIVATION_COMPLETED'
+
+Test AAI-update for target software version verify
+ Create Session aai_simulator_session https://${REPO_IP}:9993
+ &{headers}= Create Dictionary Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ== Content-Type=application/json Accept=application/json verify=False
+ : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ \ ${get_pnf_request}= Get Request aai_simulator_session aai/v11/network/pnfs/pnf/${pnfName} headers=${headers}
+ \ Run Keyword If '${get_pnf_request.status_code}' == '200' log to console \nexecuted with expected result
+ \ ${get_pnf_json_response}= Evaluate json.loads(r"""${get_pnf_request.content}""", strict=False) json
+ \ Log to console ${get_pnf_json_response}
+ \ ${sw_version}= Set Variable ${get_pnf_json_response}[sw-version]
+ \ Log to console ${sw_version}
+ \ Run Keyword If '${sw_version}' == 'pnf_sw_version-3.0.0' Exit For Loop
+ \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
+ \ SLEEP ${SLEEP_INTERVAL_SEC}s
+
+ Log To Console final target software version received: ${sw_version}
+ Run Keyword If '${sw_version}' == 'pnf_sw_version-3.0.0' log to console \nexecuted with expected result
+ Should Be Equal As Strings '${sw_version}' 'pnf_sw_version-3.0.0'