aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit
diff options
context:
space:
mode:
authorMariusz Wagner <mariusz.wagner@nokia.com>2018-07-05 11:32:51 +0200
committerMariusz Wagner <mariusz.wagner@nokia.com>2018-07-05 11:32:51 +0200
commit60be36dd12980b15db0edbb7d14c7a719596d367 (patch)
treed46b95ea0986ec9da890a02e8bae89ec8051a172 /test/csit
parentbc76450dfae26da5364b4ef79535314598e04a1c (diff)
Fix for jenkins job
Issue-ID: INT-510 Change-Id: I75cd49524b313d1db121b246b70f8b3ba2ba11d4 Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
Diffstat (limited to 'test/csit')
-rw-r--r--test/csit/plans/dcaegen2/prh-testsuites/setup.sh12
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot35
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py3
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml12
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py23
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator2
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py28
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator2
8 files changed, 46 insertions, 71 deletions
diff --git a/test/csit/plans/dcaegen2/prh-testsuites/setup.sh b/test/csit/plans/dcaegen2/prh-testsuites/setup.sh
index cdac9d210..e4b1cd7c1 100644
--- a/test/csit/plans/dcaegen2/prh-testsuites/setup.sh
+++ b/test/csit/plans/dcaegen2/prh-testsuites/setup.sh
@@ -12,7 +12,7 @@ docker login -u docker -p docker nexus3.onap.org:10003
docker-compose up -d --build
# Wait for initialization of Docker containers
-for i in {1..50}; do
+for i in {1..10}; do
if [ $(docker inspect --format '{{ .State.Running }}' ${PRH_SERVICE}) ] && \
[ $(docker inspect --format '{{ .State.Running }}' ${DMAAP_SIMULATOR}) ] && \
[ $(docker inspect --format '{{ .State.Running }}' ${AAI_SIMULATOR}) ]
@@ -38,7 +38,7 @@ echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP}
echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP}
# Wait for initialization of docker services
-for i in {1..50}; do
+for i in {1..10}; do
curl -sS -m 1 localhost:2222 && \
curl -sS -m 1 localhost:3333 && \
curl -sS -m 1 localhost:8100/heartbeat && break
@@ -46,12 +46,14 @@ for i in {1..50}; do
sleep ${i}
done
+docker stop prh
docker cp prh:/config/prh_endpoints.json ${WORKDIR}
sed -i -e 's/"dmaapHostName":.*/"dmaapHostName": "'${DMAAP_SIMULATOR_IP}'",/g' ${WORKDIR}/prh_endpoints.json
sed -i -e 's/"aaiHost":.*/"aaiHost": "'${AAI_SIMULATOR_IP}'",/g' ${WORKDIR}/prh_endpoints.json
docker cp ${WORKDIR}/prh_endpoints.json prh:/config/
+docker start prh
-#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"
+# #Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES="-v DMAAP_SIMULATOR:${DMAAP_SIMULATOR_IP}:2222 -v AAI_SIMULATOR:${AAI_SIMULATOR_IP}:3333 -v PRH:${PRH_IP}:8100"
-pip install docker
+pip install docker==2.7.0
diff --git a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
index e507dcba7..1cfc2da71 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -1,6 +1,5 @@
*** Settings ***
Library RequestsLibrary
-Library Process
Library resources/PrhLibrary.py
*** Variables ***
@@ -12,32 +11,26 @@ ${PRH_URL} http://${PRH}
Getting and Consuming Positive Scenario
[Documentation] Get message from new topic and consume it - positive scenarios
[Tags] PRH
- [Setup] Start prh
[Template] Run Getting and Consuming
- {"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
+ {"pnf-name":"NOKQTFCOC540002E","ipaddress-v4-oam":"10.16.123.234","ipaddress-v6-oam":"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}}}
+ {"pnf-name":"NOKQTFCOC540002F","ipaddress-v4-oam":"","ipaddress-v6-oam":"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}}}
+ {"pnf-name":"NOKQTFCOC540002G","ipaddress-v4-oam":"10.16.123.234","ipaddress-v6-oam":""} 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}}}
+ {"pnf-name":"ERIQTFCOC5400000","ipaddress-v4-oam":"10.16.123.23","ipaddress-v6-oam":""} 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}}}
Missing IPv4 and IPv6
[Documentation] Test get event from DMaaP without IPv4 and IPv6
[Tags] PRH no_IPv4 no_IPv6
- [Setup] Start prh
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 ***
Wrong AAI record
[Arguments] ${event_in_dmaap}
- [Timeout] 1m
+ [Timeout] 30s
${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
@@ -46,7 +39,7 @@ Wrong AAI record
Missing IP
[Arguments] ${event_in_dmaap}
- [Timeout] 1m
+ [Timeout] 30s
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
Set get event in DMAAP ${event_in_dmaap} ${headers}
${check}= check for log org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: IPV4 and IPV6 are empty
@@ -65,23 +58,9 @@ Run Getting and Consuming
\ Sleep 1s
Should Be Equal ${resp.text} ${posted_event_to_dmaap}
-Start prh
- [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] 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}
- Should Be Equal ${resp.text} "PRH Service has already been stopped!"
-
Set pnfs name in AAI
[Arguments] ${pnfs_name}
- [Timeout] 1 minute
+ [Timeout] 1m
${headers}= Create Dictionary Accept=application/json Content-Type=text/html
Create Session set_pnfs_in_aai ${AAI_SIM_URL}
${resp}= Put Request set_pnfs_in_aai /set_pnfs headers=${headers} data=${pnfs_name}
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index f07f385f5..aaae72a0f 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -1,7 +1,7 @@
import docker
class PrhLibrary(object):
-
+
def __init__(self):
pass
@@ -13,4 +13,3 @@ class PrhLibrary(object):
return True
else:
return False
- \ No newline at end of file
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 e773b76a9..03e84b388 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -17,7 +17,10 @@ services:
- "8100:8100"
- "8433:8433"
container_name: prh
-
+ depends_on:
+ - dmaap_simulator
+ - aai_simulator
+
dmaap_simulator:
build:
context: simulator
@@ -27,9 +30,7 @@ services:
ports:
- "2222:2222"
container_name: dmaap_simulator
- depends_on:
- - prh
-
+
aai_simulator:
build:
context: simulator
@@ -39,6 +40,3 @@ services:
ports:
- "3333:3333"
container_name: aai_simulator
- depends_on:
- - prh
-
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 2c0b42dcd..a0dd814b8 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -17,43 +17,42 @@ class AAIHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.end_headers()
return
-
+
def do_PATCH(self):
- pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs
+ pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs
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):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
self.wfile.write('GET')
self.wfile.close()
-
+
return
-def _main_ (HandlerClass = AAIHandler,
- ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
-
+def _main_ (HandlerClass = AAIHandler, ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 3333
-
+
server_address = ('', port)
-
+
HandlerClass.protocol_version = protocol
httpd = ServerClass(server_address, HandlerClass)
-
+
sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
httpd.serve_forever()
-
+
if __name__ == '__main__':
_main_()
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 2d96d8925..d647207fc 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
@@ -4,7 +4,7 @@ ENV https_proxy "$https_proxy"
ADD AAI.py /
-RUN pip install robotframework
+RUN pip install robotframework
EXPOSE 3333
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 af716fd06..167867842 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -7,10 +7,11 @@ from robot.api import logger
posted_event_from_prh = 'Empty'
received_event_to_get_method = 'Empty'
-class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_PUT(self):
if re.search('/set_get_event', self.path):
global received_event_to_get_method
+ posted_event_from_prh = 'Empty'
content_length = int(self.headers['Content-Length'])
received_event_to_get_method = self.rfile.read(content_length)
self.send_response(200)
@@ -18,20 +19,20 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.end_headers()
return
-
+
def do_POST(self):
- if re.search('/events/pnfReady', self.path):
+ if re.search('/events/unauthenticated.PNF_READY', self.path):
global posted_event_from_prh
content_length = int(self.headers['Content-Length'])
posted_event_from_prh = self.rfile.read(content_length)
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
-
+
return
-
+
def do_GET(self):
- if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT', self.path):
+ if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT/OpenDcae-c12/c12', self.path):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
@@ -42,8 +43,6 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-Type', 'application/json')
self.end_headers()
self.wfile.write(posted_event_from_prh)
- global posted_event_from_prh
- posted_event_from_prh = 'Empty'
self.wfile.close()
else:
self.send_response(200)
@@ -54,22 +53,21 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
return
-def _main_ (HandlerClass = DMaaPHandler,
- ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
-
+def _main_ (HandlerClass = DMaaPHandler, ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 2222
-
+
server_address = ('', port)
-
+
HandlerClass.protocol_version = protocol
httpd = ServerClass(server_address, HandlerClass)
-
+
sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
httpd.serve_forever()
-
+
if __name__ == '__main__':
_main_()
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 4de65393d..37da1c7c1 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
@@ -4,7 +4,7 @@ ENV https_proxy "$https_proxy"
ADD DMaaP.py /
-RUN pip install robotframework
+RUN pip install robotframework
EXPOSE 2222