From: YongchaoWu Date: Wed, 11 Dec 2019 12:10:30 +0000 (+0100) Subject: DRAFT: CBS and Consul simulator X-Git-Tag: 1.0.1~77^2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F1999%2F1;p=nonrtric.git DRAFT: CBS and Consul simulator Issue-ID: NONRTRIC-79 Signed-off-by: YongchaoWu Change-Id: I8ef3e2a90a750a3842409b5beefeb4854f2ab09b --- diff --git a/near-rt-ric-simulator/consul_cbs/config.json b/near-rt-ric-simulator/consul_cbs/config.json new file mode 100644 index 00000000..f75b2c5f --- /dev/null +++ b/near-rt-ric-simulator/consul_cbs/config.json @@ -0,0 +1,13 @@ + { + "//description": "Application configuration", + "ric": [ + { + "name": "ric1", + "baseUrl": "http://localhost:8080/", + "managedElementIds": [ + "kista_1", + "kista_2" + ] + } + ] + } diff --git a/near-rt-ric-simulator/consul_cbs/consul/cbs_localhost_config.hcl b/near-rt-ric-simulator/consul_cbs/consul/cbs_localhost_config.hcl new file mode 100644 index 00000000..c2d9839e --- /dev/null +++ b/near-rt-ric-simulator/consul_cbs/consul/cbs_localhost_config.hcl @@ -0,0 +1,11 @@ +service { + # Name for CBS in consul, env var CONFIG_BINDING_SERVICE + # should be passed to dfc app with this value + # This is only to be used when contacting cbs via local host + # (typicall when dfc is executed as an application without a container) + Name = "config-binding-service-localhost" + # Host name where CBS is running + Address = "localhost" + # Port number where CBS is running + Port = 10000 +} \ No newline at end of file diff --git a/near-rt-ric-simulator/consul_cbs/docker-compose-template.yml b/near-rt-ric-simulator/consul_cbs/docker-compose-template.yml new file mode 100644 index 00000000..1dcdb79e --- /dev/null +++ b/near-rt-ric-simulator/consul_cbs/docker-compose-template.yml @@ -0,0 +1,30 @@ +version: '3' + +networks: + nonrtric-docker-net: + external: + name: nonrtric-docker-net + +services: + + consul-server: + networks: + - nonrtric-docker-net + container_name: polman_consul + image: docker.io/consul:1.4.4 + ports: + - "8500:8500" + volumes: + - ./consul/:/consul/config + + config-binding-service: + networks: + - nonrtric-docker-net + container_name: polman_cbs + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.3.0 + ports: + - "10000:10000" + environment: + - CONSUL_HOST=consul-server + depends_on: + - consul-server \ No newline at end of file diff --git a/near-rt-ric-simulator/consul_cbs/docker-compose.yml b/near-rt-ric-simulator/consul_cbs/docker-compose.yml new file mode 100644 index 00000000..a01fbd9c --- /dev/null +++ b/near-rt-ric-simulator/consul_cbs/docker-compose.yml @@ -0,0 +1,27 @@ +networks: + nonrtric-docker-net: + external: + name: nonrtric-docker-net +services: + config-binding-service: + container_name: polman_cbs + depends_on: + - consul-server + environment: + CONSUL_HOST: consul-server + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.3.0 + networks: + nonrtric-docker-net: null + ports: + - 10000:10000/tcp + consul-server: + container_name: polman_consul + image: docker.io/consul:1.4.4 + networks: + nonrtric-docker-net: null + ports: + - 8500:8500/tcp + volumes: + - /Users/yonwu/ORAN/nonrtric/near-rt-ric-simulator/consul_cbs/consul:/consul/config:rw +version: '3.0' + diff --git a/near-rt-ric-simulator/consul_cbs/start.sh b/near-rt-ric-simulator/consul_cbs/start.sh new file mode 100755 index 00000000..ed4f9e60 --- /dev/null +++ b/near-rt-ric-simulator/consul_cbs/start.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +DOCKER_SIM_NWNAME="nonrtric-docker-net" +echo "Creating docker network $DOCKER_SIM_NWNAME, if needed" +docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME + +docker-compose -f docker-compose-template.yml config > docker-compose.yml + +docker-compose up -d + +CONSUL_PORT=8500 + +APP="policy-agent" +JSON_FILE="config.json" + +curl -s -v http://127.0.0.1:${CONSUL_PORT}/v1/kv/${APP}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$JSON_FILE \ No newline at end of file