Commit 953a74db authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSD

parent c26d6ae7
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -158,3 +158,28 @@ DELETE NSD - Method not implemented
    ...    Post-Conditions: none
    Send DELETE Request for NSD
    Check HTTP Response Status Code Is    405

Get single file NSD in Plain Format with permitted authorization scope
    [Documentation]    Test ID: 5.3.1.11.13
    ...    Test title: Get single file NSD in Plain Format with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of the NSD in plain format within a NSD archive with permitted authorization scope
    ...    Pre-conditions: One or more NSDs are onboarded in the NFVO.
    ...    Reference: Clause 5.4.4a.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: The NSD is implemented as a single file
    ...    Post-Conditions: none
    Get single file NSD in Plain Format with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    text/plain

Get single file NSD in Plain Format with not permitted authorization scope
    [Documentation]    Test ID: 5.3.1.11.13
    ...    Test title: Get single file NSD in Plain Format with not permitted authorization scope
    ...    Test objective: The objective is to test that the retrieval of the NSD in plain format within a NSD archive fails when using a not permitted authorization scope
    ...    Pre-conditions: One or more NSDs are onboarded in the NFVO.
    ...    Reference: Clause 5.4.4a.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: The NSD is implemented as a single file
    ...    Post-Conditions: none
    Get single file NSD in Plain Format with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
@@ -1116,6 +1116,28 @@ Get single file NSD in Plain Format
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get single file NSD in Plain Format with permitted authorization scope
    Log    Trying to get a NSD present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_PLAIN}"}
    ${scopeValue}=    Create Dictionary    scope=${NSDF_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}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoIdPlain}/nsd
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get single file NSD in Plain Format with not permitted authorization scope
    Log    Trying to get a NSD present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_PLAIN}"}
    ${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}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoIdPlain}/nsd
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get NSD in Zip Format
    Log    Trying to get a NSD present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ ${NSD_PERMITTED_SCOPE} nsd:v2:ns_descriptors
${NSD_NOT_PERMITTED_SCOPE}    nsd:v2:ns_descriptors:readonly
${ARCHIVE_PERMITTED_SCOPE}    nsd:v2:nsd_archive_content
${ARCHIVE_NOT_PERMITTED_SCOPE}    nsd:v2:nsd_archive_content:readonly
${NSDF_PERMITTED_SCOPE}    nsd:v2:nsd:readonly


${NOT_PERMITTED_SCOPE}    nfvmanologm:v2:nvalid