Commit 40151f06 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSLCM Rollback task

parent d6178567
Loading
Loading
Loading
Loading
+22
Changes for SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot: 22 added lines, 0 removed lines.
Original line number Original line Diff line number Diff line
@@ -1317,6 +1317,28 @@ POST Rollback operation task
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}


POST Rollback operation task with permitted authorization scope
    Log    Rollback a NS lifecycle operation task
    ${scopeValue}=    Create Dictionary    scope=${OPOCCS_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}
    Log    Execute Query and validate response
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_lcm_op_occs/${nsLcmOpOccId}/rollback
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

POST Rollback operation task with not permitted authorization scope
    Log    Rollback a NS lifecycle operation task
    ${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}
    Log    Execute Query and validate response
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_lcm_op_occs/${nsLcmOpOccId}/rollback
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
GET Continue operation task
GET Continue operation task
    log    Trying to perform a GET. This method should not be implemented
    log    Trying to perform a GET. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+25
Changes for SOL005/NSLifecycleManagement-API/RollbackOperationTask.robot: 25 added lines, 0 removed lines.
Original line number Original line Diff line number Diff line
@@ -95,6 +95,31 @@ DELETE Rollback operation task - Method not implemented
    DELETE Rollback operation task
    DELETE Rollback operation task
    Check HTTP Response Status Code Is    405
    Check HTTP Response Status Code Is    405


POST Rollback operation task with permitted authorization scope
     [Documentation]    Test ID: 5.3.2.11.8
    ...    Test title: POST Rollback operation task with permitted authorization scope
    ...    Test objective: The objective is to test that POST method triggers a rollback on the NS LCM operation with permitted authorization scope
    ...    Pre-conditions: NS instance status equal to FAILED_TEMP
    ...    Reference: Clause 6.4.12.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: NS instance status not equal to FAILED_TEMP    
	POST Rollback operation task with permitted authorization scope
	Check HTTP Response Status Code Is    202
	Check operation resource state is not FAILED_TEMP 

POST Rollback operation task with not permitted authorization scope
     [Documentation]    Test ID: 5.3.2.11.9
    ...    Test title: POST Rollback operation task with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method triggers a rollback on the NS LCM operation fails when using not permitted authorization scope
    ...    Pre-conditions: NS instance status equal to FAILED_TEMP
    ...    Reference: Clause 6.4.12.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
	POST Rollback operation task with not permitted authorization scope
	Check HTTP Response Status Code Is    401