How to get neighbor models information using CLI

Document ID : KB000042475
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:  

How to get neighbor models information using CLI?

Answer: 

We can use the following CLI to get neighbor models information under $SPECROOT/vnmsh directory

./update action=0x1001f mh=<device's model handle> 

This command will show result of neighbor models' model handles.

Here are the steps:

1. Login to SpectroSERVER machine as spectrum install owner user, launch a bash login shell.

2. Go to $SPECROOT/vnmsh and run the following to connect to SpectroSERVER

./connect

3. Identify the model handle of the device model you want to know the neighbors. If you know the model name and you can run the following command to get the model handle.

The following command will set the lenght of Model Name environment variable

hostname%/c/win32app/Spectrum/vnmsh
> export CLIMNAMEWIDTH=64;

The following command will seek the model and model type handle of given model name. You will notice the device model handle is 0x1400078

hostname%/c/win32app/Spectrum/vnmsh
> ./seek attr=0x1006e,val=test.ca.com
MHandle     MName                                                             MTypeHnd    MTypeName
0x1400078   test.ca.com                                                       0x21000c    Rtr_Cisco

Or using a script you may want to get only the model handle as output. You can utilize 'tail' and 'awk' command.

hostname%/c/win32app/Spectrum/vnmsh
> ./seek attr=0x1006e,val=test.ca.com | tail -n +2 | awk '{print $1}'
0x1400078

4. Run the 'update action=0x1001f' command to get the device's neighbor information.

hostname%/c/win32app/Spectrum/vnmsh
> ./update action=0x1001f mh=0x1400078
update action: successful
Response has 10 attributes:
0) Attribute 0x0 text: **** Primary_neighbors:
1) Attribute 0x0 model: 0x1400081
2) Attribute 0x0 model: 0x14004b7
3) Attribute 0x0 model: 0x140007f
4) Attribute 0x0 model: 0x14004bb
5) Attribute 0x0 model: 0x14004bd
6) Attribute 0x0 model: 0x1400079
7) Attribute 0x0 model: 0x140007b
8) Attribute 0x0 model: 0x140031c
9) Attribute 0x0 model: 0x1400087

Or using a script you may want to get only the model handle as output. You can utilize 'tail' and 'awk' command.

hostname%/c/win32app/Spectrum/vnmsh
> ./update action=0x1001f mh=0x1400078 2>/dev/null | tail -n +3 | awk '{print $5}'
0x1400081
0x14004b7
0x140007f
0x14004bb
0x14004bd
0x1400079
0x140007b
0x140031c
0x1400087

The result shows model handles of neighbor of the device model.

Additional Information: 

Overview on CA Spectrum Command Line Interface (https://docops.ca.com/ca-spectrum/10-1/en/managing-client-applications/command-line-interface/introduction-to-command-line-interface-cli/overview-on-ca-spectrum-command-line-interface)