Skip to content

Commit

Permalink
force remove veths if they're already created
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutshkumr committed Oct 20, 2023
1 parent 5d80040 commit 22563e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ VETH_B="veth-b"
VETH_C="veth-c"
VETH_X="veth-x"
VETH_Y="veth-y"
FORCE_CREATE_VETH=true

GO_VERSION=1.19
KIND_VERSION=v0.20.0
Expand All @@ -32,7 +33,6 @@ OPENCONFIG_MODELS_COMMIT=5ca6a36
TIMEOUT_SECONDS=300
APT_GET_UPDATE=true


apt_update() {
if [ "${APT_UPDATE}" = "true" ]
then
Expand Down Expand Up @@ -125,6 +125,12 @@ create_veth_pair() {
echo "usage: ${0} create_veth_pair <name1> <name2>"
exit 1
fi

if [ "${FORCE_CREATE_VETH}" = "true" ]
then
rm_veth_pair ${1} ${2} 2> /dev/null
fi

sudo ip link add ${1} type veth peer name ${2} \
&& sudo ip link set ${1} up \
&& sudo ip link set ${2} up
Expand Down

0 comments on commit 22563e2

Please sign in to comment.