Merge "Add integration bridge to the nova.conf"
diff --git a/lib/neutron_plugins/linuxbridge b/lib/neutron_plugins/linuxbridge
index 9aad8f3..37bc748 100644
--- a/lib/neutron_plugins/linuxbridge
+++ b/lib/neutron_plugins/linuxbridge
@@ -5,6 +5,8 @@
 MY_XTRACE=$(set +o | grep xtrace)
 set +o xtrace
 
+source $TOP_DIR/lib/neutron_plugins/linuxbridge_agent
+
 function neutron_plugin_configure_common() {
     Q_PLUGIN_CONF_PATH=etc/neutron/plugins/linuxbridge
     Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini
diff --git a/lib/neutron_plugins/plumgrid b/lib/neutron_plugins/plumgrid
index d4cc395..a4f0b0d 100644
--- a/lib/neutron_plugins/plumgrid
+++ b/lib/neutron_plugins/plumgrid
@@ -22,13 +22,13 @@
     Q_PLUGIN_CONF_FILENAME=plumgrid.ini
     Q_DB_NAME="plumgrid_neutron"
     Q_PLUGIN_CLASS="neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2"
+    PLUMGRID_DIRECTOR_IP=${PLUMGRID_DIRECTOR_IP:-localhost}
+    PLUMGRID_DIRECTOR_PORT=${PLUMGRID_DIRECTOR_PORT:-7766}
 }
 
 function neutron_plugin_configure_service() {
-    PLUMGRID_NOS_IP=${PLUMGRID_NOS_IP:-localhost}
-    PLUMGRID_NOS_PORT=${PLUMGRID_NOS_PORT:-7766}
-    iniset /$Q_PLUGIN_CONF_FILE plumgridnos nos_server $PLUMGRID_NOS_IP
-    iniset /$Q_PLUGIN_CONF_FILE plumgridnos nos_server_port $PLUMGRID_NOS_PORT
+    iniset /$Q_PLUGIN_CONF_FILE PLUMgridDirector director_server $PLUMGRID_DIRECTOR_IP
+    iniset /$Q_PLUGIN_CONF_FILE PLUMgridDirector director_server_port $PLUMGRID_DIRECTOR_PORT
 }
 
 function neutron_plugin_configure_debug_command() {
diff --git a/lib/swift b/lib/swift
index 36bca4c..f537989 100644
--- a/lib/swift
+++ b/lib/swift
@@ -271,6 +271,34 @@
         sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
     done
 
+    # Set new accounts in tempauth to match keystone tenant/user (to make testing easier)
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest1_swiftusertest1 "testing .admin"
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest2_swiftusertest2 "testing2 .admin"
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest1_swiftusertest3 "testing3 .admin"
+
+    testfile=${SWIFT_CONF_DIR}/test.conf
+    cp ${SWIFT_DIR}/test/sample.conf ${testfile}
+
+    # Set accounts for functional tests
+    iniset ${testfile} func_test account swifttenanttest1
+    iniset ${testfile} func_test username swiftusertest1
+    iniset ${testfile} func_test username3 swiftusertest3
+    iniset ${testfile} func_test account2 swifttenanttest2
+    iniset ${testfile} func_test username2 swiftusertest2
+
+    # Set maximum file size to 10000 bytes or our vm will fill up quickly with
+    # the default 5gb size.
+    iniuncomment ${testfile} func_test max_file_size
+    iniset ${testfile} func_test max_file_size 10000
+
+
+    if is_service_enabled key;then
+        iniuncomment ${testfile} func_test auth_version
+        iniset ${testfile} func_test auth_host ${KEYSTONE_SERVICE_HOST}
+        iniset ${testfile} func_test auth_port ${KEYSTONE_AUTH_PORT}
+        iniset ${testfile} func_test auth_prefix /v2.0/
+    fi
+
     swift_log_dir=${SWIFT_DATA_DIR}/logs
     rm -rf ${swift_log_dir}
     mkdir -p ${swift_log_dir}/hourly
@@ -329,6 +357,29 @@
         sudo chown -R $USER: ${node}
     done
 }
+# create_swift_accounts() - Set up common required swift accounts for tests we
+# are all attach names since we want to make it compatible with tempauth which
+# use underscores for separators.
+
+# Tenant               User       Roles
+# ------------------------------------------------------------------
+# swifttenanttest1   swiftusertest1     admin
+# swifttenanttest1   swiftusertest3     anotherrole
+# swifttenanttest2   swiftusertest2     admin
+
+# Migrated from keystone_data.sh
+function create_swift_accounts() {
+    SWIFT_TENANT_TEST1=$(keystone tenant-create --name=swifttenanttest1 | grep " id " | get_field 2)
+    SWIFT_USER_TEST1=$(keystone user-create --name=swiftusertest1 --pass=testing --email=test@example.com | grep " id " | get_field 2)
+    keystone user-role-add --user_id $SWIFT_USER_TEST1 --role_id $ADMIN_ROLE --tenant_id $SWIFT_TENANT_TEST1
+
+    SWIFT_USER_TEST3=$(keystone user-create --name=swiftusertest3 --pass=testing3 --email=test3@example.com | grep " id " | get_field 2)
+    keystone user-role-add --user_id $SWIFT_USER_TEST3 --role_id $ANOTHER_ROLE --tenant_id $SWIFT_TENANT_TEST1
+
+    SWIFT_TENANT_TEST2=$(keystone tenant-create --name=swifttenanttest2 | grep " id " | get_field 2)
+    SWIFT_USER_TEST2=$(keystone user-create --name=swiftusertest2 --pass=testing2 --email=test2@example.com | grep " id " | get_field 2)
+    keystone user-role-add --user_id $SWIFT_USER_TEST2 --role_id $ADMIN_ROLE --tenant_id $SWIFT_TENANT_TEST2
+}
 
 # init_swift() - Initialize rings
 function init_swift() {
diff --git a/stack.sh b/stack.sh
index 530b7b7..f2054d9 100755
--- a/stack.sh
+++ b/stack.sh
@@ -878,6 +878,7 @@
     export OS_SERVICE_ENDPOINT=$SERVICE_ENDPOINT
     create_keystone_accounts
     create_nova_accounts
+    create_swift_accounts
     create_cinder_accounts
     create_neutron_accounts
 
diff --git a/tools/xen/functions b/tools/xen/functions
index 3a69a5d..261f14f 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -40,11 +40,11 @@
     local LOCAL_ZIPBALL=$(mktemp)
     local EXTRACTED_FILES=$(mktemp -d)
 
-    (
+    {
         wget -nv $ZIPBALL_URL -O $LOCAL_ZIPBALL --no-check-certificate
         unzip -q -o $LOCAL_ZIPBALL -d $EXTRACTED_FILES
         rm -f $LOCAL_ZIPBALL
-    ) >&2
+    } >&2
 
     echo "$EXTRACTED_FILES"
 }
diff --git a/tools/xen/mocks b/tools/xen/mocks
index 6da6acb..94b0ca4 100644
--- a/tools/xen/mocks
+++ b/tools/xen/mocks
@@ -34,6 +34,9 @@
 }
 
 function wget {
+    if [[ $@ =~ "failurl" ]]; then
+        exit 1
+    fi
     echo "wget $@" >> $LIST_OF_ACTIONS
 }
 
diff --git a/tools/xen/test_functions.sh b/tools/xen/test_functions.sh
index 410df5f..5347238 100755
--- a/tools/xen/test_functions.sh
+++ b/tools/xen/test_functions.sh
@@ -173,6 +173,15 @@
     [ "$RESULT" = "tempdir" ]
 }
 
+function test_extract_remote_zipball_wget_fail {
+    set +e
+
+    local IGNORE
+    IGNORE=$(. mocks && extract_remote_zipball "failurl")
+
+    assert_previous_command_failed
+}
+
 function test_find_nova_plugins {
     local tmpdir=$(mktemp -d)