Library
- HV-VES CSIT : https://gerrit.onap.org/r/#/c/59375/
- JSONs : https://gerrit.onap.org/r/gitweb?p=integration.git;a=tree;f=test/csit/tests/dcaegen2/hv-ves-testcases/resources/scenarios;hb=3e3a52e698c023b9bcec8ad9d18892c2b545c6a3
Precondition
- Server flavor : 8 vCPU / 30GB RAM / 100GB HDD
- Server OS : Ubuntu 16.04
Planned
- Heat template TBD
- Scripts available in repo TBD
HV-VES simulator installation
- Put the following bash script on the server and run it :
#!/bin/bash set_versions () { DOCKER_VERSION=17.03 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 () { rm -rf /var/lib/apt/lists/* apt-get clean apt-get update } docker_install_configure () { curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh mkdir -p /etc/systemd/system/docker.service.d/ cat > /etc/systemd/system/docker.service.d/docker.conf << EOF [Service] ExecStart= ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10003 EOF systemctl daemon-reload systemctl restart docker apt-mark hold docker-ce 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 } hvves_sim_yml_checkout () { mkdir ~/hv-ves_sim/ cd ~/hv-ves_sim/;wget "https://gerrit.onap.org/r/gitweb?p=dcaegen2/collectors/hv-ves.git;a=blob_plain;f=docker-compose.yml;hb=HEAD" -O docker-compose.yml } dcae_simulator_disable () { cd ~/hv-ves_sim/;sed -i '/ dcae-app-simulator/,$d' docker-compose.yml } generate_certs () { mkdir ~/hv-ves_sim/ssl cd ~/hv-ves_sim/ssl;wget "https://gerrit.onap.org/r/gitweb?p=dcaegen2/collectors/hv-ves.git;a=blob_plain;f=ssl/Makefile;hb=HEAD" -O Makefile cd ~/hv-ves_sim/ssl;make FILE=client cd ~/hv-ves_sim/ssl;make FILE=server } start_simulator_env () { cd ~/hv-ves_sim;nohup docker-compose up &> ~/docker-compose.log & for i in {0..300} do sim=`grep -q "Started xNF Simulator API server" ~/docker-compose.log ; echo $?` if [ $sim -eq 0 ] then return 0 else sleep 5s fi done } consul_entry () { echo -e "127.0.0.1\tconsul" >> /etc/hosts } consul_configure () { echo '{"kafkaBootstrapServers": "kafka:9092","routing":[{"fromDomain":11,"toTopic":"ves_hvRanMeas"}]}' | curl -X PUT -d @- http://consul:8500/v1/kv/veshv-config -H "Content-Type:application/json" } restart_simulator_env () { cd ~/hv-ves_sim;nohup docker-compose restart & } set_versions enable_root_ssh update_os docker_install_configure docker_compose_install hvves_sim_yml_checkout dcae_simulator_disable generate_certs consul_entry start_simulator_env consul_configure restart_simulator_env
- Verify that all docker containers are up :
root@marekpl-rtpmsim:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ac1f97c91fbb nexus3.onap.org:10003/onap/ves-hv-collector-xnf-simulator "./run-java.sh run..." 2 minutes ago Up 28 seconds 0.0.0.0:6062->6062/tcp hv-ves_xnf-simulator_1 c9fccf31d8ac nexus3.onap.org:10003/onap/ves-hv-collector:latest "./run-java.sh run..." 2 minutes ago Up 27 seconds (healthy) 0.0.0.0:6060-6061->6060-6061/tcp hv-ves_ves-hv-collector_1 dfb445680eda wurstmeister/kafka "start-kafka.sh" 2 minutes ago Up 26 seconds 0.0.0.0:9092->9092/tcp hv-ves_kafka_1 b316f34ed9e0 wurstmeister/zookeeper "/bin/sh -c '/usr/..." 2 minutes ago Up 20 seconds 22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp hv-ves_zookeeper_1 586cb4b9dd9f progrium/consul "/bin/start -serve..." 2 minutes ago Up 30 seconds 53/tcp, 53/udp, 8300-8302/tcp, 8400/tcp, 8301-8302/udp, 0.0.0.0:8500->8500/tcp hv-ves_consul_1 root@marekpl-rtpmsim:~#
- Verify HV-VES configuration :
root@marekpl-rtpmsim:~# curl http://consul:8500/v1/kv/veshv-config [{"CreateIndex":6,"ModifyIndex":6,"LockIndex":0,"Key":"veshv-config","Flags":0,"Value":"eyJrYWZrYUJvb3RzdHJhcFNlcnZlcnMiOiAia2Fma2E6OTA5MiIsInJvdXRpbmciOlt7ImZyb21Eb21haW4iOjExLCJ0b1RvcGljIjoidmVzX2h2UmFuTWVhcyJ9XX0="}]
HV-VES simulator usage
Prepare sample of XNF file (e.g. the one from https://gerrit.onap.org/r/gitwemessagesAmountb?p=integration.git;a=blob_plain;f=test/csit/tests/dcaegen2/hv-ves-testcases/resources/scenarios/fixed-payload/xnf-fixed-payload-request.json;hb=3e3a52e698c023b9bcec8ad9d18892c2b545c6a3)
[ { "commonEventHeader": { "version": "sample-version", "domain": "HVRANMEAS", "sequence": 1, "priority": 1, "eventId": "sample-event-id", "eventName": "sample-event-name", "eventType": "sample-event-type", "startEpochMicrosec": 120034455, "lastEpochMicrosec": 120034455, "nfNamingCode": "sample-nf-naming-code", "nfcNamingCode": "sample-nfc-naming-code", "reportingEntityId": "sample-reporting-entity-id", "reportingEntityName": "sample-reporting-entity-name", "sourceId": "sample-source-id", "sourceName": "sample-source-name" }, "messageType": "FIXED_PAYLOAD", "messagesAmount": 1 } ]
- Start HV-VES log :
root@marekpl-rtpmsim:~# docker logs --tail 0 -f c9fccf31d8ac
- Start Kafka consumer log :
root@marekpl-rtpmsim:~# docker exec -ti dfb445680eda sh / # kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic ves_hvRanMeas
- Upload following script to the server as simulator.sh :
#!/bin/bash input_parameters () { option=$1 file=$2 } help () { echo -e "Usage: simulator.sh [send] [message]" } send_message () { if [[ -z $1 ]] || [[ -z $2 ]] then echo "Input parameter(s) empty." help exit 1 elif [[ $1 == "send" ]] && [[ -n $2 ]] then curl -X POST -d @$2 http://localhost:6062/simulator/async -H "Content-Type:application/json" else help fi } main () { input_parameters "$1" "$2" send_message "$option" "$file" } main "$1" "$2"
- Send the message using simulator.sh :
root@marekpl-rtpmsim:~# ./simulator.sh send ./XNF {"response":"Request accepted"}
- Check HV-VES log :
root@marekpl-rtpmsim:~# docker logs --tail 0 -f c9fccf31d8ac 2018-08-24T14:38:58.156Z INFO [o.o.d.c.v.i.s.NettyTcpServer ] - Handling connection from /172.18.0.6:40002 2018-08-24T14:38:58.188Z INFO [o.a.k.c.p.ProducerConfig ] - ProducerConfig values: acks = 1 batch.size = 16384 bootstrap.servers = [kafka:9092] buffer.memory = 33554432 client.id = compression.type = none connections.max.idle.ms = 540000 enable.idempotence = false interceptor.classes = null key.serializer = class org.onap.dcae.collectors.veshv.impl.adapters.kafka.ProtobufSerializer linger.ms = 0 max.block.ms = 60000 max.in.flight.requests.per.connection = 5 max.request.size = 1048576 metadata.max.age.ms = 300000 metric.reporters = [] metrics.num.samples = 2 metrics.recording.level = INFO metrics.sample.window.ms = 30000 partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner receive.buffer.bytes = 32768 reconnect.backoff.max.ms = 1000 reconnect.backoff.ms = 50 request.timeout.ms = 30000 retries = 0 retry.backoff.ms = 100 sasl.jaas.config = null sasl.kerberos.kinit.cmd = /usr/bin/kinit sasl.kerberos.min.time.before.relogin = 60000 sasl.kerberos.service.name = null sasl.kerberos.ticket.renew.jitter = 0.05 sasl.kerberos.ticket.renew.window.factor = 0.8 sasl.mechanism = GSSAPI security.protocol = PLAINTEXT send.buffer.bytes = 131072 ssl.cipher.suites = null ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1] ssl.endpoint.identification.algorithm = null ssl.key.password = null ssl.keymanager.algorithm = SunX509 ssl.keystore.location = null ssl.keystore.password = null ssl.keystore.type = JKS ssl.protocol = TLS ssl.provider = null ssl.secure.random.implementation = null ssl.trustmanager.algorithm = PKIX ssl.truststore.location = null ssl.truststore.password = null ssl.truststore.type = JKS transaction.timeout.ms = 60000 transactional.id = null value.serializer = class org.onap.dcae.collectors.veshv.impl.adapters.kafka.VesMessageSerializer 2018-08-24T14:38:58.220Z INFO [o.a.k.c.u.AppInfoParser ] - Kafka version : 0.11.0.0 2018-08-24T14:38:58.221Z INFO [o.a.k.c.u.AppInfoParser ] - Kafka commitId : cb8625948210849f 2018-08-24T14:38:58.228Z TRACE [o.o.d.c.v.i.w.WireChunkDecoder ] - Got message with total size of 336 B 2018-08-24T14:38:58.232Z TRACE [o.o.d.c.v.i.w.WireChunkDecoder ] - Wire payload size: 328 B 2018-08-24T14:38:58.386Z TRACE [o.o.d.c.v.i.w.WireChunkDecoder ] - Received end-of-transmission message 2018-08-24T14:38:58.386Z INFO [o.o.d.c.v.i.VesHvCollector ] - Completing stream because of receiving EOT message 2018-08-24T14:38:58.415Z TRACE [o.o.d.c.v.i.a.k.KafkaSink ] - Message #1 has been sent to ves_hvRanMeas:0 2018-08-24T14:38:58.421Z INFO [o.o.d.c.v.i.s.NettyTcpServer ] - Connection from /172.18.0.6:40002 has been closed
- Check Kafka consumer log :
root@marekpl-rtpmsim:~# docker exec -ti dfb445680eda sh / # kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic ves_hvRanMeas ? sample-version *sample-version2sample-version:sample-version@???9H???9Rsample-nf-naming-codeZsample-nfc-naming-codebsample-reporting-entity-idjsample-reporting-entity-namersample-source-idzsample-source-named