From 6bc61ee14197bfb8faaf149c84b457485b5b8c11 Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Wed, 27 Jul 2016 23:57:05 -0500 Subject: [PATCH 1/1] patch not to remove swift API. Change-Id: I32e552b7e42393fc4699010dab19f8547fa6352f Signed-off-by: Narinder Gupta --- ci/deploy.sh | 4 +++- ci/openstack.sh | 27 ++++++++++----------------- juju/configure-juju-on-openstack | 14 +++++++------- juju/get-cloud-images | 2 ++ juju/joid-configure-openstack | 6 +++--- 5 files changed, 25 insertions(+), 28 deletions(-) diff --git a/ci/deploy.sh b/ci/deploy.sh index a4ef3b2c..4d5596fd 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -160,6 +160,8 @@ deploy 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 ......." diff --git a/ci/openstack.sh b/ci/openstack.sh index a01359c4..6ccea248 100755 --- a/ci/openstack.sh +++ b/ci/openstack.sh @@ -127,36 +127,29 @@ create_openrc ## 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 diff --git a/juju/configure-juju-on-openstack b/juju/configure-juju-on-openstack index f320146e..62ce885e 100755 --- a/juju/configure-juju-on-openstack +++ b/juju/configure-juju-on-openstack @@ -35,24 +35,24 @@ then 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" @@ -119,7 +119,7 @@ upload juju-meta tools" $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) @@ -139,7 +139,7 @@ $SSH "juju bootstrap openstack openstack --config image-metadata-url=$OS_STORAGE #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." diff --git a/juju/get-cloud-images b/juju/get-cloud-images index f31d067c..bf2ed30b 100755 --- a/juju/get-cloud-images +++ b/juju/get-cloud-images @@ -1,6 +1,8 @@ #!/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 \ diff --git a/juju/joid-configure-openstack b/juju/joid-configure-openstack index a24fa005..14cc8204 100755 --- a/juju/joid-configure-openstack +++ b/juju/joid-configure-openstack @@ -88,9 +88,9 @@ neutron router-interface-add $ROUTER_ID $SUBNET_ID || true 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" -- 2.16.6