How can we export a list of interfaces that are connected to other interfaces?
search cancel

How can we export a list of interfaces that are connected to other interfaces?

book

Article ID: 249084

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

How to obtain a list of the interfaces that are connected to other interfaces and their relations. eg

interface_A         Links_with       interface_B

in other words the list of all interfaces and the connections they have with the other interfaces..

 

Environment

Release : 21.2

Component : Spectrum Applications

Resolution

There is nothing out of the box that allow you to get a such list, so a potential approach could be the following:

As the number of interfaces could be very huge (thousands and thousands) and not all interfaces are connected to another interface, the idea is to have in an input file the list of model_handles of all interfaces that have a connection, to then process them with the following CLI script:

#!/bin/bash
                       
# Connect to the VNM shell
./connect

CLIMNAMEWIDTH=64   
export CLIMNAMEWIDTH
echo "List of connected interfaces" > report.list

file=Results.txt
while read line;
do
          ./show associations mh=$line | grep -i Links_with >> report.list
            
done < "$file"

# Disconnect from the VNM shell
./disconnect

So the first step is to create a file "Results.txt" that contains the model_handle of interfaces that have a connection. How to create it?

1)  In $SPECROOT/custom/topo/config create a table-searchresults-config.xml file that contains:

<?xml version="1.0" encoding="UTF-8"?>
<!--


   CA Technologies, Inc.
   One CA Plaza
   Islandia, NY 11749 USA

   Copyright (c) 2006 CA Technologies, Inc.
   All rights reserved.

   IN NO EVENT SHALL CA TECHNOLOGIES INCORPORATED BE LIABLE FOR
   ANY INCIDENTAL, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES
   WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS) ARISING OUT
   OF OR RELATED TO THIS SOFTWARE, EVEN IF CA TECHNOLOGIES INCORPORATED
   HAS BEEN ADVISED OF, KNOWN, OR SHOULD HAVE KNOWN, THE POSSIBILITY OF
   SUCH DAMAGES.


-->
<!--
-->

<table id="table-searchresults-config"
       idref="table-model-config">
     <column-list>
         <column>
               <name>Model Handle</name>
               <content>
                 <attribute>0x129fa</attribute>
               </content>
         </column>
     </column-list>
</table>

In this way when you run a Locater search you have the possibility to display an additional column "Model Handle" that contains the model_handle of the device/interface.

See article 37604 as sample

https://knowledge.broadcom.com/external/article?articleId=37604

2) Now run the following Locater search to display all interfaces that have NetworkLinkType value NOT equal to No Link

https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=pLfSUJdTQpwXVXSrs9HTwg==

3) Select only the "model handle" column to be displayed and export the results.

4) open the Results.csv and save it as Text  (Results.txt) 

At this point, in the file you have the list of model_handle of interfaces that have a connection.

5) copy it in the $SPECROOT/vnmsh dir and run the CLI script above. You will obtain a report like the following:

List of connected interfaces
0x756abd    10-252-0-36_1                                                     Links_with                       0x76bc2f    cr-lud007-01_Gi0                                                
0x7653e0    sw-10-253-19-25_Gi1/0/20                                          Links_with                       0x719e82    10-253-19-38_eth0                                               
0x719ed0    10-253-19-39_eth0                                                 Links_with                       0x7653e1    sw-10-253-19-25_Gi1/0/21                                        
0x73a457    10-253-19-40_eth0                                                 Links_with                       0x7653e2    sw-10-253-19-25_Gi1/0/22