Added TC - AAI have wrong record 11/54811/1
authorMariusz Wagner <mariusz.wagner@nokia.com>
Thu, 14 Jun 2018 13:53:56 +0000 (15:53 +0200)
committerMariusz Wagner <mariusz.wagner@nokia.com>
Thu, 14 Jun 2018 13:53:56 +0000 (15:53 +0200)
Issue-ID: INT-531

Change-Id: I3f2db55f0257ee8d9e85c3e5678b71d8bf0ad147
Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot
test/csit/tests/dcaegen2/prh_testcases/resources/PrhLibrary.py
test/csit/tests/dcaegen2/prh_testcases/resources/simulator/AAI.py

index 2097a49..e507dcb 100644 (file)
@@ -24,16 +24,32 @@ 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}}}
+    Missing 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
+
+Wrong AAI record
+    [Documentation]    Wrong or missing record in AAI
+    [Tags]    PRH    AAI
+    [Setup]    Start prh
+    Wrong AAI record    {"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}}}
     [Teardown]    Stop prh
 
 *** Keywords ***
-No IP
+Wrong AAI record
+    [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}
+    Set pnfs name in AAI    wrong_aai_record
+    ${check}=    check for log    org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException: Incorrect response code for continuation of tasks workflow
+    Should Be Equal As Strings    ${check}    True
+
+Missing 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
+    ${check}=    check for log    org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: IPV4 and IPV6 are empty
     Should Be Equal As Strings    ${check}    True
 
 Run Getting and Consuming
index 72f491e..f07f385 100644 (file)
@@ -5,11 +5,12 @@ class PrhLibrary(object):
     def __init__(self):
         pass
 
-    def check_log_for_missing_IP(self):
+    def check_for_log(self, search_for):
         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():
+            if search_for in line.strip():
                 return True
         else:
-            return False
\ No newline at end of file
+            return False
+        
\ No newline at end of file
index f9d0ee0..2c0b42d 100644 (file)
@@ -20,10 +20,13 @@ class AAIHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         
     def do_PATCH(self):
         pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs 
-        if re.search(pnfs_name, self.path):
+        if re.search('wrong_aai_record', self.path):
+            self.send_response(400)
+            self.end_headers()
+        elif re.search(pnfs_name, self.path):
             self.send_response(200)
             self.end_headers()
-            
+                
         return
   
     def do_GET(self):