From 23f606075360a376a8fdb9f7fb1f3505c3100c1a Mon Sep 17 00:00:00 2001 From: marcinrzepeckiwroc Date: Tue, 22 Dec 2020 16:23:58 +0100 Subject: Extend PNF simulator with HTTP server Issue-ID: INT-1814 Change-Id: I06eeb81e46d6a96976f64eece6bbf7209665c1d2 Signed-off-by: marcinrzepeckiwroc --- sanitycheck/Makefile | 17 +++++++++- sanitycheck/README.md | 16 ++++++++- sanitycheck/dmaap-simulator/README.md | 1 - sanitycheck/events/eventToVesWithHttpServer.json | 36 +++++++++++++++++++++ .../events/fewEventsToVesWithHttpServer.json | 24 ++++++++++++++ .../pnfsimulator-secured/certservice/Makefile | 11 ++++--- .../pnfsimulator-secured/certservice/README.md | 24 +++++++------- .../docker-compose-certservice-clients.yml | 11 +++++++ .../certservice/docker-compose-pnfsim.yml | 22 +++++++++++++ .../client-configuration-for-httpserver.env | 18 +++++++++++ .../E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz | Bin 0 -> 2046 bytes sanitycheck/ves/README.md | 3 +- 12 files changed, 162 insertions(+), 21 deletions(-) create mode 100644 sanitycheck/events/eventToVesWithHttpServer.json create mode 100644 sanitycheck/events/fewEventsToVesWithHttpServer.json create mode 100644 sanitycheck/pnfsimulator-secured/certservice/resources/certservice-client/client-configuration-for-httpserver.env create mode 100644 sanitycheck/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz (limited to 'sanitycheck') diff --git a/sanitycheck/Makefile b/sanitycheck/Makefile index 37f2669..3602875 100644 --- a/sanitycheck/Makefile +++ b/sanitycheck/Makefile @@ -19,11 +19,21 @@ stop: make -C ../pnfsimulator stop @echo "##### DONE #####" +upload-file-http-server: + @echo "##### Upload file to Http server #####" + curl -F "uploaded_file=@./resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz" -u demo:demo123456! http://localhost:7080/upload.php + @echo "\n##### DONE #####" + generate-event: @echo "##### Trigger PNF Simulator to generate event #####" curl -X POST http://localhost:5000/simulator/event -d @events/eventToVes.json --header "Content-Type: application/json" @echo "\n##### DONE #####" +generate-event-http-server: + @echo "##### Trigger PNF Simulator to generate event with Http Server #####" + curl -X POST http://localhost:5000/simulator/event -d @events/eventToVesWithHttpServer.json --header "Content-Type: application/json" + @echo "\n##### DONE #####" + reconfigure-ves-url: @echo "##### Change VES address configuration in PNF Simulator #####" curl -X PUT http://localhost:5000/simulator/config -d @events/vesAddressConfiguration.json --header "Content-Type: application/json" @@ -34,7 +44,12 @@ generate-multiple-events: curl -X POST http://localhost:5000/simulator/start -d @events/fewEventsToVes.json --header "Content-Type: application/json" @echo "\n##### DONE #####" +generate-multiple-events-http-server: + @echo "\n##### Trigger PNF Simulator to generate multiple events with http server#####" + curl -X POST http://localhost:5000/simulator/start -d @events/fewEventsToVesWithHttpServer.json --header "Content-Type: application/json" + @echo "\n##### DONE #####" + check-dmaap: @echo "##### Check dmaap simulator for collected events #####" make -C dmaap-simulator get-data - @echo "\n##### DONE #####" \ No newline at end of file + @echo "\n##### DONE #####" diff --git a/sanitycheck/README.md b/sanitycheck/README.md index ad5f3e3..61ed943 100644 --- a/sanitycheck/README.md +++ b/sanitycheck/README.md @@ -5,7 +5,8 @@ ``` ip a | grep docker0 | grep inet ``` -If the IP address is different than 172.17.0.1/16: + +If the IP address is different than 172.17.0.1/16: inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0 You have to change the IP address in file events/vesAddressConfiguration.json @@ -14,6 +15,11 @@ You have to change the IP address in file events/vesAddressConfiguration.json "vesServerUrl": "http://:8080/eventListener/v7" } ``` + +If you want use event with http server files: +``` +make upload-file-http-server +``` ### 1. Build Projects ``` make start @@ -32,6 +38,10 @@ make check-dmaap ``` make generate-event ``` +send event with files from Http Server +``` +generate-event-http-server +``` ### 3.2 Check dmaap sim should return list containing 1 event ``` @@ -43,6 +53,10 @@ this will send 4 event with interval 1 second ``` make generate-multiple-events ``` +this event will send 2 events with files from Http Server with interval 5 second +``` +make generate-multiple-events-http-server +``` ### 4.2 Check dmaap sim should return list containing 5 event (1 from point 3.1 and 4 from point 4.1) ``` diff --git a/sanitycheck/dmaap-simulator/README.md b/sanitycheck/dmaap-simulator/README.md index c06afdf..de0615a 100644 --- a/sanitycheck/dmaap-simulator/README.md +++ b/sanitycheck/dmaap-simulator/README.md @@ -1,7 +1,6 @@ DMaaP simulator --------------- - ### Build an image ``` make build diff --git a/sanitycheck/events/eventToVesWithHttpServer.json b/sanitycheck/events/eventToVesWithHttpServer.json new file mode 100644 index 0000000..3d128e6 --- /dev/null +++ b/sanitycheck/events/eventToVesWithHttpServer.json @@ -0,0 +1,36 @@ +{ + "event": { + "event": { + "commonEventHeader": { + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1", + "domain": "notification", + "eventName": "Notification_gnb-Nokia_FileReady", + "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1", + "lastEpochMicrosec": 8745745764578, + "priority": "Normal", + "reportingEntityName": "NOK6061ZW3", + "sequence": 0, + "sourceName": "NOK6061ZW3", + "startEpochMicrosec": 8745745764578, + "timeZoneOffset": "UTC+05.30" + }, + "notificationFields": { + "changeIdentifier": "PM_MEAS_FILES", + "changeType": "FileReady", + "notificationFieldsVersion": "2.0", + "arrayOfNamedHashMap": [ + { + "name": "C_28532_measData_pm_98.xml", + "hashMap": { + "location": "http://httpserver:httpserver@localhost:7080/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V10" + } + } + ] + } + } + } +} diff --git a/sanitycheck/events/fewEventsToVesWithHttpServer.json b/sanitycheck/events/fewEventsToVesWithHttpServer.json new file mode 100644 index 0000000..de3f100 --- /dev/null +++ b/sanitycheck/events/fewEventsToVesWithHttpServer.json @@ -0,0 +1,24 @@ +{ + "simulatorParams": { + "repeatCount": 2, + "repeatInterval": 5 + }, + "templateName": "notificationHttpServer.json", + "patch": { + "event": { + "commonEventHeader": { + "domain": "notification", + "eventName": "vFirewallBroadcastPackets", + "eventId": "#RandomString(10)", + "priority": "Normal", + "reportingEntityName": "myVNF", + "sequence": 1, + "sourceName": "ClosedLoopVNF", + "startEpochMicrosec": 1531616794, + "lastEpochMicrosec": 1531719042, + "vesEventListenerVersion": "7.0.1", + "version": "4.0.1" + } + } + } +} diff --git a/sanitycheck/pnfsimulator-secured/certservice/Makefile b/sanitycheck/pnfsimulator-secured/certservice/Makefile index 2d3754c..f6667e2 100644 --- a/sanitycheck/pnfsimulator-secured/certservice/Makefile +++ b/sanitycheck/pnfsimulator-secured/certservice/Makefile @@ -11,7 +11,6 @@ restart-pnfsim: --clean-pnfsim start-pnfsim clean-all: --clean-pnfsim --clean-env - --start-certservice-and-ejbca: --create-certservice-internal-certs --start-certservice-ejbca-containers --configure-ejbca --start-certservice-ejbca-containers: @@ -34,25 +33,27 @@ clean-all: --clean-pnfsim --clean-env @echo 'Waiting for client certifiactes...' @until ls -1 ./resources/certservice-client/client-volume-for-pnfsim | grep "store" 1>/dev/null; do sleep 3; done @until ls -1 ./resources/certservice-client/client-volume-for-ves | grep "store" 1>/dev/null; do sleep 3; done + @until ls -1 ./resources/certservice-client/client-volume-for-httpserver | grep "store" 1>/dev/null; do sleep 3; done --create-client-volumes: mkdir -p ./resources/certservice-client/client-volume-for-pnfsim -m 777 mkdir -p ./resources/certservice-client/client-volume-for-ves -m 777 + mkdir -p ./resources/certservice-client/client-volume-for-httpserver -m 777 --start-local-secured-ves: docker-compose -f docker-compose-ves-dmaap.yml up --clean-pnfsim: docker-compose -f docker-compose-pnfsim.yml down - rm -rf ./resources/certservice-client/client-volume-for-pnfsim/trust.jks || true - rm -rf ./resources/certservice-client/client-volume-for-pnfsim/cert.p12 || true - rm -rf ./resources/certservice-client/client-volume-for-pnfsim/p12.pass || true - rm -rf ./resources/certservice-client/client-volume-for-pnfsim/trust.pass || true + rm -rf ./resources/certservice-client/client-volume-for-pnfsim || true + rm -rf ./resources/certservice-client/client-volume-for-httpserver || true + --clean-env: docker-compose -f docker-compose-ves-dmaap.yml down docker-compose -f docker-compose-certservice-clients.yml down rm -rf ./resources/certservice-client/client-volume-for-pnfsim || true rm -rf ./resources/certservice-client/client-volume-for-ves || true + rm -rf ./resources/certservice-client/client-volume-for-httpserver || true docker-compose -f docker-compose-certservice-ejbca.yml down make -C resources/certs clear diff --git a/sanitycheck/pnfsimulator-secured/certservice/README.md b/sanitycheck/pnfsimulator-secured/certservice/README.md index 16a4793..2708041 100644 --- a/sanitycheck/pnfsimulator-secured/certservice/README.md +++ b/sanitycheck/pnfsimulator-secured/certservice/README.md @@ -6,22 +6,23 @@ This readme describes how to run PNF Simulator with certificates fetched using O Using Makefile in this directory following can be achieved: * Setup environment for PNF Simulator, i.e.: - * Create certificates that will be used for internal communication between CertService and CertService Clients. - Generated internal certificates should be present in `resources/certs` directory. + * Create certificates that will be used for internal communication between CertService and CertService Clients. + Generated internal certificates should be present in `resources/certs` directory. * Start and configure EJBCA * Start and configure AAF Cert Service. - * Run Cert Service Clients to fetch certificates for VES and PNF Simulator. Certificates will be stored for the components -in `resources/certservice-client/client-volume-for-ves` and `resources/certservice-client/client-volume-for-pnfsim` accordingly. - * Start VES and DMaaP Simulator. Fetched certificates will be mounted to VES. + * Run Cert Service Clients to fetch certificates for VES and PNF Simulator. Certificates will be stored for the + components in `resources/certservice-client/client-volume-for-ves` + and `resources/certservice-client/client-volume-for-pnfsim` accordingly. + * Start VES and DMaaP Simulator. Fetched certificates will be mounted to VES. * Start PNF Simulator. Fetched certificates will be mounted to PNF Simulator. * Clean up. - + ### Prerequisites ##### VES collector local deployment prerequisites -By default, the image of VES from Nexus supports only HTTP communication. A local image with enabled HTTPS must be -build to use local VES as PNF simulator destination. +By default, the image of VES from Nexus supports only HTTP communication. A local image with enabled HTTPS must be build +to use local VES as PNF simulator destination. 1. Pull VES repository 2. In `/etc/collector.properties` file set field `auth.method=certBasicAuth` @@ -31,8 +32,6 @@ Local VES deployment uses also DMaaP simulator. Its image should be built locall 1. Go to `sanitycheck/dmaap-simulator` directory 2. Run: `make build` - - ### Setup environment To set up whole environment for PNF Simulator, i.e.: - deploy and configure EJBCA @@ -52,7 +51,9 @@ To run PNF Simulator execute: ```` make start-pnfsim ```` -This command starts PNF Simulator with certificates fetched using CertService (certificates are fetched in the previous step) +PNF Simulator starts together with the http server. +This command starts PNF Simulator with certificates fetched using CertService (certificates are fetched in the previous +step) ### Send event @@ -61,7 +62,6 @@ Configure PNF simulator to use proper VES URL by executing this command from ``p make reconfigure-ves-url ``` - Send an event from PNF simulator to VES by executing this command from ``pnf-simulator/sanitycheck`` directory: ``` make generate-event diff --git a/sanitycheck/pnfsimulator-secured/certservice/docker-compose-certservice-clients.yml b/sanitycheck/pnfsimulator-secured/certservice/docker-compose-certservice-clients.yml index fdfd6c6..a7b19e4 100644 --- a/sanitycheck/pnfsimulator-secured/certservice/docker-compose-certservice-clients.yml +++ b/sanitycheck/pnfsimulator-secured/certservice/docker-compose-certservice-clients.yml @@ -26,3 +26,14 @@ services: - ./resources/certservice-client/client-volume-for-pnfsim:/var/certs:rw - ./resources/certs/truststore.jks:/etc/onap/oom/certservice/certs/truststore.jks - ./resources/certs/certServiceClient-keystore.jks:/etc/onap/oom/certservice/certs/certServiceClient-keystore.jks + + oom-cert-client-httpserver: + image: nexus3.onap.org:10001/onap/org.onap.oom.platform.cert-service.oom-certservice-client:2.1.0 + container_name: oomcert-client-for-httpserver + env_file: ./resources/certservice-client/client-configuration-for-httpserver.env + networks: + - onap + volumes: + - ./resources/certservice-client/client-volume-for-httpserver:/var/certs:rw + - ./resources/certs/truststore.jks:/etc/onap/oom/certservice/certs/truststore.jks + - ./resources/certs/certServiceClient-keystore.jks:/etc/onap/oom/certservice/certs/certServiceClient-keystore.jks diff --git a/sanitycheck/pnfsimulator-secured/certservice/docker-compose-pnfsim.yml b/sanitycheck/pnfsimulator-secured/certservice/docker-compose-pnfsim.yml index d5bb5e2..a46d29e 100644 --- a/sanitycheck/pnfsimulator-secured/certservice/docker-compose-pnfsim.yml +++ b/sanitycheck/pnfsimulator-secured/certservice/docker-compose-pnfsim.yml @@ -35,6 +35,28 @@ services: ME_CONFIG_MONGODB_ADMINUSERNAME: root ME_CONFIG_MONGODB_ADMINPASSWORD: zXcVbN123! + http-server: + image: http-server + ports: + - "7080:80" + - "7443:443" + networks: + - pnfsimulator + - public + volumes: + - ~/httpservervolumes/:/usr/local/apache2/htdocs + - ../../../httpserver/resources/.htaccess:/usr/local/apache2/htdocs/.htaccess + - ../../../httpserver/logs:/var/log/apache2 + - ./resources/certservice-client/client-volume-for-httpserver/:/etc/apache2/certs/ + command: bash -c " + echo 'Http Server start'; + while [[ $$(ls -1 /etc/apache2/certs/ | wc -l) != '3' ]]; do echo 'Waiting for certs...'; sleep 3; done; + chmod 777 /usr/local/apache2/htdocs; + cp /usr/local/apache2/conf/upload.php /usr/local/apache2/htdocs/upload.php; + /usr/sbin/apache2ctl -D FOREGROUND; + " + restart: on-failure + pnf-simulator: image: nexus3.onap.org:10003/onap/org.onap.integration.simulators.pnfsimulator ports: diff --git a/sanitycheck/pnfsimulator-secured/certservice/resources/certservice-client/client-configuration-for-httpserver.env b/sanitycheck/pnfsimulator-secured/certservice/resources/certservice-client/client-configuration-for-httpserver.env new file mode 100644 index 0000000..8e8eb34 --- /dev/null +++ b/sanitycheck/pnfsimulator-secured/certservice/resources/certservice-client/client-configuration-for-httpserver.env @@ -0,0 +1,18 @@ +#Client envs +REQUEST_URL=https://oom-cert-service:8443/v1/certificate/ +REQUEST_TIMEOUT=10000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=PEM +#Csr config envs +COMMON_NAME=httpserver-onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +#Tls config envs +KEYSTORE_PATH=/etc/onap/oom/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret diff --git a/sanitycheck/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz b/sanitycheck/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz new file mode 100644 index 0000000..3af5ea8 Binary files /dev/null and b/sanitycheck/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz differ diff --git a/sanitycheck/ves/README.md b/sanitycheck/ves/README.md index 29309a4..fc9e5dc 100644 --- a/sanitycheck/ves/README.md +++ b/sanitycheck/ves/README.md @@ -18,4 +18,5 @@ make health-check ### Stop ``` -make stop \ No newline at end of file +make stop +``` -- cgit 1.2.3-korg