Skip to content

Commit

Permalink
Merge pull request #94 from rtsp/patch-1
Browse files Browse the repository at this point in the history
fix_vlan.sh: Refactor script to allow dynamic EntityID instead of hard-coded 4354/4363
  • Loading branch information
Anime4000 authored Nov 17, 2022
2 parents 7020097 + 7e1c72e commit 8f2d718
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions Tools/etc/scripts/fix_vlan_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
set -e

while true; do
omcicli mib get 84 > /tmp/84.tmp

size=$(ls -la /tmp/ | grep 84.tmp | awk '{ print $5 }')
for _EntityID in $(omcicli mib get 84 | grep '^EntityID:' | awk '{print $2}'); do

if [[ "$size" -lt "88" ]]; then
# Looks like the table is not populated yet
sleep 30
continue
fi
_FwdOp=$(omcicli mib get 84 ${_EntityID} | grep '^FwdOp:' | awk '{print $2}')

one_mode=$(awk '/0x1102/{nr[NR]; nr[NR+2]}; NR in nr' /tmp/84.tmp | grep FwdOp | awk '{ print $2 }')
two_mode=$(awk '/0x110b/{nr[NR]; nr[NR+2]}; NR in nr' /tmp/84.tmp | grep FwdOp | awk '{ print $2 }')
if [[ ! -z ${_FwdOp} && ${_FwdOp} != '0x02' ]]; then
omcicli mib set 84 ${_EntityID} FwdOp 0x02
fi

rm /tmp/84.tmp
done

[[ $one_mode != "0x02" ]] && omcicli mib set 84 4354 FwdOp 0x02
[[ $two_mode != "0x02" ]] && omcicli mib set 84 4363 FwdOp 0x02
sleep 30
done;
sleep 30
done

0 comments on commit 8f2d718

Please sign in to comment.