Commit 71d57a24 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Snaphot Mgmt individual VNF Snapshots

parent babac9b5
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -102,3 +102,29 @@ DELETE Individual VNF Snapshot Package - Conflict
    DELETE individual VNF Snapshot Package - Conflict
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails    

PATCH Individual VNF Snapshot Package with permitted authorization scope
    [Documentation]    Test ID: 5.3.7.3.9
    ...    Test title: PATCH Individual VNF Snapshot Package with permitted authorization scope
    ...    Test objective: The objective is to test that PATCH method updates the information of a VNF Snapshot package with permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.3.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH individual VNF Snapshot Package with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   VnfSnapshotPkgInfoModifications


PATCH Individual VNF Snapshot Package with not permitted authorization scope
    [Documentation]    Test ID: 5.3.7.3.9
    ...    Test title: PATCH Individual VNF Snapshot Package with not permitted authorization scope
    ...    Test objective: The objective is to test that PATCH method fails to update the information of a VNF Snapshot package when using a not permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.3.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH individual VNF Snapshot Package with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+60 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ Library JSONSchemaLibrary schemas/
Library     String
Library     OperatingSystem
Library     Collections
Library     jwt

*** Keywords ***
POST API Version
@@ -103,6 +104,33 @@ POST VNF Snapshot Packages
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}      

POST VNF Snapshot Packages with permitted authorization scope
    Log    Trying to create a VNF Snapshot Package using the POST method.
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Content-Type":"${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${PACKAGE_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/CreateVnfSnapshotPkgInfoRequest.json
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}      


POST VNF Snapshot Packages with not permitted authorization scope
    Log    Trying to create a VNF Snapshot Package using the POST method.
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Content-Type":"${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${PACKAGE_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/CreateVnfSnapshotPkgInfoRequest.json
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}      
	
GET multiple VNF Snapshot Packages	
    Log    Query VNF The GET method queries information about multiple VNF Snapshot Packages.
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
@@ -258,6 +286,32 @@ PATCH individual VNF Snapshot Package
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

PATCH individual VNF Snapshot Package with permitted authorization scope
    log    Trying to modify a VNF Snapshot Package using PATCH method
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${PACKAGE_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/VnfSnapshotPkgInfoModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

PATCH individual VNF Snapshot Package with not permitted authorization scope
    log    Trying to modify a VNF Snapshot Package using PATCH method
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${PACKAGE_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/VnfSnapshotPkgInfoModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
Check state of the VNF Snapshot Package - PATCH
    GET individual VNF Snapshot Package
    ${state}=    Get variable value    ${response['body']['state']}
@@ -830,3 +884,8 @@ DELETE Access Configuration for External Artifacts
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/ext_artifacts_access 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

JWT Encode
    [Arguments]    ${payload}    ${key}    ${algorithm}
    ${encoded}=    Evaluate    jwt.encode(${payload}, ${key}, ${algorithm})
    [Return]    ${encoded} 
 No newline at end of file