Commit c817596b authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSLCM scale task

parent 8cc482a4
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -733,6 +733,36 @@ POST scale nsInstance
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

POST scale nsInstance with permitted authorization scope
	Log    Trying to Instantiate a scale NS Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scopeValue}=    Create Dictionary    scope=${SCALE_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
    ${template}=    Get File    jsons/ScaleNs.json
    ${body}=        Format String   ${template}     scaleType=${scaleType}   scaleTimeout=${scaleTimeout}   scaleVnfType=${scaleVnfType}   scaleGroupDescriptor=${scaleGroupDescriptor}   scaleMemberVnfIndex=${scaleMemberVnfIndex}    vnfInstantiationLevelId=${InstantiationLevel_IDs[0]}
	Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/scale    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

POST scale nsInstance with not permitted authorization scope
	Log    Trying to Instantiate a scale 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
    ${template}=    Get File    jsons/ScaleNs.json
    ${body}=        Format String   ${template}     scaleType=${scaleType}   scaleTimeout=${scaleTimeout}   scaleVnfType=${scaleVnfType}   scaleGroupDescriptor=${scaleGroupDescriptor}   scaleMemberVnfIndex=${scaleMemberVnfIndex}    vnfInstantiationLevelId=${InstantiationLevel_IDs[0]}
	Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/scale    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  
	
DELETE Update NSInstance
    log    Trying to delete an Update NS instance. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+26 −0
Original line number Diff line number Diff line
@@ -83,4 +83,30 @@ DELETE Scale NSInstance - Method not implemented
    DELETE scale NSInstance
    Check HTTP Response Status Code Is    405

POST Scale a nsInstance with permitted authorization scope
    [Documentation]    Test ID: 5.3.2.4.7
    ...    Test title: POST Scale a nsInstance with permitted authorization scope
    ...    Test objective: The objective is to test that POST method scales NS instance with permitted authorization scope
    ...    Pre-conditions: NS instance is INSTANTIATED state
    ...    Reference: Clause 6.4.5.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: NS instance is INSTANTIATED state and NS has been scaled
    POST scale nsInstance with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    Check resource existence

POST Scale a nsInstance with not permitted authorization scope
    [Documentation]    Test ID: 5.3.2.4.7
    ...    Test title: POST Scale a nsInstance with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method scales NS instance fails when using not permitted authorization scope
    ...    Pre-conditions: NS instance is INSTANTIATED state
    ...    Reference: Clause 6.4.5.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST scale nsInstance with not permitted authorization scope
    Check HTTP Response Status Code Is    401
    
    
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ ${OAUTH_ENCRIPTION_ALGORITHM} HS256
${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

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