Commit 7ec8d395 authored by Elian Kraja's avatar Elian Kraja
Browse files

Refactoring environment variables

parents 8fd9619b 73eaffb5
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -8,9 +8,6 @@ Library JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Library    DependencyLibrary
Library    DependencyLibrary


*** Variables ***
${Etag}=    an etag
${Etag_modified}=    a modified etag


*** Test Cases ***
*** Test Cases ***
POST Alarm - Method not implemented
POST Alarm - Method not implemented
+2 −2
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ Create a new Subscription - DUPLICATION
    ...    Applicability: the VNFM allows creating a subscription resource if another subscription resource with the same filter and callbackUri already exists
    ...    Applicability: the VNFM allows creating a subscription resource if another subscription resource with the same filter and callbackUri already exists
    ...    Post-Conditions: 
    ...    Post-Conditions: 
    Log    Trying to create a subscription with an already created content
    Log    Trying to create a subscription with an already created content
    Pass Execution If    ${NVFM_DUPLICATION} == 0    NVFO is not permitting duplication. Skipping the test
    Pass Execution If    ${VNFM_DUPLICATION} == 0    VNFM is not permitting duplication. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
@@ -68,7 +68,7 @@ Create a new Subscription - NO-DUPLICATION
    ...    Applicability: the VNFM decides to not create a duplicate subscription resource 
    ...    Applicability: the VNFM decides to not create a duplicate subscription resource 
    ...    Post-Conditions: 
    ...    Post-Conditions: 
    Log    Trying to create a subscription with an already created content
    Log    Trying to create a subscription with an already created content
    Pass Execution If    ${NVFM_DUPLICATION} == 1    VNFM permits duplication. Skipping the test
    Pass Execution If    ${VNFM_DUPLICATION} == 1    VNFM permits duplication. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+15 −25
Original line number Original line Diff line number Diff line
*** Variables ***
*** Variables ***
${VNFM_HOST}      localhost    # Hostname of the VNFM
${VNFM_HOST}      localhost    # Hostname of the VNFM
${VNFM_PORT}      8080    # Listening port of the VNFM
${VNFM_PORT}      8080    # Listening port of the VNFM
${NFVO_HOST}      localhost    # Hostname of the NFVO
${NFVO_PORT}      8081    # Listening port of the NFVO
${VNFM_SCHEMA}    https
${VNFM_SCHEMA}    https
${NFVO_SCHEMA}    https
${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE}    application/json
${CONTENT_TYPE}    application/json
${CONTENT_TYPE_PATCH}    application/merge-patch+json 
${ACCEPT}         application/json
${ACCEPT}         application/json
${apiRoot}        /
${apiName}        vnffm
${apiVersion}     v1    
${AUTH_USAGE}     1
${AUTH_USAGE}     1
${WRONG_AUTHORIZATION}    Bearer    XXXXXWRONGXXXXX

${alarm_filter}       managedObjectId
${alarm_filter}       managedObjectId
${managedObjectId}    007c111c-38a1-42c0-a666-7475ecb1567c
${managedObjectId}    007c111c-38a1-42c0-a666-7475ecb1567c
${invalid_alarm_filter}    badFilter
${invalid_alarm_filter}    badFilter

${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${vnfInstanceDescription}    description vnf
${CONTENT_TYPE_PATCH}    application/merge-patch+json
${vnfInstanceDescription_Update}    Updated description vnf 

${SINGLE_FILE_VNFD}    1    # If VNFD is PLAIN TEXT
${Etag}=    an etag
${ACCEPT_PLAIN}    text/plain
${Etag_modified}=    a modified etag
${ACCEPT_ZIP}     application/zip

${vnfPkgId_processing}    007c111c-38a1-42c0-a666-7475ecb1567c
${VNFM_DUPLICATION} 1
${ARTIFACT_TYPE}    application/octet-stream
${ARTIFACT_ID}    artifactId
${WRONG_ACCEPT}    application/json
${vnfLcmOpOccId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${CancelMode}    GRACEFUL
${LccnSubscriptionRequest}    {}
${NVFM_DUPLICATION}    0
${sub_filter}    filter
${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${sub_filter_invalid}    filter_invalid
${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f

${notification_ep}    notification
${apiRoot}        /
${apiName}        vnffm
${apiVersion}     v1

${AlarmNotification}    {}
${AlarmNotification}    {}
${AlarmClearedNotification}    {}
${AlarmClearedNotification}    {}
${AlarmListRebuiltNotification}    {}
${AlarmListRebuiltNotification}    {}
+12 −15
Original line number Original line Diff line number Diff line
@@ -5,7 +5,6 @@ Suite Teardown Terminate All Processes kill=true
Library    MockServerLibrary
Library    MockServerLibrary
Library    Process
Library    Process
Library    OperatingSystem
Library    OperatingSystem
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${notification_port}




*** Test Cases ***
*** Test Cases ***
@@ -22,13 +21,13 @@ Deliver a notification - Alarm
    ${json}=	Get File	schemas/alarmNotification.schema.json
    ${json}=	Get File	schemas/alarmNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle alarmNotification
    Log  Creating mock request and response to handle alarmNotification
    &{req}=  Create Mock Request Matcher	POST  ${notification_ep}  body_type="JSON_SCHEMA"    body=${BODY}
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Log  Verifying results
    Log  Verifying results
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req}
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req}
    Log  Cleaning the endpoint
    Log  Cleaning the endpoint
    Clear Requests  ${notification_ep}
    Clear Requests  ${callback_endpoint}


Deliver a notification - Alarm Clearance
Deliver a notification - Alarm Clearance
    [Documentation]    Test ID: 7.4.5.2
    [Documentation]    Test ID: 7.4.5.2
@@ -43,13 +42,13 @@ Deliver a notification - Alarm Clearance
    ${json}=	Get File	schemas/alarmClearedNotification.schema.json
    ${json}=	Get File	schemas/alarmClearedNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle alarmNotification
    Log  Creating mock request and response to handle alarmNotification
    &{req}=  Create Mock Request Matcher	POST  ${notification_ep}  body_type="JSON_SCHEMA"    body=${BODY}
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Log  Verifying results
    Log  Verifying results
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req}
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req}
    Log  Cleaning the endpoint
    Log  Cleaning the endpoint
    Clear Requests  ${notification_ep}
    Clear Requests  ${callback_endpoint}


Deliver a notification - Alarm List Rebuilt
Deliver a notification - Alarm List Rebuilt
    [Documentation]    Test ID: 7.4.5.3
    [Documentation]    Test ID: 7.4.5.3
@@ -64,13 +63,13 @@ Deliver a notification - Alarm List Rebuilt
    ${json}=	Get File	schemas/alarmListRebuiltNotification.schema.json
    ${json}=	Get File	schemas/alarmListRebuiltNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle alarmNotification
    Log  Creating mock request and response to handle alarmNotification
    &{req}=  Create Mock Request Matcher  POST  ${notification_ep}  body_type="JSON_SCHEMA"    body=${BODY}
    &{req}=  Create Mock Request Matcher  POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Log  Verifying results
    Log  Verifying results
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req}
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req}
    Log  Cleaning the endpoint
    Log  Cleaning the endpoint
    Clear Requests  ${notification_ep}
    Clear Requests  ${callback_endpoint}


Test a notification end point
Test a notification end point
    [Documentation]    Test ID: 7.4.5.4
    [Documentation]    Test ID: 7.4.5.4
@@ -82,36 +81,34 @@ Test a notification end point
    ...    Applicability: 
    ...    Applicability: 
    ...    Post-Conditions:  
    ...    Post-Conditions:  
    log    The GET method allows the server to test the notification endpoint
    log    The GET method allows the server to test the notification endpoint
    Set Headers  {"Accept":"${ACCEPT}"}  
    Get    ${callback_endpoint}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${notification_ep}
    Log    Validate Status code
    Log    Validate Status code
    Integer    response status    204
    Integer    response status    204
    Log    Validation OK
    Log    Validation OK


PUT notification - Method not implemented
PUT notification - Method not implemented
    log    Trying to perform a PUT. This method should not be implemented
    log    Trying to perform a PUT. This method should not be implemented
    Put    ${notification_ep}    
    Put    ${callback_endpoint}
    Log    Validate Status code
    Log    Validate Status code
    Output    response
    Output    response
    Integer    response status    405
    Integer    response status    405


PATCH subscriptions - Method not implemented
PATCH subscriptions - Method not implemented
    log    Trying to perform a PATCH. This method should not be implemented
    log    Trying to perform a PATCH. This method should not be implemented
    Patch    ${notification_ep}    
    Patch    ${callback_endpoint}
    Log    Validate Status code
    Log    Validate Status code
    Output    response
    Output    response
    Integer    response status    405
    Integer    response status    405


DELETE subscriptions - Method not implemented
DELETE subscriptions - Method not implemented
    log    Trying to perform a DELETE. This method should not be implemented
    log    Trying to perform a DELETE. This method should not be implemented
    Delete    ${notification_ep}
    Delete    ${callback_endpoint}
    Log    Validate Status code
    Log    Validate Status code
    Output    response
    Output    response
    Integer    response status    405
    Integer    response status    405
    
    
*** Keywords ***
*** Keywords ***
Create Sessions
Create Sessions
    Start Process  java  -jar  ../../bin/mockserver-netty-5.3.0-jar-with-dependencies.jar  -serverPort  ${notification_port}  alias=mockInstance
    Start Process  java  -jar  ../../bin/mockserver-netty-5.3.0-jar-with-dependencies.jar  -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Create Mock Session  ${NFVO_SCHEMA}://${NFVO_HOST}:${notification_port}     #The API producer is set to NFVO according to SOL003-7.3.4
    Create Mock Session  ${callback_uri}:${callback_port}     #The API producer is set to NFVO according to SOL003-7.3.4
 No newline at end of file
 No newline at end of file
+3 −37
Original line number Original line Diff line number Diff line
*** Variables ***
*** Variables ***
${VNFM_HOST}      localhost    # Hostname of the VNFM
${callback_endpoint}    /notification
${VNFM_PORT}      8080    # Listening port of the VNFM
${callback_uri}    http://localhost
${NFVO_HOST}      localhost    # Hostname of the NFVO
${callback_port}    9091
${NFVO_PORT}      8081    # Listening port of the NFVO
${VNFM_SCHEMA}    https
${NFVO_SCHEMA}    https
${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE}    application/json
${CONTENT_TYPE_PATCH}    application/merge-patch+json 
${ACCEPT}         application/json
${apiRoot}        /
${apiName}        vnflcm
${apiVersion}     v1    
${AUTH_USAGE}     1
${WRONG_AUTHORIZATION}    Bearer    XXXXXWRONGXXXXX
${vnfInstanceId}       6fc3539c-e602-4afa-8e13-962fb5a7d81f
${vnfInstanceName}    Test-VnfInstance
${vnfInstanceDescription}    description vnf
${vnfInstanceDescription_Update}    Updated description vnf 
${SINGLE_FILE_VNFD}    1    # If VNFD is PLAIN TEXT
${ACCEPT_PLAIN}    text/plain
${ACCEPT_ZIP}     application/zip
${vnfPkgId_processing}    007c111c-38a1-42c0-a666-7475ecb1567c
${ARTIFACT_TYPE}    application/octet-stream
${ARTIFACT_ID}    artifactId
${WRONG_ACCEPT}    application/json
${vnfLcmOpOccId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${CancelMode}    GRACEFUL
${NVFM_DUPLICATION}    0
${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
${notification_ep}    /notification
${notification_port}    9091
${VnfLcmOperationOccurrenceNotification}    {}
${VnfIdentifierCreationNotification}    {}
${VnfIdentifierDeletionNotification}    {}
${sleep_interval}    20s
${sleep_interval}    20s
 No newline at end of file
Loading