#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 Orange and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
set +e
set -o nounset
# Modify Bundle
echo "------ Set openstack password ------"
-sed -i -- "s/\"admin-password\": openstack/\"admin-password\": $OS_ADMIN_PASSWORD/" $SRCBUNDLE
+sed -i -- "s/admin-password: openstack/admin-password: $OS_ADMIN_PASSWORD/" $SRCBUNDLE
if [ -n "$EXTNET_NAME" ]; then
echo "------ Set openstack default network ------"
- sed -i -- "s/\"neutron-external-network\": ext_net/\"neutron-external-network\": $EXTNET_NAME/" $SRCBUNDLE
+ sed -i -- "s/neutron-external-network: ext_net/neutron-external-network: $EXTNET_NAME/" $SRCBUNDLE
fi
echo "------ Set ceph disks ------"
-CEPH_DISKS_CONTROLLERS=${CEPH_DISKS_CONTROLLERS:-}
-if [ -z "$CEPH_DISKS_CONTROLLERS" ]; then
- CEPH_DISKS_CONTROLLERS=$CEPH_DISKS
-fi
-
#Find the first line of osd-devices to change the one for ceph, then the other for ceph-osd
-CEPH_DEV_LINE=$(grep -nr osd-devices $SRCBUNDLE |head -n1|cut -d: -f1)
-sed -i -- "${CEPH_DEV_LINE}s@osd-devices: /srv@osd-devices: $CEPH_DISKS@" $SRCBUNDLE
-sed -i -- "s@osd-devices: /srv@osd-devices: $CEPH_DISKS_CONTROLLERS@" $SRCBUNDLE
+sed -i -- "s@osd-devices: /srv@osd-devices: $CEPH_DISKS@" $SRCBUNDLE
sed -i -r -- "s/^(\s+osd-reformat: )'no'/\1'$CEPH_REFORMAT'/" $SRCBUNDLE
##
JOID_ADMIN_OPENRC=$LAB_CONFIG/admin-openrc
echo "------ Create OpenRC file [$JOID_ADMIN_OPENRC] ------"
-# get Keystone vip
-KEYSTONE=$(cat bundles.yaml |shyaml get-value openstack-phase2.services.keystone.options.vip)
+# get Keystone ip
+case "$HA_MODE" in
+ "ha")
+ KEYSTONE=$(cat bundles.yaml |shyaml get-value openstack-phase2.services.keystone.options.vip)
+ ;;
+ *)
+ KEYSTONE=$(juju status keystone |grep public-address|sed -- 's/.*\: //')
+ ;;
+esac
+
# get controller IP
case "$SDN_CONTROLLER" in
- "odl_l2" | "odl_l3")
+ "odl")
SDN_CONTROLLER_IP=$(juju status odl-controller/0 |grep public-address|sed -- 's/.*\: //')
;;
"onos")