Skip to content

Commit

Permalink
Add Fortinet get hardware nic nic-name'template (#1488)
Browse files Browse the repository at this point in the history
Co-authored-by: pskliarenko <“[email protected]”>
  • Loading branch information
PavloSkliarenko and pskliarenko authored Jul 22, 2024
1 parent 0d31dbb commit 554f8f2
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 0 deletions.
76 changes: 76 additions & 0 deletions ntc_templates/templates/fortinet_get_hardware_nic_nic-name.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Value DESCRIPTION (.+)
Value DRIVER_NAME (.+)
Value BOARD (\w+)
Value LIF_ID (\d+)
Value LIF_OID (\d+)
Value NETDEV_OID (\d+)
Value CURRENT_HWADDR ([a-zA-Z0-9]{2}(:[a-zA-Z0-9]{2}){5})
Value PERMANENT_HWADDR ([a-zA-Z0-9]{2}(:[a-zA-Z0-9]{2}){5})
Value ADMIN (\S+)
Value NETDEV_STATUS (\S+)
Value AUTONEGO_SETTING (\d+)
Value LINK_SETTING (\d+)
Value SPEED_SETTING (\d+)
Value DUPLEX_SETTING (\d+)
Value SPEED (\d+)
Value DUPLEX (\S+)
Value LINK_STATUS (\S+)
Value RX_PACKETS (\d+)
Value RX_BYTES (\d+)
Value TX_PACKETS (\d+)
Value TX_BYTES (\d+)
Value HOST_RX_PACKETS (\d+)
Value HOST_RX_BYTES (\d+)
Value HOST_TX_PACKETS (\d+)
Value HOST_TX_BYTES (\d+)
Value HOST_TX_DROPPED (\d+)
Value FRAGTXCREATE (\d+)
Value FRAGTXOK (\d+)
Value FRAGTXDROP (\d+)
Value List MEMBER_PORTS (\[\d+\]:\s+\S+)

Start
^Description\s*:${DESCRIPTION}\s*$$
^Driver\s+Name\s*:${DRIVER_NAME}\s*$$
^Board\s*:${BOARD}\s*$$
^lif\s+id\s*:${LIF_ID}\s*$$
^lif\s+oid\s*:${LIF_OID}\s*$$
^netdev\s+oid\s*:${NETDEV_OID}\s*$$
^Current_HWaddr\s*${CURRENT_HWADDR}\s*$$
^Permanent_HWaddr\s*${PERMANENT_HWADDR}\s*$$
^=+\s+Link\s+Status\s+=+ -> LinkStatus
^=+\s+Counters\s+=+ -> Counters
^\s*$$
^. -> Error

LinkStatus
^Admin\s*:${ADMIN}\s*$$
^netdev\s+status\s*:${NETDEV_STATUS}\s*$$
^autonego_setting\s*:${AUTONEGO_SETTING}\s*$$
^link_setting\s*:${LINK_SETTING}\s*$$
^speed_setting\s*:${SPEED_SETTING}\s*$$
^duplex_setting\s*:${DUPLEX_SETTING}\s*$$
^Speed\s*:${SPEED}\s*$$
^Duplex\s*:${DUPLEX}\s*$$
^link_status\s*:${LINK_STATUS}\s*$$ -> Start
^\s*$$
^. -> Error

Counters
^Rx\s+Pkts\s*:${RX_PACKETS}\s*$$
^Rx\s+Bytes\s*:${RX_BYTES}\s*$$
^Tx\s+Pkts\s*:${TX_PACKETS}\s*$$
^Tx\s+Bytes\s*:${TX_BYTES}\s*$$
^Host\s+Rx\s+Pkts\s*:${HOST_RX_PACKETS}\s*$$
^Host\s+Rx\s+Bytes\s*:${HOST_RX_BYTES}\s*$$
^Host\s+Tx\s+Pkts\s*:${HOST_TX_PACKETS}\s*$$
^Host\s+Tx\s+Bytes\s*:${HOST_TX_BYTES}\s*$$
^Host\s+Tx\s+dropped\s*:${HOST_TX_DROPPED}\s*$$
^FragTxCreate\s*:${FRAGTXCREATE}\s*$$
^FragTxOk\s*:${FRAGTXOK}\s*$$
^FragTxDrop\s*:${FRAGTXDROP}\s*$$
# No 'Member Ports' parsing
^Member\s+Ports\s*\:\s*$$
^\s*${MEMBER_PORTS}\s*$$
^\s*$$
^. -> Error
1 change: 1 addition & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ fortinet_get_router_info_bgp_neighbors.textfsm, .*, fortinet, g[[et]] r[[outer]]
fortinet_get_system_interface_physical.textfsm, .*, fortinet, g[[et]] sy[[stem]] in[[terface]] p[[hysical]]
fortinet_get_router_info_bgp_summary.textfsm, .*, fortinet, g[[et]] r[[outer]] info bg[[p]] su[[mmary]]
fortinet_get_router_info_ospf_status.textfsm, .*, fortinet, g[[et]] r[[outer]] info o[[spf]] s[[tatus]]
fortinet_get_hardware_nic_nic-name.textfsm, .*, fortinet, g[[et]] hard[[ware]] n[[ic]] (\S+)
fortinet_get_system_ha_status.textfsm, .*, fortinet, g[[et]] sy[[stem]] ha s[[tatus]]
fortinet_get_system_interface.textfsm, .*, fortinet, g[[et]] sy[[stem]] in[[terface]]
fortinet_fnsysctl_ifconfig.textfsm, .*, fortinet, fnsysctl ifconfig
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Description :FortiASIC NP6XLITE Adapter
Driver Name :FortiASIC NP6XLITE Driver
Board :40F
lif id :7
lif oid :71
netdev oid :71
Current_HWaddr 12:34:56:78:90:ab
Permanent_HWaddr 12:34:56:78:90:ab
========== Link Status ==========
Admin :up
netdev status :N/A
autonego_setting:1
link_setting :0
speed_setting :1000
duplex_setting :1
Speed :100
Duplex :Full
link_status :Up
============ Counters ===========
Rx Pkts :645878
Rx Bytes :62442497
Tx Pkts :1025883
Tx Bytes :76984876
Host Rx Pkts :1395584
Host Rx Bytes :87501251
Host Tx Pkts :933331
Host Tx Bytes :69433499
Host Tx dropped :0
FragTxCreate :0
FragTxOk :0
FragTxDrop :0
Member Ports :
[00]: a
[01]: lan1
[02]: lan2
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
parsed_sample:
- admin: "up"
autonego_setting: "1"
board: "40F"
current_hwaddr: "12:34:56:78:90:ab"
description: "FortiASIC NP6XLITE Adapter"
driver_name: "FortiASIC NP6XLITE Driver"
duplex: "Full"
duplex_setting: "1"
fragtxcreate: "0"
fragtxdrop: "0"
fragtxok: "0"
host_rx_bytes: "87501251"
host_rx_packets: "1395584"
host_tx_bytes: "69433499"
host_tx_dropped: "0"
host_tx_packets: "933331"
lif_id: "7"
lif_oid: "71"
link_setting: "0"
link_status: "Up"
member_ports:
- "[00]: a"
- "[01]: lan1"
- "[02]: lan2"
netdev_oid: "71"
netdev_status: "N/A"
permanent_hwaddr: "12:34:56:78:90:ab"
rx_bytes: "62442497"
rx_packets: "645878"
speed: "100"
speed_setting: "1000"
tx_bytes: "76984876"
tx_packets: "1025883"

0 comments on commit 554f8f2

Please sign in to comment.