Commit 37ec8688 authored by Muhammad Umair Khan's avatar Muhammad Umair Khan Committed by Giacomo Bernini
Browse files

implement oauth scope for SOL003 VNFSnapshotPackageManagement API

parent d1203b0e
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -75,3 +75,29 @@ DELETE Individual VNF Snapshot Package - Method Not implemented
    ...    Post-Conditions: VNF Snapshot Package deleted
    DELETE individual VNF Snapshot Package
    Check HTTP Response Status Code Is    405

GET Information about an individual VNF Snapshot Package - SUCCESSFUL with permitted authorization scope
    [Documentation]    Test ID: 7.3.8.3.7
    ...    Test title: GET Information about an individual VNF Snapshot Package - SUCCESSFUL with permitted authorization scope
    ...    Test objective: The objective is to query information about a VNF Snapshot Package resource
    ...    Pre-conditions: none
    ...    Reference: Clause 12.4.3.3.2 - ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Snapshot Package with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    VnfSnapshotPkgInfo

GET Information about an individual VNF Snapshot Package with not permitted authorization scope
    [Documentation]    Test ID: 7.3.8.3.8
    ...    Test title: GET Information about an individual VNF Snapshot Package with not permitted authorization scope
    ...    Test objective: The objective is to query information about a VNF Snapshot Package resource
    ...    Pre-conditions: none
    ...    Reference: Clause 12.4.3.3.2 - ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Snapshot Package with not permitted authorization scope
    Check HTTP Response Status Code Is    403
    Check HTTP Response Body Json Schema Is   ProblemDetails
 No newline at end of file
+27 −1
Original line number Diff line number Diff line
@@ -114,3 +114,29 @@ DELETE Individual VNF Snapshot Package Artifact - Method Not implemented
    ...    Post-Conditions: none
    DELETE Individual VNF Snapshot Package Artifact
    Check HTTP Response Status Code Is    405

GET Individual VNF Snapshot Package Artifact - Complete File with permitted authorization scope
    [Documentation]    Test ID: 7.3.8.5.2
    ...    Test title: GET Information about an individual VNF Snapshot Package - Complete File with permitted authorization scope
    ...    Test objective: The objective is to fetch the whole content of a VNF snapshot package using GET method with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 12.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual VNF Snapshot Package Artifact - Complete with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Content-Type Header Is Set For Package Artifact

GET Individual VNF Snapshot Package Artifact - Complete File with not permitted authorization scope
    [Documentation]    Test ID: 7.3.8.5.2
    ...    Test title: GET Information about an individual VNF Snapshot Package - Complete File with not permitted authorization scope
    ...    Test objective: The objective is to fetch the whole content of a VNF snapshot package using GET method with not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: Clause 12.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual VNF Snapshot Package Artifact - Complete with not permitted authorization scope
    Check HTTP Response Status Code Is    403
    Check HTTP Response Body Json Schema Is   ProblemDetails
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
@@ -192,3 +192,29 @@ GET information about multiple VNF Snapshot Packages using filter
    GET multiple VNF Snapshot Packages using filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    VnfSnapshotPkgInfos

GET information about multiple VNF Snapshot Packages with permitted authorization scope 
    [Documentation]    Test ID: 7.3.8.2.16
    ...    Test title: GET information about multiple VNF Snapshot Packages with permitted authorization scope 
    ...    Test objective: The objective is to get information about multiples VNF Snapshot Packages with permitted authorization scope 
    ...    Pre-conditions: none
    ...    Reference: Clause 12.4.2.3.2 - ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET multiple VNF Snapshot Packages with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    VnfSnapshotPkgInfos

GET information about multiple VNF Snapshot Packages with not permitted authorization scope 
    [Documentation]    Test ID: 7.3.8.2.17
    ...    Test title: GET information about multiple VNF Snapshot Packages with not permitted authorization scope 
    ...    Test objective: The objective is to get information about multiples VNF Snapshot Packages with not permitted authorization scope 
    ...    Pre-conditions: none
    ...    Reference: Clause 12.4.2.3.2 - ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET multiple VNF Snapshot Packages with not permitted authorization scope
    Check HTTP Response Status Code Is    403
    Check HTTP Response Body Json Schema Is    ProblemDetails
 No newline at end of file
+72 −2
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=fa
Library     DependencyLibrary
Library     JSONLibrary
Library     JSONSchemaLibrary    schemas/
Library     String

*** Keywords ***
POST API Version
@@ -175,6 +176,28 @@ GET multiple VNF Snapshot Packages with exclude_fields attribute selector
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

GET multiple VNF Snapshot Packages with permitted authorization scope 
    Log    Query VNF The GET method queries information about multiple VNF Snapshot Packages with permitted authorization scope .
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scopeValue=${VNF_SNAPSHOT_PACKAGES_READONLY_PERMITTED_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=${OAUTH_KEY}    algorithm=${OAUTH_ENCRYPTION_ALGORITHM}
    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages 
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 		

GET multiple VNF Snapshot Packages with not permitted authorization scope 
    Log    Query VNF The GET method queries information about multiple VNF Snapshot Packages with not permitted authorization scope .
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scopeValue=${VNF_SNAPSHOT_PACKAGES_READONLY_NOT_PERMITTED_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=${OAUTH_KEY}    algorithm=${OAUTH_ENCRYPTION_ALGORITHM}
    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages 
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 		

GET VNF Snapshot Packages without Paging support
    Run Keyword If    ${PAGING_SUPPORTED} == 0    GET multiple VNF Snapshot Packages
    
@@ -235,6 +258,28 @@ GET individual VNF Snapshot Package with invalid URI
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}      

GET individual VNF Snapshot Package with permitted authorization scope
    log    Trying to get information about an individual VNF Snapshot Package with permitted authorization scope
    Set Headers    {"Accept":"${ACCEPT_JSON}"}  
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scopeValue=${VNF_SNAPSHOT_PACKAGES_READONLY_PERMITTED_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=${OAUTH_KEY}    algorithm=${OAUTH_ENCRYPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}      

GET individual VNF Snapshot Package with not permitted authorization scope
    log    Trying to get information about an individual VNF Snapshot Package with not permitted authorization scope
    Set Headers    {"Accept":"${ACCEPT_JSON}"}  
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scopeValue=${VNF_SNAPSHOT_PACKAGES_READONLY_NOT_PERMITTED_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=${OAUTH_KEY}    algorithm=${OAUTH_ENCRYPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}      

PUT individual VNF Snapshot Package
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
@@ -399,6 +444,26 @@ GET Individual VNF Snapshot Package Artifact - Not Available
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

GET Individual VNF Snapshot Package Artifact - Complete with permitted authorization scope
    log    Trying to fetch the complete contents of an individual VNF Snapshot Package artifact with permitted authorization scope
    Set Headers    {"Accept":"${ACCEPT_OCTET}"}  
    ${scopeValue}=    Create Dictionary    scopeValue=${VNF_ARTIFACTS_READONLY_PERMITTED_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=${OAUTH_KEY}    algorithm=${OAUTH_ENCRYPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/artifacts/${artifactPath} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  
    
GET Individual VNF Snapshot Package Artifact - Complete with not permitted authorization scope
    log    Trying to fetch the complete contents of an individual VNF Snapshot Package artifact with not permitted authorization scope
    Set Headers    {"Accept":"${ACCEPT_OCTET}"}  
    ${scopeValue}=    Create Dictionary    scopeValue=${VNF_ARTIFACTS_READONLY_NOT_PERMITTED_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=${OAUTH_KEY}    algorithm=${OAUTH_ENCRYPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_snapshot_packages/${vnfSnapshotPkgId}/artifacts/${artifactPath} 		
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  

PUT Individual VNF Snapshot Package Artifact
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_OCTET}"}  
@@ -431,3 +496,8 @@ Check HTTP Content-Type Header Is Set For Package Artifact
    Should Be Equal As Strings    ${response['headers']['Content-Type']}    ${CONTENT_TYPE_OCTET} 
    Log    Content type validated

JWT Encode
    [Arguments]    ${payload}    ${key}    ${algorithm}
    ${encoded}=    Evaluate    jwt.encode(${payload}, ${key}, ${algorithm})
    [Return]    ${encoded}
+14 −0
Original line number Diff line number Diff line
@@ -2,8 +2,22 @@
${NFVO_HOST}      localhost    # Hostname of the NFVO
${NFVO_PORT}      8081    # Listening port of the NFVO
${NFVO_SCHEMA}    https

${OAUTH_KEY}
${OAUTH_ENCRYPTION_ALGORITHM}  HS256
${AUTHORIZATION_HEADER}    Authorization
${AUTHORIZATION_TOKEN}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42

${VNF_SNAPSHOT_PACKAGES_READONLY_PERMITTED_SCOPE}   vnfsnapshotpkgm:v1:vnf_snapshot_packages:readonly
${VNF_PACKAGE_CONTENT_READONLY_PERMITTED_SCOPE}    vnfsnapshotpkgm:v1:package_content:readonly
${VNF_ARTIFACTS_READONLY_PERMITTED_SCOPE}   vnfsnapshotpkgm:v1:artifacts:readonly
${VNF_SNAPSHOTPKGM_ALL_READONLY_PERMITTED_SCOPE}    vnfsnapshotpkgm:v1:all:readonly

${VNF_SNAPSHOT_PACKAGES_READONLY_NOT_PERMITTED_SCOPE}   vnfsnapshotpkgm:v1:vnf_snapshot_packages:readonly:invalid
${VNF_PACKAGE_CONTENT_READONLY_NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v1:package_content:readonly:invalid
${VNF_ARTIFACTS_READONLY_NOT_PERMITTED_SCOPE}   vnfsnapshotpkgm:v1:artifacts:readonly:invalid
${VNF_SNAPSHOTPKGM_ALL_READONLY_NOT_PERMITTED_SCOPE}    vnfsnapshotpkgm:v1:all:readonly:invalid

${ACCEPT_JSON}    application/json
${AUTH_USAGE}     1
${CONTENT_TYPE_JSON}    application/json