From 12937f7fd69e82b193e7046913064562086b632a Mon Sep 17 00:00:00 2001
From: hammad zafar <hammad.zafar@xflowresearch.com>
Date: Thu, 11 Mar 2021 14:20:20 +0500
Subject: [PATCH] updated importing of variables for VNF and NS descriptors

---
 .../NSLCMOperationKeywords.robot              | 25 ++++++++++++++-----
 .../environment/variables.txt                 |  1 +
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot b/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot
index c902a31f..cf5f5977 100644
--- a/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot
+++ b/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot
@@ -8,10 +8,10 @@ Library    OperatingSystem
 Library    MockServerLibrary
 Library    Collections
 Library    String
-Variables  descriptors/SOL006/VNFD/vnfd_SOL006.yaml
-Variables  descriptors/SOL006/NSD/nsd_SOL006.yaml
-Variables  descriptors/SOL001/VNFD/vnfd_SOL001.yaml
-Variables  descriptors/SOL001/NSD/nsd_SOL001.yaml
+#Variables  descriptors/SOL006/VNFD/vnfd_SOL006.yaml
+#Variables  descriptors/SOL006/NSD/nsd_SOL006.yaml
+#Variables  descriptors/SOL001/VNFD/vnfd_SOL001.yaml
+#Variables  descriptors/SOL001/NSD/nsd_SOL001.yaml
 
 *** Keywords ***
 Initialize System
@@ -238,6 +238,7 @@ PARSE the Descriptor File
     Run Keyword If  '${descriptorType}'=='SOL001'    Fetch Information from SOL001 descriptor file    ELSE    Fetch Information from SOL006 descriptor file
     
 Fetch Information from SOL001 descriptor file
+    Import Variables  ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
     @{VDU_labels}=    Create List
     @{VNF_labels}=    Create List
     @{VirtualLink_labels}=    Create List
@@ -265,6 +266,7 @@ Fetch Information from SOL001 descriptor file
 
 Get VNF Attributes from SOL001
     [Arguments]    ${VNF_label}
+    Import Variables  ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
     ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.descriptor_id}
     ${provider}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.provider}
     ${product_name}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.product_name}
@@ -280,6 +282,7 @@ Get VNF Attributes from SOL001
     Set Global Variable    ${Flavour_ID}    ${flavour_id}
 
 Fetch Information from SOL006 descriptor file
+    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
     ${descriptor_id}=    Get Variable Value    ${nfv.vnfd[0].id}
     ${provider}=    Get Variable Value    ${nfv.vnfd[0].provider}
     ${product_name}=    Get Variable Value    ${nfv.vnfd[0]['product-name']}
@@ -307,6 +310,7 @@ Fetch Information from SOL006 descriptor file
 
 Get VDU IDs
     [Arguments]    ${count}    
+    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
     @{VDU_labels}=    Create List
     ${Storage_labels}=    Create List
     FOR    ${i}    IN RANGE    ${count}
@@ -319,6 +323,7 @@ Get VDU IDs
             
 Get Internal CPs for each VDU
     [Arguments]    ${vdu}
+    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
     ${count}=    Get Length    ${nfv.vnfd[0].vdu[${vdu}]['int-cpd']}    
     ${internal_CPs}=    Create List
     FOR    ${i}    IN RANGE    ${count}
@@ -328,6 +333,7 @@ Get Internal CPs for each VDU
     
 Get External CP IDs
     [Arguments]    ${count}    
+    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
     @{external_CPs}=    Create List
     FOR    ${i}    IN RANGE    ${count}
         Append To List    ${external_CPs}    ${nfv.vnfd[0]['ext-cpd'][${i}]['id']} 
@@ -336,6 +342,7 @@ Get External CP IDs
 
 Get Virtual Link IDs
     [Arguments]    ${count}    
+    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
     @{VirtualLink_labels}=    Create List
     FOR    ${i}    IN RANGE    ${count}
         Append To List    ${VirtualLink_labels}    ${nfv.vnfd[0]['int-virtual-link-desc'][${i}]['id']} 
@@ -344,6 +351,7 @@ Get Virtual Link IDs
 
 Get Instantiation Levels
     [Arguments]    ${count}
+    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
     @{Instantiation_Levels}=    Create List
     FOR    ${i}    IN RANGE    ${count}
         Append To List    ${Instantiation_Levels}    ${nfv.vnfd[0].df['instantiation-level'][${i}]['id']} 
@@ -1189,14 +1197,14 @@ Get subscriptions with fields attribute selector
     Log    Get the list of active subscriptions, using fields
     Set Headers    {"Accept": "${ACCEPT_JSON}"}
     Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
-    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?fields=${fields}
+    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?fields=${fields_sub}
     ${output}=    Output    response
     Set Suite Variable    ${response}    ${output}	
 Get subscriptions with exclude_fields attribute selector
     Log    Get the list of active subscriptions, using fields
     Set Headers    {"Accept": "${ACCEPT_JSON}"}
     Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
-    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?exclude_fields=${fields}
+    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?exclude_fields=${fields_sub}
     ${output}=    Output    response
     Set Suite Variable    ${response}    ${output}     
 	
@@ -1329,6 +1337,7 @@ PARSE the NS Descriptor File
     Run Keyword If  '${descriptorType}'=='SOL001'    Fetch Information from SOL001 NS descriptor file    ELSE    Fetch Information from SOL006 NS descriptor file
 
 Fetch Information from SOL001 NS descriptor file
+    Import Variables    ${CURDIR}/descriptors/SOL001/NSD/nsd_SOL001.yaml
     @{NsVirtualLink_labels}=    Create List
     @{NsCP_labels}=    Create List
     FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
@@ -1345,6 +1354,7 @@ Fetch Information from SOL001 NS descriptor file
 
 Get NS Attributes from SOL001
     [Arguments]    ${NS_label}
+    Import Variables    ${CURDIR}/descriptors/SOL001/NSD/nsd_SOL001.yaml
     ${ns_descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${NS_label}.properties.descriptorId}
     ${designer}=    Get Variable Value    ${topology_template.node_templates.${NS_label}.properties.designer}
     ${version}=    Get Variable Value    ${topology_template.node_templates.${NS_label}.properties.version}
@@ -1358,6 +1368,7 @@ Get NS Attributes from SOL001
     Set Global Variable    ${NS_InvariantID}    ${invariantId}
 
 Fetch Information from SOL006 NS descriptor file
+    Import Variables    ${CURDIR}/descriptors/SOL006/NSD/nsd_SOL006.yaml
     ${nsd_id}=    Get Variable Value    ${nfv.nsd[0].id}
     ${VNFcount}=    Get Length    ${nfv.vnfd}
     ${SAPcount}=    Get Length    ${nfv.nsd[0].sapd}
@@ -1374,6 +1385,7 @@ Fetch Information from SOL006 NS descriptor file
     
 Get SAP IDs
     [Arguments]    ${count}
+    Import Variables    ${CURDIR}/descriptors/SOL006/NSD/nsd_SOL006.yaml
     @{SAPlabels}=    Create List
     FOR    ${i}    IN RANGE    ${count}
         Append To List    ${SAPlabels}    ${nfv.nsd[0].sapd[${i}]['id']}
@@ -1382,6 +1394,7 @@ Get SAP IDs
     
 Get NS Virtual Link IDs
     [Arguments]    ${count}
+    Import Variables    ${CURDIR}/descriptors/SOL006/NSD/nsd_SOL006.yaml
     @{NsVirtualLink_labels}=    Create List
     FOR    ${i}    IN RANGE    ${count}
         Append To List    ${NsVirtualLink_labels}    ${nfv.nsd[0]['virtual-link-desc'][${i}]['id']}
diff --git a/SOL005/NSLifecycleManagement-API/environment/variables.txt b/SOL005/NSLifecycleManagement-API/environment/variables.txt
index 71d85009..5576d162 100644
--- a/SOL005/NSLifecycleManagement-API/environment/variables.txt
+++ b/SOL005/NSLifecycleManagement-API/environment/variables.txt
@@ -40,6 +40,7 @@ ${CancelMode}    GRACEFUL
 ${NFVO_DUPLICATION}    0
 ${sub_filter}    id=41fdd38a-3d4c-465c-83e0-f80e014425f8
 ${sub_filter_invalid}    nfvid=41fdd38a-3d4c-465c-83e0-f80e014425f8
+${fields_sub}    filter
 ${fields_nsInstances}         monitoringParameter,wanConnectionInfo
 ${POS_filter_nsInstances}    id=41fdd38a-3d4c-465c-83e0-f80e014425f8
 ${NEG_filter_nsInstances}    nfvid=41fdd38a-3d4c-465c-83e0-f80e014425f8 
-- 
GitLab