Commit 3ac5171d authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Snaphot Mgmt build task

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

POST Build VNF Snapshot Package Content Task with permitted authorization scope
    [Documentation]    Test ID: 5.3.7.6.7
    ...    Test title: POST Build VNF Snapshot Package Content Task with permitted authorization scope
    ...    Test objective: The objective is to test that POST method provides the information for the NFVO to start building the content of a VNF snapshot package with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.6.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Build VNF Snapshot Package Content Task with permitted authorization scope
    Check HTTP Response Status Code Is    202

POST Build VNF Snapshot Package Content Task with not permitted authorization scope
    [Documentation]    Test ID: 5.3.7.6.8
    ...    Test title: POST Build VNF Snapshot Package Content Task with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method fails to provide the information for the NFVO to start building the content of a VNF snapshot package when using a not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.6.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Build VNF Snapshot Package Content Task with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+29 −1
Original line number Diff line number Diff line
@@ -685,6 +685,34 @@ POST Build VNF Snapshot Package Content Task
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}        

POST Build VNF Snapshot Package Content Task with permitted authorization scope
    Log    Trying to initiate the Build of VNF Snapshot Content Task
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Content-Type":"${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${BUILD_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/BuildVnfSnapshotPkgRequest.json
    ${body}=        Format String   ${template}    vnfSnapshotInfoId=${vnfSnapshotInfoId}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/package_content/build    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

POST Build VNF Snapshot Package Content Task with not permitted authorization scope
    Log    Trying to initiate the Build of VNF Snapshot Content Task
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Content-Type":"${CONTENT_TYPE_JSON}"}
    ${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/BuildVnfSnapshotPkgRequest.json
    ${body}=        Format String   ${template}    vnfSnapshotInfoId=${vnfSnapshotInfoId}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/package_content/build    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 

POST Build VNF Snapshot Package Content Task - Conflict
    Check Conflict State for BUILD VNF Snapshot Package Content
    Log    Trying to initiate the Build VNF Snapshot Content task when the state of the VNF Snapshot Package is not CREATED.
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ ${PACKAGE_NOT_PERMITTED_SCOPE} vnfsnapshotpkgm:v2:vnf_snapshot_packages:reado
${CONTENT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:package_content 
${CONTENT_NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:package_content:readonly
${URI_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:upload_from_uri
${BUILD_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:build 

${NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:invalid