cancel
Showing results for 
Search instead for 
Did you mean: 
Post a Question

VSX: show configuration For All Virtual Systems

Jump to solution

Is there a way to show the clish configuration for all virtual systems in VSX?  There are a few things we configure specifically in certain contexts (like bootp relay and dynamic routing).  I have a script that pulls a show configuration and backs it up, but it only gets data from vs0.  I tried setting my virual system and doing a vsenv with no luck...  It always pulls vs0 configuration.

[Expert@vsx:0]# clish -c "show configuration bootp"

CLINFR0771  Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.

show instance 0 configuration bootp

 [Expert@vsx:0]# clish -c "set virtual-system 2"

CLINFR0771  Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.

Context is set to vsid 2

[Expert@vsx:0]# clish -c "show configuration bootp"

CLINFR0771  Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.

show instance 0 configuration bootp

[Expert@vsx:0]# vsenv 2

Context is set to Virtual Device vsx_vs2 (ID 2).

[Expert@vsx:2]# clish -c "show configuration bootp"

CLINFR0771  Config lock is owned by admin. Use the command 'lock database override' to acquire the lock.

show instance 0 configuration bootp

[Expert@vsx:2]#

Tags (2)
1 Solution

Accepted Solutions
Admin
Admin

Re: VSX: show configuration For All Virtual Systems

Jump to solution

set virtual-system is not persistent across clish -c commands. 

clish -c is only meant to execute a single command.

You will need to execute a clish script (e.g. clish -f filename) to achieve what you are after.

0 Kudos
4 Replies
Admin
Admin

Re: VSX: show configuration For All Virtual Systems

Jump to solution

set virtual-system is not persistent across clish -c commands. 

clish -c is only meant to execute a single command.

You will need to execute a clish script (e.g. clish -f filename) to achieve what you are after.

0 Kudos

Re: VSX: show configuration For All Virtual Systems

Jump to solution

That did the trick!  I'm able to build a file of clish commands iterating over each available VS.  Thanks!

0 Kudos

Re: VSX: show configuration For All Virtual Systems

Jump to solution

Please add clish --vsid <VSID> -c "command". 

I hate jumping from bash to clish every time I have to check something miniscule.

0 Kudos

Re: VSX: show configuration For All Virtual Systems

Jump to solution

I have written a simple bash script to emulate the above functions. Use with care, no validation is done, though maybe I'll add some sanity checks.

#!/bin/bash
source /etc/profile.d/CP.sh
source /etc/profile.d/vsenv.sh
  
MYPID=$$
myVSID=0
TMPCLISH="/tmp/tmpclish-$MYPID"
scriptname=`basename ${BASH_SOURCE[0]}`
usage () { echo "$scriptname -v <vsid> <command>"; exit 1; }
  
NUMARGS=$#
if [ $NUMARGS -eq 0 ]; then
  usage
fi
  
while getopts ":h:v:" opt; do
  case $opt in
    h)usage;;
    \?)usage;;
    v)myVSID="$OPTARG";;
    🙂echo "missing option for -$OPTARG"; exit 1;;
    *)usage;;
  esac
done
  
shift $((OPTIND-1))
 
#in case -v is not set (don't use this script for VS0)
if [[ $myVSID == 0 ]]; then
  usage
fi
 
echo "$TMPCLISH"
if [[ ! -e "$TMPCLISH" ]]; then
  echo "set virtual-system $myVSID">$TMPCLISH
  echo "$@">>$TMPCLISH
  clish -f "$TMPCLISH"
  #cleanup
  rm $TMPCLISH
else
  echo "$TMPCLISH already exists. Try again!"
fi
0 Kudos