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

added oauth scope tests for NSLCM heal task

parent 5816dfe2
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -82,4 +82,30 @@ DELETE Heal NSInstance - Method not implemented
    DELETE Heal NSInstance
    Check HTTP Response Status Code Is    405

POST Heal a NSInstance with permitted authorization scope
    [Documentation]    Test ID: 5.3.2.6.6
    ...    Test title: POST Heal a NSInstance with permitted authorization scope
    ...    Test objective: The objective is to test that POST method trigger a Heal NS instance with permitted authorization scope
    ...    Pre-conditions: NS Instance is in INSTANTIATED state.
    ...    Reference: Clause 6.4.7.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: NS instance is still in INSTANTIATED state.
    POST Heal NSInstance with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location

POST Heal a NSInstance with not permitted authorization scope
    [Documentation]    Test ID: 5.3.2.6.7
    ...    Test title: POST Heal a NSInstance with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method trigger a Heal NS instance fails when using not permitted authorization scope
    ...    Pre-conditions: NS Instance is in INSTANTIATED state.
    ...    Reference: Clause 6.4.7.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: NS instance is still in INSTANTIATED state.
    POST Heal NSInstance with not permitted authorization scope
    Check HTTP Response Status Code Is    401

    
    
 No newline at end of file
+27 −0
Original line number Diff line number Diff line
@@ -900,6 +900,33 @@ POST Heal NSInstance
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

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

POST Heal NSInstance with not permitted authorization scope
	Log    Trying to Instantiate a Heal 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}
    ${template}=    Get File    jsons/HealNsRequest.json
    ${body}=        Format String   ${template}     nsDegreeHealing=${nsDegreeHealing}
	Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/heal    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
DELETE Terminate NSInstance
    log    Trying to Delete an Terminate NS instance. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +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


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