aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcaegen2')
-rw-r--r--tests/dcaegen2/prh-testcases/assets/aai-missing-entry/ves-event.json70
-rw-r--r--tests/dcaegen2/prh-testcases/assets/aai-not-responding/ves-event.json70
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json2
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/event_with_optional_registration_fields_all_filled.json2
-rw-r--r--tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json2
-rw-r--r--tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry-service-instance.json25
-rw-r--r--tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json66
-rw-r--r--tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json22
-rw-r--r--tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json8
-rw-r--r--tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json40
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-missing-field/invalid-ves-event.json30
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-logical-link.json14
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json2
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/ves-event.json74
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/ves-event.json72
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json2
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/ves-event.json74
-rw-r--r--tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/ves-event.json70
-rw-r--r--tests/dcaegen2/prh-testcases/prh_config_tests.robot33
-rw-r--r--tests/dcaegen2/prh-testcases/prh_tests.robot18
-rw-r--r--tests/dcaegen2/prh-testcases/resources/.env3
-rw-r--r--tests/dcaegen2/prh-testcases/resources/PrhLibrary.py170
-rw-r--r--tests/dcaegen2/prh-testcases/resources/docker-compose.yml11
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_config_library.robot43
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_library.robot107
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_sessions.robot25
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI.py16
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py65
28 files changed, 758 insertions, 378 deletions
diff --git a/tests/dcaegen2/prh-testcases/assets/aai-missing-entry/ves-event.json b/tests/dcaegen2/prh-testcases/assets/aai-missing-entry/ves-event.json
index 10ce41c5..3a768df2 100644
--- a/tests/dcaegen2/prh-testcases/assets/aai-missing-entry/ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/aai-missing-entry/ves-event.json
@@ -1,39 +1,37 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1540212137393,
- "sourceId": "val13",
- "eventId": "registration_40212137",
- "nfcNamingCode": "oam",
- "internalHeaderFields": {
- "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
- },
- "eventType": "pnfRegistration",
- "priority": "Normal",
- "version": "4.0.1",
- "reportingEntityName": "NOK6061ZW8",
- "sequence": 0,
- "domain": "pnfRegistration",
- "lastEpochMicrosec": 1540212137393,
- "eventName": "pnfRegistration_Nokia_5gDu",
- "vesEventListenerVersion": "7.0.1",
- "sourceName": "NOK6061ZW8",
- "nfNamingCode": "gNB"
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
},
- "pnfRegistrationFields": {
- "unitType": "val8",
- "serialNumber": "6061ZW9",
- "pnfRegistrationFieldsVersion": "2.0",
- "manufactureDate": "1540212137393",
- "modelNumber": "val6",
- "lastServiceDate": "1540212137393",
- "unitFamily": "BBU",
- "vendorName": "Nokia",
- "oamV4IpAddress": "val3",
- "oamV6IpAddress": "val4",
- "softwareVersion": "val7"
- }
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW8",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW8",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7"
}
}
-] \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/aai-not-responding/ves-event.json b/tests/dcaegen2/prh-testcases/assets/aai-not-responding/ves-event.json
index 10ce41c5..3a768df2 100644
--- a/tests/dcaegen2/prh-testcases/assets/aai-not-responding/ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/aai-not-responding/ves-event.json
@@ -1,39 +1,37 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1540212137393,
- "sourceId": "val13",
- "eventId": "registration_40212137",
- "nfcNamingCode": "oam",
- "internalHeaderFields": {
- "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
- },
- "eventType": "pnfRegistration",
- "priority": "Normal",
- "version": "4.0.1",
- "reportingEntityName": "NOK6061ZW8",
- "sequence": 0,
- "domain": "pnfRegistration",
- "lastEpochMicrosec": 1540212137393,
- "eventName": "pnfRegistration_Nokia_5gDu",
- "vesEventListenerVersion": "7.0.1",
- "sourceName": "NOK6061ZW8",
- "nfNamingCode": "gNB"
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
},
- "pnfRegistrationFields": {
- "unitType": "val8",
- "serialNumber": "6061ZW9",
- "pnfRegistrationFieldsVersion": "2.0",
- "manufactureDate": "1540212137393",
- "modelNumber": "val6",
- "lastServiceDate": "1540212137393",
- "unitFamily": "BBU",
- "vendorName": "Nokia",
- "oamV4IpAddress": "val3",
- "oamV6IpAddress": "val4",
- "softwareVersion": "val7"
- }
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW8",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW8",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7"
}
}
-] \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
index 13c564c1..cd3e73f1 100644
--- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json
@@ -13,7 +13,7 @@
"modelNumber": "modelNumber",
"unitType": "unitType",
"additionalFields": {
- "attachmentPoint": "bla-bla-30-3",
+ "attachment-point": "bla-bla-30-3",
"svlan": "1005",
"cvlan": "678"
}
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_optional_registration_fields_all_filled.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_optional_registration_fields_all_filled.json
index 9be02f10..0f2af3cd 100644
--- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_optional_registration_fields_all_filled.json
+++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_optional_registration_fields_all_filled.json
@@ -14,7 +14,7 @@
"modelNumber": "modelNumber",
"unitType": "unitType",
"additionalFields": {
- "attachmentPoint": "bla-bla-30-3",
+ "attachment-point": "bla-bla-30-3",
"svlan": "1005",
"cvlan": "678"
}
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
index 054774c5..97d2dffa 100644
--- 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
@@ -11,7 +11,7 @@
"modelNumber": "modelNumber",
"unitType": "unitType",
"additionalFields": {
- "attachmentPoint": "bla-bla-30-3",
+ "attachment-point": "bla-bla-30-3",
"svlan": "1005",
"cvlan": "678"
}
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry-service-instance.json b/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry-service-instance.json
new file mode 100644
index 00000000..6119ea8b
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry-service-instance.json
@@ -0,0 +1,25 @@
+{
+ "service-instance-id": "bbs_service",
+ "service-instance-name": "bbs_service",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "c71827e7-42fc-46ab-b059-22584c58108b",
+ "model-version-id": "8efe4a8a-6646-43e2-8807-a376ff22d2e0",
+ "resource-version": "1554127221722",
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pnf",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v12/network/pnfs/pnf/NOK6061ZW9",
+ "relationship-data": [
+ {
+ "relationship-key": "pnf.pnf-name",
+ "relationship-value": "NOK6061ZW9"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json
new file mode 100644
index 00000000..e01e26e6
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/aai-entry.json
@@ -0,0 +1,66 @@
+{
+ "pnf-name": "NOK6061ZW9",
+ "pnf-name2": "example-pnf-name2-val-58071",
+ "pnf-name2-source": "example-pnf-name2-source-val-22408",
+ "pnf-id": "example-pnf-id-val-55834",
+ "equip-type": "example-equip-type-val-5497",
+ "equip-vendor": "example-equip-vendor-val-85730",
+ "equip-model": "example-equip-model-val-38526",
+ "management-option": "example-management-option-val-15776",
+ "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556",
+ "sw-version": "example-sw-version-val-64239",
+ "in-maint": true,
+ "frame-id": "example-frame-id-val-76733",
+ "serial-number": "example-serial-number-val-79366",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665",
+ "inv-status": "example-inv-status-val-8477",
+ "prov-status": "example-prov-status-val-68268",
+ "nf-role": "example-nf-role-val-68489",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v12/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "Demonstration"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vFW"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "bbs_service"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "bbs_service"
+ }
+ ]
+ },
+ {
+ "related-to": "logical-link",
+ "relationship-label": "org.onap.relationships.inventory.BridgedTo",
+ "related-link": "/aai/v12/network/logical-links/logical-link/bbs-link",
+ "relationship-data": [
+ {
+ "relationship-key": "logical-link.link-name",
+ "relationship-value": "bbs-link"
+ }
+ ]
+ }
+ ]
+ }
+
+
+
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json
new file mode 100644
index 00000000..0e4f6ab1
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-logical-link.json
@@ -0,0 +1,22 @@
+{
+ "link-name": "bbs-link",
+ "in-maint": false,
+ "link-type": "attachment-point",
+ "relationship-list":
+ {
+ "relationship": [
+ {
+ "related-to": "pnf",
+ "relationship-label": "org.onap.relationships.inventory.BridgedTo",
+ "related-link": "/network/pnfs/pnf/NOK6061ZW9",
+ "relationship-data": [
+ {
+ "relationship-key": "pnf.pnf-name",
+ "relationship-value": "NOK6061ZW9"
+ }
+ ]
+ }
+ ]
+ }
+}
+
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json
new file mode 100644
index 00000000..5c77e125
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json
@@ -0,0 +1,8 @@
+[
+ {
+ "additionalFields": {
+ "attachment-point": "bbs-link"
+ },
+ "correlationId": "NOK6061ZW9"
+ }
+] \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json b/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json
new file mode 100644
index 00000000..5de986c5
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json
@@ -0,0 +1,40 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
+ },
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW9",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW9",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7",
+ "additionalFields": {
+ "attachment-point": "bbs-link"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-missing-field/invalid-ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-missing-field/invalid-ves-event.json
index 2bdc0570..dd135f4d 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-missing-field/invalid-ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-missing-field/invalid-ves-event.json
@@ -1,18 +1,16 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "sourceName": ""
- },
- "pnfRegistrationFields": {
- "oamV4IpAddress": "10.18.123.236",
- "oamV6IpAddress": "2001:0db8:85a3:0000:0000:8a2a:0370:7334",
- "serialNumber": "",
- "vendorName": "",
- "modelNumber": "",
- "unitType": "",
- "additionalFields": {}
- }
+{
+ "event": {
+ "commonEventHeader": {
+ "sourceName": ""
+ },
+ "pnfRegistrationFields": {
+ "oamV4IpAddress": "10.18.123.236",
+ "oamV6IpAddress": "2001:0db8:85a3:0000:0000:8a2a:0370:7334",
+ "serialNumber": "",
+ "vendorName": "",
+ "modelNumber": "",
+ "unitType": "",
+ "additionalFields": {}
}
}
-] \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-logical-link.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-logical-link.json
index c48c841c..9b4c7e2c 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-logical-link.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-logical-link.json
@@ -1,11 +1,13 @@
{
"link-name": "bbs-link",
- "link-type": "attachmentPoint",
- "relationship-list": [
+ "link-type": "attachment-point",
+ "relationship-list":
{
- "relationship": {
- "related-link": "/network/pnfs/pnf/NOK6061ZW9"
- }
+ "relationship": [
+ {
+ "related-link": "/network/pnfs/pnf/NOK6061ZW9",
+ "relationship-data": []
+ }
+ ]
}
- ]
}
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json
index 0ccc1dfb..5c77e125 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json
@@ -1,7 +1,7 @@
[
{
"additionalFields": {
- "attachmentPoint": "bbs-link"
+ "attachment-point": "bbs-link"
},
"correlationId": "NOK6061ZW9"
}
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/ves-event.json
index 9f024983..5de986c5 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/ves-event.json
@@ -1,42 +1,40 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1540212137393,
- "sourceId": "val13",
- "eventId": "registration_40212137",
- "nfcNamingCode": "oam",
- "internalHeaderFields": {
- "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
- },
- "eventType": "pnfRegistration",
- "priority": "Normal",
- "version": "4.0.1",
- "reportingEntityName": "NOK6061ZW9",
- "sequence": 0,
- "domain": "pnfRegistration",
- "lastEpochMicrosec": 1540212137393,
- "eventName": "pnfRegistration_Nokia_5gDu",
- "vesEventListenerVersion": "7.0.1",
- "sourceName": "NOK6061ZW9",
- "nfNamingCode": "gNB"
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
},
- "pnfRegistrationFields": {
- "unitType": "val8",
- "serialNumber": "6061ZW9",
- "pnfRegistrationFieldsVersion": "2.0",
- "manufactureDate": "1540212137393",
- "modelNumber": "val6",
- "lastServiceDate": "1540212137393",
- "unitFamily": "BBU",
- "vendorName": "Nokia",
- "oamV4IpAddress": "val3",
- "oamV6IpAddress": "val4",
- "softwareVersion": "val7",
- "additionalFields": {
- "attachmentPoint": "bbs-link"
- }
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW9",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW9",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7",
+ "additionalFields": {
+ "attachment-point": "bbs-link"
}
}
}
-]
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/ves-event.json
index b7e5af5e..ba91f286 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/ves-event.json
@@ -1,41 +1,39 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1540212137393,
- "sourceId": "val13",
- "eventId": "registration_40212137",
- "nfcNamingCode": "oam",
- "internalHeaderFields": {
- "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
- },
- "eventType": "pnfRegistration",
- "priority": "Normal",
- "version": "4.0.1",
- "reportingEntityName": "NOK6061ZW8",
- "sequence": 0,
- "domain": "pnfRegistration",
- "lastEpochMicrosec": 1540212137393,
- "eventName": "pnfRegistration_Nokia_5gDu",
- "vesEventListenerVersion": "7.0.1",
- "sourceName": "NOK6061ZW8",
- "nfNamingCode": "gNB"
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
},
- "pnfRegistrationFields": {
- "unitType": "val8",
- "serialNumber": "6061ZW9",
- "pnfRegistrationFieldsVersion": "2.0",
- "manufactureDate": "1540212137393",
- "modelNumber": "val6",
- "lastServiceDate": "1540212137393",
- "unitFamily": "BBU",
- "vendorName": "Nokia",
- "oamV4IpAddress": "val3",
- "oamV6IpAddress": "val4",
- "softwareVersion": "val7",
- "additionalFields": {
- }
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW8",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW8",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7",
+ "additionalFields": {
}
}
}
-] \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json
index d2cf9547..363ff3ff 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json
@@ -1,7 +1,7 @@
[
{
"additionalFields": {
- "attachmentPoint": ""
+ "attachment-point": ""
},
"correlationId": "NOK6061ZW8"
}
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/ves-event.json
index c1b6dc2c..b56341f3 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/ves-event.json
@@ -1,42 +1,40 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1540212137393,
- "sourceId": "val13",
- "eventId": "registration_40212137",
- "nfcNamingCode": "oam",
- "internalHeaderFields": {
- "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
- },
- "eventType": "pnfRegistration",
- "priority": "Normal",
- "version": "4.0.1",
- "reportingEntityName": "NOK6061ZW8",
- "sequence": 0,
- "domain": "pnfRegistration",
- "lastEpochMicrosec": 1540212137393,
- "eventName": "pnfRegistration_Nokia_5gDu",
- "vesEventListenerVersion": "7.0.1",
- "sourceName": "NOK6061ZW8",
- "nfNamingCode": "gNB"
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
},
- "pnfRegistrationFields": {
- "unitType": "val8",
- "serialNumber": "6061ZW9",
- "pnfRegistrationFieldsVersion": "2.0",
- "manufactureDate": "1540212137393",
- "modelNumber": "val6",
- "lastServiceDate": "1540212137393",
- "unitFamily": "BBU",
- "vendorName": "Nokia",
- "oamV4IpAddress": "val3",
- "oamV6IpAddress": "val4",
- "softwareVersion": "val7",
- "additionalFields": {
- "attachmentPoint": ""
- }
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW8",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW8",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7",
+ "additionalFields": {
+ "attachment-point": ""
}
}
}
-] \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/ves-event.json
index 10ce41c5..3a768df2 100644
--- a/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/ves-event.json
+++ b/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/ves-event.json
@@ -1,39 +1,37 @@
-[
- {
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1540212137393,
- "sourceId": "val13",
- "eventId": "registration_40212137",
- "nfcNamingCode": "oam",
- "internalHeaderFields": {
- "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
- },
- "eventType": "pnfRegistration",
- "priority": "Normal",
- "version": "4.0.1",
- "reportingEntityName": "NOK6061ZW8",
- "sequence": 0,
- "domain": "pnfRegistration",
- "lastEpochMicrosec": 1540212137393,
- "eventName": "pnfRegistration_Nokia_5gDu",
- "vesEventListenerVersion": "7.0.1",
- "sourceName": "NOK6061ZW8",
- "nfNamingCode": "gNB"
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
},
- "pnfRegistrationFields": {
- "unitType": "val8",
- "serialNumber": "6061ZW9",
- "pnfRegistrationFieldsVersion": "2.0",
- "manufactureDate": "1540212137393",
- "modelNumber": "val6",
- "lastServiceDate": "1540212137393",
- "unitFamily": "BBU",
- "vendorName": "Nokia",
- "oamV4IpAddress": "val3",
- "oamV6IpAddress": "val4",
- "softwareVersion": "val7"
- }
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW8",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW8",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7"
}
}
-] \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/prh_config_tests.robot b/tests/dcaegen2/prh-testcases/prh_config_tests.robot
new file mode 100644
index 00000000..144504d1
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/prh_config_tests.robot
@@ -0,0 +1,33 @@
+*** Settings ***
+Documentation Tests related to updating PRH app config based on CBS config
+Suite Setup Run keywords Create sessions
+Resource resources/prh_sessions.robot
+Resource resources/prh_config_library.robot
+Resource resources/prh_library.robot
+Test Timeout 15 seconds
+
+*** Test Cases ***
+CBS configuration forced refresh
+ [Documentation] It should be possible to force refresh PRH configuration from CBS
+ [Tags] PRH coniguration
+ ${some_random_value}= Generate random value
+ Put key-value to consul foo_${some_random_value} bar_${some_random_value}
+ Force PRH config refresh
+ Check key-value in PRH app environment foo_${some_random_value} bar_${some_random_value}
+
+CBS configuration scheduled refresh
+ [Documentation] PRH should pull for CBS configuration updates according to schedule
+ [Tags] PRH coniguration
+ Set scheduled CBS updates interval 1s
+ ${some_random_value}= Generate random value
+ Put key-value to consul spam_${some_random_value} ham_${some_random_value}
+ wait until keyword succeeds 20x 500ms
+ ... Check key-value in PRH app environment spam_${some_random_value} ham_${some_random_value}
+ [Teardown] Set scheduled CBS updates interval 0
+
+PRH log level change based on CBS config
+ [Documentation] It should be possible to change logging levels in PRH based on entries in CBS
+ [Tags] PRH coniguration logging
+ Set logging level in CBS org.onap.dcaegen2.services.prh.foo WARN
+ Force PRH config refresh
+ Verify logging level org.onap.dcaegen2.services.prh.foo WARN \ 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 acaf78fd..4e387b91 100644
--- a/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -6,18 +6,14 @@ Test Teardown Reset Simulators
Test Timeout 2 minutes
Library resources/PrhLibrary.py
+Resource resources/prh_sessions.robot
Resource resources/prh_library.robot
-Resource ../../common.robot
*** Variables ***
${TEST_CASES_DIR} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets
-${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP}
-${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP}
-${CONSUL_SETUP_URL} http://${CONSUL_SETUP}
-
*** Test Cases ***
-Simple BBS case event
+BBS case event - attachment point
[Documentation] PRH get from DMaaP valid event with valid attachment point
[Tags] PRH Valid event Attachment point
[Template] Verify PNF ready sent and logical link created
@@ -52,3 +48,13 @@ Should not sent PNF ready when AAI is not responding
[Tags] PRH AAI not responding
Verify AAI not responding is logged ${TEST_CASES_DIR}/aai-not-responding
+BBS case event - Re-registration
+ [Documentation] After regitered PNF, PRH reads another one PRH event with registration event
+ [Tags] PRH Valid event Re registraiton
+ [Template] Verify PNF re registration
+ ${TEST_CASES_DIR}/re-registration
+
+PRH logging level change
+ [Documentation] ad-hoc PRH logging level change using rest endpoint
+ [Tags] PRH logging level
+ Verify change logging level
diff --git a/tests/dcaegen2/prh-testcases/resources/.env b/tests/dcaegen2/prh-testcases/resources/.env
index a558a2e8..b1de55a9 100644
--- a/tests/dcaegen2/prh-testcases/resources/.env
+++ b/tests/dcaegen2/prh-testcases/resources/.env
@@ -1,5 +1,4 @@
-LOG_LEVEL=INFO
-PRH_LOG_LEVEL=TRACE
HOSTNAME=dcae-prh
CONSUL_HOST=consul
CONFIG_BINDING_SERVICE=cbs
+CONFIG_BINDING_SERVICE_SERVICE_PORT=10000 \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index 88aeb45c..b3f5f8d9 100644
--- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
+++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -1,5 +1,5 @@
import json
-
+import re
import docker
import time
@@ -10,84 +10,73 @@ class PrhLibrary(object):
pass
@staticmethod
- def find_log_entry(search_for):
- print (type(search_for))
+ def find_one_of_log_entryies(searched_entries):
+ print(type(searched_entries))
client = docker.from_env()
container = client.containers.get('prh')
- print ("Check for log searches for pattern: ", search_for )
+ print("Check for log searches for pattern: ", searched_entries)
for line in container.logs(stream=True):
- print ("Check for log analysis line: ", line )
- if search_for in line.strip():
+ print("Check for log analysis line: ", line )
+ for searched_entry in searched_entries:
+ if searched_entry in line.strip():
+ return True
+ else:
+ return False
+
+ @staticmethod
+ def find_log_json(prefix, json_message):
+ print("Looking for:")
+ print("Prefix: " + str(prefix))
+ print("Json: " + str(json_message))
+ try:
+ decoded_message = json.loads(json_message)
+ except json.JSONDecodeError:
+ print("Could not decode given message")
+ return False
+ pattern = re.compile(prefix + "(.*)$")
+ client = docker.from_env()
+ container = client.containers.get('prh')
+ for line in container.logs(stream=True):
+ print("Check for log analysis line: ", line )
+ if PrhLibrary.__same_json_in_log(decoded_message, line, pattern):
return True
else:
return False
@staticmethod
def create_invalid_notification(json_file):
- event = json.loads(json_file)[0]
- correlation_id = PrhLibrary.extract_correlation_id_value(event, "correlationId")
- ipv4 = PrhLibrary.extract_value_from_pnfRegistrationFields(event, "oamV4IpAddress", "oamV4IpAddress")
- ipv6 = PrhLibrary.extract_value_from_pnfRegistrationFields(event, "oamV6IpAddress", "oamV6IpAddress")
- serial_number = PrhLibrary.extract_value_from_pnfRegistrationFields(event, "serialNumber", "serialNumber")
- vendor_name = PrhLibrary.extract_value_from_pnfRegistrationFields(event, "vendorName", "vendorName")
- model_number = PrhLibrary.extract_value_from_pnfRegistrationFields(event, "modelNumber", "modelNumber")
- unit_type = PrhLibrary.extract_value_from_pnfRegistrationFields(event, "unitType", "unitType")
-
- additional_fields = PrhLibrary.extract_additional_fields(event)
-
- str_json = '{' + correlation_id + ipv4 + ipv6 + serial_number + vendor_name + model_number + unit_type + '"nfNamingCode":""' + "," + '"softwareVersion":"",' + additional_fields
- return json.dumps(str_json).replace("\\", "")[1:-1].replace("\":", "\": ").rstrip(',') + '\\n}'
+ output = {}
+ input = json.loads(json_file)
+ output["correlationId"] = PrhLibrary.__extract_correlation_id_value(input)
+ output["oamV4IpAddress"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "oamV4IpAddress")
+ output["oamV6IpAddress"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "oamV6IpAddress")
+ output["serialNumber"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "serialNumber")
+ output["vendorName"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "vendorName")
+ output["modelNumber"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "modelNumber")
+ output["unitType"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "unitType")
+ output['nfNamingCode'] = ''
+ output['softwareVersion'] = ''
+
+ output["additionalFields"] = PrhLibrary.__get_additional_fields_as_key_value_pairs(input)
+
+ return json.dumps(output)
@staticmethod
def create_pnf_ready_notification_as_pnf_ready(json_file):
- json_to_python = json.loads(json_file)
- correlation_id = PrhLibrary.extract_correlation_id_value(json_to_python, "correlationId")
-
- additional_fields = PrhLibrary.extract_additional_fields_value(json_to_python)
+ output = {}
+ input = json.loads(json_file)[0]
- str_json = '{' + correlation_id + additional_fields
+ output["correlationId"] = PrhLibrary.__extract_correlation_id_value(input)
+ output["serialNumber"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "serialNumber")
+ output["equip-vendor"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "vendorName")
+ output["equip-model"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "modelNumber")
+ output["equip-type"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "unitType")
+ output["nf-role"] = PrhLibrary.__extract_nf_role(input)
+ output["sw-version"] = ""
- return json.dumps(str_json.rstrip(',') + '}').replace("\\", "")[1:-1]
-
- @staticmethod
- def extract_additional_fields_value(content):
- fields = PrhLibrary.get_additional_fields_as_key_value_pairs(content)
- if len(fields) == 0:
- return ""
- return PrhLibrary.build_additional_fields_json(fields)
-
- @staticmethod
- def extract_additional_fields(content):
- fields = PrhLibrary.get_additional_fields_as_key_value_pairs(content)
- if fields == []:
- return '"additionalFields":null'
- return PrhLibrary.build_additional_fields_json(fields)
-
- @staticmethod
- def get_additional_fields_as_key_value_pairs(content):
- return content.get("event").get("pnfRegistrationFields").get(
- "additionalFields") if "additionalFields" in content["event"]["pnfRegistrationFields"] else []
-
- @staticmethod
- def build_additional_fields_json(fields):
- res = '"additionalFields":{'
- for f in fields:
- res += '"' + f + '":"' + fields.get(f) + '",'
- return res.rstrip(',') + '},'
-
- @staticmethod
- def extract_value_from_pnfRegistrationFields(content, name, key):
- return '"' + name + '":"' + (content.get("event").get("pnfRegistrationFields").get(key) + '",' if key in content["event"]["pnfRegistrationFields"] else '",')
-
- @staticmethod
- def extract_correlation_id_value(content, name):
- return '"' + name + '":"' + (content.get("event").get("commonEventHeader").get("sourceName") + '",' if "sourceName" in content["event"]["commonEventHeader"] else '",')
+ output["additionalFields"] = PrhLibrary.__get_additional_fields_as_key_value_pairs(input)
- @staticmethod
- def create_pnf_name(json_file):
- json_to_python = json.loads(json_file)
- correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + '",' if "sourceName" in json_to_python["event"]["commonEventHeader"] else '",'
- return correlation_id
+ return json.dumps(output)
@staticmethod
def ensure_container_is_running(name):
@@ -127,4 +116,55 @@ class PrhLibrary(object):
@staticmethod
def is_in_status(client, name, status):
- return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1 \ No newline at end of file
+ return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1
+
+ @staticmethod
+ def create_pnf_name(json_file):
+ json_to_python = json.loads(json_file)
+ correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + '",' if "sourceName" in json_to_python["event"]["commonEventHeader"] else '",'
+ return correlation_id
+
+ @staticmethod
+ def __get_additional_fields_as_key_value_pairs(content):
+ return content.get("event").get("pnfRegistrationFields").get(
+ "additionalFields") if "additionalFields" in content["event"]["pnfRegistrationFields"] else {}
+
+ @staticmethod
+ def __extract_value_from_pnfRegistrationFields(content, key):
+ return content["event"]["pnfRegistrationFields"][key] if key in content["event"]["pnfRegistrationFields"] else ''
+
+ @staticmethod
+ def __extract_correlation_id_value(content):
+ return content["event"]["commonEventHeader"]["sourceName"] if "sourceName" in content["event"]["commonEventHeader"] else ''
+
+ @staticmethod
+ def __extract_nf_role(content):
+ return content["event"]["commonEventHeader"]["nfNamingCode"] if "nfNamingCode" in content["event"]["commonEventHeader"] else ''
+
+ @staticmethod
+ def __same_json_in_log(decoded_message, line, pattern):
+ extracted_json = PrhLibrary.__extract_json(line, pattern)
+ if extracted_json is not None:
+ print("Found json: " + extracted_json)
+ try:
+ if json.loads(extracted_json) == decoded_message:
+ return True
+ except json.JSONDecodeError:
+ print("Could not decode")
+ return False
+
+ @staticmethod
+ def __extract_json(line, pattern):
+ full_message = PrhLibrary.__extract_full_message_from_line(line)
+ if full_message is not None:
+ match = pattern.match(full_message)
+ if match:
+ return match.group(1).replace("\\n", "\n").replace("\\t", "\t")
+ return None
+
+ @staticmethod
+ def __extract_full_message_from_line(line):
+ split = line.split("|")
+ if len(split) > 3:
+ return split[3]
+ return None
diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
index aba658b0..ca94dfb2 100644
--- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
+++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -8,11 +8,10 @@ services:
volumes:
- ./simulator/certs:/tmp/certs
environment:
- - LOG_LEVEL
- - PRH_LOG_LEVEL
- - HOSTNAME
- - CONSUL_HOST
+ - HOSTNAME=dcae-prh
+ - CONSUL_HOST # not in use, but still required by SDK - should be removed later on
- CONFIG_BINDING_SERVICE
+ - CONFIG_BINDING_SERVICE_SERVICE_PORT
container_name: prh
depends_on:
cbs:
@@ -55,6 +54,10 @@ services:
image: consul:1.0.6
restart: on-failure
command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-prh", '{
+ "cbs.updates-interval": 0,
+ "logging.level.org.onap.dcaegen2.services.prh": "debug",
+ "logging.level.org.onap.dcaegen2.services.sdk": "debug",
+ "logging.level.org.onap.dcaegen2.services.prh.controllers.AppInfoController": "off",
"dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin",
"dmaap.dmaapConsumerConfiguration.dmaapUserPassword":"admin",
"dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json",
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot
new file mode 100644
index 00000000..26a62704
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot
@@ -0,0 +1,43 @@
+*** Settings ***
+Documentation Keywords related to checking and updating PRH app config based on CBS config
+Library RequestsLibrary
+Library Collections
+
+*** Keywords ***
+
+Put key-value to consul
+ [Arguments] ${key} ${value}
+ ${prh_config}= Get PRH config from consul
+ set to dictionary ${prh_config} ${key} ${value}
+ put request consul_session /v1/kv/dcae-prh json=${prh_config}
+ Get PRH config from consul prh config in consul after update
+
+Get PRH config from consul
+ [Arguments] ${logMessage}=prh config in consul
+ ${phr_config_response}= get request consul_session /v1/kv/dcae-prh?raw
+ log ${logMessage}: ${phr_config_response.content}
+ [Return] ${phr_config_response.json()}
+
+Force PRH config refresh
+ ${refresh_response}= post request prh_session /actuator/refresh
+ should be equal as integers ${refresh_response.status_code} 200
+
+Check key-value in PRH app environment
+ [Arguments] ${key} ${expected_value}
+ ${env_response}= get request prh_session /actuator/env/${key}
+ should be equal as integers ${env_response.status_code} 200
+ log ${env_response.content}
+ should be equal ${env_response.json()["property"]["value"]} ${expected_value}
+
+Set scheduled CBS updates interval
+ [Arguments] ${cbs_updates_interval}
+ Put key-value to consul cbs.updates-interval ${cbs_updates_interval}
+ Force PRH config refresh
+
+Set logging level in CBS
+ [Arguments] ${logger} ${level}
+ Put key-value to consul logging.level.${logger} ${level}
+
+Generate random value
+ ${some_random_value} evaluate random.randint(sys.maxint/10, sys.maxint) modules=random,sys
+ [Return] ${some_random_value} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
index 1fae1005..3ed377c7 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -13,27 +13,29 @@ Verify PNF ready sent
Add PNF entry in AAI ${pnf_entry}
Set VES event in DMaaP ${ves_event}
Wait Until Keyword Succeeds 10x 3000ms Check CBS ready
- Wait Until Keyword Succeeds 10x 3000ms Check recorded PNF_READY notification ${expected_pnf_ready_event}
+ Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event}
Verify PNF ready sent and logical link created
[Arguments] ${test_case_directory}
${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json
Verify PNF ready sent ${test_case_directory}
- Check recorded Logical Link ${expected_logical_link}
+ Check created Logical Link ${expected_logical_link}
Verify event with missing required field is logged
[Arguments] ${test_case_directory}
${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
Set VES event in DMaaP ${invalid_ves_event}
- ${error_msg}= Create event parsing error ${invalid_ves_event}
- Wait Until Keyword Succeeds 10x 3000ms Check PRH log ${error_msg}
+ Log Invalid ves event: ${invalid_ves_event}
+ ${notification}= Create invalid notification ${invalid_ves_event}
+ ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created:
+ Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification}
Verify incorrect JSON event is logged
[Timeout] 60s
[Arguments] ${test_case_directory}
${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
Set VES event in DMaaP ${invalid_ves_event}
- Wait Until Keyword Succeeds 10x 3000ms Check PRH log |com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray
+ Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created:
Verify missing AAI record is logged
[Timeout] 100s
@@ -42,8 +44,7 @@ Verify missing AAI record is logged
${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
Add PNF entry in AAI ${incorrect_aai_entry}
Set VES event in DMaaP ${ves_event}
- Wait Until Keyword Succeeds 10x 3000ms Check PRH log |AAIProducerTask exception has been registered
- Wait Until Keyword Succeeds 10x 3000ms Check PRH log |Chain of tasks have been aborted due to errors in PRH workflow
+ Check PRH log Request failed for URL 'https://aai:3334/aai/v12/network/pnfs/pnf/NOK6061ZW8'. Response code: 404 Not Found
Verify AAI not responding is logged
[Timeout] 100s
@@ -51,30 +52,56 @@ Verify AAI not responding is logged
${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
Ensure Container Is Exited aai_simulator
Set VES event in DMaaP ${ves_event}
- Wait Until Keyword Succeeds 10x 3000ms Check PRH log java.net.UnknownHostException: aai
+ Check PRH log connection timed out: aai Host is unreachable: aai
Ensure Container Is Running aai_simulator
+Verify PNF re registration
+ [Timeout] 500s
+ [Arguments] ${test_case_directory}
+ ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json
+ Log PNF Re-registration: AAI entry for AAI Simulator ${aai_entry}
+ Add PNF entry in AAI ${aai_entry}
+ ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json
+ Add service instance entry in AAI ${service_instance}
+
+ ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
+ Set VES event in DMaaP ${ves_event}
+ ${expected_pnf_update_event}= Get Data From File ${test_case_directory}/expected-pnf-update-event.json
+ Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event}
+
Check CBS ready
- ${resp}= Get Request ${consul_setup_session} /v1/catalog/services
+ ${resp}= Get Request ${consul_session} /v1/catalog/services
Should Be Equal As Strings ${resp.status_code} 200
Log Service Catalog response: ${resp.content}
Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
-Check recorded PNF_READY notification
+Check created PNF_READY notification
[Arguments] ${expected_event_pnf_ready_in_dpaap}
- ${resp}= Get Request ${dmaap_setup_session} /setup/pnf_ready headers=${suite_headers}
+ ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers}
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
-Check recorded Logical Link
+Check created PNF_UPDATE notification
+ [Arguments] ${expected_event_pnf_update_in_dpaap}
+ ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers}
+ Log Response from DMaaP: ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+ #Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
+
+Check created Logical Link
[Arguments] ${expected_logical_link_in_aai}
- ${resp}= Get Request ${aai_setup_session} /setup/created_logical_link headers=${suite_headers}
+ ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers}
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
Check PRH log
- [Arguments] ${log_entry}
- ${found}= Find log entry ${log_entry}
+ [Arguments] @{log_entries}
+ ${found}= Find one of log entryies ${log_entries}
+ Should Be True ${found}
+
+Check PRH json log
+ [Arguments] ${prefix} ${json}
+ ${found}= Find log json ${prefix} ${json}
Should Be True ${found}
Create event parsing error
@@ -87,12 +114,19 @@ Add PNF entry in AAI
[Arguments] ${pnf_entry}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
Log AAI url ${AAI_SIMULATOR_SETUP_URL}
- ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
+ ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Add service instance entry in AAI
+ [Arguments] ${aai_service_instance}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ Log AAI url ${AAI_SIMULATOR_SETUP_URL}
+ ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance}
Should Be Equal As Strings ${resp.status_code} 200
Set VES event in DMaaP
[Arguments] ${ves_event}
- ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
+ ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As JSON
@@ -103,26 +137,39 @@ Should Be Equal As JSON
${actual_json}= Evaluate json.loads("""${actual}""") json
Should Be Equal ${actual_json} ${expected_json}
-Create sessions
- Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL}
- Set Suite Variable ${dmaap_setup_session} dmaap_setup_session
- Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL}
- Set Suite Variable ${aai_setup_session} aai_setup_session
- Create Session consul_setup_session ${CONSUL_SETUP_URL}
- Set Suite Variable ${consul_setup_session} consul_setup_session
-
Reset Simulators
Reset AAI simulator
Reset DMaaP simulator
Reset AAI simulator
- ${resp}= Post Request ${aai_setup_session} /reset
+ ${resp}= Post Request ${aai_session} /reset
Should Be Equal As Strings ${resp.status_code} 200
Reset DMaaP simulator
- ${resp}= Post Request ${dmaap_setup_session} /reset
+ ${resp}= Post Request ${dmaap_session} /reset
Should Be Equal As Strings ${resp.status_code} 200
-Create headers
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- Set Suite Variable ${suite_headers} ${headers}
+
+Verify change logging level
+ ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController
+ Change logging level ${logger} TRACE
+ Verify logging level ${logger} TRACE
+ Verify logs with heartbeat
+ [Teardown] Change logging level ${logger} INFO
+
+Change logging level
+ [Arguments] ${logger} ${log_level}
+ ${request_body}= Create Dictionary configuredLevel=${log_level}
+ ${resp}= Post Request prh_session /actuator/loggers/${logger} json=${request_body}
+ Should Be Equal As Integers ${resp.status_code} 204
+
+Verify logging level
+ [Arguments] ${logger} ${expected_log_level}
+ ${resp}= Get Request prh_session /actuator/loggers/${logger}
+ Should Be Equal As Integers ${resp.status_code} 200
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.json()["configuredLevel"]} ${expected_log_level} ignore_case=true
+
+Verify logs with heartbeat
+ Get Request prh_session /heartbeat
+ Check PRH log Heartbeat request received \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot b/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot
new file mode 100644
index 00000000..2fadbbae
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot
@@ -0,0 +1,25 @@
+*** Settings ***
+Library RequestsLibrary
+Library Collections
+
+*** Variables ***
+${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP}
+${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP}
+${CONSUL_SETUP_URL} http://${CONSUL_SETUP}
+${PRH_SETUP_URL} http://${PRH_SETUP}
+
+*** Keywords ***
+Create sessions
+ Create Session dmaap_session ${DMAAP_SIMULATOR_SETUP_URL}
+ Set Suite Variable ${dmaap_session} dmaap_session
+ Create Session aai_session ${AAI_SIMULATOR_SETUP_URL}
+ Set Suite Variable ${aai_session} aai_session
+ Create Session consul_session ${CONSUL_SETUP_URL}
+ Set Suite Variable ${consul_session} consul_session
+ Create Session prh_session ${PRH_SETUP_URL}
+ Set Suite Variable ${prh_session} prh_session
+
+
+Create headers
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ Set Suite Variable ${suite_headers} ${headers} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index ff368034..f6d3b1f6 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -22,6 +22,7 @@ AAI_RESOURCE_NOT_FOUND = b'{}'
pnf_entries = {}
patched_pnf = AAI_RESOURCE_NOT_FOUND
created_logical_link = AAI_RESOURCE_NOT_FOUND
+service_instance = AAI_RESOURCE_NOT_FOUND
class AAISetup(BaseHTTPRequestHandler):
@@ -30,7 +31,7 @@ class AAISetup(BaseHTTPRequestHandler):
if re.search('/setup/patched_pnf', self.path):
httpServerLib.set_response_200_ok(self, payload = patched_pnf)
logger.debug('AAISetup GET /setup/patched_pnf -> 200 OK')
- elif re.search('/setup/created_logical_link', self.path):
+ elif re.search('/verify/created_logical_link', self.path):
httpServerLib.set_response_200_ok(self, payload = created_logical_link)
logger.debug('AAISetup GET /setup/created_logical_link -> 200 OK')
else:
@@ -53,6 +54,13 @@ class AAISetup(BaseHTTPRequestHandler):
httpServerLib.set_response_200_ok(self)
logger.debug('AAISetup PUT /setup/add_pnf_entry [' + pnf_name + '] -> 200 OK')
+ elif re.search('/setup/add_service_instace', self.path):
+ service_instance_payload = httpServerLib.get_payload(self)
+ global service_instance
+ service_instance = json.loads(service_instance_payload)
+ httpServerLib.set_response_200_ok(self)
+ logger.debug('AAISetup PUT /setup/add_service_instace -> 200 OK')
+
elif re.search('/set_pnf', self.path):
pnf_name = httpServerLib.get_payload(self).decode()
pnf_entries[pnf_name] = AAI_RESOURCE_NOT_FOUND
@@ -70,9 +78,11 @@ class AAISetup(BaseHTTPRequestHandler):
global pnf_entries
global patched_pnf
global created_logical_link
+ global service_instance
pnf_entries = {}
patched_pnf = AAI_RESOURCE_NOT_FOUND
created_logical_link = AAI_RESOURCE_NOT_FOUND
+ service_instance = AAI_RESOURCE_NOT_FOUND
httpServerLib.set_response_200_ok(self)
logger.debug('AAISetup POST /reset -> 200 OK')
@@ -95,6 +105,9 @@ class AAIHandler(BaseHTTPRequestHandler):
else:
httpServerLib.set_response_404_not_found(self)
logger.info('AAIHandler GET /aai/v12/network/pnfs/pnf/' + pnf_name + ' -> 404 Not found, actual entries: ' + str(pnf_entries.keys()))
+ elif re.search('aai/v12/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service', self.path):
+ httpServerLib.set_response_200_ok(self, payload = service_instance)
+ logger.debug('AAIHandler GET aai/v12/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service -> 200 OK')
else:
httpServerLib.set_response_404_not_found(self)
logger.info('AAIHandler GET ' + self.path + ' -> 404 Not found')
@@ -142,7 +155,6 @@ class AAIHandler(BaseHTTPRequestHandler):
def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"):
handler_class.protocol_version = protocol
- httpServerLib.start_http_endpoint(3333, AAIHandler)
httpServerLib.start_https_endpoint(3334, AAIHandler, keyfile="certs/aai.key", certfile="certs/aai.crt", ca_certs="certs/root.crt")
httpServerLib.start_http_endpoint(3335, AAISetup)
while 1:
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
index ce9858d6..5ec601f6 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -2,6 +2,7 @@ import logging
import re
import sys
import time
+import json
from http.server import BaseHTTPRequestHandler
import httpServerLib
@@ -17,17 +18,22 @@ logger = logging.getLogger('DMaaP-simulator-logger')
DMAAP_EMPTY = b'[]'
-ves_event = DMAAP_EMPTY
-captured_prh_event = DMAAP_EMPTY
+event_ves = DMAAP_EMPTY
+event_pnf_ready = DMAAP_EMPTY
+event_pnf_update = DMAAP_EMPTY
class DmaapSetup(BaseHTTPRequestHandler):
def do_GET(self):
try:
- if re.search('/setup/pnf_ready', self.path):
- global captured_prh_event
- httpServerLib.set_response_200_ok(self, payload = captured_prh_event)
- logger.debug('DmaapSetup GET /setup/pnf_ready -> 200 OK')
+ if re.search('/verify/pnf_ready', self.path):
+ global event_pnf_ready
+ httpServerLib.set_response_200_ok(self, payload = event_pnf_ready)
+ logger.debug('DmaapSetup GET /verify/pnf_ready -> 200 OK')
+ elif re.search('/verify/pnf_update', self.path):
+ global event_pnf_update
+ httpServerLib.set_response_200_ok(self, payload = event_pnf_update)
+ logger.debug('DmaapSetup GET /verify/pnf_ready -> 200 OK')
else:
httpServerLib.set_response_404_not_found(self)
logger.info('DmaapSetup GET ' + self.path + ' -> 404 Not found')
@@ -38,10 +44,10 @@ class DmaapSetup(BaseHTTPRequestHandler):
def do_PUT(self):
try:
if re.search('/setup/ves_event', self.path):
- global ves_event
- ves_event = httpServerLib.get_payload(self)
+ global event_ves
+ event_ves = httpServerLib.get_payload(self)
httpServerLib.set_response_200_ok(self)
- logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK, content: ' + ves_event.decode("utf-8"))
+ logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK, content: ' + event_ves.decode("utf-8"))
else:
httpServerLib.set_response_404_not_found(self)
logger.info('DmaapSetup PUT ' + self.path + ' -> 404 Not found')
@@ -52,10 +58,12 @@ class DmaapSetup(BaseHTTPRequestHandler):
def do_POST(self):
try:
if re.search('/reset', self.path):
- global ves_event
- global captured_prh_event
- ves_event = DMAAP_EMPTY
- captured_prh_event = DMAAP_EMPTY
+ global event_ves
+ global event_pnf_ready
+ global event_pnf_update
+ event_ves = DMAAP_EMPTY
+ event_pnf_ready = DMAAP_EMPTY
+ event_pnf_update = DMAAP_EMPTY
httpServerLib.set_response_200_ok(self)
logger.debug('DmaapSetup POST /reset -> 200 OK')
else:
@@ -70,11 +78,17 @@ class DMaaPHandler(BaseHTTPRequestHandler):
def do_POST(self):
try:
if re.search('/events/unauthenticated.PNF_READY', self.path):
- global captured_prh_event
- captured_prh_event = httpServerLib.get_payload(self)
+ global event_pnf_ready
+ event_pnf_ready = httpServerLib.get_payload(self)
httpServerLib.set_response_200_ok(self)
logger.debug('DMaaPHandler POST /events/unauthenticated.PNF_READY -> 200, content: '
- + captured_prh_event.decode("utf-8"))
+ + event_pnf_ready.decode("utf-8"))
+ elif re.search('/events/unauthenticated.PNF_UPDATE', self.path):
+ global event_pnf_update
+ event_pnf_update = httpServerLib.get_payload(self)
+ httpServerLib.set_response_200_ok(self)
+ logger.debug('DMaaPHandler POST /events/unauthenticated.PNF_READY -> 200, content: '
+ + event_pnf_update.decode("utf-8"))
else:
httpServerLib.set_response_404_not_found(self)
logger.info('DMaaPHandler POST ' + self.path + ' -> 404 Not found')
@@ -85,12 +99,12 @@ class DMaaPHandler(BaseHTTPRequestHandler):
def do_GET(self):
try:
if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDCAE-c12/c12', self.path):
- global ves_event
- httpServerLib.set_response_200_ok(self, payload = ves_event)
+ global event_ves
+ httpServerLib.set_response_200_ok(self, payload=self.pack_event_json_as_quoted_string_into_array(event_ves))
logger.debug(
'DMaaPHandler GET /events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12 -> 200, content: '
- + ves_event.decode("utf-8"))
- ves_event = DMAAP_EMPTY
+ + event_ves.decode("utf-8"))
+ event_ves = DMAAP_EMPTY
logger.debug('DMaaPHandler GET /events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12 -> 200')
else:
httpServerLib.set_response_404_not_found(self)
@@ -99,9 +113,18 @@ class DMaaPHandler(BaseHTTPRequestHandler):
logger.error(e)
httpServerLib.set_response_500_server_error(self)
+ def pack_event_json_as_quoted_string_into_array(self, event):
+ if event == DMAAP_EMPTY:
+ return DMAAP_EMPTY
+ else:
+ decoded = event_ves.decode("utf-8")
+ packed = '[' + json.dumps(decoded) + ']'
+ logger.info("prepared response: " + packed)
+ return packed.encode()
+
+
def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"):
handler_class.protocol_version = protocol
- httpServerLib.start_http_endpoint(2222, DMaaPHandler)
httpServerLib.start_https_endpoint(2223, DMaaPHandler, keyfile="certs/dmaap-mr.key", certfile="certs/dmaap-mr.crt", ca_certs="certs/root.crt")
httpServerLib.start_http_endpoint(2224, DmaapSetup)
while 1: