查询物理机交换机信息

ifconfig | awk '/flags/ && !/lo/ {split($1, a, ":"); print a[1]}' | xargs -I{} sh -c 'echo "===== 网卡: {} ====="; lldptool -t -n -i {}; echo' 

===== 网卡: xgbe0 =====
Chassis ID TLV
    MAC: 5c:f7:96:aa:b1:0c
Port ID TLV
    Ifname: FourHundredGigE1/0/76
Time to Live TLV
    121
Port Description TLV
    FourHundredGigE1/0/76 Interface
System Name TLV
    ZWLTH3P04-IBG-12A-S9827-128DH
System Description TLV
    H3C Comware Platform Software, Software Version 9.1.058, Ess 9320P01
H3C S9827-128DH
Copyright (c) 2004-2024 New H3C Technologies Co., Ltd. All rights reserved.
System Capabilities TLV
    System capabilities:  Bridge, Router
    Enabled capabilities: Bridge, Router
Management Address TLV
    IPv4: 100.110.3.113
    Ifindex: 129
Port VLAN ID TLV
    PVID: 100
Link Aggregation TLV
    Aggregation capable
    Currently not aggregated
    Aggregated Port ID: 0
MAC/PHY Configuration Status TLV
    Auto-negotiation supported and enabled
    PMD auto-negotiation capabilities: 0x0000
    MAU type: Unknown [0x0000]
Power via MDI TLV
    Port class PD
    PSE MDI power not supported
    PSE pairs not controllable
    PSE Power pair: signal
    Power class 2
Maximum Frame Size TLV
    9216
End of LLDPDU TLV

===== 网卡: xgbe1 =====

===== 网卡: xgbe2 =====
Chassis ID TLV
    MAC: 5c:f7:96:a9:78:ba
Port ID TLV
    Ifname: FourHundredGigE1/0/76
Time to Live TLV
    121
Port Description TLV
    FourHundredGigE1/0/76 Interface
System Name TLV
    ZWLTH3P04-IBG-12B-S9827-128DH
System Description TLV
    H3C Comware Platform Software, Software Version 9.1.058, Ess 9320P01
H3C S9827-128DH
Copyright (c) 2004-2024 New H3C Technologies Co., Ltd. All rights reserved.
System Capabilities TLV
    System capabilities:  Bridge, Router
    Enabled capabilities: Bridge, Router
Management Address TLV
    IPv4: 100.110.3.114
    Ifindex: 129
Port VLAN ID TLV
    PVID: 100
Link Aggregation TLV
    Aggregation capable
    Currently not aggregated
    Aggregated Port ID: 0
MAC/PHY Configuration Status TLV
    Auto-negotiation supported and enabled
    PMD auto-negotiation capabilities: 0x0000
    MAU type: Unknown [0x0000]
Power via MDI TLV
    Port class PD
    PSE MDI power not supported
    PSE pairs not controllable
    PSE Power pair: signal
    Power class 2
Maximum Frame Size TLV
    9216
End of LLDPDU TLV