Commit 5816dfe2 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSLCM update task

parent c817596b
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -810,6 +810,38 @@ POST Update NSInstance
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

POST Update NSInstance with permitted authorization scope
	Log    Trying to Instantiate a Update NS Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scopeValue}=    Create Dictionary    scope=${UPDATE_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File
    Run Keyword If    ${check_descriptors} == 1    PARSE the NS Descriptor File  
    ${template} =    Get File    jsons/UpdateNsRequest.json
    ${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]}    newNsdId=${NS_DescriptorID}    sapdId=${SAP_IDs[0]}    vnfInstanceId=${vnfInstanceId}    
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/update    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

POST Update NSInstance with not permitted authorization scope
	Log    Trying to Instantiate a Update NS Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scopeValue}=    Create Dictionary    scope=${NOT_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    Run Keyword If    ${check_descriptors} == 1    PARSE the Descriptor File
    Run Keyword If    ${check_descriptors} == 1    PARSE the NS Descriptor File  
    ${template} =    Get File    jsons/UpdateNsRequest.json
    ${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]}    newNsdId=${NS_DescriptorID}    sapdId=${SAP_IDs[0]}    vnfInstanceId=${vnfInstanceId}    
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/update    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
 
POST Update NSInstance with feasibility check only
	Log    Trying to Instantiate a Update NS Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
+26 −1
Original line number Diff line number Diff line
@@ -94,3 +94,28 @@ DELETE Update NSInstance - Method not implemented
    ...    Post-Conditions: none
    DELETE Update NSInstance
    Check HTTP Response Status Code Is    405

POST Update a NSInstance with permitted authorization scope
    [Documentation]    Test ID: 5.3.2.5.7
    ...    Test title: POST Update a NSInstance with permitted authorization scope
    ...    Test objective: The objective is to test that POST method update a NS instance with permitted authorization scope
    ...    Pre-conditions: An NS instance is in INSTANTIATED state
    ...    Reference: Clause 6.4.6.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The NS instance is still INSTANTIATED and updated on the NFVO
    POST Update NSInstance with permitted authorization scope 
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location

POST Update a NSInstance with not permitted authorization scope
    [Documentation]    Test ID: 5.3.2.5.8
    ...    Test title: POST Update a NSInstance with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method update a NS instance fails when using not permitted authorization scope
    ...    Pre-conditions: An NS instance is in INSTANTIATED state
    ...    Reference: Clause 6.4.6.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Update NSInstance with not permitted authorization scope
    Check HTTP Response Status Code Is    401
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ ${NSINSTANCE_PERMITTED_SCOPE} nslcm:v2:ns_instance
${NSINSTANCE_NOT_PERMITTED_SCOPE}    nslcm:v2:ns_instance:readonly
${INSTANTIATE_PERMITTED_SCOPE}    nslcm:v2:instantiate
${SCALE_PERMITTED_SCOPE}    nslcm:v2:scale
${UPDATE_PERMITTED_SCOPE}    nslcm:v2:update

${CONTENT_TYPE}    application/json
${ACCEPT_JSON}         application/json