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

fixed VNFD parsing in SOL005 APIs

parent 6b64ca06
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -247,8 +247,17 @@ Fetch Information from SOL001 descriptor file
    @{VirtualLink_labels}=    Create List
    @{CP_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()} 
        ${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}
        ${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}
@@ -270,12 +279,12 @@ 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}
    ${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}
    ${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}
+109 −112
Original line number Diff line number Diff line
tosca_definitions_version: tosca_simple_yaml_1_2
description: "TST010 reference VNF-B"

imports:
  - https://forge.etsi.org/rep/nfv/SOL001/raw/v3.3.1/etsi_nfv_sol001_vnfd_types.yaml  

metadata:
  descriptor_id: "VNF-B"
  vendor: "ETSI TST WG"
  version: "2.0"
 
node_types:
  tst010.vnf.simple:
    derived_from: tosca.nodes.nfv.VNF
    properties:
      descriptor_id:
        type: string
        default: VNF-B
      descriptor_version:
        type: string
        default: '1.0'
      provider:
        type: string
        default: ETSI TST WG
      product_name:
        type: string
        default: VNF-B
      software_version:
        type: string
        default: '1.0'
      product_info_name:
        type: string
        default: VNF-B
      product_info_description:
        type: string
        default: TST010 reference VNF-B
      flavour_id:
        type: string
        default: VNF-B_flavor
      flavour_description:
        type: string
        default: "VNF-B flavor"
      vnfm_info:
        type: list
        entry_schema:
          type: string
        default: [ 'etsivnfm:v2.3.1' ]
    interfaces:
      Vnflcm:
        type: "tosca.interfaces.nfv.Vnflcm"
        scale:
          description: Invoked upon receipt of a Scale VNF request
        terminate:
          description: Invoked upon receipt Terminate VNF request
        operate:
          description: Invoked upon receipt of an Operate VNF request
    requirements:
      - virtual_link_right:
          capability: tosca.capabilities.nfv.VirtualLinkable
          relationship: tosca.relationships.nfv.VirtualLinksTo
          occurrences: [0, 1]
      - virtual_link_left:
          capability: tosca.capabilities.nfv.VirtualLinkable
          relationship: tosca.relationships.nfv.VirtualLinksTo
          occurrences: [0, 1]
      - virtual_link_management:
          capability: tosca.capabilities.nfv.VirtualLinkable
          relationship: tosca.relationships.nfv.VirtualLinksTo
          occurrences: [0, 1]
      - virtual_link:
          capability: tosca.capabilities.nfv.VirtualLinkable
          relationship: tosca.relationships.nfv.VirtualLinksTo
          occurrences: [0, 0]  

topology_template:
  substitution_mappings:
    node_type: "tosca.nodes.nfv.VNF"
    node_type: "tst010.vnf.simple"
    requirements:
      virtual_link_right:
        [right, virtual_link_right]
      virtual_link_management:
        [management, virtual_link_management]
      virtual_link_left:
        [left, virtual_link_left]
      virtual_link_right:
        [right, virtual_link_right]
  node_templates:
    right:
      type: "tosca.nodes.nfv.VduCp"
      properties:
        layer_protocols: [ ipv4 ]
        order: 1
      requirements:
        virtual_link_right:
        virtual_binding: VDU-B-2
        - virtual_binding: VDU-B
    management:
      type: "tosca.nodes.nfv.VduCp"
      properties:
        layer_protocols: [ ipv4 ]
        order: 0
      requirements:
        virtual_link_management:
        virtual_binding: VDU-B-1
        - virtual_binding: VDU-B
    left:
      type: "tosca.nodes.nfv.VduCp"
      properties:
        order: 2
      requirements:
        virtual_link_left:
        virtual_binding: VDU-B-1
    internal_vl:
      type: "tosca.nodes.nfv.VnfVirtualLink"
      properties:
        connectivity_type:
        layer_protocols: [ ipv4 ]
        description: Internal Virtual link in the VNF
        vl_profile:
          max_bitrate_requirements:
            root: 100000
            leaf: 20000
          min_bitrate_requirements:
            root: 10000
            leaf: 10000
    internal_vdu_b_1_cp:
      type: "tosca.nodes.nfv.VduCp"
      properties:
        order: 2
      requirements:
        - virtual_binding: VDU-B-1
        - virtual_link: internal_vl
    internal_vdu_b_2_cp:
      type: "tosca.nodes.nfv.VduCp"
      properties:
        order: 0
      requirements:
        - virtual_binding: VDU-B-2
        - virtual_link: internal_vl
    vdu_b_1_vsd:
        - virtual_binding: VDU-B
    vdu-b-1-vsd:
      type: "tosca.nodes.nfv.Vdu.VirtualBlockStorage"
      properties:
        virtual_block_storage_data:
          size_of_storage: 20
          size_of_storage: 20 GB
          rdma_enabled: false
        sw_image_data:
          name: "vdu-b-1 image"
@@ -76,63 +117,15 @@ topology_template:
            algorithm: "sha-224"
            hash: "somehashfortst010"
          container_format: "bare"
          disk-format: qcow2
          min-disk: '1'
          min-ram: '2'
          size: '1'
      artifacts:
        sw_image:
          type: "tosca.artifacts.nfv.SwImage"
          file: vdu-b-1.qcow2
    vdu_b_2_vsd:
      type: "tosca.nodes.nfv.Vdu.VirtualBlockStorage"
      properties:
        virtual_block_storage_data:
          size_of_storage: 20
          rdma_enabled: false
        sw_image_data:
          name: "vdu-b-2 image"
          version: "1.1"
          checksum: 
            algorithm: "sha-224"
            hash: "somehashfortst010"
          container_format: "bare"
          disk-format: qcow2
          min-disk: '1'
          min-ram: '2'
          disk_format: qcow2
          min_disk: '1'
          min_ram: '2'
          size: '1'
      artifacts:
        sw_image:
          type: tosca.artifacts.nfv.SwImage
          file: vdu-b-2.qcow2
    VNF_B:
      type: "tosca.nodes.nfv.VNF"
      properties:
        descriptor_id: "VNF_B"
        descriptor_version: "2.0"
        provider: "ETSI TST WG"
        product_name: "VNF-B-2VDUs"
        software_version: "2.0"
        product_info_name: "VNF-B-2VDUs"
        product_info_description: "TST010 reference VNF-B with 2 VDUs"
        flavour_id: "VNF-B-2VDU_flavor"
        flavour_description: "VNF-B with 2 VDUs flavor"
        vnfm_info: 
          etsivnfm: 
          - v2.3.1 
        interfaces:
            Vnflcm:
              scale:
                implementation: scale-example.yaml
              terminate:
                implementation: terminate-example.yaml
              operate:
                implementation: operate-example.yaml
    VDU_B_1:
    VDU-B:
      type: "tosca.nodes.nfv.Vdu.Compute"
      properties:
        name: "vdu-b-1-vcd"
        descriptor: "Description of VDU-B-1"
        description: "Description of VDU-B-1"
        vdu_profile:
          min_number_of_instances: 1
          max_number_of_instances: 2
@@ -140,29 +133,33 @@ topology_template:
        virtual_compute:
          properties:
            virtual_memory:
              virtual_mem_size: 4096
              virtual_mem_size: 4096 MB
              numa_enabled: false
            virtual_cpu:
              num_virtual_cpu: 2
      requirements:
        virtual_storage:
        - "vdu-b-1-vsd"
    VDU_B_2:
      type: "tosca.nodes.nfv.Vdu.Compute"
      properties:
        name: "vdu-b-2-vcd"
        descriptor: "Description of VDU-B-2"
        vdu_profile:
          min_number_of_instances: 1
          max_number_of_instances: 4
      capabilities:
        virtual_compute:
        - virtual_storage: vdu-b-1-vsd
        
    vnf-b-1_VNF:
      type: "tst010.vnf.simple"
      properties:
            virtual_memory:
              virtual_mem_size: 6144
              numa_enabled: false
            virtual_cpu:
              num_virtual_cpu: 2
      requirements:
        virtual_storage:
        - "vdu-b-2-vsd"                
 No newline at end of file
        descriptor_id: "VNF-B"
        descriptor_version: "2.0"
        provider: "ETSI TST WG"
        product_name: "VDU_VNF-B"
        software_version: "2.0"
        product_info_name: "VDU_VNF-B"
        product_info_description: "TST010 reference VNF-A"
        flavour_id: "VNF-B_flavor"
        flavour_description: "VNF-B flavor"
        vnfm_info: 
          - etsivnfm:v2.3.1 
      interfaces:
        Vnflcm:
          type: "tosca.interfaces.nfv.Vnflcm"
          scale:
            implementation: scale-example.yaml
          terminate:
            implementation: terminate-example.yaml
          operate:
            implementation: operate-example.yaml                
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -101,11 +101,13 @@ ${callbackResp} 127.0.0.1
${check_descriptors}    1
${descriptorType}    SOL006

#############internal variables used for descriptor parsing################
${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
${tosca_type_derived_from_VNF}

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


${Descriptor_ID}
${Provider}
${Product_Name}
+103 −8
Original line number Diff line number Diff line
@@ -197,11 +197,46 @@ PARSE the Descriptor File
    
Fetch Information from SOL001 descriptor file
    Import Variables    ${CURDIR}/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.properties.descriptor_id}
    ${provider}=    Get Variable Value    ${topology_template.node_templates.properties.provider}
    ${product_name}=    Get Variable Value    ${topology_template.node_templates.properties.product_name}
    ${software_version}=    Get Variable Value    ${topology_template.node_templates.properties.software_version}
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.properties.descriptor_version}
    @{VDU_labels}=    Create List
    @{VNF_labels}=    Create List
    @{VirtualLink_labels}=    Create List
    @{CP_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()} 
        ${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    ${Provider}    ${provider}
@@ -213,15 +248,75 @@ 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}
    ${software_version}=    Get Variable Value    ${nfv.vnfd[0].software-version}
    ${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} 
    ${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 of vnfPkgInfo with Descriptors
    #Checking Response attributes with VNF Descriptors
    Should Be Equal As Strings    ${response['body']['vnfdId']}    ${Descriptor_Id}
+109 −112

File changed.

Preview size limit exceeded, changes collapsed.

Loading