...
Using bash script:Put the following bash script on the server and run it :
Code Block language bash #!/bin/bash set_versions () { DOCKER_COMPOSE_VERSION=1.22.0 } enable_root_ssh () { sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config service sshd restart echo -e "arthur\narthur" | passwd root } update_os () { dnf -y install fedora-upgrade } docker_install_configureremove () { dnf -y remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine } docker_install_and_configure () { dnf -y install dnf-plugins-core dnf config-manager \ --add-repo \ https://download.docker.com/linux/fedora/docker-ce.repo dnf -y install docker-ce systemctl start docker systemctl daemon-reload systemctl restart docker docker login -u docker -p docker nexus3.onap.org:10003 } docker_compose_install () { curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose } pnf_sim_file_checkout () { mkdircd ~/sim/root; mkdir ~/sim/ssh cd ~/sim/ssh/;wget "git clone https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/ssh/ssh_host_rsa_key;hb=HEAD" -O ssh_host_rsa_key cd ~/sim/ssh/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/ssh/ssh_host_rsa_key.pub;hb=HEAD" -O ssh_host_rsa_key.pub mkdir ~/sim/sftp cd ~/sim/sftp/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/sftp/sftp-file.txt;hb=HEAD" -O sftp-file.txt mkdir ~/sim/config cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/config/config.json;hb=HEAD" -O config.json cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/config/netconf.env;hb=HEAD" -O netconf.env mkdir ~/sim/json_schema cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/json_schema/input_validator.json;hb=HEAD" -O input_validator.json cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/json_schema/output_validator_ves_schema_30.0.1.json;hb=HEAD" -O output_validator_ves_schema_30.0.1.json mkdir ~/sim/netconf cd ~/sim/netconf/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/netconf/pnf-simulator.data.xml;hb=HEAD" -O pnf-simulator.data.xml cd ~/sim/netconf/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/netconf/pnf-simulator.yang;hb=HEAD" -O pnf-simulator.yang cd ~/sim/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/docker-compose.yml;hb=HEAD" -O docker-compose.yml cd ~/sim/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/simulator.sh;hb=HEAD" -O simulator.sh chmod 654 ~/sim/simulator.sh } start_simulator (){ ~/simintegration printf "{\n "simulatorParams": {\n "vesServerUrl": "http://VES-HOST:VES-PORT/eventListener/v7",\n "testDuration": "10",\n "messageInterval": "1"\n },\n "commonEventHeaderParams": {\n "eventName": "pnfRegistration_Nokia_5gDu",\n "nfNamingCode": "gNB",\n "nfcNamingCode": "oam",\n "sourceName": "NOK6061ZW3",\n "sourceId": "val13",\n "reportingEntityName": "NOK6061ZW3"\n },\n "pnfRegistrationParams": {\n "serialNumber": "6061ZW3",\n "vendorName": "Nokia",\n "oamV4IpAddress": "val3",\n "oamV6IpAddress": "val4",\n "unitFamily": "BBU",\n "modelNumber": "val6",\n "softwareVersion": "val7",\n "unitType": "val8"\n }\n}" > integration/test/mocks/pnfsimulator/config/config.json } start_simulator () { docker login -u docker -p docker nexus3.onap.org:10003 cd ~/integration/test/mocks/pnfsimulator ./simulator.sh start } set_versions enable_root_ssh update_os docker_remove docker_install_and_configure docker_compose_install pnf_sim_file_checkout start_simulator
Using heat template:
Heat template used to deploy PnP PNF simulator on open stack can be found in:
https://gerrit.onap.org/r/gitweb?p=integration.git;a=tree;f=test/mocks/pnfsimulator/deployment;hb=HEAD
Deployment requires to fill define following parameters:- flavor_name
- Image name - use fesdora/centos/redhat base image with dnf support
- Key pair name
- Public network name or ID
- Private network name or ID
- Private subnetwork name or ID
- Proxy (optional parameter, format http://10.10.10.10:8080/, default is empty string)
Verify that all docker containers are up :
Code Block language bash [root@pnf-simroot@pnp-pnf-simulator-heat-pnf-pnp-simualtor-zaxysj4zteyy ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS PORTS NAMES bf0e6872738a90c67bbc8ff1 nexus3.onap.org:10003/onap/pnf-simulator:latest "/bin/sh -c 'java -c…" 1132 minutes ago Up 32 minutes 0.0.0.0:5000->5000/tcp Restarting (1) 47 seconds ago pnf-simulator 05f16489d3ca27b80e0de7c1 sysrepo/sysrepo-netopeer2:latest "/usr/bin/supervisor…" 1434 minutes ago Up 1434 minutes 0.0.0.0:830->830/tcp netopeer f1e73511a75e netopeer d42e41c873a6 atmoz/sftp:alpine "/entrypoint sftp-us…" 1434 minutes ago Up 1434 minutes 0.0.0.0:2222->22/tcp sftp-server 189b7e48955e stilliard/pure-ftpd:latest "/bin/sh -c '/run.sh…" 34 minutes ago Up 34 minutes 0.0.0.0:2222->2230000-30009->30000-30009/tcp, 0.0.0.0:2221->21/tcp sftpftpes-server
PnP PNF simulator usage
PNF registration events configuration
In order to configure events that will be send to OANP user need to configure config.json file.
Path to the file~/sim /root/integration/test/mocks/pnfsimulator/config/config.jsonCode Block language js title config.json { "simulatorParams": { "vesServerUrl": "http://<VESVES-HOST>HOST:<VESVES-PORT>PORT/eventListener/v7", "testDuration": "10", "messageInterval": "1" }, "messageParams"commonEventHeaderParams: { "pnf_serialNumber"eventName: "6061ZW3"pnfRegistration_Nokia_5gDu, "pnf_vendorName"nfNamingCode: "Nokia"gNB, "pnf_oamV4IpAddress"nfcNamingCode: "val3"oam, "pnf_oamV6IpAddress"sourceName: "val4"NOK6061ZW3, "pnf_unitFamily"sourceId: "BBU"val13, "pnf_modelNumber": "val6",reportingEntityName: NOK6061ZW3 }, pnfRegistrationParams: { "pnf_softwareVersion"serialNumber: "val7"6061ZW3, "pnf_unitType"vendorName: "val8"Nokia, "eventName"oamV4IpAddress: "pnfRegistration_Nokia_5gDu"val3, "nfNamingCode"oamV6IpAddress: "gNB"val4, "nfcNamingCode"unitFamily: "oam"BBU, "sourceName"modelNumber: "NOK6061ZW3"val6, "sourceId"softwareVersion: "val13"val7, "reportingEntityName"unitType: "NOK6061ZW3"val8 } }
User need to fill:
vesServerUrl
<VES-HOST> - IP of any Kubernetes host
<VES-PORT> - port under which VES service is visible outside Kuberentes cluster
messageInterval - interval with which messages are send to ONAP
testDuration - amount of registration requests
sourceName - use correlationId value used during service instantiation
pnfOamIpv4Address - put there some IPv4 address
pnfOamIpv6Address - put there some IPv6 address
...