From 06ef83d26dad0ed18b38e929e3a7bbcad76e7c98 Mon Sep 17 00:00:00 2001 From: root Date: Sep 15 2012 17:12:58 +0000 Subject: Added tests to install bridge-utils,add a bridge and delete a bridge --- diff --git a/tests/p_bridge-utils/0-install_bridge-utils.sh b/tests/p_bridge-utils/0-install_bridge-utils.sh new file mode 100755 index 0000000..69045ed --- /dev/null +++ b/tests/p_bridge-utils/0-install_bridge-utils.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +# Install bridge_utils package +t_Log "Running $0 - bridge-utils: Installation" + +t_InstallPackage bridge-utils diff --git a/tests/p_bridge-utils/05-add_bridge.sh b/tests/p_bridge-utils/05-add_bridge.sh new file mode 100755 index 0000000..e21c60b --- /dev/null +++ b/tests/p_bridge-utils/05-add_bridge.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Author : Madhurranjan Mohaan + +if [ $# -eq 0 ] +then + bridge=testbridge1 +else + bridge=$1 +fi + +t_Log "Running $0 - Adding a dummy Bridge: $bridge" +bridge_present=`brctl show | grep $bridge` +if ! [ "$bridge_present" ] + then + brctl addbr $bridge + bridge_present=`brctl show | grep $bridge` + if [ "$bridge_present" ] + then + ret_val=0 + else + ret_val=1 + fi +else + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_bridge-utils/10-delete_bridge.sh b/tests/p_bridge-utils/10-delete_bridge.sh new file mode 100755 index 0000000..202e407 --- /dev/null +++ b/tests/p_bridge-utils/10-delete_bridge.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Author : Madhurranjan Mohaan +#add bridge +bridge=testbridge2 +./05-add_bridge.sh $bridge +#delete the bridge created +bridge_present=`brctl show | grep $bridge` +t_Log "Running $0 - Deleting the dummy bridge: $bridge" + +if ! [ "$bridge_present" ] + then + ret_val=1 +else + t_Log "Deleting bridge $bridge" + brctl delbr $bridge + bridge_present=`brctl show | grep $bridge` + if [ $bridge_present ] + then + ret_val=1 + else + ret_val=0 + fi +fi +t_CheckExitStatus $ret_val