summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliang gao <jean.gaoliang@huawei.com>2016-08-01 07:24:54 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-08-01 07:24:55 +0000
commitc89fda5b5e7ae1ce501fba9e506ff3528c7d6f92 (patch)
treec5f904ec87b632665a8c2a67ed72779544f711bb
parentfe46800c17c055ee337dddb2e2de00d6db128cda (diff)
parentecdcc2f378dfac0c35deb3b5b537fc0d14b81828 (diff)
Merge "Create Bash Sheel Utilities"
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker_conf.yaml12
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/disk/block_io.bash14
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash15
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/network/close_interface.bash15
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/network/open_interface.bash15
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/node/release_cpu.bash14
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/node/stress_cpu.bash14
7 files changed, 99 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml
index e5d1b9f0b..d37d66964 100644
--- a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml
+++ b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml
@@ -15,3 +15,15 @@ bare-metal-down:
stop-service:
inject_script: ha_tools/stop_service.bash
recovery_script: ha_tools/start_service.bash
+
+close-interface:
+ inject_script: ha_tools/network/close_interface.bash
+ recovery_script: ha_tools/network/open_interface.bash
+
+stress-cpu:
+ inject_script: ha_tools/node/stress_cpu.bash
+ recovery_script: ha_tools/node/release_cpu.bash
+
+block-io:
+ inject_script: ha_tools/disk/block_io.bash
+ recovery_script: ha_tools/disk/recovery_disk_io.bash \ No newline at end of file
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/disk/block_io.bash b/yardstick/benchmark/scenarios/availability/ha_tools/disk/block_io.bash
new file mode 100644
index 000000000..2ccf7eeab
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/disk/block_io.bash
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+##############################################################################
+# (c) OPNFV, Yin Kanglin and others.
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# make a disk IO jam
+
+sudo dd if=/dev/zero of=/test.dbf bs=8k count=30000000 &
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash b/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash
new file mode 100644
index 000000000..dbe8519ba
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+##############################################################################
+# (c) OPNFV, Yin Kanglin and others.
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# recover a node from disk io block status
+
+sudo kill `pidof dd`
+
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/network/close_interface.bash b/yardstick/benchmark/scenarios/availability/ha_tools/network/close_interface.bash
new file mode 100644
index 000000000..02c8d4736
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/network/close_interface.bash
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+##############################################################################
+# (c) OPNFV, Yin Kanglin and others.
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# close a network interface.
+# parameter: $1 - interface-name
+
+ifconfig $1 down \ No newline at end of file
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/network/open_interface.bash b/yardstick/benchmark/scenarios/availability/ha_tools/network/open_interface.bash
new file mode 100644
index 000000000..953d5d30d
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/network/open_interface.bash
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+##############################################################################
+# (c) OPNFV, Yin Kanglin and others.
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# open a network interface.
+# parameter: $1 - interfaced-name
+
+ifconfig $1 up \ No newline at end of file
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/node/release_cpu.bash b/yardstick/benchmark/scenarios/availability/ha_tools/node/release_cpu.bash
new file mode 100644
index 000000000..8e25fae5c
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/node/release_cpu.bash
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+##############################################################################
+# (c) OPNFV, Yin Kanglin and others.
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# release CPU stress.
+
+ps -ef|grep "dd if=/dev/zero of=/dev/null"|awk '{print$2}'|xargs kill -9 \ No newline at end of file
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/node/stress_cpu.bash b/yardstick/benchmark/scenarios/availability/ha_tools/node/stress_cpu.bash
new file mode 100644
index 000000000..30aa70748
--- /dev/null
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/node/stress_cpu.bash
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+##############################################################################
+# (c) OPNFV, Yin Kanglin and others.
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# stress CPU usage to 100%.
+
+for i in `seq 1 $(cat /proc/cpuinfo |grep "physical id" |wc -l)`; do dd if=/dev/zero of=/dev/null & done \ No newline at end of file