opnfvsdn=nosdn
opnfvtype=nonha
-openstack=newton
+openstack=ocata
opnfvlab=default
-opnfvrel=d
+opnfvrel=e
opnfvfeature=none
opnfvdistro=xenial
opnfvarch=amd64
if [[ -z "$node_id" ]]; then
sudo virt-install --connect qemu:///system --name $node \
--ram 8192 --cpu host --vcpus 4 \
- --disk size=120,format=qcow2,bus=virtio,io=native,pool=default \
+ --disk size=120,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \
--network bridge=virbr0,model=virtio \
--network bridge=virbr0,model=virtio \
--boot network,hd,menu=off \
echo " MAAS not deployed please deploy MAAS first."
fi
fi
+#create json file which is missing in case of new deployment after maas and git tree cloned freshly.
+
+ python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < labconfig.yaml > labconfig.json
+ python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < deployconfig.yaml > deployconfig.json
+
else
if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then
cp ~/.juju/environments.yaml ./environments.yaml
#check whether charms are still executing the code even juju-deployer says installed.
check_status() {
+ waitstatus=$1
retval=0
timeoutiter=0
echo -n "executing the reltionship within charms ."
while [ $retval -eq 0 ]; do
- sleep 30
- if juju status | grep -q "executing"; then
+ if juju status | grep -q $waitstatus; then
echo -n '.'
if [ $timeoutiter -ge 120 ]; then
echo 'timed out'
retval=1
+ else
+ sleep 30
fi
timeoutiter=$((timeoutiter+1))
else
juju expose ceph-radosgw || true
#juju ssh ceph/0 \ 'sudo radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph"'
fi
+
echo "...... deployment finishing ......."
-}
+ }
echo "...... deployment started ......"
deploy
-check_status
+check_status executing
echo "...... deployment finished ......."
-if [[ "$opnfvmodel" = "openstack" ]]; then
+
+echo "...... configuring public access ......."
+
+# translate bundle.yaml to json
+python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < bundles.yaml > bundles.json
+# get services list having a public interface
+srv_list=$(cat bundles.json | jq -r ".services | to_entries[] | {\"key\": .key, \"value\": .value[\"bindings\"]} | select (.value!=null) | select(.value[] | contains(\"public-api\"))".key)
+# get cnt list from service list
+cnt_list=$(for cnt in $srv_list; do juju status $cnt --format=json | jq -r ".machines[].containers | to_entries[]".key; done)
+# get public network gateway (supposing it is the first ip of the network)
+public_api_gw=$(cat labconfig.json | jq --raw-output ".opnfv.spaces[] | select(.type==\"public\")".gateway)
+admin_gw=$(cat labconfig.json | jq --raw-output ".opnfv.spaces[] | select(.type==\"admin\")".gateway)
+
+if ([ $admin_gw ] && [ $admin_gw != "null" ]); then
+ # set default gateway to public api gateway
+ for cnt in $cnt_list; do
+ echo "changing default gw on $cnt"
+ if ([ $public_api_gw ] && [ $public_api_gw != "null" ]); then
+ juju ssh $cnt "sudo ip r d default && sudo ip r a default via $public_api_gw";
+ juju ssh $cnt "gw_dev=\$(ip r l | grep 'via $public_api_gw' | cut -d \ -f5) &&\
+ sudo cp /etc/network/interfaces /etc/network/interfaces.bak &&\
+ echo 'removing old default gateway' &&\
+ sudo perl -i -pe 's/^\ *gateway $admin_gw\n$//' /etc/network/interfaces &&\
+ sudo perl -i -pe \"s/iface \$gw_dev inet static/iface \$gw_dev inet static\\n gateway $public_api_gw/\" /etc/network/interfaces \
+ ";
+ fi
+ done
+fi
+
+echo "...... configure ......."
+
+if ([ $opnfvmodel == "openstack" ]); then
./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true
# creating heat domain after puching the public API into /etc/hosts
-
if [[ "$jujuver" > "2" ]]; then
status=`juju run-action heat/0 domain-setup`
echo $status
echo $status
fi
-
sudo ../juju/get-cloud-images || true
../juju/joid-configure-openstack || true
-fi
-if [[ "$opnfvmodel" = "kubernetes" ]]; then
+ if grep -q 'openbaton' bundles.yaml; then
+ juju add-relation openbaton keystone
+ fi
+
+elif ([ $opnfvmodel == "kubernetes" ]); then
./k8.sh
fi
+# expose the juju gui-url to login into juju gui
+
+echo " ...... JUJU GUI can be access using the below URL ...... "
+juju gui --show-credentials --no-browser
+
echo "...... finished ......."