From 554f8f2139526dd0c69449becc59d6bdeece4e9f Mon Sep 17 00:00:00 2001 From: PavloSkliarenko <78343937+PavloSkliarenko@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:12:37 +0400 Subject: [PATCH] Add Fortinet get hardware nic nic-name'template (#1488) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: pskliarenko <“pskliarenko@bsh.ru”> --- ...fortinet_get_hardware_nic_nic-name.textfsm | 76 +++++++++++++++++++ ntc_templates/templates/index | 1 + .../fortinet_get_hardware_nic_nic-name.raw | 35 +++++++++ .../fortinet_get_hardware_nic_nic-name.yml | 35 +++++++++ 4 files changed, 147 insertions(+) create mode 100644 ntc_templates/templates/fortinet_get_hardware_nic_nic-name.textfsm create mode 100644 tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.raw create mode 100644 tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.yml diff --git a/ntc_templates/templates/fortinet_get_hardware_nic_nic-name.textfsm b/ntc_templates/templates/fortinet_get_hardware_nic_nic-name.textfsm new file mode 100644 index 0000000000..7534ff13f6 --- /dev/null +++ b/ntc_templates/templates/fortinet_get_hardware_nic_nic-name.textfsm @@ -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 diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 116b4aa5ae..819c4f2dd9 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -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 diff --git a/tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.raw b/tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.raw new file mode 100644 index 0000000000..b414128948 --- /dev/null +++ b/tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.raw @@ -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 diff --git a/tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.yml b/tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.yml new file mode 100644 index 0000000000..0ccb8a6c22 --- /dev/null +++ b/tests/fortinet/get_hardware_nic_nic-name/fortinet_get_hardware_nic_nic-name.yml @@ -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"