3 CERT=/opt/optf-has/aai_cert.cer
4 KEY=/opt/optf-has/aai_key.key
5 BUNDLE=/opt/optf-has/AAF_RootCA.cer
7 NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
8 NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
9 NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
10 CASS_MUSIC_IMAGE_VERSION=$(cat /opt/config/cass_version.txt)
11 MUSIC_IMAGE_VERSION=$(cat /opt/config/music_version.txt)
12 HAS_IMAGE_VERSION=$(cat /opt/config/has_docker_version.txt)
13 OSDF_IMAGE_VERSION=$(cat /opt/config/osdf_docker_version.txt)
18 COND_CONF=/opt/optf-has/conductor.conf
19 LOG_CONF=/opt/optf-has/log.conf
21 #!!! THE FOLLOWING LINE IS A PLACEHOLDER !!!
22 AAI_cert=/usr/local/bin/AAF_RootCA.cer
24 OSDF_IMG=${NEXUS_DOCKER_REPO}/onap/optf-osdf:${OSDF_IMAGE_VERSION}
25 HAS_IMG=${NEXUS_DOCKER_REPO}/onap/optf-has:${HAS_IMAGE_VERSION}
28 CASS_IMG=${NEXUS_DOCKER_REPO}/onap/music/cassandra_music:$CASS_MUSIC_IMAGE_VERSION
29 MUSIC_IMG=${NEXUS_DOCKER_REPO}/onap/music/music:$MUSIC_IMAGE_VERSION
30 TOMCAT_IMG=library/tomcat:8.5
31 ZK_IMG=library/zookeeper:3.4
32 WORK_DIR=/opt/optf-has
33 CASS_USERNAME=cassandra1
34 CASS_PASSWORD=cassandra1
36 # pull images from repo
37 docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
38 docker pull ${OSDF_IMG}
40 docker pull ${TOMCAT_IMG}
41 docker pull ${CASS_IMG}
42 docker pull ${MUSIC_IMG}
43 docker pull ${HAS_IMG}
48 OSDF_CONFIG=/opt/optf-osdf/config/osdf_config.yaml
49 HAS_HOST=$(docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' api)
51 mkdir -p /opt/optf-osdf/config
53 cat > $OSDF_CONFIG<<NEWFILE
56 soUsername: "" # SO username for call back.
57 soPassword: "" # SO password for call back.
59 # Credentials for Conductor
60 conductorUrl: http://$HAS_HOST:8091/v1/plans/
61 conductorUsername: admin1
62 conductorPassword: plan.15
63 conductorPingWaitTime: 60 # seconds to wait before calling the conductor retry URL
64 conductorMaxRetries: 30 # if we don't get something in 30 minutes, give up
66 # Policy Platform -- requires ClientAuth, Authorization, and Environment
67 policyPlatformUrl: http://policy.api.simpledemo.onap.org:8081/pdp/api/getConfig # Policy Dev platform URL
68 policyPlatformEnv: TEST # Environment for policy platform
69 policyPlatformUsername: testpdp # Policy platform username.
70 policyPlatformPassword: alpha123 # Policy platform password.
71 policyClientUsername: python # For use with ClientAuth
72 policyClientPassword: test # For use with ClientAuth
74 # Credentials for DMaaP
75 messageReaderHosts: NA
76 messageReaderTopic: NA
77 messageReaderAafUserId: NA
78 messageReaderAafPassword: NA
86 # Credentials for the OOF placement service - Generic
87 osdfPlacementUsername: test
88 osdfPlacementPassword: testpwd
90 # Credentials for the OOF placement service - SO
91 osdfPlacementSOUsername: so_test
92 osdfPlacementSOPassword: so_testpwd
94 # Credentials for the OOF CM scheduling service - Generic
95 osdfCMSchedulerUsername: test1
96 osdfCMSchedulerPassword: testpwd1
100 docker run -d --name osdf -v $OSDF_CONFIG:/opt/app/config/osdf_config.yaml -p 8698:8699 ${OSDF_IMG}
103 # create directory for music properties and logs
104 mkdir -p /opt/optf-has/music/properties
105 mkdir -p /opt/optf-has/music/logs
107 # add music.properties file
108 cat > /opt/optf-has/music/properties/music.properties<<NEWFILE
111 my.public.ip=localhost
112 all.public.ips=localhost
114 #######################################
116 # Optional current values are defaults
118 #######################################
119 zookeeper.host=music-zk
120 cassandra.host=music-db
123 #music.rest.ip=localhost
124 #lock.lease.period=6000
125 cassandra.user=cassandra1
126 cassandra.password=cassandra1
128 # AAF Endpoint if using AAF
129 aaf.endpoint.url=https://aaf.api.simpledemo.onap.org
132 # Create Volume for mapping war file and tomcat
133 docker volume create music-vol
135 # Create a network for all the containers to run in.
136 docker network create music-net
139 docker run -d --rm --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG}
142 docker run -d --rm --name music-war -v music-vol:/app ${MUSIC_IMG}
145 docker run -d --rm --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}
147 # Delay for Cassandra
150 # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
151 docker run -d --rm --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/music/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/music/logs:/opt/app/music/logs ${TOMCAT_IMG}
153 # Connect tomcat to host bridge network so that its port can be seen.
154 docker network connect bridge music-tomcat;
156 echo "Running onboarding curl command"
158 http://localhost:8080/MUSIC/rest/v2/admin/onboardAppWithMusic \
159 -H 'Cache-Control: no-cache' \
160 -H 'Content-Type: application/json' \
161 -H 'Postman-Token: 7d2839f4-b032-487a-8998-4d1b27a932d7' \
163 "appname": "conductor",
164 "userId" : "conductor",
166 "password" : "c0nduct0r"
169 echo "Onboarding curl complete"
172 MUSIC_URL=$(docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat)
175 # Set A&AI and MUSIC url inside OOF-HAS conductor.conf
176 sed -i "138 s%.*%server_url = https://aai.api.simpledemo.onap.org:8443/aai%" $COND_CONF
177 sed -i "141 s%.*%server_url_version = v13%" $COND_CONF
178 sed -i "257 s%.*%server_url = http://$MUSIC_URL:8080/MUSIC/rest/v2%" $COND_CONF
179 sed -i "284 s%.*%replication_factor = 1%" $COND_CONF
180 sed -i "359 s%.*%server_url = http://msb.api.simpledemo.onap.org/api/multicloud%" $COND_CONF
182 # Set A&AI authentication file locations inside OOF-HAS conductor.conf
183 sed -i "153 s%.*%certificate_authority_bundle_file = $AAI_cert%" $COND_CONF
186 echo "Values to data component"
192 docker run -d --name controller -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf
194 docker run -d --name api -p "8091:8091" -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf
196 docker run -d --name solver -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf
198 docker run -d --name reservation -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf
200 docker run -d --name data -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf -v $CERT:/usr/local/bin/aai_cert.cer -v $KEY:/usr/local/bin/aai_key.key -v $BUNDLE:/usr/local/bin/AAF_RootCA.cer ${HAS_IMG} python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf
204 echo "Inserting healthcheck plan"
207 http://localhost:8080/MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows/ \
208 -H 'Cache-Control: no-cache' \
209 -H 'Content-Type: application/json' \
210 -H 'Postman-Token: 502781e8-d588-475d-b181-c2e26625ac95' \
211 -H 'X-minorVersion: 3' \
212 -H 'X-patchVersion: 0' \
214 -H 'password: c0nduct0r' \
215 -H 'userId: conductor' \
221 "id" : "healthcheck",
222 "created": 1479482603641,
226 "solution": "{\"healthcheck\": \" healthcheck\"}",
228 "template": "{\"healthcheck\": \"healthcheck\"}",
230 "translation": "{\"healthcheck\": \" healthcheck\"}",
231 "updated": 1484324150629
236 echo "Healthcheck plan inserted"