Commit 32d2301c authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSLCM terminate task

parent c35769f6
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -971,6 +971,30 @@ POST Terminate NSInstance
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

POST Terminate NSInstance with permitted authorization scope
	Log    Trying to Instantiate a Terminate NS Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scopeValue}=    Create Dictionary    scope=${TERMINATE_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}    ${body}=    Get File    jsons/TerminateNsRequest.json
	Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/terminate    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

POST Terminate NSInstance with not permitted authorization scope
	Log    Trying to Instantiate a Terminate 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}    ${body}=    Get File    jsons/TerminateNsRequest.json
	Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/terminate    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
		
POST NS LCM OP Occurrences
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
+27 −1
Original line number Diff line number Diff line
@@ -82,3 +82,29 @@ DELETE Terminate NSInstance - Method not implemented
    ...    Post-Conditions: none
    DELETE Terminate NSInstance
    Check HTTP Response Status Code Is    405

POST Terminate a NSInstance with permitted authorization scope
    [Documentation]    Test ID: 5.3.2.7.7
    ...    Test title: POST Terminate a NSInstance with permitted authorization scope
    ...    Test objective: The objective is to test that POST method terminate the NS with permitted authorization scope
    ...    Pre-conditions: NS instance in INSTANTIATED state
    ...    Reference: Clause 6.4.8.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: NS instance has NOT_INSTANTIATED state
    POST Terminate NSInstance with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    Check resource not_instantiated

POST Terminate a NSInstance with not permitted authorization scope
    [Documentation]    Test ID: 5.3.2.7.8
    ...    Test title: POST Terminate a NSInstance with permitted authorization scope
    ...    Test objective: The objective is to test that POST method terminate the NS fails when using not permitted authorization scope
    ...    Pre-conditions: NS instance in INSTANTIATED state
    ...    Reference: Clause 6.4.8.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Terminate NSInstance with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@ ${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
${HEAL_PERMITTED_SCOPE}    nslcm:v2:HEAL
${HEAL_PERMITTED_SCOPE}    nslcm:v2:heal
${TERMINATE_PERMITTED_SCOPE}    nslcm:v2:tearminate


${CONTENT_TYPE}    application/json