summaryrefslogtreecommitdiffstats
path: root/boot/dbcl_vm_init.sh
blob: 3605f898282bc2e443b1258460f256b946f6862b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash

# Establish environment variables
NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)

# Refresh images
docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
docker pull $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION
docker tag $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION onap/dmaap/buscontroller:latest

docker rm -f dmaap-buscontroller

TMP_CFG=/tmp/docker-dmaap-buscontroller.conf
cat >> $TMP_CFG <<!EOF
DMAAPBC_INT_HTTPS_PORT=8443
DMAAPBC_PG_ENABLED=false
DMAAPBC_INSTANCE_NAME=ONAP-CSIT
DMAAPBC_AAF_URL=https://aaf.api.simpledemo.onap.org:8095/proxy/
DMAAPBC_MR_CNAME=mr.api.simpledemo.onap.org
DMAAPBC_DRPROV_FQDN=drprov.simpledemo.onap.org
!EOF

# Insert docker run instructions here
docker run -i -t -d --name dmaap-buscontroller -p 8080:8080 -p 8443:8443 -v $TMP_CFG:/opt/app/config/conf $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION

sleep 15

DBCL_FQDN=dbc.api.simpledemo.onap.org
DRPS_FQDN=drprov.simpledemo.onap.org
MR_FQDN=mr.api.simpledemo.onap.org
# INITIALIZE: dmaap object
JSON=/tmp/$$.dmaap
cat << EOF > $JSON
{
"version": "1",
"topicNsRoot": "org.onap.dmaap",
"drProvUrl": "http://${DRPS_FQDN}:8080",
"dmaapName": "onapStable",
"bridgeAdminTopic": "MM_AGENT_PROV"

}
EOF

curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/dmaap 



# INITIALIZE: dcaeLocation object
JSON=/tmp/$$.loc
cat << EOF > $JSON
{
"dcaeLocationName": "csit-sanfrancisco",
"dcaeLayer": "central-cloud",
"clli": "STABLE2345",
"zone": "zoneA"

}
EOF

curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/dcaeLocations 


# INITIALIZE: MR object in 1 site
# Note: the values in the hosts[] are fictitious, and anticipate a 
# future MR cluster deployment.
JSON=/tmp/$$.mrc
cat << EOF > $JSON
{
"dcaeLocationName": "stable-sanfrancisco",
"fqdn": "${MR_FQDN}",
"hosts" : [ 
	"mrhost1.simpledemo.onap.org", 
	"mrhost2.simpledemo.onap.org", 
	"mrhost3.simpledemo.onap.org" 
	],
"protocol" : "https",
"port": "3094"

}
EOF

curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/mr_clusters