You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
QA/tests/p_bridge-utils/p_bridge-utils-functions

98 lines
1.6 KiB

#!/bin/bash
function bru_add_bridge_7
{
bridge=$1
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
echo $ret_val
}
function bru_add_bridge_8
{
bridge=$1
bridge_present=`cat /proc/net/dev | grep $bridge`
if ! [ "$bridge_present" ]
then
ip link add name $bridge type bridge
bridge_present=`cat /proc/net/dev | grep $bridge`
if [ "$bridge_present" ]
then
ret_val=0
else
ret_val=1
fi
else
ret_val=0
fi
echo $ret_val
}
function bru_del_bridge_7
{
bridge=$1
bridge_present=`brctl show | grep $bridge`
if ! [ "$bridge_present" ]
then
ret_val=1
else
brctl delbr $bridge
bridge_present=`brctl show | grep $bridge`
if [ "$bridge_present" ]
then
ret_val=1
else
ret_val=0
fi
fi
echo $ret_val
}
function bru_del_bridge_8
{
bridge=$1
bridge_present=`cat /proc/net/dev | grep $bridge`
if ! [ "$bridge_present" ]
then
ret_val=1
else
ip link del name $bridge
bridge_present=`cat /proc/net/dev | grep $bridge`
if [ $bridge_present ]
then
ret_val=1
else
ret_val=0
fi
fi
echo $ret_val
}
function bru_add_bridge
{
if [ "$centos_ver" -ge 8 ] ; then
bru_add_bridge_8 $1
else
bru_add_bridge_7 $1
fi
}
function bru_del_bridge
{
if [ "$centos_ver" -ge 8 ] ; then
bru_del_bridge_8 $1
else
bru_del_bridge_7 $1
fi
}