dglFromAtt | 62b8b12 | 2018-03-03 11:57:29 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # $1 is the IP address of the buscontroller |
| 4 | # $2 is the IP address of the DRPS |
| 5 | # $3 is the IP address of the MRC |
| 6 | |
| 7 | # INITIALIZE: dmaap object |
| 8 | JSON=/tmp/$$.dmaap |
| 9 | cat << EOF > $JSON |
| 10 | { |
| 11 | "version": "1", |
| 12 | "topicNsRoot": "org.onap.dmaap", |
| 13 | "drProvUrl": "http://${2}:8080", |
| 14 | "dmaapName": "onapCSIT", |
| 15 | "bridgeAdminTopic": "MM_AGENT_PROV" |
| 16 | |
| 17 | } |
| 18 | EOF |
| 19 | |
Dominic Lunanuova | db5f989 | 2018-04-20 18:54:47 +0000 | [diff] [blame^] | 20 | echo "Initializing /dmaap endpoint" |
dglFromAtt | 62b8b12 | 2018-03-03 11:57:29 -0500 | [diff] [blame] | 21 | curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap |
| 22 | |
| 23 | |
| 24 | |
| 25 | # INITIALIZE: dcaeLocation object |
| 26 | JSON=/tmp/$$.loc |
| 27 | cat << EOF > $JSON |
| 28 | { |
| 29 | "dcaeLocationName": "csit-sanfrancisco", |
| 30 | "dcaeLayer": "central-cloud", |
| 31 | "clli": "CSIT12345", |
| 32 | "zone": "zoneA" |
| 33 | |
| 34 | } |
| 35 | EOF |
| 36 | |
Dominic Lunanuova | db5f989 | 2018-04-20 18:54:47 +0000 | [diff] [blame^] | 37 | echo "Initializing /dcaeLocations endpoint" |
dglFromAtt | 62b8b12 | 2018-03-03 11:57:29 -0500 | [diff] [blame] | 38 | curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dcaeLocations |
| 39 | |
| 40 | |
| 41 | # INITIALIZE: MR object in 1 site |
Dominic Lunanuova | db5f989 | 2018-04-20 18:54:47 +0000 | [diff] [blame^] | 42 | # since MR is currently deployed via docker-compose, its IP doesn't seem |
| 43 | # to be routable from DBCL. Fortunately, the MR port is mapped from the docker bridge IP address. |
| 44 | # Found this article for how to deterine the docker bridge IP so using it as a workaround. |
| 45 | # https://stackoverflow.com/questions/22944631/how-to-get-the-ip-address-of-the-docker-host-from-inside-a-docker-container |
| 46 | # Used the following snippet found buried in a comment to an answer and then modified for only 1 value. |
| 47 | DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -1 ) |
| 48 | # Perhaps there is a better way... |
dglFromAtt | 62b8b12 | 2018-03-03 11:57:29 -0500 | [diff] [blame] | 49 | JSON=/tmp/$$.mrc |
| 50 | cat << EOF > $JSON |
| 51 | { |
| 52 | "dcaeLocationName": "csit-sanfrancisco", |
Dominic Lunanuova | db5f989 | 2018-04-20 18:54:47 +0000 | [diff] [blame^] | 53 | "fqdn": "$DOCKER_HOST", |
| 54 | "topicProtocol" : "http", |
| 55 | "topicPort": "3904" |
dglFromAtt | 62b8b12 | 2018-03-03 11:57:29 -0500 | [diff] [blame] | 56 | |
| 57 | } |
| 58 | EOF |
| 59 | |
Dominic Lunanuova | db5f989 | 2018-04-20 18:54:47 +0000 | [diff] [blame^] | 60 | echo "Initializing /mr_clusters endpoint" |
dglFromAtt | 62b8b12 | 2018-03-03 11:57:29 -0500 | [diff] [blame] | 61 | curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters |