Commit 9a334d6c authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Snaphot Mgmt VNF Snapshots content

parent 71d57a24
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -128,3 +128,27 @@ DELETE VNF Snapshot Package Content - Method Not implemented
    ...    Post-Conditions: none
    DELETE VNF Snapshot Package Content
    Check HTTP Response Status Code Is    405

PUT VNF Snapshot Package Content with permitted authorization scope
     [Documentation]    Test ID: 5.3.7.4.11
    ...    Test title: PUT VNF Snapshot Package Content with permitted authorization scope
    ...    Test objective: The objective is to test that PUT method uploads the content of VNF Snapshot Package with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.4.3.3 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    PUT VNF Snapshot Package Content with permitted authorization scope
    Check HTTP Response Status Code Is    202

PUT VNF Snapshot Package Content with not permitted authorization scope
     [Documentation]    Test ID: 5.3.7.4.12
    ...    Test title: PUT VNF Snapshot Package Content with not permitted authorization scope
    ...    Test objective: The objective is to test that PUT method fails to upload the content of VNF Snapshot Package when using a not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.4.3.3 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    PUT VNF Snapshot Package Content with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
@@ -435,6 +435,32 @@ PUT VNF Snapshot Package Content
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

PUT VNF Snapshot Package Content with permitted authorization scope
    log    Trying to upload the contents of VNF Snapshot Package using PUT
    Set Headers  {"Accept":"${ACCEPT_ZIP}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_ZIP}"}
    ${scopeValue}=    Create Dictionary    scope=${CONTENT_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 Binary File    zip/sampleVNFSnapshotPackage.zip
    Put    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/package_content    ${body} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

PUT VNF Snapshot Package Content with not permitted authorization scope
    log    Trying to upload the contents of VNF Snapshot Package using PUT
    Set Headers  {"Accept":"${ACCEPT_ZIP}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_ZIP}"}
    ${scopeValue}=    Create Dictionary    scope=${CONTENT_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 Binary File    zip/sampleVNFSnapshotPackage.zip
    Put    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/package_content    ${body} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

PUT VNF Snapshot Package Content - Conflict
    Check Conflict State for PUT VNF Snapshot Package Content
    log    Trying to upload the contents of VNF Snapshot Package using PUT when the state of Individual VNF Snapshot Package is other than CREATED or ERROR
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ ${AUTHORIZATION_TOKEN} Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${OAUTH_ENCRIPTION_ALGORITHM}    HS256
${PACKAGE_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:vnf_snapshot_packages  
${PACKAGE_NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:vnf_snapshot_packages:readonly
${CONTENT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:package_content 
${CONTENT_NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:package_content:readonly


${NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:invalid