Commit ba31126d authored by zafar's avatar zafar
Browse files

SOL001 & SOL006 Descriptor parsing and checking updated for VNFPackageManagement & NS-LCM APIs

parent f96f746f
Loading
Loading
Loading
Loading
+131 −67
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ Library OperatingSystem
Library    MockServerLibrary
Library    Collections
Library    String
Variables  descriptors/SOL006/reference_tst010_vnf_b_2vdu_SOL006.yaml
Variables  descriptors/SOL001/reference_tst010_vnf_b_2vdu_SOL001.yaml


@@ -228,55 +229,139 @@ Check HTTP Response Body NsInstance content against VNF Descriptor
    Run Keyword If    ${check_descriptors} == 1    Check Individual NsInstance Content

Check Individual NsInstance Content    
    Run Keyword If  '${descriptorType}'=='SOL001'  Parse SOL001    ELSE    Parse SOL006

Parse SOL001
    Get key for VNF Descriptor
    
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_id}
    ${provider}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.provider}
    ${product_name}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.product_name}
    ${software_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.software_version}
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_version}
    ${flavour_id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.flavour_id}
    
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfdId']}    ${descriptor_id}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfProvider']}    ${provider}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfProductName']}    ${product_name}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfSoftwareVesion']}    ${software_version}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfdVersion']}    ${descriptor_version}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['flavourId']}    ${flavour_id}
    
Parse SOL006
    PARSE the Descriptor File
    Match the Response Attributes with Descriptors
    
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
    @{VDU_labels}=    Create List
    @{VNF_labels}=    Create List
    @{VirtualLink_labels}=    Create List
    @{CP_labels}=    Create List
    @{Storage_labels}=    Create List
    FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
        ${key_type}=    Get Variable Value    ${topology_template.node_templates.${key}.type}
        ${VDU_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}   ${tosca_type_VDU_compute}
        ${VNF_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_VNF}
        ${Link_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_virtual_link}
        ${VDUcp_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_VDU_cp}
        ${Storage_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_storage}
        Run Keyword If    ${VDU_check}    Append To List    ${VDU_labels}    ${key}
        Run Keyword If    ${VNF_check}    Append To List    ${VNF_labels}    ${key}
        Run Keyword If    ${VNF_check}    Get VNF Attributes from SOL001    ${key}            
        Run Keyword If    ${Link_check}    Append To List    ${VirtualLink_labels}    ${key}
        Run Keyword If    ${VDUcp_check}    Append To List    ${CP_labels}    ${key}
        Run Keyword If    ${Storage_check}    Append To List    ${Storage_labels}    ${key}
    END
    Set Global Variable    @{VDU_IDs}    @{VDU_labels}
    Set Global Variable    @{VNF_IDs}    @{VNF_labels}
    Set Global Variable    @{VirtualLink_IDs}    @{VirtualLink_labels}
    Set Global Variable    @{CP_IDs}    @{CP_labels}
    Set Global Variable    @{Storage_IDs}    @{Storage_labels}

Get VNF Attributes from SOL001
    [Arguments]    ${VNF_label}
    ${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}
    ${software_version}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.software_version}
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.descriptor_version}
    ${flavour_id}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.flavour_id}
    
    Set Global Variable    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Provider}    ${provider}
    Set Global Variable    ${Product_Name}    ${product_name}
    Set Global Variable    ${Software_Version}    ${software_version}
    Set Global Variable    ${Descriptor_Version}    ${descriptor_version}
    Set Global Variable    ${Flavour_ID}    ${flavour_id}

Fetch Information from SOL006 descriptor file
    ${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}
    ${software_version}=    Get Variable Value    ${nfv.vnfd[0].software-version}
    ${descriptor_version}=    Get Variable Value    ${nfv.vnfd[0].version}    
     ${external_cp}=    Get Variable Value    ${nfv.vnfd[0].ext-cpd[0].id}
     ${vdu_id}=    Get Variable Value    ${nfv.vnfd[0].vdu[0].id}
     ${vdu_cpid}=    Get Variable Value    ${nfv.vnfd[0].vdu[0].int-cpd[2].id} 
     ${virtual_storage}=    Get Variable Value    ${nfv.vnfd[0].virtual-storage-desc.id}
     ${virtual_link}=    Get Variable Value    ${nfv.vnfd[0].int-virtual-link-desc.id}

    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfdId']}    ${descriptor_id}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfProvider']}    ${provider}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfProductName']}    ${product_name}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfSoftwareVesion']}    ${software_version}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfdVersion']}    ${descriptor_version}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extCpInfo']['cpdId']}    ${external_cp}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['vnfcResourceInfo']['vduId']}    ${vdu_id}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extCpInfo']['cpdId']}    ${vdu_cpid}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['virtualStorageResourceInfo']['virtualStorageDescId']}    ${virtual_storage}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extManagedVirtualLinkInfo']['vnfVirtualLinkDescId']}    ${virtual_link}


Get key for VNF Descriptor
    FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
        Log    ${key}
        ${check1}=    Run Keyword And Return Status    Should End With    ${key}    VNF
        Run Keyword If     ${check1}     Set Global Variable    ${vnfKey}    ${key}   
    ${VDUcount}=    Get Length    ${nfv.vnfd[0].vdu}
    ${extCP_count}=    Get Length    ${nfv.vnfd[0].ext_cpd}
    ${virtualLink_count}=    Get length    ${nfv.vnfd[0].int_virtual_link_desc}
    ${instantiation_levels}=    Get Length    ${nfv.vnfd[0].df.instantiation_level}    
    FOR    ${key}    IN    @{nfv.vnfd[0].keys()}
        ${VDU_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key}    vdu
        Run Keyword If    ${VDU_check}    Get VDU IDs    ${VDUcount}
        ${extCP_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key}    ext_cpd
        Run Keyword If    ${extCP_check}    Get External CP IDs    ${extCP_count}
        ${virtualLink_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key}    int_virtual_link_desc
        Run Keyword If    ${virtualLink_check}    Get Virtual Link IDs   ${virtualLink_count}    
        ${DF_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key}    df
        Run Keyword If    ${DF_check}    Get Instantiation Levels    ${instantiation_levels}    
    END
    Set Global Variable    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Provider}    ${provider}
    Set Global Variable    ${Product_Name}    ${product_name}
    Set Global Variable    ${Software_Version}    ${software_version}
    Set Global Variable    ${Descriptor_Version}    ${descriptor_version}

Get VDU IDs
    [Arguments]    ${count}    
    @{VDU_labels}=    Create List
    ${Storage_labels}=    Create List
    FOR    ${i}    IN RANGE    ${count}
        Append To List    ${VDU_labels}    ${nfv.vnfd[0].vdu[${i}].id}
        Append To List    ${Storage_labels}    ${nfv.vnfd[0].vdu[${i}].virtual_storage_desc} 
        Get Internal CPs for each VDU    ${i}   
    END
    Set Global Variable    ${VDU_IDs}    ${VDU_labels}
    Set Global Variable    ${Storage_IDs}    ${Storage_labels}
            
Get Internal CPs for each VDU
    [Arguments]    ${vdu}
    ${count}=    Get Length    ${nfv.vnfd[0].vdu[${vdu}].int_cpd}    
    ${internal_CPs}=    Create List
    FOR    ${i}    IN RANGE    ${count}
        Append To List    ${internal_CPs}    ${nfv.vnfd[0].vdu[${vdu}].int_cpd[${i}].id} 
    END
    Set Global Variable    ${internalCP_IDs}    ${internal_CPs}
    
Get External CP IDs
    [Arguments]    ${count}    
    @{external_CPs}=    Create List
    FOR    ${i}    IN RANGE    ${count}
        Append To List    ${external_CPs}    ${nfv.vnfd[0].ext_cpd[${i}].id} 
    END
    Set Global Variable    ${externalCP_IDs}    ${external_CPs}

Get Virtual Link IDs
    [Arguments]    ${count}    
    ${VirtualLink_labels}=    Create List
    FOR    ${i}    IN RANGE    ${count}
        Append To List    ${VirtualLink_labels}    ${nfv.vnfd[0].int_virtual_link_desc[${i}].id} 
    END
    Set Global Variable    ${VirtualLink_IDs}    ${VirtualLink_labels}

Get Instantiation Levels
    [Arguments]    ${count}
    @{Instantiation_Levels}=    Create List
    FOR    ${i}    IN RANGE    ${count}
        Append To List    ${Instantiation_Levels}    ${nfv.vnfd[0].df.instantiation_level[${i}].id} 
    END
    Set Global Variable    ${InstantiationLevel_IDs}    ${Instantiation_Levels}

Match the Response Attributes with Descriptors
    #Checking Response attributes with VNF Descriptors
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfdId']}    ${Descriptor_ID}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfProvider']}    ${Provider}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfProductName']}    ${Product_Name}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfSoftwareVesion']}    ${Software_Version}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['vnfdVersion']}    ${Descriptor_Version}
    Should Be Equal As Strings    ${response['body']['vnfInstance']['instantiatedVnfInfo']['flavourId']}    ${Flavour_ID}
    List Should Contain Value    ${VDU_IDs}    ${response['body']['vnfInstance']['instantiatedVnfInfo']['vnfcResourceInfo']['vduId']}        
    Run Keyword If  '${descriptorType}'=='SOL006'    List Should Contain Value    ${externalCP_IDs}    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extCpInfo']['cpdId']}
    Run Keyword If  '${descriptorType}'=='SOL006'    List Should Contain Value    ${internalCP_IDs}    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extCpInfo']['cpdId']}
    Run Keyword If  '${descriptorType}'=='SOL001'    List Should Contain Value    @{CP_IDs}    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extCpInfo']['cpdId']}
    List Should Contain value    ${Storage_IDs}    ${response['body']['vnfInstance']['instantiatedVnfInfo']['virtualStorageResourceInfo']['virtualStorageDescId']}
    List Should Contain Value    ${VirtualLink_IDs}    ${response['body']['vnfInstance']['instantiatedVnfInfo']['extManagedVirtualLinkInfo']['vnfVirtualLinkDescId']}

POST New nsInstance with DISABLED nsd
    Log    Create NS instance by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances
@@ -518,9 +603,9 @@ POST scale nsInstance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${check_descriptors} == 1    Add VNF Descriptor Content to NS Instance
    Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File
    ${template}=    Get File    jsons/ScaleNs.json
    ${body}=        Format String   ${template}     scaleType=${scaleType}   scaleTimeout=${scaleTimeout}   scaleVnfType=${scaleVnfType}   scaleGroupDescriptor=${scaleGroupDescriptor}   scaleMemberVnfIndex=${scaleMemberVnfIndex}    vnfInstantiationLevelId=${instantiationLevel_id}
    ${body}=        Format String   ${template}     scaleType=${scaleType}   scaleTimeout=${scaleTimeout}   scaleVnfType=${scaleVnfType}   scaleGroupDescriptor=${scaleGroupDescriptor}   scaleMemberVnfIndex=${scaleMemberVnfIndex}    vnfInstantiationLevelId=${InstantiationLevel_IDs[0]}
	Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/scale    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
@@ -564,34 +649,13 @@ POST Update NSInstance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${check_descriptors} == 1    Add VNF Descriptor Content to NS Instance
    Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File 
    ${template} =    Get File    jsons/UpdateNsRequest.json
    ${body}=        Format String   ${template}     vnfdId=${descriptor_id}    vnfFlavourId=${flavour_Id}    newFlavourId=${flavour_Id}    vnfVirtualLinkDescId=${virtualLink_id}    instantiationLevelId=${instantiationLevel_id}    vnfInstantiationLevelId=${instantiationLevel_id}    
    ${body}=        Format String   ${template}     vnfdId=${descriptor_id}    vnfFlavourId=${Flavour_ID}    newFlavourId=${Flavour_ID}    vnfVirtualLinkDescId=${VirtualLink_IDs[0]}    instantiationLevelId=${InstantiationLevel_IDs[1]}    vnfInstantiationLevelId=${InstantiationLevel_IDs[0]}    
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/update    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
 
Add VNF Descriptor Content to NS Instance
    Run Keyword If  '${descriptorType}'=='SOL001'  Parse SOL001 NS Instance    ELSE    Parse SOL006 NS Instance
   
Parse SOL001 NS Instance
    Get key for VNF Descriptor
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_id}
    ${provider}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.provider}
    ${product_name}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.product_name}
    ${software_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.software_version}
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_version}
    ${flavour_Id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.flavour_id}
    
Parse SOL006 NS Instance
    ${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}
    ${software_version}=    Get Variable Value    ${nfv.vnfd[0].software-version}
    ${descriptor_version}=    Get Variable Value    ${nfv.vnfd[0].version}
    ${virtualLink_id}=    Get Variable Value    ${nfv.vnfd[0].int-virtual-link-desc.id}       
    ${instantiationLevel_id}=    Get Variable Value    ${nfv.vnfd[0].df[0].instantiation-level[0].id}  
 
DELETE Heal NSInstance
    log    Trying to Delete an Heal NS instance. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
+3 −6
Original line number Diff line number Diff line
@@ -66,16 +66,13 @@ Post Ns Lcm Operation Occurrence Notification
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${check_descriptors} == 1    Add VNF Descriptor Content to Notification
    Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File
    ${template} =    Get File    jsons/NsLcmOperationOccurrenceNotification.json
    ${body}=        Format String   ${template}    nsInstanceId=${nsInstanceId}    nsLcmOpOccId=${nsLcmOpOccId}    subscriptionId=${subscriptionId}    vnfdId=${descriptor_id}  
    ${body}=        Format String   ${template}    nsInstanceId=${nsInstanceId}    nsLcmOpOccId=${nsLcmOpOccId}    subscriptionId=${subscriptionId}    vnfdId=${Descriptor_ID}  
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
		
Add VNF Descriptor Content to Notification
    Run Keyword If  '${descriptorType}'=='SOL001'  Parse SOL001 NS Instance    ELSE    Parse SOL006 NS Instance
	
Post Ns Identifier Creation Notification
    log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT}"}  
+22 −11
Original line number Diff line number Diff line
@@ -78,16 +78,27 @@ ${json} {"notificationStatus": ""}

${callbackResp}    127.0.0.1

${descriptorType}    SOL001
${vnfKey}    {}
${check_descriptors}    1
${descriptorType}    SOL006

${descriptor_id}	
${provider}	
${product_name}    
${software_version}    
${descriptor_version}
${flavour_id}
${tosca_type_VDU_compute}    tosca.nodes.nfv.Vdu.Compute
${tosca_type_VNF}    tosca.nodes.nfv.VNF
${tosca_type_virtual_link}    tosca.nodes.nfv.VnfVirtualLink
${tosca_type_VDU_cp}    tosca.nodes.nfv.VduCp
${tosca_type_storage}    tosca.nodes.nfv.Vdu.VirtualBlockStorage
  
${virtualLink_id}
${instantiationLevel_id}
 No newline at end of file
@{VDU_IDs}
@{VNF_IDs}
@{virtualLink_IDs}
@{CP_IDs}
@{Storage_IDs}
@{internalCP_IDs}
@{externalCP_IDs}
@{InstantiationLevel_IDs}

${Descriptor_ID}
${Provider}
${Product_Name}
${Software_Version}
${Descriptor_Version}
${Flavour_ID}
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -53,9 +53,9 @@ Post VNF Package Onboarding Notification
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${check_descriptors} == 1    Add VNF Descriptor Content to VNF Package
    Run Keyword If    ${check_descriptors} == 1    Parse the Descriptor File
    ${template} =    Get File    jsons/VnfPackageOnboardingNotification.json
    ${body}=        Format String   ${template}    subscriptionId=${subscriptionId}    vnfPkgId=${vnfPkgId}    vnfdId=${descriptor_id}
    ${body}=        Format String   ${template}    subscriptionId=${subscriptionId}    vnfPkgId=${vnfPkgId}    vnfdId=${Descriptor_ID}
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
@@ -65,9 +65,9 @@ Post VNF Package Change Notification
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${check_descriptors} == 1    Add VNF Descriptor Content to VNF Package
    Run Keyword If    ${check_descriptors} == 1    Parse the Descriptor File
    ${template} =    Get File    jsons/VnfPackageChangeNotification.json
    ${body}=        Format String   ${template}    subscriptionId=${subscriptionId}    vnfPkgId=${vnfPkgId}    vnfdId=${descriptor_id}
    ${body}=        Format String   ${template}    subscriptionId=${subscriptionId}    vnfPkgId=${vnfPkgId}    vnfdId=${Descriptor_ID}
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
 No newline at end of file
+136 −84

File changed.

Preview size limit exceeded, changes collapsed.

Loading