blob: 96ac40f1845d3eacd2579932d829120ac5e502f3 [file] [log] [blame]
dglFromAtt62b8b122018-03-03 11:57:29 -05001#!/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
8JSON=/tmp/$$.dmaap
9cat << 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}
18EOF
19
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000020echo "Initializing /dmaap endpoint"
dglFromAtt62b8b122018-03-03 11:57:29 -050021curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap
22
23
24
25# INITIALIZE: dcaeLocation object
26JSON=/tmp/$$.loc
27cat << EOF > $JSON
28{
29 "dcaeLocationName": "csit-sanfrancisco",
30 "dcaeLayer": "central-cloud",
31 "clli": "CSIT12345",
32 "zone": "zoneA"
33
34}
35EOF
36
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000037echo "Initializing /dcaeLocations endpoint"
dglFromAtt62b8b122018-03-03 11:57:29 -050038curl -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 Lunanuovadb5f9892018-04-20 18:54:47 +000042# 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.
47DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -1 )
48# Perhaps there is a better way...
dglFromAtt62b8b122018-03-03 11:57:29 -050049JSON=/tmp/$$.mrc
50cat << EOF > $JSON
51{
52 "dcaeLocationName": "csit-sanfrancisco",
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000053 "fqdn": "$DOCKER_HOST",
54 "topicProtocol" : "http",
55 "topicPort": "3904"
dglFromAtt62b8b122018-03-03 11:57:29 -050056
57}
58EOF
59
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000060echo "Initializing /mr_clusters endpoint"
dglFromAtt62b8b122018-03-03 11:57:29 -050061curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters