Added TC with missing IP 35/54635/1
authorMariusz Wagner <mariusz.wagner@nokia.com>
Wed, 13 Jun 2018 12:30:27 +0000 (14:30 +0200)
committerMariusz Wagner <mariusz.wagner@nokia.com>
Wed, 13 Jun 2018 12:30:27 +0000 (14:30 +0200)
Issue-ID: INT-530

Change-Id: Ie3d7062ce72b275d3268403114b79c042a1ac77c
Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
test/csit/plans/dcaegen2/prh_testsuites/setup.sh
test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot
test/csit/tests/dcaegen2/prh_testcases/resources/PrhLibrary.py [new file with mode: 0644]
test/csit/tests/dcaegen2/prh_testcases/resources/docker-compose.yml

index 2796965..39c1fce 100644 (file)
@@ -53,3 +53,5 @@ docker cp ${WORKDIR}/prh_endpoints.json prh:/config/
 
 #Pass any variables required by Robot test suites in ROBOT_VARIABLES
 ROBOT_VARIABLES="-v DMAAP_SIMULATOR:localhost:2222 -v AAI_SIMULATOR:localhost:3333 -v PRH:localhost:8100"
+
+pip install docker
index 764a879..2097a49 100644 (file)
@@ -1,5 +1,7 @@
 *** Settings ***
 Library           RequestsLibrary
+Library           Process
+Library           resources/PrhLibrary.py
 
 *** Variables ***
 ${DMAAP_SIM_URL}    http://${DMAAP_SIMULATOR}
@@ -12,17 +14,31 @@ Getting and Consuming Positive Scenario
     [Tags]    PRH
     [Setup]    Start prh
     [Template]    Run Getting and Consuming
-    [Timeout]
     {"pnfName":"NOKQTFCOC540002E","ipv4":"10.16.123.234","ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}    NOKQTFCOC540002E    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002E", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002E-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.234", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002E", "pnfManufactureDate":1516406400}}}
     {"pnfName":"NOKQTFCOC540002F","ipv4":"","ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}    NOKQTFCOC540002F    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002F", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002F-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002F", "pnfManufactureDate":1516406400}}}
     {"pnfName":"NOKQTFCOC540002G","ipv4":"10.16.123.234","ipv6":""}    NOKQTFCOC540002G    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002G", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002G-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.234", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002G", "pnfManufactureDate":1516406400}}}
     {"pnfName":"ERIQTFCOC5400000","ipv4":"10.16.123.23","ipv6":""}    ERIQTFCOC5400000    {"event": {"commonEventHeader": {"sourceId":"QTFCOC5400000", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC5400000-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Ericsson", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.23", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC5400000", "pnfManufactureDate":1516406400}}}
     [Teardown]    Stop prh
 
+Missing IPv4 and IPv6
+    [Documentation]    Test get event from DMaaP without IPv4 and IPv6
+    [Tags]    PRH    no_IPv4    no_IPv6
+    [Setup]    Start prh
+    No IP    {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002E", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002E-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002E", "pnfManufactureDate":1516406400}}}
+    [Teardown]    Stop prh
+
 *** Keywords ***
+No IP
+    [Arguments]    ${event_in_dmaap}
+    [Timeout]    1m
+    ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
+    Set get event in DMAAP    ${event_in_dmaap}    ${headers}
+    ${check}=    check log for missing IP
+    Should Be Equal As Strings    ${check}    True
+
 Run Getting and Consuming
     [Arguments]    ${posted_event_to_dmaap}    ${pnfs_name}    ${event_in_dmaap}
-    [Timeout]    1 minutes
+    [Timeout]    1m
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
     Set pnfs name in AAI    ${pnfs_name}
     Set get event in DMAAP    ${event_in_dmaap}    ${headers}
@@ -34,14 +50,14 @@ Run Getting and Consuming
     Should Be Equal    ${resp.text}    ${posted_event_to_dmaap}
 
 Start prh
-    [Timeout]    1 minute
+    [Timeout]    1m
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
     Create Session    prh_start    ${PRH_URL}
     ${resp}=    Get Request    prh_start    /start    headers=${headers}
     Should Be Equal    ${resp.text}    "PRH Service has been started!"
 
 Stop prh
-    [Timeout]    1 minute
+    [Timeout]    1m
     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
     Create Session    prh_stop    ${PRH_URL}
     ${resp}=    Get Request    prh_stop    /stopPrh    headers=${headers}
@@ -58,7 +74,7 @@ Set pnfs name in AAI
 
 Set get event in DMAAP
     [Arguments]    ${event_in_dmaap}    ${headers}
-    [Timeout]    1 minute
+    [Timeout]    1m
     Create Session    set_get_event    ${DMAAP_SIM_URL}
     ${resp}=    Put Request    set_get_event    /set_get_event    headers=${headers}    data=${event_in_dmaap}
     Should Be Equal As Strings    ${resp.status_code}    200
diff --git a/test/csit/tests/dcaegen2/prh_testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh_testcases/resources/PrhLibrary.py
new file mode 100644 (file)
index 0000000..72f491e
--- /dev/null
@@ -0,0 +1,15 @@
+import docker
+
+class PrhLibrary(object):
+    
+    def __init__(self):
+        pass
+
+    def check_log_for_missing_IP(self):
+        client = docker.from_env()
+        container = client.containers.get('prh')
+        for line in container.logs(stream=True):
+            if "org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: IPV4 and IPV6 are empty" in line.strip():
+                return True
+        else:
+            return False
\ No newline at end of file
index e27d845..e773b76 100644 (file)
@@ -41,4 +41,4 @@ services:
      container_name: aai_simulator
      depends_on:
        - prh
-   
\ No newline at end of file
+