3 CERT=/opt/optf-has/aai_cert.cer
4 KEY=/opt/optf-has/aai_key.key
5 BUNDLE=/opt/optf-has/aai_bundle.pem
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 DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
15 COND_CONF=/opt/optf-has/conductor.conf
16 LOG_CONF=/opt/optf-has/log.conf
18 #!!! THE FOLLOWING LINE IS A PLACEHOLDER !!!
19 AAI_cert=/usr/local/bin/aai_cert.cer
21 IMAGE_NAME="$NEXUS_DOCKER_REPO/onap/optf-has"
24 CASS_IMG=${NEXUS_DOCKER_REPO}/onap/music/cassandra_music:latest
25 MUSIC_IMG=${NEXUS_DOCKER_REPO}/onap/music/music:latest
26 TOMCAT_IMG=library/tomcat:8.5
27 ZK_IMG=library/zookeeper:3.4
28 WORK_DIR=/opt/optf-has
29 CASS_USERNAME=cassandra1
30 CASS_PASSWORD=cassandra1
32 # pull images from repo
33 docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
34 docker pull $NEXUS_DOCKER_REPO/onap/optf-osdf:$DOCKER_IMAGE_VERSION
36 docker pull ${TOMCAT_IMG}
37 docker pull ${CASS_IMG}
38 docker pull ${MUSIC_IMG}
39 docker pull $NEXUS_DOCKER_REPO/onap/optf-has:$DOCKER_IMAGE_VERSION
44 OSDF_IMAGE_NAME="$NEXUS_DOCKER_REPO/onap/optf-osdf"
45 OSDF_CONFIG=/opt/optf-osdf/config/osdf_config.yaml
47 mkdir -p /opt/optf-osdf/config
49 cat > $OSDF_CONFIG<<NEWFILE
52 soUsername: "" # SO username for call back.
53 soPassword: "" # SO password for call back.
55 # Credentials for Conductor
56 conductorUrl: https://localhost:8091/v1/plans/
57 conductorUsername: admin1
58 conductorPassword: plan.15
59 conductorPingWaitTime: 60 # seconds to wait before calling the conductor retry URL
60 conductorMaxRetries: 30 # if we don't get something in 30 minutes, give up
62 # Policy Platform -- requires ClientAuth, Authorization, and Environment
63 policyPlatformUrl: http://policy.api.simpledemo.onap.org:8081/pdp/api/getConfig # Policy Dev platform URL
64 policyPlatformEnv: TEST # Environment for policy platform
65 policyPlatformUsername: testpdp # Policy platform username.
66 policyPlatformPassword: alpha123 # Policy platform password.
67 policyClientUsername: python # For use with ClientAuth
68 policyClientPassword: test # For use with ClientAuth
70 # Credentials for DMaaP
71 messageReaderHosts: NA
72 messageReaderTopic: NA
73 messageReaderAafUserId: NA
74 messageReaderAafPassword: NA
82 # Credentials for the OOF placement service - Generic
83 osdfPlacementUsername: test
84 osdfPlacementPassword: testpwd
86 # Credentials for the OOF placement service - SO
87 osdfPlacementSOUsername: so_test
88 osdfPlacementSOPassword: so_testpwd
90 # Credentials for the OOF CM scheduling service - Generic
91 osdfCMSchedulerUsername: test1
92 osdfCMSchedulerPassword: testpwd1
96 docker run -d --name osdf -v $OSDF_CONFIG:/optf/config/osdf_config.yaml -p 8698:8699 ${OSDF_IMAGE_NAME}:latest
99 # create directory for music properties and logs
100 mkdir -p /opt/optf-has/music/properties
101 mkdir -p /opt/optf-has/music/logs
103 # add music.properties file
104 cat > /opt/optf-has/music/properties/music.properties<<NEWFILE
107 my.public.ip=localhost
108 all.public.ips=localhost
110 #######################################
112 # Optional current values are defaults
114 #######################################
115 zookeeper.host=music-zk
116 cassandra.host=music-db
119 #music.rest.ip=localhost
120 #lock.lease.period=6000
121 cassandra.user=cassandra1
122 cassandra.password=cassandra1
124 # AAF Endpoint if using AAF
125 aaf.endpoint.url=https://aaf.api.simpledemo.onap.org
128 # Create Volume for mapping war file and tomcat
129 docker volume create music-vol
131 # Create a network for all the containers to run in.
132 docker network create music-net
135 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}
138 docker run -d --rm --name music-war -v music-vol:/app ${MUSIC_IMG}
141 docker run -d --rm --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}
143 # Delay for Cassandra
146 # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
147 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}
149 # Connect tomcat to host bridge network so that its port can be seen.
150 docker network connect bridge music-tomcat;
152 echo "Running onboarding curl command"
154 http://localhost:8080/MUSIC/rest/v2/admin/onboardAppWithMusic \
155 -H 'Cache-Control: no-cache' \
156 -H 'Content-Type: application/json' \
157 -H 'Postman-Token: 7d2839f4-b032-487a-8998-4d1b27a932d7' \
159 "appname": "conductor",
160 "userId" : "conductor",
162 "password" : "c0nduct0r"
165 echo "Onboarding curl complete"
168 MUSIC_URL=$(docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat)
171 # Set A&AI and MUSIC url inside OOF-HAS conductor.conf
172 sed -i "138 s%.*%server_url = https://aai.api.simpledemo.onap.org:8443/aai%" $COND_CONF
173 sed -i "141 s%.*%server_url_version = v13%" $COND_CONF
174 sed -i "257 s%.*%server_url = http://$MUSIC_URL:8080/MUSIC/rest/v2%" $COND_CONF
175 sed -i "284 s%.*%replication_factor = 1%" $COND_CONF
177 # Set A&AI authentication file locations inside OOF-HAS conductor.conf
178 sed -i "153 s%.*%certificate_authority_bundle_file = $AAI_cert%" $COND_CONF
181 echo "Values to data component"
187 docker run -d --name controller -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf
189 docker run -d --name api -p "8091:8091" -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf
191 docker run -d --name solver -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf
193 docker run -d --name reservation -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf
195 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/bundle.pem ${IMAGE_NAME}:latest python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf
199 echo "Inserting healthcheck plan"
202 http://localhost:8080/MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows/ \
203 -H 'Cache-Control: no-cache' \
204 -H 'Content-Type: application/json' \
205 -H 'Postman-Token: 502781e8-d588-475d-b181-c2e26625ac95' \
206 -H 'X-minorVersion: 3' \
207 -H 'X-patchVersion: 0' \
209 -H 'password: c0nduct0r' \
210 -H 'userId: conductor' \
216 "id" : "healthcheck",
217 "created": 1479482603641,
221 "solution": "{\"healthcheck\": \" healthcheck\"}",
223 "template": "{\"healthcheck\": \"healthcheck\"}",
225 "translation": "{\"healthcheck\": \" healthcheck\"}",
226 "updated": 1484324150629
231 echo "Healthcheck plan inserted"