aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xplans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh9
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json14
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json19
-rw-r--r--tests/dcaegen2/prh-testcases/prh_tests.robot27
-rw-r--r--tests/dcaegen2/prh-testcases/resources/PrhLibrary.py2
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_library.robot6
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI.py49
-rw-r--r--tests/dcaegen2/prh-testcases/ssl_prh_tests.robot11
8 files changed, 101 insertions, 36 deletions
diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh
index 50b8a918..bed9742c 100755
--- a/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh
+++ b/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh
@@ -33,10 +33,15 @@ fi
set +e
-METRICS_FILE=${WORKSPACE}/archives/containers_logs/hv-ves-metrics.dump
+METRICS_FILE=${WORKSPACE}/archives/containers_logs/collector-metrics.dump
docker-compose exec hv-ves-collector curl -qs localhost:6060/monitoring/prometheus > ${METRICS_FILE}
-COMPOSE_LOGS_FILE=${WORKSPACE}/archives/containers_logs/docker-compose.log
+CONTAINER_LOGS=${WORKSPACE}/archives/containers_logs/
+COMPOSE_LOGS_FILE=${CONTAINER_LOGS}/docker-compose.log
+
+docker-compose logs hv-ves-collector > ${CONTAINER_LOGS}/hv-ves-collector.log
+docker-compose logs unencrypted-hv-ves-collector > ${CONTAINER_LOGS}/unencrypted-hv-ves-collector.log
+docker-compose logs dcae-app-simulator > ${CONTAINER_LOGS}/dcae-app-simulator.log
docker-compose logs > ${COMPOSE_LOGS_FILE}
docker-compose down
docker-compose rm -f
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json
new file mode 100644
index 00000000..c3089678
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json
@@ -0,0 +1,14 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"NOK6061ZW1",
+ "nfNamingCode": "nfNamingCode"
+ },
+ "pnfRegistrationFields": {
+ "serialNumber":"serialNumber",
+ "vendorName":"vendorName",
+ "modelNumber":"modelNumber",
+ "unitType":"unitType"
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json
new file mode 100644
index 00000000..9d730bf6
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json
@@ -0,0 +1,19 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName":"NOK6061ZW1",
+ "nfNamingCode": "nfNamingCode"
+ },
+ "pnfRegistrationFields": {
+ "serialNumber":"serialNumber",
+ "vendorName":"vendorName",
+ "modelNumber":"modelNumber",
+ "unitType":"unitType",
+ "additionalFields": {
+ "attachmentPoint": "bla-bla-30-3",
+ "svlan": "1005",
+ "cvlan": "678"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot
index 701a714d..31a7d0d8 100644
--- a/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -11,6 +11,8 @@ Resource ../../common.robot
*** Variables ***
${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP}
${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP}
+
+${VES_EVENT_PNF_REGISTRATION_SIMPLE} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json
${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
${EVENT_WITH_IPV4} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
${EVENT_WITH_IPV6} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
@@ -31,24 +33,25 @@ Valid DMaaP event can be converted to PNF_READY notification
[Documentation] PRH get valid event from DMaaP with required fields - PRH produce PNF_READY notification
[Tags] PRH Valid event
[Template] Valid event processing
- ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
- ${EVENT_WITH_IPV4}
- ${EVENT_WITH_IPV6}
- ${EVENT_WITHOUT_IPV6_FILED}
- ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_ALL_FILLED}
- ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_EMPTY}
- ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_ALL}
- ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_PARTIAL}
+ ${VES_EVENT_PNF_REGISTRATION_SIMPLE}
+ #${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+ #${EVENT_WITH_IPV4}
+ #${EVENT_WITH_IPV6}
+ #${EVENT_WITHOUT_IPV6_FILED}
+ #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_ALL_FILLED}
+ #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_EMPTY}
+ #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_ALL}
+ #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_PARTIAL}
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_WITH_MISSING_IPV4_AND_IPV6}
+ #${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}
+ #${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
diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index 6667bd78..0dd01dcb 100644
--- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
+++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -91,7 +91,7 @@ class PrhLibrary(object):
@staticmethod
def create_pnf_name(json_file):
json_to_python = json.loads(json_file)
- correlation_id = json_to_python.get("sourceName")
+ correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + '",' if "sourceName" in json_to_python["event"]["commonEventHeader"] else '",'
return correlation_id
@staticmethod
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
index 9d4dca2e..a6a01eb9 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -53,9 +53,9 @@ Check PNF_READY notification
Set PNF name in AAI
[Arguments] ${pnf_name}
${headers}= Create Dictionary Accept=application/json Content-Type=text/html
- #Log AAI url ${AAI_SIMULATOR_SETUP_URL}
- #Log Http headers ${headers}
- #Log PNF name ${pnf_name}
+ Log AAI url ${AAI_SIMULATOR_SETUP_URL}
+ Log Http headers ${headers}
+ Log PNF name ${pnf_name}
${resp}= Put Request ${aai_setup_session} /set_pnf headers=${headers} data=${pnf_name}
Should Be Equal As Strings ${resp.status_code} 200
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index 91a93de5..27883655 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -1,4 +1,5 @@
import logging
+import json
import sys
import re
import time
@@ -15,42 +16,62 @@ logging.basicConfig(
logger = logging.getLogger('AAI-simulator-logger')
-pnfs = 'Empty'
-pnf_entry = 'Empty'
+pnf_name = 'Empty'
+pnf_entry = {}
+
+
+def _mark_response_as_http_ok(http_endpoint):
+ logger.info('Execution status 200')
+ httpServerLib.header_200_and_json(http_endpoint)
+
class AAISetup(BaseHTTPRequestHandler):
def do_PUT(self):
logger.info('AAI SIM Setup Put execution')
if re.search('/set_pnf', self.path):
- global pnfs
- content_length = int(self.headers['Content-Length'])
- pnfs = self.rfile.read(content_length)
- logger.info('Execution status 200')
- httpServerLib.header_200_and_json(self)
+ global pnf_name
+ content_length = self._get_content_length()
+ pnf_name = self.rfile.read(content_length)
+ _mark_response_as_http_ok(self)
if re.search('/set_pnf_entry',self.path):
- logger.info('Execution status 200')
- httpServerLib.header_200_and_json(self)
+ global pnf_entry
+ content_length = self._get_content_length()
+ pnf_entry = json.loads(self.rfile.read(content_length))
+ _mark_response_as_http_ok(self)
return
def do_POST(self):
logger.info('AAI SIM Setup Post execution')
if re.search('/reset', self.path):
- global pnfs
- pnfs = 'Empty'
- logger.info('Execution status 200')
- httpServerLib.header_200_and_json(self)
+ global pnf_name
+ pnf_name = 'Empty'
+ _mark_response_as_http_ok(self)
return
+ def _get_content_length(self):
+ return int(self.headers['Content-Length'])
+
class AAIHandler(BaseHTTPRequestHandler):
+ def do_GET(self):
+ logger.info('AAI SIM Get execution')
+ full_request_path = '/aai/v12/network/pnfs/pnf/' + pnf_name
+ if re.search(full_request_path, self.path):
+ _mark_response_as_http_ok(self)
+ body = json.dumps(pnf_entry)
+ logger.info('AAI SIM Get json prepared')
+ self.wfile.write(body.encode())
+ return
+
+
def do_PATCH(self):
logger.info('AAI SIM Patch execution')
- pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode()
+ pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnf_name
if re.search('wrong_aai_record', self.path):
self.send_response(400)
logger.info('Execution status 400')
diff --git a/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot b/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot
index 49d2c45a..111a4fbd 100644
--- a/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot
@@ -11,6 +11,8 @@ Resource ../../common.robot
*** Variables ***
${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP}
${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP}
+
+${VES_EVENT_PNF_REGISTRATION_SIMPLE} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json
${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
${EVENT_WITH_IPV4} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json
${EVENT_WITH_IPV6} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json
@@ -21,7 +23,8 @@ Valid DMaaP event can be converted to PNF_READY notification with ssl connection
[Documentation] PRH get valid event from DMaaP with required fields - PRH produce PNF_READY notification
[Tags] PRH Valid event
[Template] Valid event processing
- ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
- ${EVENT_WITH_IPV4}
- ${EVENT_WITH_IPV6}
- ${EVENT_WITHOUT_IPV6_FILED}
+ ${VES_EVENT_PNF_REGISTRATION_SIMPLE}
+ #${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+ #${EVENT_WITH_IPV4}
+ #${EVENT_WITH_IPV6}
+ #${EVENT_WITHOUT_IPV6_FILED}