Discussion:
[rancid] OAM Ping scripts?
Ed Ravin
2008-02-28 23:44:57 UTC
Permalink
Has anyone automated performing OAM ping on an interface? It seems like
a natural fit for RANCID...
Ed Ravin
2008-03-01 14:25:57 UTC
Permalink
Post by Ed Ravin
Has anyone automated performing OAM ping on an interface? It seems like
a natural fit for RANCID...
It wasn't so hard to do, it turned out. Here's some sample shell code.

Assuming that "routercmd" runs the requested command on the appropriate
command line, and $VPI and $VCI have the VPI/VCI of the circuit you want
to OAM ping:

# determine the ATM subinterface
routerout=$(routercmd "show atm pvc" | perl -n -e "print \$1, \"\\n\" if /^(\\S+)\\s+\\S+\\s+$VPI\\s+$VCI\\s/")
# 1 2 3 4
# 6/0.1438 54 0 1438 PVC SNAP UBR 1536 UP

if [ -z "$routerout" ]
then
echo "cannot get data from router - check your VPI/VCI and try again"
exit 25
fi

pingcmd="ping atm interface ATM${routerout} $VPI $VCI end-loopback"
echo $pingcmd
routercmd "$pingcmd"

Loading...