Skip to content

Replace (or add an alternative for) PortDescr with PortID #7

@madecto

Description

@madecto

PortDescr depends on the interface description on the switches: in case of an empty description the field will report something very similar to the PortID, but in case the port description on the switch has been filled in, then this will be reported on Proxmox's interface file thus potentially masking the true ID of the interface.

This was tested with the following equipment:

  • Huawei Quidway and Cloud Managed switches
  • Cisco Catalyst 9300X
  • HPE OfficeConnect switches

Something like the following should work:

@@ -64,10 +64,10 @@
 while IFS= read -r line; do
     if [[ "$line" =~ Interface: ]]; then
         iface=$(echo "$line" | awk '{print $2}' | tr -d ',')
-    elif [[ "$line" =~ PortDescr: ]]; then
-        port_descr=$(echo "$line" | cut -d ' ' -f 2-)
-        log "Processing $iface with port description $port_descr."
-        update_description "$iface" "$port_descr"
+    elif [[ "$line" =~ PortID: ]]; then
+        port_id=$(echo "$line" | cut -d ' ' -f 2-)
+        log "Processing $iface with port description $port_id."
+        update_description "$iface" "$port_id"
     fi
 done < <(lldpcli show neighbors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions