#!/bin/bash staging=/tmp installLog=$staging/dupIpPeerCheck.out runValidateConfig() { status=0 echo -e "\n===========================================================================================================================\n" | tee -a $installLog echo " Starting configuration validation for duplicate ipPeer..." | tee -a $installLog `/opt/sonus/sbx/tailf/bin/confd_load -F p -P /addressContext/zone/ipPeer/name | grep -A 1 "http://sonusnet.com/ns/mibs/SONUS-IP-PEER/1.0" | grep name | cut -d ">" -f 2 | cut -d "<" -f 1 | sort | uniq -Di > $staging/duplicateIpPeerList`; if [ ! -s $staging/duplicateIpPeerList ]; then echo " No duplicate IpPeers found..." | tee -a $installLog `/bin/rm -f $staging/duplicateIpPeerList > /dev/null 2>&1` else status=1 echo " Found duplicate ipPeer. Please delete the following ipPeers..." | tee -a $installLog echo " " cat $staging/duplicateIpPeerList | tee -a $installLog fi echo -e "\n===========================================================================================================================\n" | tee -a $installLog if [ $status -eq 0 ]; then echo " Configuration passed validation - No duplicate IpPeer found. ok to proceed with SW upgrade..." | tee -a $installLog else echo " Configuration failed validation, duplicate ipPeer found. Please contact Sonus TAC before performing SW upgrade..." | tee -a $installLog fi echo -e "\n===========================================================================================================================\n" | tee -a $installLog } /bin/rm -f $staging/duplicateIpPeerList > /dev/null 2>&1 runValidateConfig echo "Validation completed." echo "" echo "" exit 0