Modify Xtesting code according to NFV-TST version 38/11738/3
authorKoichi Edagawa <edagawa.kc@nec.com>
Tue, 26 Sep 2023 09:22:30 +0000 (18:22 +0900)
committerAshutosh Mishra <ashutosh.mishra1@india.nec.com>
Fri, 15 Dec 2023 04:39:26 +0000 (04:39 +0000)
This patch modifies Xtesting code to use the branch 2.6.1-fix-plu of NFV-TST.
This change is due to the issue [1] in ETSI NFV-TST.

[1] https://forge.etsi.org/rep/nfv/api-tests/-/issues/197

Issue-ID: SMO-119
Change-Id: I8e974c21c4221998dbd8bec829e351a3208c9db6
Signed-off-by: Koichi Edagawa <edagawa.kc@nec.com>
docs/developer-guide.rst
tacker/tacker/tests/xtesting/api-tests/SOL003/cnflcm/jsons/createVnfRequest.json [new file with mode: 0644]
tacker/tacker/tests/xtesting/api-tests/SOL003/cnflcm/jsons/instantiateVnfRequest.json [moved from tacker/tacker/tests/xtesting/api-tests/SOL003/cnflcm/jsons/inst.json with 100% similarity]
tacker/tacker/tests/xtesting/api-tests/SOL005/CNFPrecondition/packageTest.sh

index 43f39fe..e4dcaa3 100644 (file)
@@ -73,6 +73,9 @@ The following steps are the procedure of API conformance test according to the s
       .. code:: bash
 
          $ git clone https://forge.etsi.org/rep/nfv/api-tests.git
+         $ cd api-tests
+         $ git checkout origin/2.6.1-fix-plu
+         $ cd ..
 
    7. Copy the directories and file under '/tmp/o2/tacker/tacker/tests/xtesting/' to the location under the current directory.
 
@@ -82,7 +85,7 @@ The following steps are the procedure of API conformance test according to the s
          $ 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
          $ mkdir jsons
-         $ cp ./api-tests/SOL003/cnflcm/jsons/inst.json ./jsons/instantiateVnfRequest.json
+         $ cp ./api-tests/SOL003/cnflcm/jsons/* ./jsons
 
    8. Copy 'testcases.yaml' file from '/tmp/o2/tacker/tacker/tests/xtesting/' directory to the location under the current directory.
 
@@ -110,7 +113,6 @@ The following steps are the procedure of API conformance test according to the s
 
       .. code:: bash
 
-         $ cp ./api-tests/SOL003/VNFLifecycleManagement-API/jsons/createVnfRequest.json ./jsons
          $ cp ./api-tests/SOL003/VNFLifecycleManagement-API/jsons/healVnfRequest.json ./jsons
          $ mkdir schemas
          $ cp ./api-tests/SOL003/VNFLifecycleManagement-API/schemas/vnfInstance.schema.json ./schemas
@@ -132,10 +134,8 @@ The following steps are the procedure of API conformance test according to the s
                 Set Headers  {"Accept":"${ACCEPT}"}
                 Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
                 Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
-                Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File
-                ${template}=    Get File    jsons/createVnfRequest.json
-                ${body}=        Format String   ${template}     vnfdId=${vnfdId}    vnfProvider=${Provider}    vnfProductName=${Product_Name}    vnfSoftwareVersion=${Software_Version}    vnfdVersion= ${Descriptor_Version}
-                Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_instances    ${body}
+                ${body}=    Get File    jsons/createVnfRequest.json
+                Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances    ${body}
                 ${outputResponse}=    Output    response
                     Set Global Variable    ${response}    ${outputResponse}
                 ${res_body}=    Get From Dictionary     ${outputResponse}    body                       # Add this line
@@ -167,9 +167,9 @@ The following steps are the procedure of API conformance test according to the s
                 ...    Test title: POST Create a new vnfInstance
                 ...    Test objective: The objective is to create a new VNF instance resource
                 ...    Pre-conditions: none
-                ...    Reference: Clause 5.4.2.3.1 - ETSI GS NFV-SOL 003 [1] v2.8.1
+                ...    Reference: Clause 5.4.2.3.1 - ETSI GS NFV-SOL 003 [1] v2.6.1
                 ...    Config ID: Config_prod_VNFM
-                ...    Applicability: none
+                ...    Applicability:
                 ...    Post-Conditions: VNF instance created
                 POST Create a new vnfInstance
                 Check HTTP Response Status Code Is    201
@@ -195,6 +195,7 @@ The following steps are the procedure of API conformance test according to the s
          $ openstack project create --domain default nfv
          $ openstack user create --domain default --project nfv --password devstack nfv_user
          $ openstack role add --project nfv --user nfv_user admin
+         $ source ${devstack_dir}/openrc nfv_user nfv
 
    2. Register Kubernetes VIM and create an executable environment for Helm CLI from steps mentioned in below link.
 
@@ -212,9 +213,58 @@ The following steps are the procedure of API conformance test according to the s
       .. code:: bash
 
          $ cd ~/tacker/tacker/tests/xtesting/api-tests/SOL005/CNFPrecondition
-         $ ./packageTest.sh ../../SOL003/VNFLifecycleManagement-API/environment/variables.txt
+         $ ./packageTest.sh ../../SOL003/VNFLifecycleManagement-API/environment/configuration.txt
 
-   5. Get 'vimId' and change it in the file 'instantiateVnfRequest.json' as below.
+   5. Get 'vnfdId' and change it in the file 'createVnfRequest.json' as below.
+
+     .. code:: bash
+
+         $ openstack vnf package list -c "Id"
+
+      E.g: Output of command
+
+         .. code:: bash
+
+            +--------------------------------------+
+            | ID                                   |
+            +--------------------------------------+
+            | 0ca03e2e-1c51-4696-9baa-36f974185825 |
+            +--------------------------------------+
+
+      .. code:: bash
+
+         $ openstack vnf package show 0ca03e2e-1c51-4696-9baa-36f974185825 -c "VNFD ID"
+
+      E.g: Output of command
+
+         .. code:: bash
+
+            +--------------------------------------+
+            | ID                                   |
+            +--------------------------------------+
+            | 4688aff3-b456-4b07-bca6-089db8aec8b0 |
+            +--------------------------------------+
+
+            .. code:: bash
+
+         $ vi ~/tacker/tacker/tests/xtesting/jsons/createVnfRequest.json
+
+      E.g: Content of file
+
+         .. code:: bash
+
+            {
+              "vnfdId": "48471dd8-3ad3-4920-8ee7-607105ef5f9b", # Update value here
+              "vnfInstanceName": "",
+              "vnfInstanceDescription": "",
+              "vnfProvider":"Company",
+              "vnfProductName":"Sample CNF",
+              "vnfSoftwareVersion":"1.0",
+              "vnfdVersion":"1.0",
+              "metadata":{}
+            }
+
+   6. Get 'vimId' and change it in the file 'instantiateVnfRequest.json' as below.
 
       .. code:: bash
 
@@ -270,7 +320,7 @@ The following steps are the procedure of API conformance test according to the s
               ]
             }
 
-   6. Start kubectl proxy.
+   7. Start kubectl proxy.
 
       .. code:: bash
 
@@ -333,14 +383,30 @@ The following steps are the procedure of API conformance test according to the s
 
       .. code:: bash
 
-         $ grep -nu "vnfInstanceId" ~/tacker/tacker/tests/xtesting/api-tests/SOL003/VNFLifecycleManagement-API/environment/variables.txt | awk '{print $2}'
-         6fc3539c-e602-4afa-8e13-962fb5a7d81f
+         $ openstack vnflcm list  -c "ID"
+
+      E.g: Output of command
+
+         .. code:: bash
+
+            +--------------------------------------+
+            | ID                                   |
+            +--------------------------------------+
+            | 6fc3539c-e602-4afa-8e13-962fb5a7d81f |
+            +--------------------------------------+
 
          $ openstack vnflcm terminate 6fc3539c-e602-4afa-8e13-962fb5a7d81f
          $ openstack vnflcm delete 6fc3539c-e602-4afa-8e13-962fb5a7d81f
 
-         $ grep -nu "{vnfPkgId}" ~/tacker/tacker/tests/xtesting/api-tests/SOL003/VNFLifecycleManagement-API/environment/variables.txt | awk '{print $2}'
-         718b9054-2a7a-4489-a893-f2b2b1794825
+         $ openstack vnf package list -c "Id"
+
+         .. code:: bash
+
+            +--------------------------------------+
+            | ID                                   |
+            +--------------------------------------+
+            | 718b9054-2a7a-4489-a893-f2b2b1794825 |
+            +--------------------------------------+
 
          $ openstack vnf package update --operational-state DISABLED 718b9054-2a7a-4489-a893-f2b2b1794825
          $ openstack vnf package delete 718b9054-2a7a-4489-a893-f2b2b1794825
@@ -351,4 +417,4 @@ The following steps are the procedure of API conformance test according to the s
          If any update in the package with respect to name and namespace, then the name and namespace variables in the file
          '~/tacker/tacker/tests/xtesting/api-tests/SOL003/CNFDeployment/environment/variables.txt' need to be updated accordingly.
 
-.. _ETSI NFV-TST 010: https://www.etsi.org/deliver/etsi_gs/NFV-TST/001_099/010/02.08.01_60/gs_NFV-TST010v020801p.pdf
+.. _ETSI NFV-TST 010: https://www.etsi.org/deliver/etsi_gs/NFV-TST/001_099/010/02.06.01_60/gs_NFV-TST010v020601p.pdf
diff --git a/tacker/tacker/tests/xtesting/api-tests/SOL003/cnflcm/jsons/createVnfRequest.json b/tacker/tacker/tests/xtesting/api-tests/SOL003/cnflcm/jsons/createVnfRequest.json
new file mode 100644 (file)
index 0000000..cea4c87
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "vnfdId": "48471dd8-3ad3-4920-8ee7-607105ef5f9b",
+  "vnfInstanceName": "",
+  "vnfInstanceDescription": "",
+  "vnfProvider":"Company",
+  "vnfProductName":"Sample CNF",
+  "vnfSoftwareVersion":"1.0",
+  "vnfdVersion":"1.0",
+  "metadata":{}
+}
index 64c2d5f..f0eeb2d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-variableFile=$1    # file path of variables.txt in which environmental variables should be updated
+variableFile=$1    # file path of configuration.txt in which environmental variables should be updated
 if [ ! $1 ]; then
         echo "Input parameter is missing"
         exit 1
@@ -48,13 +48,8 @@ else
         exit 1
 fi
 
-#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)
-
+#update environmental variables in configuration.txt
 sed -i '/${vnfPkgId}/d' $variableFile
-sed -i '/${vnfdId}/d' $variableFile
 sed -i '/${AUTHORIZATION_HEADER}/d' $variableFile
 sed -i '/${AUTHORIZATION_TOKEN}/d' $variableFile
 sed -i '/${VNFM_PORT}/d' $variableFile
@@ -62,7 +57,6 @@ sed -i '/${VNFM_SCHEMA}/d' $variableFile
 
 echo "" >> $variableFile
 echo "\${vnfPkgId}     $Packageid" >> $variableFile
-echo "\${vnfdId}     $vnfdid" >> $variableFile
 echo "\${AUTHORIZATION_HEADER}    X-Auth-Token" >> $variableFile
 echo "\${AUTHORIZATION_TOKEN}     $token" >> $variableFile
 echo "\${VNFM_PORT}      9890" >> $variableFile
@@ -74,7 +68,4 @@ echo "\${VNFM_SCHEMA}    http" >> $variableFile
 sed -i 's/    Check Individual VNF LCM operation occurrence operationState is    STARTING/\#   Check Individual VNF LCM operation occurrence operationState is    STARTING\n\n\*\*\* comment \*\*\*/g' ../../SOL003/VNFLifecycleManagement-API/InstantiateVNFTask.robot
 sed -i 's/    Check Individual VNF LCM operation occurrence operationState is    STARTING/\#   Check Individual VNF LCM operation occurrence operationState is    STARTING\n\n\*\*\* comment \*\*\*/g' ../../SOL003/VNFLifecycleManagement-API/HealVNFTask.robot
 
-#change variable names and values to adapt our test
-sed -i 's/vnfdId=${Descriptor_ID}/vnfdId=${vnfdId}/g' ../../SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot
-
 exit 0