Commit d506d7cc authored by Sana Zulfiqar's avatar Sana Zulfiqar
Browse files

Descriptor checks added for 7.3.1.1.1

parent 96ac9300
Loading
Loading
Loading
Loading
+135 −36
Original line number Original line Diff line number Diff line
@@ -8,7 +8,8 @@ Library BuiltIn
Library    JSONLibrary
Library    JSONLibrary
Library    Collections
Library    Collections
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Variables    descriptors/SOL001/vnf-b-1_VNF.yaml
Variables    descriptors/SOL001/reference_tst010_vnf_b_2vdu_SOL001.yaml
Variables    descriptors/SOL006/reference_tst010_vnf_b_2vdu_SOL006.yaml


*** Keywords ***
*** Keywords ***
Get Vnf Instance 
Get Vnf Instance 
@@ -371,9 +372,9 @@ POST Create a new vnfInstance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${check_descriptors} == 1    Add VNF Descriptor Content to VNF Instance
    Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File
    ${template}=    Get File    jsons/createVnfRequest.json
    ${template}=    Get File    jsons/createVnfRequest.json
    ${body}=        Format String   ${template}     vnfdId=${descriptor_id}    vnfProvider=${provider}    vnfProductName=${product_name}    vnfSoftwareVersion=${software_version}    vnfdVersion= ${descriptor_version} 
    ${body}=        Format String   ${template}     vnfdId=${Descriptor_ID}    vnfProvider=${Provider}    vnfProductName=${Product_Name}    vnfSoftwareVersion=${Software_Version}    vnfdVersion= ${Descriptor_Version} 
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_instances    ${body}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_instances    ${body}
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 	
	Set Global Variable    ${response}    ${outputResponse} 	
@@ -1200,45 +1201,143 @@ Check HTTP Response Body vnfInstance content against VNF Descriptor
    Run Keyword If    ${check_descriptors} == 1    Check Individual VNF Instance Content
    Run Keyword If    ${check_descriptors} == 1    Check Individual VNF Instance Content
    
    
Check Individual VNF Instance Content    
Check Individual VNF Instance Content    
    Run Keyword If  '${descriptorType}'=='SOL001'  Parse SOL001    ELSE    Parse SOL006
    PARSE the Descriptor File
    
    Match the VNF Instance Response Attributes with Descriptors
Parse SOL001
    
    Get key for VNF Descriptor
PARSE the Descriptor File
    
    Run Keyword If  '${descriptorType}'=='SOL001'    Fetch Information from SOL001 descriptor file    ELSE    Fetch Information from SOL006 descriptor file
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_id}
    
    ${provider}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.provider}
Fetch Information from SOL001 descriptor file
    ${product_name}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.product_name}
    @{VDU_labels}=    Create List
    ${software_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.software_version}
    @{VNF_labels}=    Create List
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_version}
    @{VirtualLink_labels}=    Create List
    ${flavour_id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.flavour_id}
    @{CP_labels}=    Create List
    
    @{Storage_labels}=    Create List
    Should Be Equal As Strings    ${response['body']['vnfdId']}    ${descriptor_id}
    FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
    Should Be Equal As Strings    ${response['body']['vnfProvider']}    ${provider}
        ${key_type}=    Get Variable Value    ${topology_template.node_templates.${key}.type}
    Should Be Equal As Strings    ${response['body']['vnfProductName']}    ${product_name}
        ${VDU_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}   ${tosca_type_VDU_compute}
    Should Be Equal As Strings    ${response['body']['vnfSoftwareVesion']}    ${software_version}
        ${VNF_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_VNF}
    Should Be Equal As Strings    ${response['body']['vnfdVersion']}    ${descriptor_version}
        ${Link_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_virtual_link}
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['flavourId']}    ${flavour_id}
        ${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}
Parse SOL006
        Run Keyword If    ${VDU_check}    Append To List    ${VDU_labels}    ${key}
    #Log    SOL006 code
        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}
    ${descriptor_id}=    Get Variable Value    ${nfv.vnfd[0].id}
    ${provider}=    Get Variable Value    ${nfv.vnfd[0].provider}
    ${provider}=    Get Variable Value    ${nfv.vnfd[0].provider}
     ${product_name}=    Get Variable Value    ${nfv.vnfd[0].product-name}
    ${product_name}=    Get Variable Value    ${nfv.vnfd[0]['product-name']}
     ${software_version}=    Get Variable Value    ${nfv.vnfd[0].software-version}
    ${software_version}=    Get Variable Value    ${nfv.vnfd[0]['software-version']}
    ${descriptor_version}=    Get Variable Value    ${nfv.vnfd[0].version}    
    ${descriptor_version}=    Get Variable Value    ${nfv.vnfd[0].version}    
    ${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}
    
    
    Should Be Equal As Strings    ${response['body']['vnfdId']}    ${descriptor_id}
Get External CP IDs
    Should Be Equal As Strings    ${response['body']['vnfProvider']}    ${provider}
    [Arguments]    ${count}    
    Should Be Equal As Strings    ${response['body']['vnfProductName']}    ${product_name}
    @{external_CPs}=    Create List
    Should Be Equal As Strings    ${response['body']['vnfSoftwareVesion']}    ${software_version}
    FOR    ${i}    IN RANGE    ${count}
    Should Be Equal As Strings    ${response['body']['vnfdVersion']}    ${descriptor_version}
        Append To List    ${external_CPs}    ${nfv.vnfd[0].ext_cpd[${i}].id} 
    END
    Set Global Variable    ${externalCP_IDs}    ${external_CPs}


Get key for VNF Descriptor
Get Virtual Link IDs
    FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
    [Arguments]    ${count}    
        Log    ${key}
    ${VirtualLink_labels}=    Create List
        ${check1}=    Run Keyword And Return Status    Should Be Equal As Strings    ${topology_template.node_templates.${key}.type}    tosca.nodes.nfv.VNF
    FOR    ${i}    IN RANGE    ${count}
        Run Keyword If     ${check1}     Set Global Variable    ${vnfKey}    ${key}   
        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
    END
    Set Global Variable    ${InstantiationLevel_IDs}    ${Instantiation_Levels}
    
Match the VNF Instance Response Attributes with Descriptors
    #Checking Response attributes with VNF Descriptors
    Should Be Equal As Strings    ${response['body']['vnfdId']}    ${Descriptor_ID}
    Should Be Equal As Strings    ${response['body']['vnfProvider']}    ${Provider}
    Should Be Equal As Strings    ${response['body']['vnfProductName']}    ${Product_Name}
    Should Be Equal As Strings    ${response['body']['vnfSoftwareVesion']}    ${Software_Version}
    Should Be Equal As Strings    ${response['body']['vnfdVersion']}    ${Descriptor_Version}
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['flavourId']}    ${Flavour_ID}
    List Should Contain Value    ${VDU_IDs}    ${response['body']['instantiatedVnfInfo']['vnfcResourceInfo']['vduId']}        
    Run Keyword If  '${descriptorType}'=='SOL006'    List Should Contain Value    ${externalCP_IDs}    ${response['body']['instantiatedVnfInfo']['extCpInfo']['cpdId']}
    Run Keyword If  '${descriptorType}'=='SOL006'    List Should Contain Value    ${internalCP_IDs}    ${response['body']['instantiatedVnfInfo']['vnfcResourceInfo']['vnfcCpInfo']['cpdId']}
    Run Keyword If  '${descriptorType}'=='SOL001'    List Should Contain Value    @{CP_IDs}    ${response['body']['instantiatedVnfInfo']['extCpInfo']['cpdId']}
    Run Keyword If  '${descriptorType}'=='SOL001'    List Should Contain Value    @{CP_IDs}    ${response['body']['instantiatedVnfInfo']['vnfcResourceInfo']['vnfcCpInfo']['cpdId']}
    List Should Contain value    ${Storage_IDs}    ${response['body']['instantiatedVnfInfo']['virtualStorageResourceInfo']['virtualStorageDescId']}
    List Should Contain Value    ${VirtualLink_IDs}    ${response['body']['instantiatedVnfInfo']['extManagedVirtualLinkInfo']['vnfVirtualLinkDescId']}

    


Check HTTP Response Body of Individual VNF LCM Operation occurrences content against VNF Descriptor
Check HTTP Response Body of Individual VNF LCM Operation occurrences content against VNF Descriptor
    Run Keyword If    ${check_descriptors} == 1    Check Individual VNF LCM Operation Occurence Content
    Run Keyword If    ${check_descriptors} == 1    Check Individual VNF LCM Operation Occurence Content
+21 −6
Original line number Original line Diff line number Diff line
@@ -100,11 +100,26 @@ ${scaleOutResponse}
${callbackResp}    localhost
${callbackResp}    localhost


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


${descriptor_id}    
${tosca_type_VDU_compute}    tosca.nodes.nfv.Vdu.Compute
${provider}    
${tosca_type_VNF}    tosca.nodes.nfv.VNF
${product_name}    
${tosca_type_virtual_link}    tosca.nodes.nfv.VnfVirtualLink
${software_version}    
${tosca_type_VDU_cp}    tosca.nodes.nfv.VduCp
${descriptor_version}
${tosca_type_storage}    tosca.nodes.nfv.Vdu.VirtualBlockStorage
 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