diff options
Diffstat (limited to 'test/csit/tests')
63 files changed, 1302 insertions, 461 deletions
diff --git a/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot b/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot index dae48a9f5..78e352229 100644 --- a/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot +++ b/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot @@ -7,7 +7,7 @@ Library json ${MESSAGE} {"ping": "ok"} #global variables -${generatedAID} + *** Test Cases *** SMS Check SMS API Docker Container diff --git a/test/csit/tests/appc/cdt/cdt.robot b/test/csit/tests/appc/cdt/cdt.robot index 03ba3a4f9..b33bfe778 100644 --- a/test/csit/tests/appc/cdt/cdt.robot +++ b/test/csit/tests/appc/cdt/cdt.robot @@ -43,11 +43,14 @@ | | Click Link | MY VNFs # Verify button element is ready before clicking it. | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME} -| | Click Button | Create New VNF Type or VNFC Type -| | Page Should Contain | Enter VNF type and VNFC to proceed +#| | Click Button | Create New VNF Type or VNFC Type +| | Click Button | Create New VNF Type +#| | Page Should Contain | Enter VNF type and VNFC to proceed +| | Page Should Contain | Enter VNF Type | | Page Should Contain Element | id=vnfType # Proceed without entering any new information -| | Click Button | Proceed anyway +#| | Click Button | Proceed anyway +| | Click Button | Proceed To Upload | | Page Should Contain Element | id=cmbAction | | Click Button | Upload Reference File | | Choose File | id=inputFile | ${CURDIR}/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json @@ -66,8 +69,10 @@ | | Click Link | MY VNFs # Verify button element is ready before clicking it. | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME} -| | Click Button | Create New VNF Type or VNFC Type -| | Page Should Contain | Enter VNF type and VNFC to proceed +#| | Click Button | Create New VNF Type or VNFC Type +| | Click Button | Create New VNF Type +#| | Page Should Contain | Enter VNF type and VNFC to proceed +| | Page Should Contain | Enter VNF Type | | Page Should Contain Element | id=vnfType # Create a date to use in VNF Type to make it unique | | ${THEDATE} | Get Current Date | result_format=%m%d%H%M%S | exclude_millis=True @@ -93,7 +98,8 @@ | | Click Link | MY VNFs # Verify button element is ready before clicking it. | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME} -| | Click Button | Create New VNF Type or VNFC Type +#| | Click Button | Create New VNF Type or VNFC Type +| | Click Button | Create New VNF Type | | Wait Until Page Contains Element | id=vnfType | ${LONGTIME} # Create a date to use in VNF Type to make it unique | | ${THEDATE} | Get Current Date | result_format=%m%d%H%M%S | exclude_millis=True @@ -142,14 +148,15 @@ | | Click Link | MY VNFs # Verify button element is ready before clicking it. | | Wait Until Page Contains Element | xpath=(//*[@class='mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary']) | ${LONGTIME} -| | Click Button | Create New VNF Type or VNFC Type +#| | Click Button | Create New VNF Type or VNFC Type +| | Click Button | Create New VNF Type | | Wait Until Page Contains Element | id=vnfType | ${LONGTIME} # Create a date to use in VNF Type to make it unique | | ${THEDATE} | Get Current Date | result_format=%m%d%H%M%S | exclude_millis=True | | Input Text | id=vnfType | csit${THEDATE} # Check the box indicating VNFC templates | | Select Checkbox | id=vnfcRequired -| | Input Text | id=vnfcType | csitVNFC +#| | Input Text | id=vnfcType | csitVNFC | | Click Button | Next | | Wait Until Page Contains Element | id=cmbAction | ${LONGTIME} # Populate the action and protocol diff --git a/test/csit/tests/appc/cdt/data/pd_Configure_vUSP - Revenue Assurance_0.0.1V.yaml b/test/csit/tests/appc/cdt/data/pd_Configure_vUSP - Revenue Assurance_0.0.1V.yaml index cea00f0f9..ced4a7c58 100755 --- a/test/csit/tests/appc/cdt/data/pd_Configure_vUSP - Revenue Assurance_0.0.1V.yaml +++ b/test/csit/tests/appc/cdt/data/pd_Configure_vUSP - Revenue Assurance_0.0.1V.yaml @@ -4,7 +4,7 @@ version: V1 vnf-parameter-list: - name: vnf_name type: null - description: dawnDescript + description: CSIT required: null default: null source: Manual diff --git a/test/csit/tests/appc/cdt/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json b/test/csit/tests/appc/cdt/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json index 90fd0acd5..416780615 100755 --- a/test/csit/tests/appc/cdt/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json +++ b/test/csit/tests/appc/cdt/data/reference_AllAction_HealthCheckAnsible_0.0.1V.json @@ -5,7 +5,7 @@ "action-level": "vnf", "scope": { "vnf-type": "csit", - "vnfc-type-list": [], + "vnfc-type-list": ["testvnftype"], "vnfc-type": "" }, "template": "Y", @@ -15,15 +15,15 @@ "port-number": "", "artifact-list": [ { - "artifact-name": "template_HealthCheck_dawnMay17_0.0.1V.json", + "artifact-name": "template_HealthCheck_csit_0.0.1V.json", "artifact-type": "config_template" }, { - "artifact-name": "pd_HealthCheck_dawnMay17_0.0.1V.yaml", + "artifact-name": "pd_HealthCheck_csit_0.0.1V.yaml", "artifact-type": "parameter_definitions" }, { - "artifact-name": "param_HealthCheck_dawnMay17_0.0.1V.json", + "artifact-name": "param_HealthCheck_csit_0.0.1V.json", "artifact-type": "param_values" } ], @@ -34,12 +34,12 @@ "action-level": "vnf", "scope": { "vnf-type": "csit", - "vnfc-type-list": [], + "vnfc-type-list": ["testvnftype"], "vnfc-type": "" }, "artifact-list": [ { - "artifact-name": "reference_AllAction_dawnMay17_0.0.1V.json", + "artifact-name": "reference_AllAction_csit_0.0.1V.json", "artifact-type": "reference_template" } ] diff --git a/test/csit/tests/appc/cdt/data/reference_AllAction_vUSP - Revenue Assurance_0.0.1V.json b/test/csit/tests/appc/cdt/data/reference_AllAction_vUSP - Revenue Assurance_0.0.1V.json index f78debef4..a575129f0 100755 --- a/test/csit/tests/appc/cdt/data/reference_AllAction_vUSP - Revenue Assurance_0.0.1V.json +++ b/test/csit/tests/appc/cdt/data/reference_AllAction_vUSP - Revenue Assurance_0.0.1V.json @@ -5,6 +5,7 @@ "action-level": "vnf", "scope": { "vnf-type": "vUSP - Revenue Assurance", + "vnf-type-list": "testvnftype", "vnfc-type": "" }, "template": "Y", @@ -61,7 +62,7 @@ "scope": { "vnf-type": "vUSP - Revenue Assurance", "vnfc-type": "", - "vnfc-type-list": [] + "vnfc-type-list": ["testvnftype"] }, "template": "Y", "vm": [], @@ -86,7 +87,7 @@ "scope": { "vnf-type": "vUSP - Revenue Assurance", "vnfc-type": "", - "vnfc-type-list": [] + "vnfc-type-list": ["testvnftype"] }, "template": "Y", "vm": [], @@ -111,7 +112,7 @@ "scope": { "vnf-type": "vUSP - Revenue Assurance", "vnfc-type": "", - "vnfc-type-list": [] + "vnfc-type-list": ["testvnftype"] }, "artifact-list": [ { @@ -121,4 +122,4 @@ ] } ] -}
\ No newline at end of file +} diff --git a/test/csit/tests/appc/healthcheck/LCM_HEALTHCHECK_TIMESTAMP.robot b/test/csit/tests/appc/healthcheck/LCM_HEALTHCHECK_TIMESTAMP.robot index cfba50b8d..1cea75e90 100644 --- a/test/csit/tests/appc/healthcheck/LCM_HEALTHCHECK_TIMESTAMP.robot +++ b/test/csit/tests/appc/healthcheck/LCM_HEALTHCHECK_TIMESTAMP.robot @@ -14,8 +14,8 @@ ${var} APPC LCM API HEALTHCHECK [Documentation] APPC LCM API HEALTHCHECK Start Virtual Display 1920 1080 - Open Browser http://admin:admin@localhost:8282/apidoc/explorer/index.html chrome - Maximize Browser Window + Open Browser http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@localhost:8282/apidoc/explorer/index.html chrome +# Maximize Browser Window # Click Element xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img Reload Page diff --git a/test/csit/tests/appc/healthcheck/LCM_VM_RESTART_TIMESTAMP.robot b/test/csit/tests/appc/healthcheck/LCM_VM_RESTART_TIMESTAMP.robot index 98a8e584c..7968d5526 100644 --- a/test/csit/tests/appc/healthcheck/LCM_VM_RESTART_TIMESTAMP.robot +++ b/test/csit/tests/appc/healthcheck/LCM_VM_RESTART_TIMESTAMP.robot @@ -13,8 +13,8 @@ ${var} APPC LCM API VM RESTART [Documentation] APPC LCM API VM RESTART Start Virtual Display 1920 1080 - Open Browser http://admin:admin@localhost:8282/apidoc/explorer/index.html chrome - Maximize Browser Window + Open Browser http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@localhost:8282/apidoc/explorer/index.html chrome +# Maximize Browser Window # Click Element xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img Reload Page diff --git a/test/csit/tests/appc/healthcheck/LCM_VNF_RESTART_TIMESTAMP.robot b/test/csit/tests/appc/healthcheck/LCM_VNF_RESTART_TIMESTAMP.robot index 0f550d343..93c72d725 100644 --- a/test/csit/tests/appc/healthcheck/LCM_VNF_RESTART_TIMESTAMP.robot +++ b/test/csit/tests/appc/healthcheck/LCM_VNF_RESTART_TIMESTAMP.robot @@ -16,8 +16,8 @@ ${var} APPC LCM API VNF RESTART [Documentation] APPC LCM API VNF RESTART Start Virtual Display 1920 1080 - Open Browser http://admin:admin@localhost:8282/apidoc/explorer/index.html chrome - Maximize Browser Window + Open Browser http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@localhost:8282/apidoc/explorer/index.html chrome +# Maximize Browser Window # Click Element xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img Reload Page diff --git a/test/csit/tests/common.robot b/test/csit/tests/common.robot index 944be6b9f..8af66a5df 100644 --- a/test/csit/tests/common.robot +++ b/test/csit/tests/common.robot @@ -1,22 +1,29 @@ #Robot functions that will be shared also with other tests +*** Settings *** +Library OperatingSystem *** Keywords *** json_from_file #Robot function to extract the json object from a file [Arguments] ${file_path} - ${json_file}= Get file ${file_path} + ${json_file}= Get File ${file_path} ${json_object}= Evaluate json.loads('''${json_file}''') json - [return] ${json_object} + [Return] ${json_object} string_from_json #Robot function to transform the json object to a string [Arguments] ${json_value} ${json_string}= Stringify Json ${json_value} - [return] ${json_string} + [Return] ${json_string} random_ip #Robot function to generate a random IP [Arguments] ${numbers}= Evaluate random.sample([x for x in range(1, 256)], 4) random ${generated_ip}= Catenate ${numbers[0]}.${numbers[1]}.${numbers[2]}.${numbers[3]} - [return] ${generated_ip}
\ No newline at end of file + [Return] ${generated_ip} + +Get Data From File + [Arguments] ${file} + ${data}= Get File ${file} + [Return] ${data} diff --git a/test/csit/tests/dcae-bulkpm/testcases/__init__.robot b/test/csit/tests/dcae-bulkpm/testcases/__init__.robot new file mode 100644 index 000000000..7114fd447 --- /dev/null +++ b/test/csit/tests/dcae-bulkpm/testcases/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation 5G Bulk PM E2E Testcases diff --git a/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json new file mode 100644 index 000000000..96068e39a --- /dev/null +++ b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json @@ -0,0 +1,30 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1", + "domain": "notification", + "eventName": "Noti_RnNode-Ericsson_FileReady", + "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1", + "lastEpochMicrosec": 8745745764578, + "priority": "Normal", + "reportingEntityName": "otenb5309", + "sequence": 0, + "sourceName": "oteNB5309", + "startEpochMicrosec": 8745745764578, + "timeZoneOffset": "UTC+05.30" + }, + "notificationFields": { + "changeIdentifier": "PM_MEAS_FILES", + "changeType": "FileReady", + "notificationFieldsVersion": "2.0", + "additionalFields": + { + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz", + "compression": "gzip", + "fileformatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V10" + } + } + } + }
\ No newline at end of file diff --git a/test/csit/tests/dcae-bulkpm/testcases/e2e.robot b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot new file mode 100644 index 000000000..69c795341 --- /dev/null +++ b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Testing E2E VES,Dmaap,DFC,DR with File Ready event feed from xNF +Library RequestsLibrary +Library OperatingSystem +Library Collections +Resource resources/ves_keywords.robot + + +*** Variables *** +${VESC_URL} http://%{VESC_IP}:8080 +${GLOBAL_APPLICATION_ID} robot-ves +${VES_ANY_EVENT_PATH} /eventListener/v7 +${HEADER_STRING} content-type=application/json +${EVENT_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json + +${TARGETURL_TOPICS} http://${DMAAP_MR_IP}:3904/topics +${TARGETURL_SUBSCR} http://${DMAAP_MR_IP}:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12?timeout=1000 +*** Test Cases *** + +Send VES File Ready Event to VES Collector + [Tags] DCAE-VESC-R1 + [Documentation] Post single event and expect 200 Response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + ${resp}= Publish Event To VES Collector ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 202 + +Check VES Notification Topic is existing in Message Router + [Documentation] Get the count of the Topics + [Timeout] 1 minute + Sleep 10s + ${resp}= GetCall ${TARGETURL_TOPICS} + log ${TARGETURL_TOPICS} + log 'JSON Response Code :'${resp} + ${topics}= Evaluate $resp.json().get('topics') + log ${topics} + ${ListLength}= Get Length ${topics} + log ${ListLength} + List Should Contain Value ${topics} unauthenticated.VES_NOTIFICATION_OUTPUT diff --git a/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py b/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py new file mode 100644 index 000000000..d1ec9811d --- /dev/null +++ b/test/csit/tests/dcae-bulkpm/testcases/resources/VesLibrary.py @@ -0,0 +1,25 @@ +''' +Created on Aug 18, 2017 + +@author: sw6830 +''' +from robot.api import logger +from Queue import Queue +import uuid, time, json, threading,os, platform, subprocess,paramiko + +class VesLibrary(object): + + def __init__(self): + pass + + def create_header_from_string(self, dictStr): + logger.info("Enter create_header_from_string: dictStr") + return dict(u.split("=") for u in dictStr.split(",")) + + def Generate_UUID(self): + """generate a uuid""" + return uuid.uuid4() + +if __name__ == '__main__': + lib = VesLibrary() + time.sleep(100000)
\ No newline at end of file diff --git a/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot b/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot new file mode 100644 index 000000000..76bc33f47 --- /dev/null +++ b/test/csit/tests/dcae-bulkpm/testcases/resources/ves_keywords.robot @@ -0,0 +1,39 @@ + *** Settings *** +Documentation The main interface for interacting with VES. It handles low level stuff like managing the http request library and VES required fields +Library RequestsLibrary +Library ../resources/VesLibrary.py +Library OperatingSystem +Library Collections +Library requests +Library Collections +Library String + +*** Variables *** + +*** Keywords *** + +Get Event Data From File + [Arguments] ${jsonfile} + ${data}= OperatingSystem.Get File ${jsonfile} + #Should Not Be_Equal ${data} None + [return] ${data} + +Publish Event To VES Collector + [Documentation] Send an event to VES Collector + [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} + Log Creating session ${url} + ${session}= Create Session dcaegen2-d1 ${url} + ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + #Log Received response from dcae ${resp.json()} + [return] ${resp} +PostCall + [Arguments] ${url} ${data} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests + [Return] ${resp} + +GetCall + [Arguments] ${url} + ${resp}= Evaluate requests.get('${url}') requests + [Return] ${resp} +
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot index 1b832f27d..15c1c4896 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot @@ -11,21 +11,47 @@ Test Teardown VES-HV Collector Test Shutdown Client Authorization Suite Setup Log Started Suite: VES-HV Client Authorization ${XNF_PORTS_LIST}= Create List 7000 - Configure Invalid xNF Simulators On Ports ${XNF_PORTS_LIST} + ${XNF_WITH_INVALID_CERTIFICATES}= Configure xNF Simulators ${XNF_PORTS_LIST} + ... should_use_valid_certs=${false} + Set Suite Variable ${XNF_WITH_INVALID_CERTIFICATES} + ${XNF_PORTS_LIST}= Create List 7001 + ${XNF_WITHOUT_SSL}= Configure xNF Simulators ${XNF_PORTS_LIST} + ... should_disable_ssl=${true} + Set Suite Variable ${XNF_WITHOUT_SSL} + ${XNF_PORTS_LIST}= Create List 7002 + ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}= Configure xNF Simulators ${XNF_PORTS_LIST} + ... should_disable_ssl=${true} + ... should_connect_to_unencrypted_hv_ves=${true} + Set Suite Variable ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES} Log Suite setup finished - *** Test Cases *** Authorization [Documentation] VES-HV Collector should not authorize XNF with invalid certificate and not route any message ... to topics - ${SIMULATORS_LIST}= Get Invalid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_VALID_MESSAGES_REQUEST} + Send Messages From xNF Simulators ${XNF_WITH_INVALID_CERTIFICATES} ${XNF_VALID_MESSAGES_REQUEST} + + Wait until keyword succeeds 60 sec 5 sec + ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_0} + +Unencrypted connection from client + [Documentation] VES-HV Collector should not authorize XNF trying to connect through unencrypted connection + + Send Messages From xNF Simulators ${XNF_WITHOUT_SSL} ${XNF_VALID_MESSAGES_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_0} +Unencrypted connection on both ends + [Documentation] When run without SSL turned on, VES-HV Collector should route all valid messages + ... from xNF trying to connect through unencrypted connection + + Send Messages From xNF Simulators ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES} ${XNF_VALID_MESSAGES_REQUEST} + + Wait until keyword succeeds 60 sec 5 sec + ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_5000} + *** Variables *** ${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios @@ -33,3 +59,4 @@ ${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcae ${XNF_VALID_MESSAGES_REQUEST} ${VES_HV_SCENARIOS}/authorization/xnf-valid-messages-request.json ${AMOUNT_0} 0 +${AMOUNT_5000} 5000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py index 0d1d928b5..c0dcd81d4 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py @@ -1,12 +1,19 @@ import requests from robot.api import logger +valid_status_codes = [ + requests.codes.ok, + requests.codes.accepted +] + + def session_without_env(): session = requests.Session() session.trust_env = False return session + def checkStatusCode(status_code, server_name): - if status_code != 200: + if status_code not in valid_status_codes: logger.error("Response status code from " + server_name + ": " + str(status_code)) - raise (Exception(server_name + " returned status code " + status_code))
\ No newline at end of file + raise (Exception(server_name + " returned status code " + status_code)) diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py index b2466d7ca..26d5a91c2 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py @@ -1,4 +1,3 @@ -from VesHvContainersUtilsLibrary import copy_to_container import HttpRequests import os import docker @@ -16,13 +15,22 @@ ONE_SECOND_IN_NANOS = 10 ** 9 class XnfSimulatorLibrary: - def start_xnf_simulators(self, list_of_ports, valid_certs=True): + def start_xnf_simulators(self, list_of_ports, + should_use_valid_certs=True, + should_disable_ssl=False, + should_connect_to_unencrypted_hv_ves=False): logger.info("Creating " + str(len(list_of_ports)) + " xNF Simulator containers") dockerClient = docker.from_env() - cert_name_prefix = "" if valid_certs else "invalid_" + self.pullImageIfAbsent(dockerClient) logger.info("Using image: " + SIMULATOR_IMAGE_FULL_NAME) - simulators_addresses = self.create_simulators(dockerClient, list_of_ports, cert_name_prefix) + + simulators_addresses = self.create_containers(dockerClient, + list_of_ports, + should_use_valid_certs, + should_disable_ssl, + should_connect_to_unencrypted_hv_ves) + self.assert_containers_startup_was_successful(dockerClient) dockerClient.close() return simulators_addresses @@ -35,34 +43,24 @@ class XnfSimulatorLibrary: "This can take a while.") dockerClient.images.pull(SIMULATOR_IMAGE_FULL_NAME) - def create_simulators(self, dockerClient, list_of_ports, cert_name_prefix): + def create_containers(self, + dockerClient, + list_of_ports, + should_use_valid_certs, + should_disable_ssl, + should_connect_to_unencrypted_hv_ves): simulators_addresses = [] for port in list_of_ports: - container = self.run_simulator(dockerClient, port, - collector_certs_lookup_dir + cert_name_prefix + "client.crt", - collector_certs_lookup_dir + cert_name_prefix + "client.key", - collector_certs_lookup_dir + cert_name_prefix + "trust.crt" - ) - + xnf = XnfSimulator(port, should_use_valid_certs, should_disable_ssl, should_connect_to_unencrypted_hv_ves) + container = self.run_simulator(dockerClient, xnf) logger.info("Started container: " + container.name + " " + container.id) - simulators_addresses.append(container.name + ":" + port) + simulators_addresses.append(container.name + ":" + xnf.port) return simulators_addresses - def run_simulator(self, dockerClient, port, client_crt_path, client_key_path, client_trust_store): - xNF_startup_command = ["--listen-port", port, - "--ves-host", "ves-hv-collector", - "--ves-port", "6061", - "--cert-file", client_crt_path, - "--private-key-file", client_key_path, - "--trust-cert-file", client_trust_store] - xNF_healthcheck_command = { - "interval": 5 * ONE_SECOND_IN_NANOS, - "timeout": 3 * ONE_SECOND_IN_NANOS, - "retries": 1, - "test": ["CMD", "curl", "--request", "GET", - "--fail", "--silent", "--show-error", - "localhost:" + port + "/healthcheck"] - } + def run_simulator(self, dockerClient, xnf): + xNF_startup_command = xnf.get_startup_command() + xNF_healthcheck_command = xnf.get_healthcheck_command() + port = xnf.port logger.info("Startup command: " + str(xNF_startup_command)) logger.info("Healthcheck command: " + str(xNF_healthcheck_command)) return dockerClient.containers.run(SIMULATOR_IMAGE_FULL_NAME, @@ -72,7 +70,7 @@ class XnfSimulatorLibrary: network="ves-hv-default", ports={port + "/tcp": port}, volumes=self.container_volumes(), - name="ves-hv-collector-xnf-simulator" + port) + name=xnf.container_name_prefix + port) def container_volumes(self): return {certificates_dir_path: {"bind": collector_certs_lookup_dir, "mode": 'rw'}} @@ -121,6 +119,46 @@ class XnfSimulatorLibrary: HttpRequests.checkStatusCode(resp.status_code, XNF_SIMULATOR_NAME) +class XnfSimulator: + container_name_prefix = "ves-hv-collector-xnf-simulator" + + def __init__(self, + port, + should_use_valid_certs, + should_disable_ssl, + should_connect_to_unencrypted_hv_ves): + self.port = port + cert_name_prefix = "" if should_use_valid_certs else "invalid_" + certificates_path_with_file_prefix = collector_certs_lookup_dir + cert_name_prefix + self.cert_path = certificates_path_with_file_prefix + "client.crt" + self.key_path = certificates_path_with_file_prefix + "client.key" + self.trust_cert_path = certificates_path_with_file_prefix + "trust.crt" + self.disable_ssl = should_disable_ssl + self.hv_collector_host = "unencrypted-ves-hv-collector" \ + if should_connect_to_unencrypted_hv_ves else "ves-hv-collector" + + def get_startup_command(self): + startup_command = ["--listen-port", self.port, + "--ves-host", self.hv_collector_host, + "--ves-port", "6061", + "--cert-file", self.cert_path, + "--private-key-file", self.key_path, + "--trust-cert-file", self.trust_cert_path] + if (self.disable_ssl): + startup_command.append("--ssl-disable") + return startup_command + + def get_healthcheck_command(self): + return { + "interval": 5 * ONE_SECOND_IN_NANOS, + "timeout": 3 * ONE_SECOND_IN_NANOS, + "retries": 1, + "test": ["CMD", "curl", "--request", "GET", + "--fail", "--silent", "--show-error", + "localhost:" + self.port + "/healthcheck"] + } + + class ContainerException(Exception): def __init__(self, message): super(ContainerException, self).__init__(message) diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot index 6153afa0a..89208e456 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot @@ -14,7 +14,7 @@ Test Teardown VES-HV Collector Test Shutdown Message Routing Suite Setup Log Started Suite: VES-HV Message Routing ${XNF_PORTS_LIST}= Create List 7000 - Configure Valid xNF Simulators On Ports ${XNF_PORTS_LIST} + Configure xNF Simulators Using Valid Certificates On Ports ${XNF_PORTS_LIST} Log Suite setup finished *** Test Cases *** @@ -22,8 +22,8 @@ Correct Messages Routing [Documentation] VES-HV Collector should route all valid messages to topics specified in configuration ... and do not change message payload generated in XNF simulator - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_FIXED_PAYLOAD_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_FIXED_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000} @@ -33,8 +33,8 @@ Correct Messages Routing Too big payload message handling [Documentation] VES-HV Collector should interrupt the stream when encountered message with too big payload - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_TOO_BIG_PAYLOAD_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_TOO_BIG_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed Less Equal Than ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000} @@ -43,8 +43,8 @@ Too big payload message handling Invalid wire frame message handling [Documentation] VES-HV Collector should skip messages with invalid wire frame - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_INVALID_WIRE_FRAME_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_WIRE_FRAME_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} @@ -54,8 +54,8 @@ Invalid wire frame message handling Invalid GPB data message handling [Documentation] VES-HV Collector should skip messages with invalid GPB data - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_INVALID_GPB_DATA_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_GPB_DATA_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} @@ -65,8 +65,8 @@ Invalid GPB data message handling Unsupported domain message handling [Documentation] VES-HV Collector should skip messages with unsupported domain - ${SIMULATORS_LIST}= Get Valid xNF Simulators 1 - Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_UNSUPPORTED_DOMAIN_REQUEST} + ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_UNSUPPORTED_DOMAIN_REQUEST} Wait until keyword succeeds 60 sec 5 sec ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot index 862a2bc6a..9b1982a6b 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot @@ -11,14 +11,14 @@ Test Teardown VES-HV Collector Test Shutdown Multiple Clients Handling Suite Setup Log Started Suite: VES-HV Multiple Clients Handling ${XNF_PORTS_LIST}= Create List 7000 7001 7002 - Configure Valid xNF Simulators On Ports ${XNF_PORTS_LIST} + Configure xNF Simulators Using Valid Certificates On Ports ${XNF_PORTS_LIST} Log Suite setup finished *** Test Cases *** Handle Multiple Connections [Documentation] VES-HV Collector should handle multiple incoming transmissions - ${SIMULATORS_LIST}= Get Valid xNF Simulators 3 + ${SIMULATORS_LIST}= Get xNF Simulators Using Valid Certificates 3 Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_SMALLER_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot index bc03de232..58f5cbc16 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -4,30 +4,28 @@ Library VesHvContainersUtilsLibrary Library Collections *** Keywords *** -Configure Valid xNF Simulators On Ports +Configure xNF Simulators Using Valid Certificates On Ports [Arguments] ${XNF_PORTS_LIST} - ${VALID_XNF_SIMULATORS_ADDRESSES}= Start Xnf Simulators ${XNF_PORTS_LIST} ${true} + ${VALID_XNF_SIMULATORS_ADDRESSES}= Configure xNF Simulators ${XNF_PORTS_LIST} Set Suite Variable ${VALID_XNF_SIMULATORS_ADDRESSES} - -Configure Invalid xNF Simulators On Ports +Configure xNF Simulators [Arguments] ${XNF_PORTS_LIST} - ${INVALID_XNF_SIMULATORS_ADDRESSES}= Start Xnf Simulators ${XNF_PORTS_LIST} ${false} - Set Suite Variable ${INVALID_XNF_SIMULATORS_ADDRESSES} - - -Get Valid xNF Simulators - [Arguments] ${AMOUNT} + ... ${should_use_valid_certs}=${true} + ... ${should_disable_ssl}=${false} + ... ${should_connect_to_unencrypted_hv_ves}=${false} + ${XNF_SIMULATORS_ADDRESSES}= Start Xnf Simulators ${XNF_PORTS_LIST} + ... ${should_use_valid_certs} + ... ${should_disable_ssl} + ... ${should_connect_to_unencrypted_hv_ves} + [Return] ${XNF_SIMULATORS_ADDRESSES} + +Get xNF Simulators Using Valid Certificates + [Arguments] ${AMOUNT}=1 ${SIMULATORS}= Get Slice From List ${VALID_XNF_SIMULATORS_ADDRESSES} 0 ${AMOUNT} [Return] ${SIMULATORS} -Get Invalid xNF Simulators - [Arguments] ${AMOUNT} - ${SIMULATORS}= Get Slice From List ${INVALID_XNF_SIMULATORS_ADDRESSES} 0 ${AMOUNT} - [Return] ${SIMULATORS} - - Send Messages From xNF Simulators [Arguments] ${XNF_HOSTS_LIST} ${MESSAGE_FILEPATH} :FOR ${HOST} IN @{XNF_HOSTS_LIST} diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json index c71793d7d..9aca4015c 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,9 +15,10 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", - "messagesAmount": 500000 + "messagesAmount": 5000 } ]
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json index fb53f50ec..642c7d564 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "FIXED_PAYLOAD", "messagesAmount": 25000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json index fb53f50ec..642c7d564 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "FIXED_PAYLOAD", "messagesAmount": 25000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json index 772b03bef..f38e9aa07 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 50000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json index d9cb4c2ec..22d48c5f5 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 @@ -23,7 +24,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -36,7 +37,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "INVALID_GPB_DATA", "messagesAmount": 100 @@ -44,7 +46,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -57,7 +59,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json index 772b03bef..f38e9aa07 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 50000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json index 88d4e325d..a7d221905 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 @@ -23,7 +24,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -36,7 +37,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "INVALID_WIRE_FRAME", "messagesAmount": 100 @@ -44,7 +46,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -57,7 +59,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json index 9d34a7e24..89f3e0672 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "FIXED_PAYLOAD", "messagesAmount": 15000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json index 625737e56..60c81a898 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "FIXED_PAYLOAD", "messagesAmount": 5000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json index b1c727a0c..54836bf38 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 @@ -23,7 +24,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -36,7 +37,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "TOO_BIG_PAYLOAD", "messagesAmount": 100 @@ -44,7 +46,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -57,7 +59,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json index 772b03bef..f38e9aa07 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 50000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json index e37e20d19..b3aada5bd 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json @@ -2,7 +2,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -15,7 +15,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 @@ -36,7 +37,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 100 @@ -44,7 +46,7 @@ { "commonEventHeader": { "version": "sample-version", - "domain": "HVRANMEAS", + "domain": "HVMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -57,7 +59,8 @@ "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", - "sourceName": "sample-source-name" + "sourceName": "sample-source-name", + "vesEventListenerVersion": "another-version" }, "messageType": "VALID", "messagesAmount": 25000 diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json index 3235a0c0e..b9e1a4b59 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json @@ -1,8 +1,8 @@ { - "kafkaBootstrapServers": "kafka:9092", - "routing": [ + "dmaap.kafkaBootstrapServers": "kafka:9092", + "collector.routing": [ { - "fromDomain": 11, + "fromDomain": "HVMEAS", "toTopic": "test-hv-ran-meas" } ] diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json new file mode 100644 index 000000000..2ffe356fc --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW2" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.17.123.234", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json new file mode 100644 index 000000000..c4a0e7271 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"ERI6061ZW3" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json new file mode 100644 index 000000000..16963e1bc --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.16.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json new file mode 100644 index 000000000..1e3afa9df --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW4" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json new file mode 100644 index 000000000..126987fd6 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.18.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json new file mode 100644 index 000000000..de1f576c8 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json new file mode 100644 index 000000000..4838f1b01 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json new file mode 100644 index 000000000..04ab7cebd --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.17.163.234", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json new file mode 100644 index 000000000..c87e188ff --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.16.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot index 5150a4b35..23d86663a 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot +++ b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot @@ -1,17 +1,24 @@ *** Settings *** Documentation Integration tests for PRH. ... PRH receive events from DMaaP and produce or not PNF_READY notification depends on required fields in received event. -Suite Setup Run keywords Create header -... Create sessions +Suite Setup Run keywords Create header Create sessions Library resources/PrhLibrary.py Resource resources/prh_library.robot +Resource ../../common.robot *** Variables *** ${DMAAP_SIMULATOR_URL} http://${DMAAP_SIMULATOR} ${AAI_SIMULATOR_URL} http://${AAI_SIMULATOR} ${PRH_URL} http://${PRH} -${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW1"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.16.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}} -${Not_json_format} "" +${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json +${EVENT_WITH_IPV4} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json +${EVENT_WITH_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json +${EVENT_WITH_MISSING_IPV4_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json +${EVENT_WITH_MISSING_SOURCENAME} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json +${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json +${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json +${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json +${Not_json_format} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json *** Test Cases *** Valid DMaaP event can be converted to PNF_READY notification @@ -19,37 +26,40 @@ Valid DMaaP event can be converted to PNF_READY notification [Tags] PRH Valid event [Template] Valid event processing ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} - {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW2"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.123.234", "oamV6IpAddress":""}}} - {"event": {"commonEventHeader": {"sourceName":"ERI6061ZW3"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334"}}} + ${EVENT_WITH_IPV4} + ${EVENT_WITH_IPV6} Invalid DMaaP event cannot be converted to PNF_READY notification [Documentation] PRH get invalid event from DMaaP with missing required fields - PRH does not produce PNF_READY notification [Tags] PRH Invalid event [Template] Invalid event processing - {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW4"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.18.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334"}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.163.234", "oamV6IpAddress":""}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334"}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}} + ${EVENT_WITH_MISSING_IPV4_AND_IPV6} + ${EVENT_WITH_MISSING_SOURCENAME} + ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} + ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} + ${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} Get valid event from DMaaP and record in AAI does not exist [Documentation] PRH get valid event from DMaaP with all required fields and in AAI record doesn't exist - PRH does not produce PNF_READY notification [Tags] PRH Missing AAI record [Timeout] 30s + ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} Set PNF name in AAI wrong_aai_record - Set event in DMaaP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log java.io.IOException: Connection closed prematurely Event in DMaaP is not JSON format [Documentation] PRH get not JSON format event from DMaaP - PRH does not produce PNF_READY notification [Tags] PRH - Set event in DMaaP ${Not_json_format} + ${data}= Get Data From File ${Not_json_format} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array: Get valid event from DMaaP and AAI is not responding [Documentation] PRH get valid event from DMaaP with all required fields and AAI is not responding - PRH does not produce PNF_READY notification [Tags] PRH AAI [Timeout] 180s + ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} Stop AAI - Set event in DMaaP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index c2a8b78a2..6a95c71e5 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -23,16 +23,16 @@ class PrhLibrary(object): json_to_python = json.loads(json_file) ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"] ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"] - header = json_to_python["event"]["commonEventHeader"]["sourceName"] - str_json = '{"sourceName":"' + header + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}' + correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"] + str_json = '{"correlationId":"' + correlationId + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}' python_to_json = json.dumps(str_json) return python_to_json.replace("\\", "")[1:-1] @staticmethod def create_pnf_name(json_file): json_to_python = json.loads(json_file) - header = json_to_python["event"]["commonEventHeader"]["sourceName"] - return header + correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"] + return correlationId @staticmethod def stop_aai(): @@ -43,4 +43,4 @@ class PrhLibrary(object): def create_invalid_notification(self, json_file): return self.create_pnf_ready_notification(json_file).replace("\":", "\": ")\ .replace("ipaddress-v4-oam", "oamV4IpAddress").replace("ipaddress-v6-oam", "oamV6IpAddress")\ - .replace("}", "\\\\n}") + .replace("}", "\\n}") diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot index fa8c0d052..73ce2a2c4 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -2,6 +2,7 @@ Library RequestsLibrary Library Collections Library PrhLibrary.py +Resource ../../../common.robot *** Keywords *** Create header @@ -17,18 +18,20 @@ Create sessions Invalid event processing [Arguments] ${input_invalid_event_in_dmaap} [Timeout] 30s - Set event in DMaaP ${input_invalid_event_in_dmaap} - ${invalid_notification}= Create invalid notification ${input_invalid_event_in_dmaap} - ${notification}= Catenate SEPARATOR= \\\\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} - Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} - + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${invalid_notification}= Create invalid notification ${data} + ${notification}= Catenate SEPARATOR= \\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} + Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} + Valid event processing [Arguments] ${input_valid_event_in_dmaap} [Timeout] 30s - ${posted_event_to_dmaap}= Create PNF_Ready notification ${input_valid_event_in_dmaap} - ${pnf_name}= Create PNF name ${input_valid_event_in_dmaap} + ${data}= Get Data From File ${input_valid_event_in_dmaap} + ${posted_event_to_dmaap}= Create PNF_Ready notification ${data} + ${pnf_name}= Create PNF name ${data} Set PNF name in AAI ${pnf_name} - Set event in DMaaP ${input_valid_event_in_dmaap} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${posted_event_to_dmaap} Check PRH log diff --git a/test/csit/tests/dcaegen2/testcases/dcae_ves.robot b/test/csit/tests/dcaegen2/testcases/dcae_ves.robot index 393359f54..daed35fa8 100644 --- a/test/csit/tests/dcaegen2/testcases/dcae_ves.robot +++ b/test/csit/tests/dcaegen2/testcases/dcae_ves.robot @@ -5,8 +5,9 @@ Library OperatingSystem Library Collections Library DcaeLibrary Resource resources/dcae_keywords.robot +Resource ../../common.robot Test Setup Cleanup VES Events -Suite Setup VES Collector Suite Setup DMaaP +Suite Setup Run keywords VES Collector Suite Setup DMaaP Create sessions Create header Suite Teardown VES Collector Suite Shutdown DMaaP *** Variables *** @@ -15,13 +16,12 @@ ${VESC_URL} http://%{VESC_IP}:8080 ${VES_ANY_EVENT_PATH} /eventListener/v5 ${VES_BATCH_EVENT_PATH} /eventListener/v5/eventBatch ${VES_THROTTLE_STATE_EVENT_PATH} /eventListener/v5/clientThrottlingState -${HEADER_STRING} content-type=application/json ${EVENT_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json ${EVENT_MEASURE_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json ${EVENT_DATA_FILE_BAD} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json ${EVENT_BATCH_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json ${EVENT_THROTTLING_STATE_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json -${EVENT_PNF_REGISTRATION} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_pnf_registration_event.json +${EVENT_PNF_REGISTRATION} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_pnf_registration_event.json #DCAE Health Check ${CONFIG_BINDING_URL} http://localhost:8443 @@ -30,22 +30,20 @@ ${CB_SERVICE_COMPONENT_PATH} /service_component/ ${VES_Service_Name1} dcae-controller-ves-collector ${VES_Service_Name2} ves-collector-not-exist -*** Test Cases *** +*** Test Cases *** VES Collector Health Check [Tags] DCAE-VESC-R1 [Documentation] Ves Collector Health Check ${uuid}= Generate UUID - ${session}= Create Session dcae ${VESC_URL} ${headers}= Create Dictionary Accept=*/* X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Get Request dcae /healthcheck headers=${headers} + ${resp}= Get Request ${suite_dcae_vesc_url_session} /healthcheck headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 Publish Single VES VoLTE Fault Event [Tags] DCAE-VESC-R1 [Documentation] Post single event and expect 200 Response - ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} - ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + ${evtdata}= Get Data From File ${EVENT_DATA_FILE} + ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 200 ${isEmpty}= Is Json Empty ${resp} @@ -56,9 +54,8 @@ Publish Single VES VoLTE Fault Event Publish Single VES VNF Measurement Event [Tags] DCAE-VESC-R1 [Documentation] Post single event and expect 200 Response - ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE} - ${headers}= Create Header From String ${HEADER_STRING} - ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + ${evtdata}= Get Data From File ${EVENT_MEASURE_FILE} + ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 200 ${isEmpty}= Is Json Empty ${resp} @@ -69,9 +66,8 @@ Publish Single VES VNF Measurement Event Publish VES VoLTE Fault Batch Events [Tags] DCAE-VESC-R1 [Documentation] Post batched events and expect 200 Response - ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} - ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata} + ${evtdata}= Get Data From File ${EVENT_BATCH_DATA_FILE} + ${resp}= Publish Event To VES Collector No Auth ${VES_BATCH_EVENT_PATH} ${evtdata} Should Be Equal As Strings ${resp.status_code} 200 #${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546025 @@ -80,10 +76,9 @@ Publish VES VoLTE Fault Batch Events Publish Single VES VoLTE Fault Event With Bad Data [Tags] DCAE-VESC-R1 [Documentation] Run with JSON Envent with missing comma to expect 400 response - ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE_BAD} - ${headers}= Create Header From String ${HEADER_STRING} + ${evtdata}= Get Data From File ${EVENT_DATA_FILE_BAD} Log Send HTTP Request with invalid Json Event Data - ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 400 ${isEmpty}= Is Json Empty ${resp} @@ -92,20 +87,18 @@ Publish Single VES VoLTE Fault Event With Bad Data Publish VES Event With Invalid Method [Tags] DCAE-VESC-R1 [Documentation] Use invalid Put instead of Post method to expect 405 response - ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} + ${evtdata}= Get Data From File ${EVENT_DATA_FILE} Log Send HTTP Request with invalid method Put instead of Post - ${resp}= Publish Event To VES Collector With Put Method No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + ${resp}= Publish Event To VES Collector With Put Method No Auth ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 404 Publish VES Event With Invalid URL Path [Tags] DCAE-VESC-R1 [Documentation] Use invalid url path to expect 404 response - ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} + ${evtdata}= Get Data From File ${EVENT_DATA_FILE} Log Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path - ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} /listener/v5/ ${headers} ${evtdata} + ${resp}= Publish Event To VES Collector No Auth /listener/v5/ ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 404 @@ -123,10 +116,9 @@ Publish VES Event With Invalid URL Path Publish Single VES Fault Event Over HTTPS [Tags] DCAE-VESC-R1 [Documentation] Post single event and expect 200 Response - ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} + ${evtdata}= Get Data From File ${EVENT_DATA_FILE} Log Login User=${VESC_HTTPS_USER}, Pd=${VESC_HTTPS_PD} - ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} sample1 sample1 + ${resp}= Publish Event To VES Collector ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 200 ${isEmpty}= Is Json Empty ${resp} @@ -137,9 +129,8 @@ Publish Single VES Fault Event Over HTTPS Publish Single VES Measurement Event Over HTTPS [Tags] DCAE-VESC-R1 [Documentation] Post single event and expect 200 Response - ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE} - ${headers}= Create Header From String ${HEADER_STRING} - ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + ${evtdata}= Get Data From File ${EVENT_MEASURE_FILE} + ${resp}= Publish Event To VES Collector ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 200 ${isEmpty}= Is Json Empty ${resp} @@ -150,9 +141,8 @@ Publish Single VES Measurement Event Over HTTPS Publish VES Fault Batch Events Over HTTPS [Tags] DCAE-VESC-R1 [Documentation] Post batched events and expect 202 Response - ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} - ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + ${evtdata}= Get Data From File ${EVENT_BATCH_DATA_FILE} + ${resp}= Publish Event To VES Collector ${VES_BATCH_EVENT_PATH} ${evtdata} Should Be Equal As Strings ${resp.status_code} 200 #${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546025 @@ -161,19 +151,17 @@ Publish VES Fault Batch Events Over HTTPS Publish VES Event With Invalid URL Path HTTPS [Tags] DCAE-VESC-R1 [Documentation] Use invalid url path to expect 404 response - ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} - ${headers}= Create Header From String ${HEADER_STRING} + ${evtdata}= Get Data From File ${EVENT_DATA_FILE} Log Send HTTP Request with invalid /eventlistener/v5/ instead of /eventListener/v5 path - ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} /eventlistener/v5 ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + ${resp}= Publish Event To VES Collector /eventlistener/v5 ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 404 Publish PNF Registration Event [Tags] DCAE-VESC-R1 [Documentation] Post PNF registration event and expect 200 Response - ${evtdata}= Get Event Data From File ${EVENT_PNF_REGISTRATION} - ${headers}= Create Header From String ${HEADER_STRING} - ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + ${evtdata}= Get Data From File ${EVENT_PNF_REGISTRATION} + ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata} Log Receive HTTP Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 200 ${isEmpty}= Is Json Empty ${resp} diff --git a/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py b/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py index db59557db..092b60817 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py +++ b/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py @@ -8,9 +8,13 @@ import posixpath import BaseHTTPServer import urllib import urlparse -import cgi, sys, shutil, mimetypes +import cgi +import sys +import shutil +import mimetypes from jsonschema import validate -import jsonschema, json +import jsonschema +import json import DcaeVariables import SimpleHTTPServer from robot.api import logger @@ -25,7 +29,7 @@ EvtSchema = None DMaaPHttpd = None -def cleanUpEvent(): +def clean_up_event(): sz = DcaeVariables.VESEventQ.qsize() for i in range(sz): try: @@ -33,8 +37,9 @@ def cleanUpEvent(): except: pass -def enqueEvent(evt): - if DcaeVariables.VESEventQ != None: + +def enque_event(evt): + if DcaeVariables.VESEventQ is not None: try: DcaeVariables.VESEventQ.put(evt) if DcaeVariables.IsRobotRun: @@ -46,12 +51,13 @@ def enqueEvent(evt): print (str(e)) return False return False - -def dequeEvent(waitSec=25): + + +def deque_event(wait_sec=25): if DcaeVariables.IsRobotRun: logger.console("Enter DequeEvent") try: - evt = DcaeVariables.VESEventQ.get(True, waitSec) + evt = DcaeVariables.VESEventQ.get(True, wait_sec) if DcaeVariables.IsRobotRun: logger.console("DMaaP Event dequeued - size=" + str(len(evt))) else: @@ -64,7 +70,8 @@ def dequeEvent(waitSec=25): else: print("DMaaP Event dequeue timeout") return None - + + class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_PUT(self): @@ -73,7 +80,7 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_POST(self): - respCode = 0 + resp_code = 0 # Parse the form data posted ''' form = cgi.FieldStorage( @@ -95,21 +102,21 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): ''' if 'POST' not in self.requestline: - respCode = 405 + resp_code = 405 ''' - if respCode == 0: + if resp_code == 0: if '/eventlistener/v5' not in self.requestline and '/eventlistener/v5/eventBatch' not in self.requestline and \ '/eventlistener/v5/clientThrottlingState' not in self.requestline: - respCode = 404 + resp_code = 404 - if respCode == 0: + if resp_code == 0: if 'Y29uc29sZTpaakprWWpsbE1qbGpNVEkyTTJJeg==' not in str(self.headers): - respCode = 401 + resp_code = 401 ''' - if respCode == 0: + if resp_code == 0: content_len = int(self.headers.getheader('content-length', 0)) post_body = self.rfile.read(content_len) @@ -123,21 +130,21 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): if indx != 0: post_body = post_body[indx:] - if enqueEvent(post_body) == False: + if not enque_event(post_body): print "enque event fails" global EvtSchema try: - if EvtSchema == None: - with open(DcaeVariables.CommonEventSchemaV5) as file: - EvtSchema = json.load(file) + if EvtSchema is None: + with open(DcaeVariables.CommonEventSchemaV5) as opened_file: + EvtSchema = json.load(opened_file) decoded_body = json.loads(post_body) jsonschema.validate(decoded_body, EvtSchema) except: - respCode = 400 + resp_code = 400 # Begin the response - if DcaeVariables.IsRobotRun == False: + if not DcaeVariables.IsRobotRun: print ("Response Message:") ''' @@ -154,18 +161,18 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): ''' - if respCode == 0: + if resp_code == 0: if 'clientThrottlingState' in self.requestline: self.send_response(204) else: self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() - #self.wfile.write("{'responses' : {'200' : {'description' : 'Success'}}}") + # self.wfile.write("{'responses' : {'200' : {'description' : 'Success'}}}") self.wfile.write("{'count': 1, 'serverTimeMs': 3}") self.wfile.close() else: - self.send_response(respCode) + self.send_response(resp_code) ''' self.end_headers() @@ -190,8 +197,7 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.wfile.write('\t%s=%s\n' % (field, form[field].value)) ''' return - - + def do_GET(self): """Serve a GET request.""" f = self.send_head() @@ -219,7 +225,6 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): """ path = self.translate_path(self.path) - f = None if os.path.isdir(path): parts = urlparse.urlsplit(self.path) if not parts.path.endswith('/'): @@ -268,18 +273,18 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): """ try: - list = os.listdir(path) + list_dir = os.listdir(path) except os.error: self.send_error(404, "No permission to list directory") return None - list.sort(key=lambda a: a.lower()) + list_dir.sort(key=lambda a: a.lower()) f = StringIO() displaypath = cgi.escape(urllib.unquote(self.path)) f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">') f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath) f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath) f.write("<hr>\n<ul>\n") - for name in list: + for name in list_dir: fullname = os.path.join(path, name) displayname = linkname = name # Append / for directories or @ for symbolic links @@ -301,7 +306,8 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.end_headers() return f - def translate_path(self, path): + @staticmethod + def translate_path(path): """Translate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system @@ -310,8 +316,8 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): """ # abandon query parameters - path = path.split('?',1)[0] - path = path.split('#',1)[0] + path = path.split('?', 1)[0] + path = path.split('#', 1)[0] # Don't forget explicit trailing slash when normalizing. Issue17324 trailing_slash = path.rstrip().endswith('/') path = posixpath.normpath(urllib.unquote(path)) @@ -327,7 +333,8 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): path += '/' return path - def copyfile(self, source, outputfile): + @staticmethod + def copyfile(source, outputfile): """Copy all data between two file objects. The SOURCE argument is a file object open for reading @@ -368,26 +375,26 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): return self.extensions_map[''] if not mimetypes.inited: - mimetypes.init() # try to read system mime.types + mimetypes.init() # try to read system mime.types extensions_map = mimetypes.types_map.copy() extensions_map.update({ - '': 'application/octet-stream', # Default + '': 'application/octet-stream', # Default '.py': 'text/plain', '.c': 'text/plain', '.h': 'text/plain', }) -def test(HandlerClass = DMaaPHandler, - ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0", port=3904): + +def test(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0", port=3904): print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5 - with open(DcaeVariables.CommonEventSchemaV5) as file: + with open(DcaeVariables.CommonEventSchemaV5) as opened_file: global EvtSchema - EvtSchema = json.load(file) + EvtSchema = json.load(opened_file) server_address = ('', port) - HandlerClass.protocol_version = protocol - httpd = ServerClass(server_address, HandlerClass) + handler_class.protocol_version = protocol + httpd = server_class(server_address, handler_class) global DMaaPHttpd DMaaPHttpd = httpd @@ -395,10 +402,10 @@ def test(HandlerClass = DMaaPHandler, sa = httpd.socket.getsockname() print "Serving HTTP on", sa[0], "port", sa[1], "..." - #httpd.serve_forever() + # httpd.serve_forever() + -def _main_ (HandlerClass = DMaaPHandler, - ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"): +def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"): if sys.argv[1:]: port = int(sys.argv[1]) @@ -406,18 +413,19 @@ def _main_ (HandlerClass = DMaaPHandler, port = 3904 print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5 - with open(DcaeVariables.CommonEventSchemaV5) as file: + with open(DcaeVariables.CommonEventSchemaV5) as opened_file: global EvtSchema - EvtSchema = json.load(file) + EvtSchema = json.load(opened_file) server_address = ('', port) - HandlerClass.protocol_version = protocol - httpd = ServerClass(server_address, HandlerClass) + handler_class.protocol_version = protocol + httpd = server_class(server_address, handler_class) sa = httpd.socket.getsockname() print "Serving HTTP on", sa[0], "port", sa[1], "..." httpd.serve_forever() - + + if __name__ == '__main__': - _main_()
\ No newline at end of file + _main_() diff --git a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py index e581f1b2c..b43ee29e2 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py +++ b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py @@ -5,24 +5,34 @@ Created on Aug 18, 2017 ''' from robot.api import logger from Queue import Queue -import uuid, time, datetime,json, threading,os, platform, subprocess,paramiko +import uuid +import time +import datetime +import json +import threading +import os +import platform +import subprocess +import paramiko import DcaeVariables import DMaaP + class DcaeLibrary(object): def __init__(self): pass - def setup_dmaap_server(self, portNum=3904): - if DcaeVariables.HttpServerThread != None: - DMaaP.cleanUpEvent() + @staticmethod + def setup_dmaap_server(port_num=3904): + if DcaeVariables.HttpServerThread is not None: + DMaaP.clean_up_event() logger.console("Clean up event from event queue before test") logger.info("DMaaP Server already started") return "true" DcaeVariables.IsRobotRun = True - DMaaP.test(port=portNum) + DMaaP.test(port=port_num) try: DcaeVariables.VESEventQ = Queue() DcaeVariables.HttpServerThread = threading.Thread(name='DMAAP_HTTPServer', target=DMaaP.DMaaPHttpd.serve_forever) @@ -34,8 +44,9 @@ class DcaeLibrary(object): print (str(e)) return "false" - def shutdown_dmaap(self): - if DcaeVariables.HTTPD != None: + @staticmethod + def shutdown_dmaap(): + if DcaeVariables.HTTPD is not None: DcaeVariables.HTTPD.shutdown() logger.console("DMaaP Server shut down") time.sleep(3) @@ -43,20 +54,23 @@ class DcaeLibrary(object): else: return "false" - def cleanup_ves_events(self): - if DcaeVariables.HttpServerThread != None: - DMaaP.cleanUpEvent() + @staticmethod + def cleanup_ves_events(): + if DcaeVariables.HttpServerThread is not None: + DMaaP.clean_up_event() logger.console("DMaaP event queue is cleaned up") return "true" logger.console("DMaaP server not started yet") return "false" - def enable_vesc_https_auth(self): + @staticmethod + def enable_vesc_https_auth(): + global client if 'Windows' in platform.system(): try: client = paramiko.SSHClient() client.load_system_host_keys() - #client.set_missing_host_key_policy(paramiko.WarningPolicy) + # client.set_missing_host_key_policy(paramiko.WarningPolicy) client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(os.environ['CSIT_IP'], port=22, username=os.environ['CSIT_USER'], password=os.environ['CSIT_PD']) @@ -73,42 +87,42 @@ class DcaeLibrary(object): time.sleep(5) return - def dmaap_message_receive(self, evtobj, action='contain'): + @staticmethod + def dmaap_message_receive(evtobj, action='contain'): - evtStr = DMaaP.dequeEvent() - while evtStr != None: - logger.console("DMaaP receive VES Event:\n" + evtStr) + evt_str = DMaaP.deque_event() + while evt_str != None: + logger.console("DMaaP receive VES Event:\n" + evt_str) if action == 'contain': - if evtobj in evtStr: - logger.info("DMaaP Receive Expected Publish Event:\n" + evtStr) + if evtobj in evt_str: + logger.info("DMaaP Receive Expected Publish Event:\n" + evt_str) return 'true' if action == 'sizematch': - if len(evtobj) == len(evtStr): + if len(evtobj) == len(evt_str): return 'true' if action == 'dictmatch': - evtDict = json.loads(evtStr) - if cmp(evtobj, evtDict) == 0: + evt_dict = json.loads(evt_str) + if cmp(evtobj, evt_dict) == 0: return 'true' - evtStr = DMaaP.dequeEvent() + evt_str = DMaaP.deque_event() return 'false' - - def create_header_from_string(self, dictStr): - logger.info("Enter create_header_from_string: dictStr") - return dict(u.split("=") for u in dictStr.split(",")) - - def is_json_empty(self, resp): + + @staticmethod + def is_json_empty(resp): logger.info("Enter is_json_empty: resp.text: " + resp.text) - if resp.text == None or len(resp.text) < 2: + if resp.text is None or len(resp.text) < 2: return 'True' return 'False' - def Generate_UUID(self): + @staticmethod + def generate_uuid(): """generate a uuid""" return uuid.uuid4() - def get_json_value_list(self, jsonstr, keyval): + @staticmethod + def get_json_value_list(jsonstr, keyval): logger.info("Enter Get_Json_Key_Value_List") - if jsonstr == None or len(jsonstr) < 2: + if jsonstr is None or len(jsonstr) < 2: logger.info("No Json data found") return [] try: @@ -122,12 +136,14 @@ class DcaeLibrary(object): print str(e) return [] - def generate_MilliTimestamp_UUID(self): + @staticmethod + def generate_millitimestamp_uuid(): """generate a millisecond timestamp uuid""" then = datetime.datetime.now() return int(time.mktime(then.timetuple())*1e3 + then.microsecond/1e3) - def test (self): + @staticmethod + def test(): import json from pprint import pprint @@ -138,7 +154,6 @@ class DcaeLibrary(object): pprint(data) - if __name__ == '__main__': ''' dictStr = "action=getTable,Accept=application/json,Content-Type=application/json,X-FromAppId=1234908903284" @@ -156,4 +171,3 @@ if __name__ == '__main__': ret = lib.setup_dmaap_server() print ret time.sleep(100000) - diff --git a/test/csit/tests/dcaegen2/testcases/resources/DcaeVariables.py b/test/csit/tests/dcaegen2/testcases/resources/DcaeVariables.py index 4d51a8f5a..a9456d0fa 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/DcaeVariables.py +++ b/test/csit/tests/dcaegen2/testcases/resources/DcaeVariables.py @@ -1,13 +1,14 @@ +import os -import os, time -def GetEnvironmentVariable(envVarstr): - return os.environ.get(envVarstr) +def get_environment_variable(env_varstr): + return os.environ.get(env_varstr) + DCAE_HEALTH_CHECK_URL = "http://135.205.228.129:8500" DCAE_HEALTH_CHECK_URL1 = "http://135.205.228.170:8500" -CommonEventSchemaV5 = GetEnvironmentVariable('WORKSPACE') + "/test/csit/tests/dcaegen2/testcases/assets/json_events/CommonEventFormat_28.3.json" +CommonEventSchemaV5 = get_environment_variable('WORKSPACE') + "/test/csit/tests/dcaegen2/testcases/assets/json_events/CommonEventFormat_28.3.json" HttpServerThread = None HTTPD = None diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot index 98b341529..6820050fe 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot @@ -1,4 +1,4 @@ - *** Settings *** +*** Settings *** Documentation The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields Library RequestsLibrary Library DcaeLibrary @@ -6,9 +6,23 @@ Library OperatingSystem Library Collections Variables ../resources/DcaeVariables.py Resource ../resources/dcae_properties.robot + *** Variables *** ${DCAE_HEALTH_CHECK_BODY} %{WORKSPACE}/test/csit/tests/dcae/testcases/assets/json_events/dcae_healthcheck.json + *** Keywords *** +Create sessions + [Documentation] Create all required sessions + Create Session dcae_vesc_url ${VESC_URL} + Set Suite Variable ${suite_dcae_vesc_url_session} dcae_vesc_url + ${auth}= Create List ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + Create Session dcae_vesc_url_https ${VESC_URL_HTTPS} auth=${auth} disable_warnings=1 + Set Suite Variable ${suite_dcae_vesc_url_https_session} dcae_vesc_url_https + +Create header + ${headers}= Create Dictionary Content-Type=application/json + Set Suite Variable ${suite_headers} ${headers} + Get DCAE Nodes [Documentation] Get DCAE Nodes from Consul Catalog #Log Creating session ${GLOBAL_DCAE_CONSUL_URL} @@ -22,7 +36,8 @@ Get DCAE Nodes ${NodeListLength}= Get Length ${NodeList} ${len}= Get Length ${NodeList} Should Not Be Equal As Integers ${len} 0 - [return] ${NodeList} + [Return] ${NodeList} + DCAE Node Health Check [Documentation] Perform DCAE Node Health Check [Arguments] ${NodeName} @@ -38,18 +53,22 @@ DCAE Node Health Check Should Not Be Equal As Integers ${len} 0 DCAE Check Health Status ${NodeName} ${StatusList[0]} Serf Health Status #Run Keyword if ${len} > 1 DCAE Check Health Status ${NodeName} ${StatusList[1]} Serf Health Status + DCAE Check Health Status [Arguments] ${NodeName} ${ItemStatus} ${CheckType} Should Be Equal As Strings ${ItemStatus} passing Log Node: ${NodeName} ${CheckType} check pass ok + VES Collector Suite Setup DMaaP [Documentation] Start DMaaP Mockup Server ${ret}= Setup DMaaP Server Should Be Equal As Strings ${ret} true + VES Collector Suite Shutdown DMaaP [Documentation] Shutdown DMaaP Mockup Server ${ret}= Shutdown DMaap Should Be Equal As Strings ${ret} true + Check DCAE Results [Documentation] Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN [Arguments] ${json} @@ -65,6 +84,7 @@ Check DCAE Results \ ${cells}= Get From Dictionary ${row} cells \ ${dict}= Make A Dictionary ${cells} ${columns} \ Dictionary Should Contain Item ${dict} healthTestStatus GREEN + Make A Dictionary [Documentation] Given a list of column names and a list of dictionaries, map columname=value [Arguments] ${columns} ${names} ${valuename}=value @@ -77,57 +97,49 @@ Make A Dictionary \ ${value}= Get From Dictionary ${valued} ${valueName} \ Set To Dictionary ${dict} ${name} ${value} [Return] ${dict} -Get Event Data From File - [Arguments] ${jsonfile} - ${data}= OperatingSystem.Get File ${jsonfile} - #Should Not Be_Equal ${data} None - [return] ${data} + Json String To Dictionary [Arguments] ${json_string} ${json_dict}= evaluate json.loads('''${json_string}''') json - [return] ${json_dict} + [Return] ${json_dict} + Dictionary To Json String [Arguments] ${json_dict} ${json_string}= evaluate json.dumps(${json_dict}) json - [return] ${json_string} + [Return] ${json_string} + Get DCAE Service Component Status [Documentation] Get the status of a DCAE Service Component [Arguments] ${url} ${urlpath} ${usr} ${passwd} ${auth}= Create List ${usr} ${passwd} ${session}= Create Session dcae-service-component ${url} auth=${auth} ${resp}= Get Request dcae-service-component ${urlpath} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector No Auth [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} - Log Creating session ${url} - ${session}= Create Session dcaegen2-d1 ${url} - ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Post Request ${suite_dcae_vesc_url_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd} - ${auth}= Create List ${user} ${pd} - Log Creating session ${url} - ${session}= Create Session dcaegen2-d1 ${url} auth=${auth} disable_warnings=1 - ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Post Request ${suite_dcae_vesc_url_https_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector With Put Method [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd} - ${auth}= Create List ${user} ${pd} - Log Creating session ${url} - ${session}= Create Session dcae-d1 ${url} auth=${auth} - ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Put Request ${suite_dcae_vesc_url_https_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector With Put Method No Auth [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} - Log Creating session ${url} - ${session}= Create Session dcae-d1 ${url} - ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Put Request ${suite_dcae_vesc_url_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot index 692488814..135ff263a 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot @@ -1,9 +1,8 @@ +*** Settings *** Documentation store all properties that can change or are used in multiple places here ... format is all caps with underscores between words and prepended with GLOBAL ... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. - - *** Variables *** ${GLOBAL_APPLICATION_ID} robot-dcaegen2 ${GLOBAL_DCAE_CONSUL_URL} http://135.205.228.129:8500 diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa.json b/test/csit/tests/optf-has/has/data/plan_with_hpa.json index bf314a9cb..21985776b 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_hpa.json +++ b/test/csit/tests/optf-has/has/data/plan_with_hpa.json @@ -1,8 +1,8 @@ -{ +{ "name":"vCPE-with-HPA", - "template":{ + "template":{ "homing_template_version":"2017-10-10", - "parameters":{ + "parameters":{ "service_name":"Residential vCPE", "service_id":"vcpe_service_id", "customer_lat":45.395968, @@ -11,58 +11,71 @@ "REQUIRED_DISK":100, "pnf_id":"some_pnf_id" }, - "locations":{ - "customer_loc":{ - "latitude":{ + "locations":{ + "customer_loc":{ + "latitude":{ "get_param":"customer_lat" }, - "longitude":{ + "longitude":{ "get_param":"customer_long" } } }, "demands":{ - "vG":[ - { + "vG":[ + { "inventory_provider":"aai", "inventory_type":"cloud" } ] }, "constraints":{ - "constraint_vg_customer":{ + "constraint_vg_customer":{ "type":"distance_to_location", - "demands":[ + "demands":[ "vG" ], - "properties":{ + "properties":{ "distance":"< 100 km", "location":"customer_loc" } }, - "hpa_constraint":{ + "hpa_constraint":{ "type":"hpa", - "demands":[ + "demands":[ "vG" ], - "properties":{ - "evaluate":[ - { - "flavorLabel":"flavor_label_1", - "flavorProperties":[ - { + "properties":{ + "evaluate":[ + { + "id":"vg_1", + "type":"vnfc", + "directives":[ + { + "type": "flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_1", + "attribute_value":"" + } + ] + } + ], + "flavorProperties":[ + { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score": "5", - "hpa-feature-attributes":[ - { + "directives": [], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numVirtualCpu", "hpa-attribute-value":"4", "operator":">=" }, - { + { "hpa-attribute-key":"virtualMemSize", "hpa-attribute-value":"4", "operator":">=", @@ -70,35 +83,36 @@ } ] }, - { + { "hpa-feature":"numa", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score": "5", - "hpa-feature-attributes":[ - { + "directives": [], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numaNodes", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-0", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-1", "hpa-attribute-value":"4", "operator":"=" }, - { + { "hpa-attribute-key":"numaMem-0", "hpa-attribute-value":"2", "operator":"=", "unit":"GB" }, - { + { "hpa-attribute-key":"numaMem-1", "hpa-attribute-value":"4", "operator":"=", @@ -106,19 +120,20 @@ } ] }, - { + { "hpa-feature":"cpuPinning", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score": "5", - "hpa-feature-attributes":[ - { + "directives": [], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"prefer", "operator":"=" }, - { + { "hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value":"dedicated", "operator":"=" @@ -127,22 +142,35 @@ } ] }, - { - "flavorLabel":"flavor_label_2", - "flavorProperties":[ - { + { + "id":"vg_2", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_2", + "attribute_value":"" + } + ] + } + ], + "flavorProperties":[ + { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score": "5", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numVirtualCpu", "hpa-attribute-value":"8", "operator":">=" }, - { + { "hpa-attribute-key":"virtualMemSize", "hpa-attribute-value":"16", "operator":">=", @@ -150,35 +178,36 @@ } ] }, - { + { "hpa-feature":"numa", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score": "5", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numaNodes", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-0", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-1", "hpa-attribute-value":"4", "operator":"=" }, - { + { "hpa-attribute-key":"numaMem-0", "hpa-attribute-value":"2", "operator":"=", "unit":"GB" }, - { + { "hpa-attribute-key":"numaMem-1", "hpa-attribute-value":"4", "operator":"=", @@ -186,14 +215,15 @@ } ] }, - { + { "hpa-feature":"ovsDpdk", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score": "5", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"v18.02", "operator":"=" @@ -206,17 +236,17 @@ } } }, - "optimization":{ - "minimize":{ - "sum":[ - { - "distance_between":[ + "optimization":{ + "minimize":{ + "sum":[ + { + "distance_between":[ "customer_loc", "vG" ] }, - { - "distance_between":[ + { + "distance_between":[ "customer_loc", "vG" ] diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_mandatory.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_mandatory.json index 80685ae8e..bb613abd8 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_mandatory.json +++ b/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_mandatory.json @@ -48,13 +48,26 @@ "properties":{ "evaluate":[ { - "flavorLabel":"flavor_label_1", + "id":"vg_1", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_1", + "attribute_value":"" + } + ] + } + ], "flavorProperties":[ { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "True", + "directives":[], "hpa-feature-attributes":[ { "hpa-attribute-key":"numVirtualCpu", @@ -74,6 +87,7 @@ "hpa-version":"v1", "architecture":"generic", "mandatory":"True", + "directives":[], "hpa-feature-attributes":[ { "hpa-attribute-key":"numaNodes", @@ -107,13 +121,26 @@ ] }, { - "flavorLabel":"flavor_label_2", + "id":"vg_2", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_2", + "attribute_value":"" + } + ] + } + ], "flavorProperties":[ { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "True", + "directives":[], "hpa-feature-attributes":[ { "hpa-attribute-key":"numVirtualCpu", @@ -133,6 +160,7 @@ "hpa-version":"v1", "architecture":"generic", "mandatory": "True", + "directives":[], "hpa-feature-attributes":[ { "hpa-attribute-key":"dataProcessingAccelerationLibrary", diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_optionals.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_optionals.json index 4672349d2..50c23ee8a 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_optionals.json +++ b/test/csit/tests/optf-has/has/data/plan_with_hpa_requirements_optionals.json @@ -1,8 +1,8 @@ -{ +{ "name":"vCPE-HPA-Requirement-Optional", - "template":{ + "template":{ "homing_template_version":"2017-10-10", - "parameters":{ + "parameters":{ "service_name":"Residential vCPE", "service_id":"vcpe_service_id", "customer_lat":45.395968, @@ -11,57 +11,70 @@ "REQUIRED_DISK":100, "pnf_id":"some_pnf_id" }, - "locations":{ - "customer_loc":{ - "latitude":{ + "locations":{ + "customer_loc":{ + "latitude":{ "get_param":"customer_lat" }, - "longitude":{ + "longitude":{ "get_param":"customer_long" } } }, - "demands":{ - "vG":[ - { + "demands":{ + "vG":[ + { "inventory_provider":"aai", "inventory_type":"cloud" } ] }, - "constraints":{ - "constraint_vg_customer":{ + "constraints":{ + "constraint_vg_customer":{ "type":"distance_to_location", - "demands":[ + "demands":[ "vG" ], - "properties":{ + "properties":{ "distance":"< 100 km", "location":"customer_loc" } }, - "hpa_constraint":{ + "hpa_constraint":{ "type":"hpa", - "demands":[ + "demands":[ "vG" ], - "properties":{ - "evaluate":[ - { - "flavorLabel":"flavor_label_1", - "flavorProperties":[ - { + "properties":{ + "evaluate":[ + { + "id":"vg_1", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_1", + "attribute_value":"" + } + ] + } + ], + "flavorProperties":[ + { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "True", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numVirtualCpu", "hpa-attribute-value":"4", "operator":">=" }, - { + { "hpa-attribute-key":"virtualMemSize", "hpa-attribute-value":"8", "operator":">=", @@ -69,13 +82,14 @@ } ] }, - { + { "hpa-feature":"instructionSetExtensions", "hpa-version":"v1", "architecture":"Intel64", "mandatory": "True", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["aes", "sse", "avx", "smt"], "operator":"ALL", @@ -83,35 +97,36 @@ } ] }, - { + { "hpa-feature":"numa", "hpa-version":"v1", "architecture":"generic", "mandatory":"False", "score":"3", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numaNodes", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-0", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-1", "hpa-attribute-value":"4", "operator":"=" }, - { + { "hpa-attribute-key":"numaMem-0", "hpa-attribute-value":"2", "operator":"=", "unit":"GB" }, - { + { "hpa-attribute-key":"numaMem-1", "hpa-attribute-value":"4", "operator":"=", @@ -121,21 +136,34 @@ } ] }, - { - "flavorLabel":"flavor_label_2", - "flavorProperties":[ - { + { + "id":"vg_2", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_2", + "attribute_value":"" + } + ] + } + ], + "flavorProperties":[ + { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "True", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numVirtualCpu", "hpa-attribute-value":"4", "operator":">=" }, - { + { "hpa-attribute-key":"virtualMemSize", "hpa-attribute-value":"8", "operator":">=", @@ -143,49 +171,51 @@ } ] }, - { + { "hpa-feature":"ovsDpdk", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", "score":"5", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"v18.02", "operator":"=" } ] }, - { + { "hpa-feature":"numa", "hpa-version":"v1", "architecture":"generic", "mandatory":"False", "score":"3", - "hpa-feature-attributes":[ - { + "directives":[], + "hpa-feature-attributes":[ + { "hpa-attribute-key":"numaNodes", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-0", "hpa-attribute-value":"2", "operator":"=" }, - { + { "hpa-attribute-key":"numaCpu-1", "hpa-attribute-value":"4", "operator":"=" }, - { + { "hpa-attribute-key":"numaMem-0", "hpa-attribute-value":"2", "operator":"=", "unit":"GB" }, - { + { "hpa-attribute-key":"numaMem-1", "hpa-attribute-value":"4", "operator":"=", @@ -199,11 +229,11 @@ } } }, - "optimization":{ - "minimize":{ - "sum":[ - { - "distance_between":[ + "optimization":{ + "minimize":{ + "sum":[ + { + "distance_between":[ "customer_loc", "vG" ] diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json new file mode 100644 index 000000000..4a6d3bc8d --- /dev/null +++ b/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json @@ -0,0 +1,267 @@ +{ + "name": "vCPE-HPA-Requirement-Optional", + "template": { + "homing_template_version": "2017-10-10", + "parameters": { + "service_name": "Residential vCPE", + "service_id": "vcpe_service_id", + "customer_lat": 45.395968, + "customer_long": -71.135344, + "REQUIRED_MEM": 4, + "REQUIRED_DISK": 100, + "pnf_id": "some_pnf_id" + }, + "locations": { + "customer_loc": { + "latitude": { + "get_param": "customer_lat" + }, + "longitude": { + "get_param": "customer_long" + } + } + }, + "demands": { + "vG": [ + { + "inventory_provider": "aai", + "inventory_type": "cloud" + } + ] + }, + "constraints": { + "constraint_vg_customer": { + "type": "distance_to_location", + "demands": [ + "vG" + ], + "properties": { + "distance": "< 100 km", + "location": "customer_loc" + } + }, + "hpa_constraint": { + "type": "hpa", + "demands": [ + "vG" + ], + "properties": { + "evaluate": [ + { + "id":"vg_1", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_1", + "attribute_value":"" + } + ] + } + ], + "flavorProperties": [ + { + "hpa-feature": "basicCapabilities", + "hpa-version": "v1", + "architecture": "generic", + "mandatory": "True", + "directives":[], + "hpa-feature-attributes": [ + { + "hpa-attribute-key": "numVirtualCpu", + "hpa-attribute-value": "4", + "operator": ">=" + }, + { + "hpa-attribute-key": "virtualMemSize", + "hpa-attribute-value": "8", + "operator": ">=", + "unit": "GB" + } + ] + }, + { + "hpa-feature": "instructionSetExtensions", + "hpa-version": "v1", + "architecture": "Intel64", + "mandatory": "True", + "directives":[], + "hpa-feature-attributes": [ + { + "hpa-attribute-key": "instructionSetExtensions", + "hpa-attribute-value": [ + "aes", + "sse", + "avx", + "smt" + ], + "operator": "ALL", + "unit": "" + } + ] + }, + { + "hpa-feature": "numa", + "hpa-version": "v1", + "architecture": "generic", + "mandatory": "False", + "score": "3", + "directives":[], + "hpa-feature-attributes": [ + { + "hpa-attribute-key": "numaNodes", + "hpa-attribute-value": "2", + "operator": "=" + }, + { + "hpa-attribute-key": "numaCpu-0", + "hpa-attribute-value": "2", + "operator": "=" + }, + { + "hpa-attribute-key": "numaCpu-1", + "hpa-attribute-value": "4", + "operator": "=" + }, + { + "hpa-attribute-key": "numaMem-0", + "hpa-attribute-value": "2", + "operator": "=", + "unit": "GB" + }, + { + "hpa-attribute-key": "numaMem-1", + "hpa-attribute-value": "4", + "operator": "=", + "unit": "GB" + } + ] + } + ] + }, + { + "id":"vg_2", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_2", + "attribute_value":"" + } + ] + } + ], + "flavorProperties": [ + { + "hpa-feature": "basicCapabilities", + "hpa-version": "v1", + "architecture": "generic", + "mandatory": "True", + "directives":[], + "hpa-feature-attributes": [ + { + "hpa-attribute-key": "numVirtualCpu", + "hpa-attribute-value": "4", + "operator": ">=" + }, + { + "hpa-attribute-key": "virtualMemSize", + "hpa-attribute-value": "8", + "operator": ">=", + "unit": "GB" + } + ] + }, + { + "hpa-feature": "ovsDpdk", + "hpa-version": "v1", + "architecture": "generic", + "mandatory": "False", + "score": "5", + "directives":[], + "hpa-feature-attributes": [ + { + "hpa-attribute-key": "dataProcessingAccelerationLibrary", + "hpa-attribute-value": "v18.02", + "operator": "=" + } + ] + }, + { + "hpa-feature": "numa", + "hpa-version": "v1", + "architecture": "generic", + "mandatory": "False", + "score": "3", + "directives":[], + "hpa-feature-attributes": [ + { + "hpa-attribute-key": "numaNodes", + "hpa-attribute-value": "2", + "operator": "=" + }, + { + "hpa-attribute-key": "numaCpu-0", + "hpa-attribute-value": "2", + "operator": "=" + }, + { + "hpa-attribute-key": "numaCpu-1", + "hpa-attribute-value": "4", + "operator": "=" + }, + { + "hpa-attribute-key": "numaMem-0", + "hpa-attribute-value": "2", + "operator": "=", + "unit": "GB" + }, + { + "hpa-attribute-key": "numaMem-1", + "hpa-attribute-value": "4", + "operator": "=", + "unit": "GB" + } + ] + } + ] + } + ] + } + } + }, + "optimization": { + "minimize": { + "sum": [ + { + "product": [ + 100, + { + "distance_between": [ + "customer_loc", + "vG" + ] + } + ] + }, + { + "product": [ + 200, + { + "hpa_score": [ + "vG" + ] + } + ] + } + ] + } + } + }, + "timeout": 5, + "limit": 3 +} diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_simple.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_simple.json index 25b226280..d343dc805 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_hpa_simple.json +++ b/test/csit/tests/optf-has/has/data/plan_with_hpa_simple.json @@ -38,13 +38,26 @@ "properties":{ "evaluate":[ { - "flavorLabel":"flavor_label_1", + "id":"vg_1", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_1", + "attribute_value":"" + } + ] + } + ], "flavorProperties":[ { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", + "directives":[], "score": "5", "hpa-feature-attributes":[ { @@ -65,6 +78,7 @@ "hpa-version":"v1", "architecture":"generic", "mandatory": "False", + "directives":[], "score": "5", "hpa-feature-attributes":[ { @@ -77,13 +91,26 @@ ] }, { - "flavorLabel":"flavor_label_2", + "id":"vg_2", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_2", + "attribute_value":"" + } + ] + } + ], "flavorProperties":[ { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "False", + "directives":[], "score": "5", "hpa-feature-attributes":[ { diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_unmatched.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_unmatched.json index 8a3198566..e95ecedde 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_hpa_unmatched.json +++ b/test/csit/tests/optf-has/has/data/plan_with_hpa_unmatched.json @@ -48,13 +48,26 @@ "properties":{ "evaluate":[ { - "flavorLabel":"flavor_label_1", + "id":"vg_1", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_1", + "attribute_value":"" + } + ] + } + ], "flavorProperties":[ { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory": "True", + "directives":[], "hpa-feature-attributes":[ { "hpa-attribute-key":"numVirtualCpu", @@ -72,13 +85,26 @@ ] }, { - "flavorLabel":"flavor_label_2", + "id":"vg_2", + "type":"vnfc", + "directives":[ + { + "type":"flavor_directives", + "attributes":[ + { + "attribute_name":"flavor_label_2", + "attribute_value":"" + } + ] + } + ], "flavorProperties":[ { "hpa-feature":"basicCapabilities", "hpa-version":"v1", "architecture":"generic", "mandatory":"True", + "directives":[], "hpa-feature-attributes":[ { "hpa-attribute-key":"numVirtualCpu", diff --git a/test/csit/tests/optf-has/has/optf_has_test.robot b/test/csit/tests/optf-has/has/optf_has_test.robot index deba6470e..3b3ee7a0e 100644 --- a/test/csit/tests/optf-has/has/optf_has_test.robot +++ b/test/csit/tests/optf-has/has/optf_has_test.robot @@ -482,6 +482,41 @@ GetPlanWithHpaUnmatched Should Be Equal As Integers ${resp.status_code} 200 Should Be Equal not found ${resultStatus} +# HPA Score Multi objective Optimization +SendPlanWithHpaScoreMultiObj + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_score_multi_objective.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 60s Wait Plan Resolution + +GetPlanWithHpaScoreMultiObj + [Documentation] It sends a REST GET request to capture recommendations + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + ${vim-id}= Convert To String ${response_json['plans'][0]['recommendations'][0]['vG']['candidate']['vim-id']} + # ${hpa_score}= Convert To String ${response_json['plans'][0]['recommendations']['vG']['hpa_score']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal done ${resultStatus} + Should Be Equal HPA-cloud_cloud-region-1 ${vim-id} + *** Keywords *** diff --git a/test/csit/tests/policy/apex-pdp/apex-pdp-test.robot b/test/csit/tests/policy/apex-pdp/apex-pdp-test.robot new file mode 100644 index 000000000..f1dea17d1 --- /dev/null +++ b/test/csit/tests/policy/apex-pdp/apex-pdp-test.robot @@ -0,0 +1,14 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Test Cases *** + +Call Apex Policy + Create Session apexSession http://${APEX_IP}:23324 max_retries=3 + ${data}= Get Binary File ${CURDIR}${/}data${/}event.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Put Request apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 diff --git a/test/csit/tests/policy/apex-pdp/data/event.json b/test/csit/tests/policy/apex-pdp/data/event.json new file mode 100644 index 000000000..9dbf2790b --- /dev/null +++ b/test/csit/tests/policy/apex-pdp/data/event.json @@ -0,0 +1,11 @@ +{ + "nameSpace": "org.onap.policy.apex.sample.events", + "name": "Event0000", + "version": "0.0.1", + "source": "REST_0", + "target": "apex", + "TestSlogan": "Test slogan for External Event0", + "TestMatchCase": 3, + "TestTimestamp": 1536363522018, + "TestTemperature": 9080.866 +} diff --git a/test/csit/tests/policy/suite1/global_properties.robot b/test/csit/tests/policy/suite1/global_properties.robot index 911fdaff9..60826bbc3 100644 --- a/test/csit/tests/policy/suite1/global_properties.robot +++ b/test/csit/tests/policy/suite1/global_properties.robot @@ -25,6 +25,6 @@ ${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pv ${GLOBAL_POLICY_SERVER_URL} https://%{PDP_IP}:8081 ${GLOBAL_POLICY_AUTH} dGVzdHBkcDphbHBoYTEyMw== ${GLOBAL_POLICY_CLIENTAUTH} cHl0aG9uOnRlc3Q= -${GLOBAL_POLICY_HEALTHCHECK_URL} http://%{POLICY_IP}:6969 +${GLOBAL_POLICY_HEALTHCHECK_URL} https://%{POLICY_IP}:6969 ${GLOBAL_POLICY_USERNAME} healthcheck ${GLOBAL_POLICY_PASSWORD} zb!XztG34 diff --git a/test/csit/tests/sdnc/healthcheck/test1.robot b/test/csit/tests/sdnc/healthcheck/test1.robot index 4bf3d25e7..c002a1892 100644 --- a/test/csit/tests/sdnc/healthcheck/test1.robot +++ b/test/csit/tests/sdnc/healthcheck/test1.robot @@ -14,32 +14,31 @@ ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} /operations/VNF-API:preload-vnf-topology Healthcheck API Create Session sdnc http://localhost:8282/restconf - ${data}= Get Binary File ${CURDIR}${/}data${/}data.json + ${data}= Get File ${CURDIR}${/}data${/}data.json &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json ${resp}= Post Request sdnc ${SDN_HEALTHCHECK_OPERATION_PATH} data=${data} headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200 - + Check SLI-API Create Session sdnc http://localhost:8282 &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json ${resp}= Get Request sdnc ${SDN_APIDOCS_URI} headers=${headers} - Log ${resp.content} - Should Contain ${resp.content} SLI-API + Log ${resp.text} + Should Contain ${resp.text} SLI-API Check VNF-API Create Session sdnc http://localhost:8282 &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json ${resp}= Get Request sdnc ${SDN_APIDOCS_URI} headers=${headers} - Log ${resp.content} - Should Contain ${resp.content} VNF-API + Log ${resp.text} + Should Contain ${resp.text} VNF-API Test Preload Create Session sdnc http://localhost:8282/restconf - ${data}= Get Binary File ${CURDIR}${/}data${/}preload.json + ${data}= Get File ${CURDIR}${/}data${/}preload.json &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json ${resp}= Post Request sdnc ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH} data=${data} headers=${headers} - Log ${resp.content} + Log ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200 - diff --git a/test/csit/tests/vid/resources/docker-compose.yml b/test/csit/tests/vid/resources/docker-compose.yml index 93b317001..879c23d47 100644 --- a/test/csit/tests/vid/resources/docker-compose.yml +++ b/test/csit/tests/vid/resources/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: vid-server: - image: nexus3.onap.org:10001/onap/vid:latest + image: nexus3.onap.org:10001/onap/vid:3.0-STAGING-latest environment: - VID_MYSQL_DBNAME=vid_openecomp_epsdk - VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U @@ -23,7 +23,6 @@ services: container_name: vid-mariadb volumes: - ${WORKSPACE}/data/clone/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf - - ${WORKSPACE}/data/clone/vid/lf_config/vid-schema.sql:/docker-entrypoint-initdb.d/vid-schema.sql - /var/lib/mysql sdc_simulator: |