Commit 4f4cdb59 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Snaphot Mgmt Upload from URI

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

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

POST Upload VNF Snapshot Package Content from URI with not permitted authorization scope
    [Documentation]    Test ID: 5.3.7.5.7
    ...    Test title: POST Upload VNF Snapshot Package Content from URI with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method fails to provide the information for the NFVO to get the content of a VNF snapshot package when using not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 11.4.5.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Upload VNF Snapshot Package Content from URI 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
@@ -599,6 +599,34 @@ POST Upload VNF Snapshot Package Content from URI
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}    

POST Upload VNF Snapshot Package Content from URI with permitted authorization scope
    Log    Trying to initiate Upload VNF Snapshot Content from URI task
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Content-Type":"${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${URI_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/UploadVnfSnapshotPkgFromUriRequest.json
    ${body}=        Format String   ${template}    addressInformation=${vnfPackageContent_URI}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/package_content/upload_from_uri    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}    

POST Upload VNF Snapshot Package Content from URI with not permitted authorization scope
    Log    Trying to initiate Upload VNF Snapshot Content from URI 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/UploadVnfSnapshotPkgFromUriRequest.json
    ${body}=        Format String   ${template}    addressInformation=${vnfPackageContent_URI}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/package_content/upload_from_uri    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}    
    
POST Upload VNF Snapshot Package Content from URI - Conflict
    Check Conflict State for PUT VNF Snapshot Package Content
    Log    Trying to initiate Upload VNF Snapshot Content from URI task when the state of the VNF Snapshot Package is other than ERROR or CREATED.
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ ${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

${URI_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:upload_from_uri

${NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v2:invalid