Commit ef5add67 authored by Muhammad Hamza's avatar Muhammad Hamza Committed by Giacomo Bernini
Browse files

fixed VNFD parsing in SOL005 APIs

parent d61a1faf
Loading
Loading
Loading
Loading
+18 −9
Original line number Original line Diff line number Diff line
@@ -269,14 +269,23 @@ PARSE the Descriptor File
    Run Keyword If  '${descriptorType}'=='SOL001'    Fetch Information from SOL001 descriptor file    ELSE    Fetch Information from SOL006 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
Fetch Information from SOL001 descriptor file
    Import Variables  descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    Import Variables    ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    @{VDU_labels}=    Create List
    @{VDU_labels}=    Create List
    @{VNF_labels}=    Create List
    @{VNF_labels}=    Create List
    @{VirtualLink_labels}=    Create List
    @{VirtualLink_labels}=    Create List
    @{CP_labels}=    Create List
    @{CP_labels}=    Create List
    @{Storage_labels}=    Create List
    @{Storage_labels}=    Create List

    FOR    ${key}    IN    @{node_types.keys()}
        ${node_type}=    Get Variable Value    ${node_types['${key}']['derived_from']}
        ${is_VNF}=    Run Keyword And Return Status    Should Be Equal As Strings    ${node_type}    ${tosca_type_VNF}
        Run Keyword If    ${is_VNF}    Set Global Variable    ${tosca_type_derived_from_VNF}    ${key}
    END  
    ${derived_type_is_used}=    Run Keyword And Return Status    Should not be empty    ${tosca_type_derived_from_VNF}
    Run Keyword If    ${derived_type_is_used}    Set Global Variable    ${tosca_type_VNF}    ${tosca_type_derived_from_VNF}

    FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
    FOR    ${key}    IN    @{topology_template.node_templates.keys()} 
        ${key_type}=    Get Variable Value    ${topology_template.node_templates.${key}.type}
        ${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}
        ${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}
        ${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}
        ${Link_check}=    Run Keyword And Return Status    Should Be Equal As Strings    ${key_type}    ${tosca_type_virtual_link}
@@ -297,13 +306,13 @@ Fetch Information from SOL001 descriptor file


Get VNF Attributes from SOL001
Get VNF Attributes from SOL001
    [Arguments]    ${VNF_label}
    [Arguments]    ${VNF_label}
    Import Variables  descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    Import Variables    ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${VNF_label}.properties.descriptor_id}
    ${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}
    ${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}
    ${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}
    ${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}
    ${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}
    ${flavour_id}=    Get Variable Value    ${topology_template.node_templates['${VNF_label}'].properties.flavour_id}
    
    
    Set Global Variable    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Provider}    ${provider}
    Set Global Variable    ${Provider}    ${provider}
+1 −3
Original line number Original line Diff line number Diff line
@@ -90,7 +90,6 @@ topology_template:
        order: 1
        order: 1
      requirements:
      requirements:
        - virtual_binding: VDU-B
        - virtual_binding: VDU-B
    vdu-b-1-vsd:
    management:
    management:
      type: "tosca.nodes.nfv.VduCp"
      type: "tosca.nodes.nfv.VduCp"
      properties:
      properties:
@@ -98,7 +97,6 @@ topology_template:
        order: 0
        order: 0
      requirements:
      requirements:
        - virtual_binding: VDU-B
        - virtual_binding: VDU-B
    vdu-b-1-vsd:
    left:
    left:
      type: "tosca.nodes.nfv.VduCp"
      type: "tosca.nodes.nfv.VduCp"
      properties:
      properties:
+3 −2
Original line number Original line Diff line number Diff line
@@ -82,11 +82,13 @@ ${callbackResp} 127.0.0.1
${check_descriptors}    1
${check_descriptors}    1
${descriptorType}    SOL006
${descriptorType}    SOL006


#############internal variables used for descriptor parsing################
${tosca_type_VDU_compute}    tosca.nodes.nfv.Vdu.Compute
${tosca_type_VDU_compute}    tosca.nodes.nfv.Vdu.Compute
${tosca_type_VNF}    tst010.vnf.simple    # custom tosca type defined in the descriptor vnfd_SOL001.yaml in descriptors folder
${tosca_type_VNF}    tosca.nodes.nfv.VNF
${tosca_type_virtual_link}    tosca.nodes.nfv.VnfVirtualLink
${tosca_type_virtual_link}    tosca.nodes.nfv.VnfVirtualLink
${tosca_type_VDU_cp}    tosca.nodes.nfv.VduCp
${tosca_type_VDU_cp}    tosca.nodes.nfv.VduCp
${tosca_type_storage}    tosca.nodes.nfv.Vdu.VirtualBlockStorage
${tosca_type_storage}    tosca.nodes.nfv.Vdu.VirtualBlockStorage
${tosca_type_derived_from_VNF}


${tosca_type_NS}    tosca.nodes.nfv.NS
${tosca_type_NS}    tosca.nodes.nfv.NS
${tosca_type_NsVirtualLink}    tosca.nodes.nfv.NsVirtualLink
${tosca_type_NsVirtualLink}    tosca.nodes.nfv.NsVirtualLink
@@ -111,7 +113,6 @@ ${NS_Name}
${NS_Version}
${NS_Version}
${NS_InvariantId}
${NS_InvariantId}



${Descriptor_ID}
${Descriptor_ID}
${Provider}
${Provider}
${Product_Name}
${Product_Name}
+101 −8
Original line number Original line Diff line number Diff line
@@ -197,11 +197,45 @@ PARSE the Descriptor File
    
    
Fetch Information from SOL001 descriptor file
Fetch Information from SOL001 descriptor file
    Import Variables    ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    Import Variables    ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.properties.descriptor_id}
    @{VDU_labels}=    Create List
    ${provider}=    Get Variable Value    ${topology_template.node_templates.properties.provider}
    @{VNF_labels}=    Create List
    ${product_name}=    Get Variable Value    ${topology_template.node_templates.properties.product_name}
    @{VirtualLink_labels}=    Create List
    ${software_version}=    Get Variable Value    ${topology_template.node_templates.properties.software_version}
    @{CP_labels}=    Create List
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.properties.descriptor_version}
    @{Storage_labels}=    Create List
    FOR    ${key}    IN    @{node_types.keys()}
        ${node_type}=    Get Variable Value    ${node_types['${key}']['derived_from']}
        ${is_VNF}=    Run Keyword And Return Status    Should Be Equal As Strings    ${node_type}    ${tosca_type_VNF}
        Run Keyword If    ${is_VNF}    Set Global Variable    ${tosca_type_derived_from_VNF}    ${key}
    END  
    ${derived_type_is_used}=    Run Keyword And Return Status    Should not be empty    ${tosca_type_derived_from_VNF}
    Run Keyword If    ${derived_type_is_used}    Set Global Variable    ${tosca_type_VNF}    ${tosca_type_derived_from_VNF}              
    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}
    
    
    Set Global Variable    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Provider}    ${provider}
    Set Global Variable    ${Provider}    ${provider}
@@ -213,15 +247,74 @@ Fetch Information from SOL006 descriptor file
    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
    Import Variables    ${CURDIR}/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
    ${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    ${Descriptor_ID}    ${descriptor_id}
    Set Global Variable    ${Provider}    ${provider}
    Set Global Variable    ${Provider}    ${provider}
    Set Global Variable    ${Product_Name}    ${product_name}
    Set Global Variable    ${Product_Name}    ${product_name}
    Set Global Variable    ${Software_Version}    ${software_version}
    Set Global Variable    ${Software_Version}    ${software_version}
    Set Global Variable    ${Descriptor_Version}    ${descriptor_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 of vnfPkgInfo with Descriptors
Match the Response Attributes of vnfPkgInfo with Descriptors
    #Checking Response attributes with VNF Descriptors
    #Checking Response attributes with VNF Descriptors
    Should Be Equal As Strings    ${response['body']['vnfdId']}    ${Descriptor_Id}
    Should Be Equal As Strings    ${response['body']['vnfdId']}    ${Descriptor_Id}
+1 −3
Original line number Original line Diff line number Diff line
@@ -90,7 +90,6 @@ topology_template:
        order: 1
        order: 1
      requirements:
      requirements:
        - virtual_binding: VDU-B
        - virtual_binding: VDU-B
    vdu-b-1-vsd:
    management:
    management:
      type: "tosca.nodes.nfv.VduCp"
      type: "tosca.nodes.nfv.VduCp"
      properties:
      properties:
@@ -98,7 +97,6 @@ topology_template:
        order: 0
        order: 0
      requirements:
      requirements:
        - virtual_binding: VDU-B
        - virtual_binding: VDU-B
    vdu-b-1-vsd:
    left:
    left:
      type: "tosca.nodes.nfv.VduCp"
      type: "tosca.nodes.nfv.VduCp"
      properties:
      properties:
Loading