summaryrefslogtreecommitdiffstats
path: root/test/csit/tests
diff options
context:
space:
mode:
authorHelen Chen <helen.chen@huawei.com>2018-09-06 13:50:14 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-06 13:50:14 +0000
commit736dbe2bc4e0cde2a12ee3cc513babf7dd8fe93b (patch)
treee2a680092bc502f726bdfaef700d68d889fb80d0 /test/csit/tests
parent2c55c0e7342f09788bc92d54dfc39ffac2d180c4 (diff)
parent347997816e5c053ae7d0d53ea346265d5d574875 (diff)
Merge "Fix tests and updated docker files"
Diffstat (limited to 'test/csit/tests')
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/__init__.robot2
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot36
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py22
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml21
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot7
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py1
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator10
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py3
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator10
9 files changed, 67 insertions, 45 deletions
diff --git a/test/csit/tests/dcaegen2/prh-testcases/__init__.robot b/test/csit/tests/dcaegen2/prh-testcases/__init__.robot
index e69de29bb..f13ba6df8 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/__init__.robot
+++ b/test/csit/tests/dcaegen2/prh-testcases/__init__.robot
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation Integration - PRH suite \ No newline at end of file
diff --git a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
index b7013c4a2..5150a4b35 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -10,7 +10,7 @@ Resource resources/prh_library.robot
${DMAAP_SIMULATOR_URL} http://${DMAAP_SIMULATOR}
${AAI_SIMULATOR_URL} http://${AAI_SIMULATOR}
${PRH_URL} http://${PRH}
-${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW1"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.16.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
${Not_json_format} ""
*** Test Cases ***
@@ -19,28 +19,18 @@ Valid DMaaP event can be converted to PNF_READY notification
[Tags] PRH Valid event
[Template] Valid event processing
${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
- {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002G", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002F", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"Ericsson", "pnfSerialNumber":"QTFCOC5400000", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85b3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW2"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.123.234", "oamV6IpAddress":""}}}
+ {"event": {"commonEventHeader": {"sourceName":"ERI6061ZW3"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334"}}}
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": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
- {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
- ${Not_json_format}
+ {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW4"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}}
+ {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.18.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334"}}}
+ {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.163.234", "oamV6IpAddress":""}}}
+ {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334"}}}
+ {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}}
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
@@ -48,7 +38,13 @@ Get valid event from DMaaP and record in AAI does not exist
[Timeout] 30s
Set PNF name in AAI wrong_aai_record
Set event in DMaaP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
- Wait Until Keyword Succeeds 100x 300ms Check PRH log org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException: Incorrect response code for continuation of tasks workflow
+ Wait Until Keyword Succeeds 100x 300ms Check PRH log java.io.IOException: Connection closed prematurely
+
+Event in DMaaP is not JSON format
+ [Documentation] PRH get not JSON format event from DMaaP - PRH does not produce PNF_READY notification
+ [Tags] PRH
+ Set event in DMaaP ${Not_json_format}
+ Wait Until Keyword Succeeds 100x 300ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array:
Get valid event from DMaaP and AAI is not responding
[Documentation] PRH get valid event from DMaaP with all required fields and AAI is not responding - PRH does not produce PNF_READY notification
@@ -56,4 +52,4 @@ Get valid event from DMaaP and AAI is not responding
[Timeout] 180s
Stop AAI
Set event in DMaaP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
- Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.NoRouteToHostException: Host is unreachable (Host unreachable)
+ Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index ac3fba46e..c2a8b78a2 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -21,16 +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"]["otherFields"]["pnfOamIpv4Address"]
- ipv6 = json_to_python["event"]["otherFields"]["pnfOamIpv6Address"]
- pnf_name = _create_pnf_name(json_file)
- str_json = '{"pnf-name":"' + pnf_name + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
+ ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"]
+ ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"]
+ header = json_to_python["event"]["commonEventHeader"]["sourceName"]
+ str_json = '{"sourceName":"' + header + '","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):
- return _create_pnf_name(json_file)
+ json_to_python = json.loads(json_file)
+ header = json_to_python["event"]["commonEventHeader"]["sourceName"]
+ return header
@staticmethod
def stop_aai():
@@ -38,9 +40,7 @@ class PrhLibrary(object):
container = client.containers.get('aai_simulator')
container.stop()
-
-def _create_pnf_name(json_file):
- json_to_python = json.loads(json_file)
- vendor = json_to_python["event"]["otherFields"]["pnfVendorName"]
- serial_number = json_to_python["event"]["otherFields"]["pnfSerialNumber"]
- return vendor[:3].upper() + serial_number
+ def create_invalid_notification(self, json_file):
+ return self.create_pnf_ready_notification(json_file).replace("\":", "\": ")\
+ .replace("ipaddress-v4-oam", "oamV4IpAddress").replace("ipaddress-v6-oam", "oamV6IpAddress")\
+ .replace("}", "\\\\n}")
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
index b1f84fda2..67921e8e0 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -1,12 +1,15 @@
version: '3'
services:
prh:
- image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server
+ image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:latest
command: >
- --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222
- --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222
- --aai.aaiClientConfiguration.aaiHostPortNumber=3333
- --aai.aaiClientConfiguration.aaiProtocol=http
+ --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap
+ --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222
+ --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap
+ --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222
+ --aai.aaiClientConfiguration.aaiHostPortNumber=3333
+ --aai.aaiClientConfiguration.aaiHost=aai
+ --aai.aaiClientConfiguration.aaiProtocol=http
entrypoint:
- java
- -Dspring.profiles.active=dev
@@ -18,10 +21,10 @@ services:
- "8433:8433"
container_name: prh
depends_on:
- - dmaap_simulator
- - aai_simulator
+ - dmaap
+ - aai
- dmaap_simulator:
+ dmaap:
build:
context: simulator
dockerfile: DMaaP_simulator
@@ -29,7 +32,7 @@ services:
- "2222:2222"
container_name: dmaap_simulator
- aai_simulator:
+ aai:
build:
context: simulator
dockerfile: AAI_simulator
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot
index 10bc26c18..fa8c0d052 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -1,6 +1,7 @@
*** Settings ***
Library RequestsLibrary
Library Collections
+Library PrhLibrary.py
*** Keywords ***
Create header
@@ -17,8 +18,10 @@ Invalid event processing
[Arguments] ${input_invalid_event_in_dmaap}
[Timeout] 30s
Set event in DMaaP ${input_invalid_event_in_dmaap}
- Wait Until Keyword Succeeds 100x 100ms Check PRH log INFO 1 --- [pool-2-thread-1] o.o.d.s.prh.tasks.DmaapConsumerTaskImpl \ : Consumed model from DmaaP: ${input_invalid_event_in_dmaap}
-
+ ${invalid_notification}= Create invalid notification ${input_invalid_event_in_dmaap}
+ ${notification}= Catenate SEPARATOR= \\\\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification}
+ Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification}
+
Valid event processing
[Arguments] ${input_valid_event_in_dmaap}
[Timeout] 30s
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index e70d8d30f..c57903c30 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -7,6 +7,7 @@ pnfs = 'Empty'
class AAIHandler(BaseHTTPRequestHandler):
+
def do_PUT(self):
if re.search('/set_pnfs', self.path):
global pnfs
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
index 013cd0a65..89a266ebe 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
@@ -1,4 +1,12 @@
-FROM python:3
+FROM alpine:3.8
+
+RUN apk add --no-cache python3 && \
+ python3 -m ensurepip && \
+ rm -r /usr/lib/python*/ensurepip && \
+ pip3 install --upgrade pip setuptools && \
+ if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
+ if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
+ rm -r /root/.cache
ADD AAI.py /
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
index 210378421..96e22a141 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -8,6 +8,7 @@ received_event_to_get_method = 'Empty'
class DMaaPHandler(BaseHTTPRequestHandler):
+
def do_PUT(self):
if re.search('/set_get_event', self.path):
global received_event_to_get_method
@@ -27,7 +28,7 @@ class DMaaPHandler(BaseHTTPRequestHandler):
return
def do_GET(self):
- if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT/OpenDcae-c12/c12', self.path):
+ if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12', self.path):
_header_200_and_json(self)
self.wfile.write(received_event_to_get_method)
elif re.search('/events/pnfReady', self.path):
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
index cf4160c89..9cf21dc92 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
@@ -1,4 +1,12 @@
-FROM python:3
+FROM alpine:3.8
+
+RUN apk add --no-cache python3 && \
+ python3 -m ensurepip && \
+ rm -r /usr/lib/python*/ensurepip && \
+ pip3 install --upgrade pip setuptools && \
+ if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
+ if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
+ rm -r /root/.cache
ADD DMaaP.py /