From ecdcc2f378dfac0c35deb3b5b537fc0d14b81828 Mon Sep 17 00:00:00 2001 From: tjuyinkanglin <14_ykl@tongji.edu.cn> Date: Wed, 27 Jul 2016 23:49:35 +0800 Subject: Create Bash Sheel Utilities JIRA: YARDSTICK-277 Change-Id: I7379d4fe375d22e544ab93b48d56a017a60c4b9f Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn> --- .../benchmark/scenarios/availability/attacker_conf.yaml | 12 ++++++++++++ .../scenarios/availability/ha_tools/disk/block_io.bash | 14 ++++++++++++++ .../availability/ha_tools/disk/recovery_disk_io.bash | 15 +++++++++++++++ .../availability/ha_tools/network/close_interface.bash | 15 +++++++++++++++ .../availability/ha_tools/network/open_interface.bash | 15 +++++++++++++++ .../scenarios/availability/ha_tools/node/release_cpu.bash | 14 ++++++++++++++ .../scenarios/availability/ha_tools/node/stress_cpu.bash | 14 ++++++++++++++ 7 files changed, 99 insertions(+) create mode 100644 yardstick/benchmark/scenarios/availability/ha_tools/disk/block_io.bash create mode 100644 yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash create mode 100644 yardstick/benchmark/scenarios/availability/ha_tools/network/close_interface.bash create mode 100644 yardstick/benchmark/scenarios/availability/ha_tools/network/open_interface.bash create mode 100644 yardstick/benchmark/scenarios/availability/ha_tools/node/release_cpu.bash create mode 100644 yardstick/benchmark/scenarios/availability/ha_tools/node/stress_cpu.bash (limited to 'yardstick') 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 -- cgit 1.2.3-korg