apt dist-upgrade reboot enabled, lint fixes
second round, for testing
lint clean, testing needed
prereqs assert w/dig doesn't loop properly
use head not all for target hosts in single

Change-Id: Ie530204b989a73828f45508fcdd4374a3362c764
diff --git a/scripts/compute-ext-net-tutorial.sh b/scripts/compute-ext-net-tutorial.sh
deleted file mode 100755
index 50090a9..0000000
--- a/scripts/compute-ext-net-tutorial.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-apt-get update
-apt-get install bridge-utils
-brctl addbr databr
-ifconfig databr 10.168.0.1/24 up
-ip link add address 02:42:0a:a8:00:01 type veth
-ifconfig veth0 up
-ifconfig veth1 up
-brctl addif databr veth0
-ip addr add 10.168.1.1/24 dev databr
-iptables -t nat -A POSTROUTING -s 10.168.0.0/16 \! -d 10.168.0.0/16 -j MASQUERADE
-sysctl -w net.ipv4.ip_forward=1
-sysctl -w net.ipv4.conf.all.send_redirects=0
-sysctl -w net.ipv4.conf.default.send_redirects=0
-sysctl -w net.ipv4.conf.eth0.send_redirects=0
-sysctl -w net.ipv4.conf.databr.send_redirects=0
\ No newline at end of file
diff --git a/scripts/compute-ext-net.sh b/scripts/compute-ext-net.sh
deleted file mode 100755
index 762d37f..0000000
--- a/scripts/compute-ext-net.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-apt-get update
-apt-get install bridge-utils
-brctl addbr databr
-ifconfig databr 10.168.0.1/24 up
-ip link add address 02:42:0a:a8:00:01 type veth
-ifconfig veth0 up
-ifconfig veth1 up
-brctl addif databr veth0
-iptables -t nat -A POSTROUTING -s 10.168.0.0/24 \! -d 10.168.0.0/24 -j MASQUERADE
-sysctl -w net.ipv4.ip_forward=1
diff --git a/scripts/create-vms-cord.sh b/scripts/create-vms-cord.sh
deleted file mode 100755
index a0af3ed..0000000
--- a/scripts/create-vms-cord.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-
-TESTING=false
-
-while [[ $# > 0 ]]
-do
-key="$1"
-
-case $key in
-    --testing)
-    TESTING=true
-    ;;
-    *)
-    ;;
-esac
-shift
-done
-
-function create-vm {
-	NAME=$1
-	CPU=$2
-	MEM_MB=$3
-	DISK_GB=$4
-	uvt-kvm list | grep $1
-	if [ "$?" -ne "0" ]
-	then
-		if $TESTING
-		then
-			# Don't use mgmtbr for testing
-			uvt-kvm create $NAME release=trusty --cpu=$CPU --memory=$MEM_MB --disk=$DISK_GB
-		else
-			uvt-kvm create $NAME release=trusty --cpu=$CPU --memory=$MEM_MB --disk=$DISK_GB --bridge mgmtbr
-		fi
-		# uvt-kvm wait --insecure $NAME
-	fi
-}
-
-function wait-for-vm {
-  NAME=$1
-  until dig $NAME && ssh ubuntu@$NAME "ls"
-  do
-    sleep 1
-  done
-}
-
-create-vm juju 1 2048 20
-create-vm mysql 2 4096 40
-create-vm rabbitmq-server 2 4096 40
-create-vm keystone 2 4096 40
-create-vm glance 2 4096 160
-create-vm nova-cloud-controller 2 4096 40
-create-vm neutron-api 2 4096 40
-create-vm openstack-dashboard 1 2048 20
-create-vm ceilometer 1 2048 20
-create-vm nagios 1 2048 20
-
-create-vm xos 2 4096 40
-create-vm onos-cord 2 4096 40
-create-vm onos-fabric 2 4096 40
-if $TESTING
-then
-	create-vm nova-compute 6 16384 240
-fi
-
-# Wait for everything to get set up
-wait-for-vm juju
-wait-for-vm mysql
-wait-for-vm rabbitmq-server
-wait-for-vm keystone
-wait-for-vm glance
-wait-for-vm nova-cloud-controller
-wait-for-vm neutron-api
-wait-for-vm openstack-dashboard
-wait-for-vm ceilometer
-wait-for-vm nagios
-
-wait-for-vm xos
-wait-for-vm onos-cord
-wait-for-vm onos-fabric
-if $TESTING
-then
-	wait-for-vm nova-compute
-fi
diff --git a/scripts/create-vms.sh b/scripts/create-vms.sh
deleted file mode 100755
index 1f1c789..0000000
--- a/scripts/create-vms.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-function create-vm {
-	NAME=$1
-	CPU=$2
-	MEM_MB=$3
-	DISK_GB=$4
-	uvt-kvm list | grep $1
-	if [ "$?" -ne "0" ]
-	then
-		uvt-kvm create $NAME release=trusty --cpu=$CPU --memory=$MEM_MB --disk=$DISK_GB
-		uvt-kvm wait --insecure $NAME
-	fi
-}
-
-create-vm juju 1 2048 20
-create-vm mysql 2 4096 40
-create-vm rabbitmq-server 2 4096 40
-create-vm keystone 2 4096 40
-create-vm glance 2 4096 160
-create-vm nova-cloud-controller 2 4096 40
-create-vm neutron-gateway 2 4096 40
-create-vm neutron-api 2 4096 40
-create-vm openstack-dashboard 1 2048 20
-create-vm ceilometer 1 2048 20
-create-vm nagios 1 2048 20
diff --git a/scripts/juju-compute-relations.py b/scripts/juju-compute-relations.py
deleted file mode 100755
index 535b5d4..0000000
--- a/scripts/juju-compute-relations.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-
-import subprocess
-import time
-import argparse
-
-sleep_interval = 1
-
-relations = [
-    "nova-compute:shared-db mysql:shared-db",
-    "nova-compute:amqp rabbitmq-server:amqp",
-    "nova-compute glance",
-    "nova-compute nova-cloud-controller",
-    "nova-compute neutron-openvswitch",
-    "ntp nova-compute",
-    "nova-compute nagios",
-    "nova-compute nrpe",
-    "nova-compute:nova-ceilometer ceilometer-agent:nova-ceilometer",
-    ]
-
-def addrelation(relation):
-    subprocess.check_call("juju add-relation %s" % relation, shell=True)
-
-def destroyrelation(relation):
-    subprocess.check_call("juju destroy-relation %s" % relation, shell=True)
-
-def addrelations():
-    for relation in relations:
-        print "Adding relation %s" % relation
-        try:
-            addrelation(relation)
-            time.sleep(sleep_interval)
-        except:
-            pass
-
-def destroyrelations():
-    for relation in relations:
-        print "Destroying relation %s" % relation
-        try:
-            destroyrelation(relation)
-            time.sleep(sleep_interval)
-        except:
-            pass
-
-def main():
-    parser = argparse.ArgumentParser(description='Deploy OpenStack controller services')
-    parser.add_argument('--destroy', action='store_true',
-                       help='Destroy the relations instead of adding them')
-
-    args = parser.parse_args()
-    if args.destroy:
-        destroyrelations()
-    else:
-        addrelations()
-
-if  __name__ =='__main__':
-    main()
diff --git a/scripts/juju-compute-setup.py b/scripts/juju-compute-setup.py
deleted file mode 100755
index 326eaf3..0000000
--- a/scripts/juju-compute-setup.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-
-import subprocess
-import json
-import time
-
-jujuconfig="/usr/local/src/openstack.cfg"
-
-services = {
-#    "nova-compute" : "--config=%s cs:~andybavier/trusty/nova-compute" % jujuconfig,
-    "nova-compute" : "--config=%s nova-compute" % jujuconfig,
-}
-
-def get_free_machines(status):
-    for (service, svcinfo) in status['services'].iteritems():
-        if 'units' in svcinfo:
-            for (unit, unitinfo) in svcinfo['units'].iteritems():
-                if 'machine' in unitinfo:
-                    machine = unitinfo['machine']
-                    status['machines'][machine]['unit'] = unit
-
-    free = {}
-    for (machine, mchinfo) in status['machines'].iteritems():
-        if machine == "0":
-            continue
-
-        if 'unit' not in mchinfo:
-            # print "%s: %s" % (machine, mchinfo['dns-name'])
-            free[machine] = mchinfo
-
-    return free
-
-
-def deploy(status, service, cmd):
-    # Deploy nova-compute to all free machines
-    machines = get_free_machines(status)
-
-    for (machine, mchinfo) in machines.iteritems():
-        if service in status['services']:
-            print "Adding unit %s on %s" % (service, mchinfo['dns-name'])
-            subprocess.check_call("juju add-unit --to=%s %s" % (machine, service), shell=True)
-        else:
-            print "Deploying service %s on %s" % (service, mchinfo['dns-name'])
-            subprocess.check_call("juju deploy --to=%s %s" % (machine, cmd), shell=True)
-            status['services'][service] = "installed"
-            time.sleep(10)
-
-def get_juju_status():
-    output = subprocess.check_output("juju status --format=json", shell=True)
-    status = json.loads(output)
-    return status
-
-def addservices():
-    status = get_juju_status()
-
-    for service, cmd in services.iteritems():
-        try:
-            deploy(status, service, cmd)
-        except:
-            pass
-
-def main():
-    addservices()
-
-if  __name__ =='__main__':
-    main()
diff --git a/scripts/juju-relations.py b/scripts/juju-relations.py
deleted file mode 100755
index 9c4b1f7..0000000
--- a/scripts/juju-relations.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-
-import subprocess
-import time
-import argparse
-
-sleep_interval = 1
-
-relations = ["keystone mysql",
-             "nova-cloud-controller mysql",
-             "nova-cloud-controller rabbitmq-server",
-             "nova-cloud-controller glance",
-             "nova-cloud-controller keystone",
-             "glance mysql",
-             "glance keystone",
-             "neutron-gateway neutron-api",
-             "neutron-gateway:amqp rabbitmq-server:amqp",
-             "neutron-gateway nova-cloud-controller",
-             "neutron-gateway mysql",
-             "neutron-api keystone",
-             "neutron-api neutron-openvswitch",
-             "neutron-api mysql",
-             "neutron-api rabbitmq-server",
-             "neutron-api nova-cloud-controller",
-             "neutron-openvswitch rabbitmq-server",
-             "openstack-dashboard keystone",
-#             "mysql nagios",
-#             "rabbitmq-server nagios",
-#             "keystone nagios",
-#             "glance nagios",
-#             "nova-cloud-controller nagios",
-#             "neutron-gateway nagios",
-#             "openstack-dashboard nagios",
-#             "neutron-api nagios",
-             "nagios nrpe",
-             "mysql:juju-info nrpe:general-info",
-             "rabbitmq-server nrpe",
-             "keystone nrpe",
-             "glance nrpe",
-             "nova-cloud-controller nrpe",
-             "neutron-gateway nrpe",
-             "openstack-dashboard nrpe",
-             "neutron-api nrpe",
-             "ceilometer mongodb",
-             "ceilometer rabbitmq-server",
-             "ceilometer:identity-service keystone:identity-service",
-             "ceilometer:ceilometer-service ceilometer-agent:ceilometer-service",
-             "ceilometer nagios",
-             "ceilometer nrpe",
-             ]
-
-def addrelation(relation):
-    subprocess.check_call("juju add-relation %s" % relation, shell=True)
-
-def destroyrelation(relation):
-    subprocess.check_call("juju destroy-relation %s" % relation, shell=True)
-
-def addrelations():
-    for relation in relations:
-        print "Adding relation %s" % relation
-        try:
-            addrelation(relation)
-            time.sleep(sleep_interval)
-        except:
-            pass
-
-def destroyrelations():
-    for relation in relations:
-        print "Destroying relation %s" % relation
-        try:
-            destroyrelation(relation)
-            time.sleep(sleep_interval)
-        except:
-            pass
-
-def main():
-    parser = argparse.ArgumentParser(description='Deploy OpenStack controller services')
-    parser.add_argument('--destroy', action='store_true',
-                       help='Destroy the relations instead of adding them')
-
-    args = parser.parse_args()
-    if args.destroy:
-        destroyrelations()
-    else:
-        addrelations()
-
-if  __name__ =='__main__':
-    main()
diff --git a/scripts/juju-setup.py b/scripts/juju-setup.py
deleted file mode 100755
index 3a75b07..0000000
--- a/scripts/juju-setup.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/python
-
-import subprocess
-import json
-import socket
-
-jujuconfig="/usr/local/src/openstack.cfg"
-
-# Assumption: VMs have same hostname as service that runs inside
-machines = ["mysql", "rabbitmq-server", "keystone", "glance", "nova-cloud-controller",
-            "neutron-gateway", "openstack-dashboard", "ceilometer", "nagios", "neutron-api"]
-
-services = {
-    "mysql" : "mysql",
-    "rabbitmq-server" : "rabbitmq-server",
-    "keystone" : "--config=%s keystone" % jujuconfig,
-    "glance" : "--config=%s glance" % jujuconfig,
-#    "nova-cloud-controller" : "--config=%s cs:~andybavier/trusty/nova-cloud-controller" % jujuconfig,
-    "nova-cloud-controller" : "--config=%s nova-cloud-controller" % jujuconfig,
-    "neutron-gateway" : "--config=%s cs:~andybavier/trusty/neutron-gateway" % jujuconfig,
-#    "neutron-gateway" : "--config=%s neutron-gateway" % jujuconfig,
-    "neutron-api" : "--config=%s neutron-api" % jujuconfig,
-    "neutron-openvswitch" : "--config=%s neutron-openvswitch" % jujuconfig,
-    "openstack-dashboard" : "--config=%s openstack-dashboard" % jujuconfig,
-    "nagios" : "nagios",
-    "mongodb" : "mongodb",   # deploy to ceilometer machine
-    "ceilometer" : "ceilometer",
-    "nrpe" : "nrpe",
-    "ntp" : "ntp",
-    "ceilometer-agent" : "ceilometer-agent"
-}
-
-# Figure out Juju ID of machine we should install on
-def get_machine(status, service):
-    if service == "mongodb":
-        service = "ceilometer"
-    for key, value in status['machines'].iteritems():
-        (hostname, aliaslist, ipaddrlist) = socket.gethostbyaddr(value['dns-name'])
-        if hostname == service:
-            return key
-    return None
-
-def deploy(status, service, cmd):
-    if service in status['services']:
-        return
-
-    print "Installing %s" % service
-    machine = get_machine(status, service)
-    if machine:
-        subprocess.check_call("juju deploy --to=%s %s" % (machine, cmd), shell=True)
-    else:
-        subprocess.check_call("juju deploy %s" % cmd, shell=True)
-
-def get_juju_status():
-    output = subprocess.check_output("juju status --format=json", shell=True)
-    status = json.loads(output)
-    return status
-
-def addservices():
-    status = get_juju_status()
-
-    for service, cmd in services.iteritems():
-        try:
-            deploy(status, service, cmd)
-        except:
-            pass
-
-def addmachines():
-    status = get_juju_status()
-
-    for machine in machines:
-        if get_machine(status, machine) == None:
-            ipaddr = socket.gethostbyname(machine)
-            subprocess.check_call("juju add-machine ssh:%s" % ipaddr, shell=True)
-
-def main():
-    addmachines()
-    addservices()
-
-if  __name__ =='__main__':
-    main()
diff --git a/scripts/network-setup.sh b/scripts/network-setup.sh
deleted file mode 100755
index 05e4c12..0000000
--- a/scripts/network-setup.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-source ~/admin-openrc.sh
-
-function create-flat-net {
-    NAME=$1
-    neutron net-show $NAME-net 2>&1 > /dev/null
-    if [ "$?" -ne 0 ]
-    then
-	neutron net-create --provider:physical_network=$NAME --provider:network_type=flat --shared $NAME-net
-    fi
-}
-
-function create-subnet {
-    NAME=$1
-    CIDR=$2
-    GW=$3
-
-    neutron subnet-show $NAME-net 2>&1 > /dev/null
-    if [ "$?" -ne 0 ]
-    then
-	neutron subnet-create $NAME-net --name $NAME-net $CIDR --gateway=$GW --disable-dhcp
-    fi
-}
-
-function create-subnet-no-gateway {
-    NAME=$1
-    CIDR=$2
-
-    neutron subnet-show $NAME-net 2>&1 > /dev/null
-    if [ "$?" -ne 0 ]
-    then
-	neutron subnet-create $NAME-net --name $NAME-net $CIDR --no-gateway --disable-dhcp
-    fi
-}
-
-create-flat-net nat
-create-subnet nat 172.16.0.0/16 172.16.0.1
-
-create-flat-net ext
diff --git a/scripts/recreate-virbr0.sh b/scripts/recreate-virbr0.sh
deleted file mode 100644
index d38a6d5..0000000
--- a/scripts/recreate-virbr0.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-FILE=/etc/libvirt/qemu/networks/default.xml
-
-cp $FILE $FILE.tmp
-virsh net-destroy default
-virsh net-undefine default
-
-cp $FILE.tmp $FILE
-virsh net-create $FILE
diff --git a/scripts/single-node-pod.sh b/scripts/single-node-pod.sh
index 70a56aa..3f24801 100755
--- a/scripts/single-node-pod.sh
+++ b/scripts/single-node-pod.sh
@@ -27,7 +27,7 @@
 function bootstrap() {
     cd ~
     sudo apt-get update
-    sudo apt-get -y install software-properties-common curl git mosh tmux dnsutils python-netaddr
+    sudo apt-get -y install software-properties-common curl git tmux dnsutils python-netaddr python-dnspython
     sudo add-apt-repository -y ppa:ansible/ansible
     sudo apt-get update
     sudo apt-get install -y ansible
@@ -52,7 +52,7 @@
     if [[ "$XOS_REPO_URL" != "" ]]; then
         extra_vars="$extra_vars xos_repo_url=$XOS_REPO_URL"
     fi
-    if [[ "$XOS_BRANCH" != "" ]]; then 
+    if [[ "$XOS_BRANCH" != "" ]]; then
         extra_vars="$extra_vars xos_repo_branch=$XOS_BRANCH"
     fi
 
diff --git a/scripts/wait-for-services.sh b/scripts/wait-for-services.sh
deleted file mode 100755
index da4ef1f..0000000
--- a/scripts/wait-for-services.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Wait for there to be no services in pending state
-while $( juju status --format=summary|grep -q pending )
-do
-  sleep 10
-done