.. code:: bash
+ $ cp -r /tmp/o2/tacker/tacker/tests/xtesting/api-tests/SOL002/cnflcm ./api-tests/SOL002
$ cp -r /tmp/o2/tacker/tacker/tests/xtesting/api-tests/SOL003/CNFDeployment ./api-tests/SOL003
$ cp -r /tmp/o2/tacker/tacker/tests/xtesting/api-tests/SOL003/cnflcm ./api-tests/SOL003
$ cp -r /tmp/o2/tacker/tacker/tests/xtesting/api-tests/SOL005/CNFPrecondition ./api-tests/SOL005
.. code:: bash
$ cp ./api-tests/SOL003/VNFLifecycleManagement-API/jsons/healVnfRequest.json ./jsons
+ $ cp ./api-tests/SOL003/VNFLifecycleManagement-API/jsons/healVnfRequest.json ./jsons/healVnfcRequest.json
$ mkdir schemas
$ cp ./api-tests/SOL003/VNFLifecycleManagement-API/schemas/vnfInstance.schema.json ./schemas
.. code:: bash
$ cd ~/tacker/tacker/tests/xtesting/api-tests/SOL005/CNFPrecondition
- $ ./packageTest.sh ../../SOL003/VNFLifecycleManagement-API/environment/configuration.txt
+ $ ./packageTest.sh
5. Get 'vnfdId' and change it in the file 'createVnfRequest.json' as below.
| cnf-deployments-validation | smo | 00:01 | PASS |
+-------------------------------+-----------------+------------------+----------------+
- 3. For Re-testing, user must delete all the VNF instances and packages created in the above test. An example of steps is below.
+ 3. Revert all the changes in json files for Re-testing.
+
+ .. code:: bash
+
+ $ cp ./api-tests/SOL003/VNFLifecycleManagement-API/jsons/healVnfRequest.json ./jsons/healVnfRequest.json
+
+ 4. For Re-testing, user must delete all the VNF instances and packages created in the above test. An example of steps is below.
.. code:: bash
--- /dev/null
+*** Settings ***
+Resource ../VNFLifecycleManagement-API/environment/variables.txt
+Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} ssl_verify=false
+Library JSONLibrary
+Library OperatingSystem
+Library Process
+Library Collections
+Library String
+
+*** Test Cases ***
+GET VNFC Instance Id
+ [Documentation] Test ID: 6.3.4.9.3
+ ... Test title: GET VNFC Instance Id
+ ... Test objective: The objective is to Get the VNF Instance Id
+ ... Pre-conditions: none
+ ... Applicability: none
+ ... Post-Conditions: none
+ Get VNFC Instance Id
+
+*** Keywords ***
+Get VNFC Instance Id
+ log Trying to perform a GET. This keyword is defined for fetching the Vnfc Instance ID.
+ Set Headers {"Accept":"${ACCEPT}"}
+ Set Headers {"Content-Type": "${CONTENT_TYPE}"}
+ Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+ Get ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}
+ ${outputResponse}= Output response
+ ${body} = Get From Dictionary ${outputResponse} body
+ ${instantiatedVnfInfo} = Get From Dictionary ${body} instantiatedVnfInfo
+ ${vnfcResourceInfo} = Get From Dictionary ${instantiatedVnfInfo} vnfcResourceInfo
+ ${dict} = Get From List ${vnfcResourceInfo} 0
+ ${vnfc_id} = Get From Dictionary ${dict} id
+ ${json_file_path} = Set Variable jsons/healVnfRequest.json
+ Run Keyword And Ignore Error Run jq '.cause = "healing" | .vnfcInstanceId = ["${vnfc_id}"]' "${json_file_path}" > "${json_file_path}.tmp"
+ Run Process mv ${json_file_path}.tmp ${json_file_path} shell=yes
#!/bin/sh
-variableFile=$1 # file path of configuration.txt in which environmental variables should be updated
-if [ ! $1 ]; then
- echo "Input parameter is missing"
- exit 1
-fi
+sol002VariableFile=../../SOL002/VNFLifecycleManagement-API/environment/variables.txt
+sol003VariableFile=../../SOL003/VNFLifecycleManagement-API/environment/configuration.txt
#curl command for token generation
curl -X POST -H 'Content-Type:application/json' --data '{"auth": {"scope":
exit 1
fi
-#update environmental variables in configuration.txt
-sed -i '/${vnfPkgId}/d' $variableFile
-sed -i '/${AUTHORIZATION_HEADER}/d' $variableFile
-sed -i '/${AUTHORIZATION_TOKEN}/d' $variableFile
-sed -i '/${VNFM_PORT}/d' $variableFile
-sed -i '/${VNFM_SCHEMA}/d' $variableFile
-
-echo "" >> $variableFile
-echo "\${vnfPkgId} $Packageid" >> $variableFile
-echo "\${AUTHORIZATION_HEADER} X-Auth-Token" >> $variableFile
-echo "\${AUTHORIZATION_TOKEN} $token" >> $variableFile
-echo "\${VNFM_PORT} 9890" >> $variableFile
-echo "\${VNFM_SCHEMA} http" >> $variableFile
+#update environmental variables in variables.txt
+vnfdid=$(curl -g -X GET http://localhost:9890/vnfpkgm/v1/vnf_packages/$Packageid \
+ -H "Accept: application/json" -H "User-Agent: python-tackerclient" \
+ -H "X-Auth-Token: $token" | jq -r .vnfdId)
+
+sed -i '/${AUTHORIZATION_HEADER}/d' $sol002VariableFile
+sed -i '/${AUTHORIZATION_TOKEN}/d' $sol002VariableFile
+sed -i '/${VNFM_PORT}/d' $sol002VariableFile
+sed -i '/${VNFM_SCHEMA}/d' $sol002VariableFile
+
+echo "" >> $sol002VariableFile
+echo "\${AUTHORIZATION_HEADER} X-Auth-Token" >> $sol002VariableFile
+echo "\${AUTHORIZATION_TOKEN} $token" >> $sol002VariableFile
+echo "\${VNFM_PORT} 9890" >> $sol002VariableFile
+echo "\${VNFM_SCHEMA} http" >> $sol002VariableFile
+
+sed -i '/${vnfPkgId}/d' $sol003VariableFile
+sed -i '/${vnfdId}/d' $sol003VariableFile
+sed -i '/${AUTHORIZATION_HEADER}/d' $sol003VariableFile
+sed -i '/${AUTHORIZATION_TOKEN}/d' $sol003VariableFile
+sed -i '/${VNFM_PORT}/d' $sol003VariableFile
+sed -i '/${VNFM_SCHEMA}/d' $sol003VariableFile
+
+echo "" >> $sol003VariableFile
+echo "\${vnfPkgId} $Packageid" >> $sol003VariableFile
+echo "\${vnfdId} $vnfdid" >> $sol003VariableFile
+echo "\${AUTHORIZATION_HEADER} X-Auth-Token" >> $sol003VariableFile
+echo "\${AUTHORIZATION_TOKEN} $token" >> $sol003VariableFile
+echo "\${VNFM_PORT} 9890" >> $sol003VariableFile
+echo "\${VNFM_SCHEMA} http" >> $sol003VariableFile
#comment out test cases in api-tests
# TODO: Although the bug in the test case "Check Individual VNF LCM operation occurrence operationState is"
Command="sed -i '$((lineNo))i $insertSteps' $robotFile"
eval "$Command"
+#comment out test cases in api-tests which are unnecessary for conformance test
+robotFile=../../SOL003/VNFLifecycleManagement-API/VNFInstances.robot
+lineNo=`cat -n $robotFile | sed -n '/POST Create a new vnfInstance/,$p' | grep -E '^([0-9]|[[:space:]])+$' | head -1`
+insertSteps="*** comment ***"
+Command="sed -i '$((lineNo))a $insertSteps' $robotFile"
+eval "$Command"
+
+robotFile=../../SOL002/VNFLifecycleManagement-API/HealVNFTask.robot
+lineNo=`cat -n $robotFile | sed -n '/POST Heal a vnfInstance/,$p' | grep -E '^([0-9]|[[:space:]])+$' | head -1`
+insertSteps="*** comment ***"
+Command="sed -i '$((lineNo))a $insertSteps' $robotFile"
+eval "$Command"
+
+#modify api-tests code so that vnfInstanceId is treated as global variable
+# TODO: After the modification is officially done in api-tests by ETSI NFV TST, we need to remove below step.
+robotFile=../../SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot
+lineNo=`cat -n $robotFile | sed -n '/POST Create a new vnfInstance/,$p' | grep -E '^([0-9]|[[:space:]])+$' | head -1`
+insertSteps="\ \${res_body}= Get From Dictionary \${outputResponse} body\n \${res_id}= Get From Dictionary \${res_body} id\n Set Global Variable \${vnfInstanceId} \${res_id}"
+Command="sed -i '$((lineNo))i $insertSteps' $robotFile"
+eval "$Command"
+
exit 0