Identify Nearby Network Interfaces#

You can use the lldp_neighbors script to identify nearby network interfaces for nodes. Typically a node's network neighbor is a network switch, so the script is useful for identifying the network switch ports that a node is plugged in to. The network neighbors are listed in the _neighbors reserved attribute on the node.

  1. Run the script to identify the node neighbors and set the reserved attribute:

    cw-nodectl -i<node name> script lldp_neighbors
    
  2. After the script completes, view the neighbors on the node:

    cw-nodectl -i<node name> ls -l
    

The script can run on multiple nodes.

For example:

  1. Run the script on nodes n20-24:

    cw-nodectl -in20-24 script lldp_neighbors
    
  2. After the script completes, view the node neighbors for node n22:

    [admin@head ~]$ cw-nodectl -in22 ls -l
    Nodes
      n22
        attributes
          _boot_config: DefaultBoot
          _neighbors: enp6s0=sonic:Ethernet97,bootnet=monkish:swp36,enp1s0f1=monkish:swp6
    <...snip...>