check_status
echo "...... deployment finished ......."
-./openstack.sh "$opnfvsdn"
+./openstack.sh "$opnfvsdn" || true
+sudo ../juju/get-cloud-images || true
+../juju/joid-configure-openstack || true
echo "...... finished ......."
## one option is not to used radosgw and other one is remove endpoint.
##
-echo "Removing swift endpoint and service"
-swift_service_id=$(openstack service list | grep swift | cut -d ' ' -f 2)
-swift_endpoint_id=$(openstack endpoint list | grep swift | cut -d ' ' -f 2)
-openstack endpoint delete $swift_endpoint_id
-openstack service delete $swift_service_id
+#echo "Removing swift endpoint and service"
+#swift_service_id=$(openstack service list | grep swift | cut -d ' ' -f 2)
+#swift_endpoint_id=$(openstack endpoint list | grep swift | cut -d ' ' -f 2)
+#openstack endpoint delete $swift_endpoint_id
+#openstack service delete $swift_service_id
##
## Create external subnet Network
##
#neutron net-create ext-net --shared --router:external=True
-neutron net-create ext-net --router:external=True
+neutron net-show ext-net > /dev/null 2>&1 || neutron net-create ext-net --router:external=True
if [ "onos" == "$1" ]; then
launch_eth
- neutron subnet-create ext-net --name ext-subnet \
- --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \
+ neutron subnet-show ext-subnet > /dev/null 2>&1 || neutron subnet-create ext-net \
+ --name ext-subnet --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \
--disable-dhcp --gateway $EXTNET_GW --dns-nameserver 8.8.8.8 $EXTNET_NET
#neutron subnet-create ext-net --name ext-subnet $EXTNET_NET
#update_gw_mac
-elif [ "nosdn" == "$1" ]; then
- neutron subnet-create ext-net --name ext-subnet \
- --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \
- --disable-dhcp --gateway $EXTNET_GW --dns-nameserver 8.8.8.8 $EXTNET_NET
- # configure security groups
- #neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol icmp --remote-ip-prefix 0.0.0.0/0 default
- #neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 22 --port-range-max 22 --remote-ip-prefix 0.0.0.0/0 default
else
- neutron subnet-create ext-net --name ext-subnet \
- --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \
+ neutron subnet-show ext-subnet > /dev/null 2>&1 || neutron subnet-create ext-net \
+ --name ext-subnet --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \
--disable-dhcp --gateway $EXTNET_GW --dns-nameserver 8.8.8.8 $EXTNET_NET
fi
else
FLOAT_IP="$(openstack ip floating create ext-net -c ip -f value)"
fi
-
+
#Launch an instance
NET_UUID="$(nova net-list | grep private | awk '{ print $2 }')"
IMAGE_UUID="$(nova image-list | grep Xenial | awk '{ print $2 }')"
nova list | grep jumpserver2 ||nova boot --flavor m1.small --key-name default --image $IMAGE_UUID --nic net-id=$NET_UUID --security-group default jumpserver2
# checking jumpserver2 state until active ..
INST_STATE=` nova show jumpserver2 | grep status | awk '{print $4}'`
-while [ $INST_STATE != "ACTIVE" ];
-do
+while [ $INST_STATE != "ACTIVE" ];
+do
INST_STATE=` nova show jumpserver2 | grep status | awk '{print $4}'`
echo "Jumpserver2 instance state is: "$INST_STATE" waiting to be active"
sleep 1
done
sleep 6
#Associate the floating IP with the new instance
-nova floating-ip-associate jumpserver2 $FLOAT_IP || true
+nova floating-ip-associate jumpserver2 $FLOAT_IP || true
-sleep 30
+sleep 90
### make it more Readable
export SSH="ssh -o StrictHostKeyChecking=no ubuntu@$FLOAT_IP"
$SSH swift --os-auth-url $OS_AUTH_URL --os-username $OS_USERNAME --os-password $OS_PASSWORD \
--os-tenant-name $OS_TENANT_NAME post -r '.r:*' juju-meta
-## collect the URL for getting the images
+## collect the URL for getting the images
$($SSH swift --os-auth-url $OS_AUTH_URL --os-username $OS_USERNAME --os-password $OS_PASSWORD \
--os-tenant-name $OS_TENANT_NAME auth)
#Create a new floating IP and associate with juju bootstrap instance
#INSTANCE_ID="$(nova list | grep juju-openstack-machine-0 | awk '{ print $2}')"
#FLOAT_IP2="$(nova floating-ip-create | grep ext_net | awk '{ print $2}')"
-#nova floating-ip-associate $INSTANCE_ID $FLOAT_IP2
+#nova floating-ip-associate $INSTANCE_ID $FLOAT_IP2
#Print the address of Juju-gui for deployments on Openstack
echo "Now connect to the Juju-GUI at: http://$FLOAT_IP2/ to continue deployments on Openstack."
#!/bin/bash -e
folder=/srv/data/
+sudo mkdir $folder || true
+
URLS="http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img \
http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img \
http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img \
echo "Configuring security groups for access to ICMP, SSH and RDP by default"
#Configure the default security group to allow ICMP and SSH
-neutron security-group-rule-list default | grep icmp > /dev/null 2>&1 || neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol icmp --remote-ip-prefix 0.0.0.0/0 default
-neutron security-group-rule-list default | grep 22 > /dev/null 2>&1 || neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 22 --port-range-max 22 --remote-ip-prefix 0.0.0.0/0 default
-neutron security-group-rule-list default | grep 3389 > /dev/null 2>&1 || neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 3389 --port-range-max 3389 --remote-ip-prefix 0.0.0.0/0 default
+neutron security-group-rule-list | grep icmp > /dev/null 2>&1 || neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol icmp --remote-ip-prefix 0.0.0.0/0 default
+neutron security-group-rule-list | grep 22 > /dev/null 2>&1 || neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 22 --port-range-max 22 --remote-ip-prefix 0.0.0.0/0 default
+neutron security-group-rule-list | grep 3389 > /dev/null 2>&1 || neutron security-group-rule-create --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 3389 --port-range-max 3389 --remote-ip-prefix 0.0.0.0/0 default
echo "Uploading default SSH key"