Commit 8cc482a4 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSLCM instantiate task

parent 934f6047
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -96,3 +96,29 @@ DELETE Instantiate NSInstance - Method not implemented
    ...    Post-Conditions: none.
    DELETE Instantiate NSInstance
    Check HTTP Response Status Code Is    405

POST Instantiate a nsInstance with permitted authorization scope
    [Documentation]    Test ID: 5.3.2.3.7
    ...    Test title: POST Instantiate a nsInstance with permitted authorization scope
    ...    Test objective: The objective is to test that POST method instantiate a new NS instance with permitted authorization scope
    ...    Pre-conditions: An NS instance created and it is in NOT_INSTANTIATED state
    ...    Reference: Clause 6.4.4.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Instantiate nsInstance with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    Check Operation Occurrence Id

POST Instantiate a nsInstance with not permitted authorization scope
    [Documentation]    Test ID: 5.3.2.3.8
    ...    Test title: POST Instantiate a nsInstance with not permitted authorization scope
    ...    Test objective: The objective is to test that POST method instantiate a new NS instance fails when using not permitted authorization scope
    ...    Pre-conditions: An NS instance created and it is in NOT_INSTANTIATED state
    ...    Reference: Clause 6.4.4.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Instantiate nsInstance with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+31 −1
Original line number Diff line number Diff line
@@ -645,6 +645,36 @@ GET Instantiate NSInstance
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

POST Instantiate nsInstance with permitted authorization scope
    Log    Trying to Instantiate a ns Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scopeValue}=    Create Dictionary    scope=${INSTANTIATE_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}
    Run Keyword If    ${check_descriptors} == 1    PARSE the NS Descriptor File
    ${template}=    Get File    jsons/InstantiateNs.json
    ${body}=        Format String   ${template}     nsFlavourId=${nsFlavourId}   vimAccountId=${vimAccountId}   nsdId=${nsdId}    sapdId=${SAP_IDs[0]}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/instantiate    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

POST Instantiate nsInstance with not permitted authorization scope
    Log    Trying to Instantiate a ns Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${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}
    Run Keyword If    ${check_descriptors} == 1    PARSE the NS Descriptor File
    ${template}=    Get File    jsons/InstantiateNs.json
    ${body}=        Format String   ${template}     nsFlavourId=${nsFlavourId}   vimAccountId=${vimAccountId}   nsdId=${nsdId}    sapdId=${SAP_IDs[0]}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/instantiate    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
POST Instantiate nsInstance with feasibility check only
    Log    Trying to Instantiate a ns Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
+3 −3
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@ ${AUTHORIZATION_HEADER} Authorization
${AUTHORIZATION_TOKEN}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42

${OAUTH_ENCRIPTION_ALGORITHM}    HS256
${NSINSTANCE_PERMITTED_SCOPE}    nslcm:v2:instantiate 
${NSINSTANCE_NOT_PERMITTED_SCOPE}    nslcm:v2:instantiate:readonly

${NSINSTANCE_PERMITTED_SCOPE}    nslcm:v2:ns_instance 
${NSINSTANCE_NOT_PERMITTED_SCOPE}    nslcm:v2:ns_instance:readonly
${INSTANTIATE_PERMITTED_SCOPE}    nslcm:v2:instantiate

${CONTENT_TYPE}    application/json
${ACCEPT_JSON}         application/json