Merge "Added New Test for File Consumer"
authorGary Wu <gary.i.wu@huawei.com>
Mon, 1 Oct 2018 16:35:58 +0000 (16:35 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 1 Oct 2018 16:35:58 +0000 (16:35 +0000)
19 files changed:
plans/dmaap-datarouter/dr-suite/setup.sh
tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/dcae-smaller-valid-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/multiple-simulators-payload/xnf-simulator-smaller-valid-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json
tests/dcaegen2-collectors-hv-ves/testcases/resources/ves-hv-configuration.json
tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json [new file with mode: 0644]
tests/dcaegen2/prh-testcases/prh_tests.robot
tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
tests/dmaap-datarouter/dr-suite/dr-suite.robot

index e5debfc..023e265 100755 (executable)
@@ -38,7 +38,6 @@ echo DR_PROV_IP=${DR_PROV_IP}
 echo DR_NODE_IP=${DR_NODE_IP}
 echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
 
-docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP"
 docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP"
 
 #Pass any variables required by Robot test suites in ROBOT_VARIABLES
index 7b99fb0..6058008 100644 (file)
@@ -50,7 +50,7 @@ ${DCAE_APP_API_MESSAGES_PATH}                  /messages/all
 ${DCAE_APP_API_MESSAGES_COUNT_PATH}            ${DCAE_APP_API_MESSAGES_PATH}/count
 ${DCAE_APP_API_MESSAGES_VALIDATION_PATH}       ${DCAE_APP_API_MESSAGES_PATH}/validate
 
-${ROUTED_MESSAGES_TOPIC}                       test-hv-ran-meas
+${ROUTED_MESSAGES_TOPIC}                       TEST_HV_VES_PERF3GPP
 
 ${VES_HV_RESOURCES}                            %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources
 ${VES_HV_CONFIGURATION_JSON_FILEPATH}          ${VES_HV_RESOURCES}/ves-hv-configuration.json
index 9aca401..eabb9ce 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index 642c7d5..f0c169d 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index 642c7d5..f0c169d 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index 22d48c5..281b66b 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -24,7 +24,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -46,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index a7d2219..6d50cc9 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -24,7 +24,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -46,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index 54836bf..6dab011 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -24,7 +24,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -46,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index b3aada5..58f7c97 100644 (file)
@@ -2,7 +2,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
@@ -46,7 +46,7 @@
   {
     "commonEventHeader": {
       "version": "sample-version",
-      "domain": "HVMEAS",
+      "domain": "PERF3GPP",
       "sequence": 1,
       "priority": 1,
       "eventId": "sample-event-id",
index b9e1a4b..6404c6c 100644 (file)
@@ -2,8 +2,8 @@
   "dmaap.kafkaBootstrapServers": "kafka:9092",
   "collector.routing": [
     {
-      "fromDomain": "HVMEAS",
-      "toTopic": "test-hv-ran-meas"
+      "fromDomain": "PERF3GPP",
+      "toTopic": "TEST_HV_VES_PERF3GPP"
     }
   ]
 }
\ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json
new file mode 100644 (file)
index 0000000..0aa0372
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "event": {
+    "commonEventHeader": {
+      "sourceName":"NOK6061ZW9"
+    },
+    "pnfRegistrationFields": {
+      "oamV4IpAddress":"10.17.123.24"
+    }
+  }
+}
index 55f484f..6269845 100644 (file)
@@ -18,6 +18,7 @@ ${EVENT_WITH_MISSING_SOURCENAME}    %{WORKSPACE}/tests/dcaegen2/prh-testcases/as
 ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4}    %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json
 ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6}    %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json
 ${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6}    %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json
+${EVENT_WITHOUT_IPV6_FILED}    %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json
 ${Not_json_format}    %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json
 
 *** Test Cases ***
@@ -28,6 +29,7 @@ Valid DMaaP event can be converted to PNF_READY notification
     ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
     ${EVENT_WITH_IPV4}
     ${EVENT_WITH_IPV6}
+    ${EVENT_WITHOUT_IPV6_FILED}
 
 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
index 6a95c71..656f6fc 100644 (file)
@@ -21,18 +21,18 @@ class PrhLibrary(object):
     @staticmethod
     def create_pnf_ready_notification(json_file):
         json_to_python = json.loads(json_file)
-        ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"]
-        ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"]
-        correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
-        str_json = '{"correlationId":"' + correlationId + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
+        ipv4 = json_to_python.get("event").get("pnfRegistrationFields").get("oamV4IpAddress")
+        ipv6 = json_to_python.get("event").get("pnfRegistrationFields").get("oamV6IpAddress") if "oamV6IpAddress" in json_to_python["event"]["pnfRegistrationFields"] else ""
+        correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName")
+        str_json = '{"correlationId":"' + correlation_id + '","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)
-        correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
-        return correlationId
+        correlation_id = json_to_python.get("sourceName")
+        return correlation_id
 
     @staticmethod
     def stop_aai():
index fcac202..d00bddc 100755 (executable)
@@ -10,7 +10,8 @@ ${TARGET_URL}                   https://${DR_PROV_IP}:8443
 ${TARGET_URL_FEED}              https://${DR_PROV_IP}:8443/feed/1
 ${TARGET_URL_SUBSCRIBE}         https://${DR_PROV_IP}:8443/subscribe/1
 ${TARGET_URL_SUBSCRIPTION}      https://${DR_PROV_IP}:8443/subs/1
-${TARGET_URL_PUBLISH}           https://${DR_NODE_IP}:8443/publish/1/csit_test
+${TARGET_URL_PUBLISH_PROV}      https://${DR_PROV_IP}:8443/publish/1/csit_test
+${TARGET_URL_PUBLISH_NODE}      https://${DR_NODE_IP}:8443/publish/1/csit_test
 ${CREATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
 ${UPDATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
 ${SUBSCRIBE_DATA}               {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
@@ -42,9 +43,10 @@ Run Publish Feed
     [Documentation]                 Publish to Feed
     [Timeout]                       1 minute
     Sleep                           10s                              Behaviour was noticed where feed was not created in time for publish to be sent
-    ${resp}=                        PutCall                          ${TARGET_URL_PUBLISH}    ${CREATE_FEED_DATA}      ${PUBLISH_FEED_CONTENT_TYPE}    rs873m
-    log                             ${TARGET_URL_PUBLISH}
-    log                             ${resp.text}
+    ${resp}=                        PutCall                          ${TARGET_URL_PUBLISH_PROV}    ${CREATE_FEED_DATA}      ${PUBLISH_FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_PUBLISH_PROV}
+    Should Contain                  ${resp.headers['Location']}      https://dmaap-dr-node:8443/publish/1/csit_test
+    ${resp}=                        PutCall                          ${TARGET_URL_PUBLISH_NODE}    ${CREATE_FEED_DATA}      ${PUBLISH_FEED_CONTENT_TYPE}    rs873m
     Should Be Equal As Strings      ${resp.status_code}              204
     log                             'JSON Response Code:'${resp}
 
@@ -94,23 +96,23 @@ Run Delete Feed
 PostCall
     [Arguments]      ${url}              ${data}            ${content_type}        ${user}
     ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
-    ${resp}=         Evaluate            requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
+    ${resp}=         Evaluate            requests.post('${url}', data='${data}', headers=${headers}, verify=False)    requests
     [Return]         ${resp}
 
 PutCall
     [Arguments]      ${url}              ${data}            ${content_type}        ${user}
     ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}    Authorization=Basic cnM4NzNtOnJzODczbQ==
-    ${resp}=         Evaluate            requests.put('${url}',data='${data}', headers=${headers},verify=False)    requests
+    ${resp}=         Evaluate            requests.put('${url}', data='${data}', headers=${headers}, verify=False, allow_redirects=False)    requests
     [Return]         ${resp}
 
 GetCall
     [Arguments]      ${url}              ${content_type}        ${user}
     ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
-    ${resp}=         Evaluate            requests.get('${url}', headers=${headers},verify=False)    requests
+    ${resp}=         Evaluate            requests.get('${url}', headers=${headers}, verify=False)    requests
     [Return]         ${resp}
 
 DeleteCall
     [Arguments]      ${url}              ${user}
     ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}
-    ${resp}=         Evaluate            requests.delete('${url}', headers=${headers},verify=False)    requests
+    ${resp}=         Evaluate            requests.delete('${url}', headers=${headers}, verify=False)    requests
     [Return]         ${resp}