aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/availability/ha_tools/nova
diff options
context:
space:
mode:
authorDimitrios Markou <mardim@intracom-telecom.com>2018-03-03 03:38:31 +0200
committerDimitrios Markou <mardim@intracom-telecom.com>2018-03-08 14:14:00 +0200
commitce37b262a5afa80ca883506cf362a165114ce3de (patch)
tree94e6d0c5c67838c714f96eb4a6af4970a5c333b5 /yardstick/benchmark/scenarios/availability/ha_tools/nova
parentd5a2c20d8de2796b2d2e2143ddfb2ba839a0e999 (diff)
Assign nova instance to security group
Support the assigning of a nova instance to an existing security group through the operation perspective Change-Id: Ic1c26031c25d400fede2ecb298a66aec42dcfbc5 Signed-off-by: Dimitrios Markou <mardim@intracom-telecom.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/availability/ha_tools/nova')
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/nova/add_server_to_existing_secgroup.bash26
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/nova/remove_server_from_secgroup.bash25
2 files changed, 51 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/nova/add_server_to_existing_secgroup.bash b/yardstick/benchmark/scenarios/availability/ha_tools/nova/add_server_to_existing_secgroup.bash
new file mode 100644
index 000000000..3a50626f5
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/nova/add_server_to_existing_secgroup.bash
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2018 Intracom Telecom 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
+##############################################################################
+
+# add server to existing security group
+# parameters: $1 - server name, $2 - security group name
+
+set -e
+
+if [ $OS_INSECURE ] && [ "$(echo $OS_INSECURE | tr '[:upper:]' '[:lower:]')" = "true" ]; then
+ SECURE="--insecure"
+else
+ SECURE=""
+fi
+
+SECGROUPNAME="$(openstack ${SECURE} security group list -f value -c Name | grep $2)"
+
+openstack ${SECURE} server add security group $1 ${SECGROUPNAME}
+
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/nova/remove_server_from_secgroup.bash b/yardstick/benchmark/scenarios/availability/ha_tools/nova/remove_server_from_secgroup.bash
new file mode 100644
index 000000000..61d0a2b49
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/nova/remove_server_from_secgroup.bash
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2018 Intracom Telecom 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
+##############################################################################
+
+# remove server from existing security group
+# parameters: $1 - server name, $2 - security group name
+
+set -e
+
+if [ $OS_INSECURE ] && [ "$(echo $OS_INSECURE | tr '[:upper:]' '[:lower:]')" = "true" ]; then
+ SECURE="--insecure"
+else
+ SECURE=""
+fi
+
+SECGROUPNAME="$(openstack ${SECURE} security group list -f value -c Name | grep $2)"
+
+openstack ${SECURE} server remove security group $1 ${SECGROUPNAME}