Commit 404a7fce authored by Elian Kraja's avatar Elian Kraja
Browse files

Bug Fix on SOL002

parent cbe2eeb6
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Resource    environments/variables.txt 
Resource    environments/variables.txt 
Library    REST    ${VNF_SCHEMA}://${VNF_HOST}:${VNF_PORT} 
Library    REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}
...        spec=SOL002-VNFConfiguration-API.yaml
...        spec=SOL002-VNFConfiguration-API.yaml
Library    JSONLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Library    OperatingSystem
Library    OperatingSystem
Library    DependencyLibrary
Library    DependencyLibrary


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

*** Test Cases ***
*** Test Cases ***
POST Configuration - Method not implemented
POST Configuration - Method not implemented
    log    Trying to perform a POST. This method should not be implemented
    log    Trying to perform a POST. This method should not be implemented
+8 −37
Original line number Original line Diff line number Diff line
*** Variables ***
*** Variables ***
${VNFM_HOST}      localhost    # Hostname of the VNFM
${EM-VNF_HOST}      localhost    # Hostname of the NFVO
${VNFM_PORT}      8080    # Listening port of the VNFM
${EM-VNF_PORT}      8081    # Listening port of the NFVO
${VNF_HOST}      localhost    # Hostname of the NFVO
${EM-VNF_SCHEMA}    https
${VNF_PORT}      8081    # Listening port of the NFVO
${ACCEPT}         application/json
${VNFM_SCHEMA}    https
${AUTH_USAGE}     1
${VNF_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
${apiRoot}        /
${apiRoot}        /
${apiName}        vnfconfig
${apiName}        vnfconfig
${apiVersion}     v1
${apiVersion}     v1
${AUTH_USAGE}     1
${Etag}=    an etag
${WRONG_AUTHORIZATION}    Bearer    XXXXXWRONGXXXXX
${Etag_modified}=    a modified etag
${alarm_filter}       managedObjectId
${managedObjectId}    007c111c-38a1-42c0-a666-7475ecb1567c
${invalid_alarm_filter}    badFilter 
${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${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
${LccnSubscriptionRequest}    {}
${NVFM_DUPLICATION}    0
${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
${notification_ep}    /notification
${notification_port}    9091
${AlarmNotification}    {}
${AlarmClearedNotification}    {}
${AlarmListRebuiltNotification}    {}
${PerceivedSeverity}    CRITICAL
 No newline at end of file
+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
+13 −17
Original line number Original line Diff line number Diff line
@@ -5,10 +5,6 @@ Suite Teardown Terminate All Processes kill=true
Library    MockServerLibrary
Library    MockServerLibrary
Library    Process
Library    Process
Library    OperatingSystem
Library    OperatingSystem
Library    REST    ${CONSUMER_SCHEMA}://${CONSUMER_HOST}:${notification_port}

*** Variables ***
${sleep_interval}    20s


*** Test Cases ***
*** Test Cases ***
Deliver a notification - Alarm
Deliver a notification - Alarm
@@ -16,75 +12,75 @@ 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 Schema	POST  ${notification_ep}  body=${BODY}
    &{req}=  Create Mock Request Matcher Schema 	POST    ${callback_uri}  body=${BODY}
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Log  Cleaning the endpoint
    Clear Requests  ${notification_ep}
    Clear Requests  ${callback_uri}


Deliver a notification - Alarm Clearance
Deliver a notification - Alarm Clearance
    log    The POST method delivers a notification - Information of a VNF alarm.
    log    The POST method delivers a notification - Information of a VNF alarm.
    ${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 Schema	POST  ${notification_ep}  body=${BODY}
    &{req}=  Create Mock Request Matcher Schema	POST  ${callback_uri}  body=${BODY}
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Log  Cleaning the endpoint
    Clear Requests  ${notification_ep}
    Clear Requests  ${callback_uri}


Deliver a notification - Alarm List Rebuilt
Deliver a notification - Alarm List Rebuilt
    log    The POST method delivers a notification - Information of a VNF alarm.
    log    The POST method delivers a notification - Information of a VNF alarm.
    ${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 Schema	POST  ${notification_ep}  body=${BODY}
    &{req}=  Create Mock Request Matcher Schema	POST  ${callback_endpoint}  body=${BODY}
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Log  Verifying results
    Verify Mock Expectation  ${req}
    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
    log    The GET method allows the server to test the notification endpoint
    log    The GET method allows the server to test the notification endpoint
    &{req}=  Create Mock Request Matcher Schema	GET  ${notification_ep}    
    &{req}=  Create Mock Request Matcher Schema	GET  ${callback_endpoint}
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    &{rsp}=  Create Mock Response Schema	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Sleep  ${sleep_interval}
    Verify Mock Expectation  ${req}
    Verify Mock Expectation  ${req}
    Clear Requests  ${notification_ep}
    Clear Requests  ${callback_endpoint}


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  ${CONSUMER_SCHEMA}://${CONSUMER_HOST}:${notification_port}     #The API producer is set to NFVO according to SOL003-7.3.4
    Create Mock Session  ${callback_schema}://${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
+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ Create a new subscription


Create a new Subscription - DUPLICATION
Create a new Subscription - DUPLICATION
    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}"}
Loading