VnfLcmOperationKeywords.robot 64.2 KB
Newer Older
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_lcm_op_occs?fields=${fields}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get VNF LCM Operation occurrences with exclude_default and fields attribute selector
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_lcm_op_occs?fields=${fields}&exclude_default
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get VNF LCM Operation occurrences with exclude_fields attribute selector
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_lcm_op_occs?exclude_fields=${fields}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 	
    
Check HTTP Response Header Contain Link
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
    Should Not Be Empty    ${linkURL}
    
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}   
    END

Check HTTP Response Body vnfInstance content against VNF Descriptor
    #${check_descriptors} flag, 1 to check descriptors
    Run Keyword If    ${check_descriptors} == 1    Check Individual VNF Instance Content
    
Check Individual VNF Instance 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']['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}
    
Parse SOL006
     ${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}
zafar's avatar
zafar committed
     ${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']['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}
zafar's avatar
zafar committed
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['extCpInfo']['cpdId']}    ${external_cp}
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['vnfcResourceInfo']['vduId']}    ${vdu_id}
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['vnfcResourceInfo']['vnfcCpInfo']['cpdId']}    ${vdu_cpid}
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['virtualStorageResourceInfo']['virtualStorageDescId']}    ${virtual_storage}
    Should Be Equal As Strings    ${response['body']['instantiatedVnfInfo']['extManagedVirtualLinkInfo']['vnfVirtualLinkDescId']}    ${virtual_link}


Add VNF Descriptor Content to VNF Instance
    Run Keyword If  '${descriptorType}'=='SOL001'  Parse SOL001 VNF Instance    ELSE    Parse SOL006 VNF Instance
    
Parse SOL001 VNF 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}
    
Parse SOL006 VNF 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}     
    
Check HTTP Response Body vnf LCM OpOCC content against VNF Descriptor
    Run Keyword If    ${check_descriptors} == 1    Check Individual VNF LCM Operation Occurence Content
    
Check Individual VNF LCM Operation Occurence Content    
    Run Keyword If  '${descriptorType}'=='SOL001'  Parse SOL001 LCM Op Occ   ELSE    Parse SOL006 LCM Op Occ
    
Parse SOL001 LCM Op Occ
    Get key for VNF Descriptor
    
    ${descriptor_id}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_id}
    ${descriptor_version}=    Get Variable Value    ${topology_template.node_templates.${vnfKey}.properties.descriptor_version}
    
zafar's avatar
zafar committed
    Should Be Equal As Strings    ${response['body']['changedInfo']['vnfdId']}    ${descriptor_id}
    Should Be Equal As Strings    ${response['body']['changedInfo']['vnfdVersion']}    ${descriptor_version}
    
Parse SOL006 LCM Op Occ
     ${descriptor_id}=    Get Variable Value    ${nfv.vnfd[0].id}
     ${descriptor_version}=    Get Variable Value    ${nfv.vnfd[0].version}
zafar's avatar
zafar committed
     ${vdu_id}=    Get Variable Value    ${nfv.vnfd[0].vdu[0].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}
zafar's avatar
zafar committed
    Should Be Equal As Strings    ${response['body']['changedInfo']['vnfdId']}    ${descriptor_id}
    Should Be Equal As Strings    ${response['body']['changedInfo']['vnfdVersion']}    ${descriptor_version}
    Should Be Equal As Strings    ${response['body']['resourceChanges']['affectedVirtualLinks']['vnfVirtualLinkDescId']}    ${virtual_link}
    Should Be Equal As Strings    ${response['body']['resourceChanges']['affectedVnfcs']['vduId']}    ${vdu_id}
    Should Be Equal As Strings    ${response['body']['resourceChanges']['affectedVirtualStorages']['virtualStorageDescId']}    ${virtual_storage}