blob: 804603f2bd740c022fcd705666ef4b0fed96d774 [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
Dominic Lunanuovabfb3ea42018-08-23 21:49:47 +00006# $4 is the protocol (defaults to http)
7
8PROTO=${4:-http}
9if [ "$PROTO" = "http" ]
10then
11 PORT=8080
12 CURLOPT="-v"
13 MRPORT=3904
14 DRPORT=8080
15else
16 PORT=8443
17 CURLOPT="-v -k"
18 MRPORT=3905
19 DRPORT=8443
20fi
dglFromAtt62b8b122018-03-03 11:57:29 -050021
22# INITIALIZE: dmaap object
23JSON=/tmp/$$.dmaap
24cat << EOF > $JSON
25{
26 "version": "1",
27 "topicNsRoot": "org.onap.dmaap",
Dominic Lunanuovaf118f2e2018-09-04 23:14:13 +000028 "drProvUrl": "${PROTO}://dmaap-dr-prov:${DRPORT}",
dglFromAtt62b8b122018-03-03 11:57:29 -050029 "dmaapName": "onapCSIT",
30 "bridgeAdminTopic": "MM_AGENT_PROV"
31
32}
33EOF
34
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000035echo "Initializing /dmaap endpoint"
Dominic Lunanuovabfb3ea42018-08-23 21:49:47 +000036curl ${CURLOPT} -X POST -d @${JSON} -H "Content-Type: application/json" ${PROTO}://$1:${PORT}/webapi/dmaap
dglFromAtt62b8b122018-03-03 11:57:29 -050037
38
39
40# INITIALIZE: dcaeLocation object
41JSON=/tmp/$$.loc
42cat << EOF > $JSON
43{
44 "dcaeLocationName": "csit-sanfrancisco",
45 "dcaeLayer": "central-cloud",
46 "clli": "CSIT12345",
47 "zone": "zoneA"
48
49}
50EOF
51
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000052echo "Initializing /dcaeLocations endpoint"
Dominic Lunanuovabfb3ea42018-08-23 21:49:47 +000053curl ${CURLOPT} -X POST -d @${JSON} -H "Content-Type: application/json" ${PROTO}://$1:${PORT}/webapi/dcaeLocations
dglFromAtt62b8b122018-03-03 11:57:29 -050054
55
56# INITIALIZE: MR object in 1 site
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000057# since MR is currently deployed via docker-compose, its IP doesn't seem
58# to be routable from DBCL. Fortunately, the MR port is mapped from the docker bridge IP address.
59# Found this article for how to deterine the docker bridge IP so using it as a workaround.
60# https://stackoverflow.com/questions/22944631/how-to-get-the-ip-address-of-the-docker-host-from-inside-a-docker-container
61# Used the following snippet found buried in a comment to an answer and then modified for only 1 value.
62DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -1 )
63# Perhaps there is a better way...
dglFromAtt62b8b122018-03-03 11:57:29 -050064JSON=/tmp/$$.mrc
65cat << EOF > $JSON
66{
67 "dcaeLocationName": "csit-sanfrancisco",
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000068 "fqdn": "$DOCKER_HOST",
69 "topicProtocol" : "http",
Dominic Lunanuovabfb3ea42018-08-23 21:49:47 +000070 "topicPort": "${MRPORT}"
dglFromAtt62b8b122018-03-03 11:57:29 -050071
72}
73EOF
74
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000075echo "Initializing /mr_clusters endpoint"
Dominic Lunanuovabfb3ea42018-08-23 21:49:47 +000076curl ${CURLOPT} -X POST -d @${JSON} -H "Content-Type: application/json" ${PROTO}://$1:${PORT}/webapi/mr_clusters