Skip to content

Commit

Permalink
Add Eltex platform with 8 templates (#1519)
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloSkliarenko authored Nov 8, 2023
1 parent 741b865 commit 22c0103
Show file tree
Hide file tree
Showing 54 changed files with 12,943 additions and 0 deletions.
89 changes: 89 additions & 0 deletions ntc_templates/templates/eltex_show_interface.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Value INTERFACE ([a-zA-Z\-]+\s*(\d+(/\d+)*)?)
Value STATUS (.*)
Value IFACE_INDEX (\d+)
Value MAC_ADDRESS ([a-zA-Z0-9]{2}(:[a-zA-Z0-9]{2}){5})
Value DESCRIPTION (.*)
Value MTU (\d+)
Value DUPLEX_TYPE (\S+)
Value SPEED (\S+)
Value LINK_TYPE (.*)
Value MEDIA_TYPE (\S+)
Value UPTIME (.*)
Value DOWNTIME (.*)
Value LINK_AGGREGATION_TYPE (.*)
Value List LINK_MODES (\d+baseT/(?:Full|Half))
Value FLOW_CONTROL_STATUS (\S+)
Value FEC_STATUS (\S+)
Value MDIX_MODE_STATUS (\S+)
Value IFACE_IN_PO_NUM (\d+)
Value ACTIVE_IFACE_IN_PO_NUM (\d+)
Value List IFACE_IN_PO ([a-zA-Z\-]+\s*(\d+(/\d+)*)?)
Value List IFACE_IN_PO_BANDWIDTH (\d+[a-zA-Z]+)
Value List IFACE_IN_PO_STATUS (.*)
Value SUM_BANDWIDTH ([a-zA-Z0-9]+)
Value INPUT_RATE (-?\d+)
Value OUTPUT_RATE (-?\d+)
Value INPUT_PACKETS (-?\d+)
Value BYTES_RECEIVED (-?\d+)
Value BROADCASTS_NUM (-?\d+)
Value MULTICASTS_NUM (-?\d+)
Value INPUT_ERR_NUM (-?\d+)
Value FCS_NUM (-?\d+)
Value ALIGNMENTS_NUM (-?\d+)
Value OVERSIZE_NUM (-?\d+)
Value INTERNAL_MAC_NUM (-?\d+)
Value PAUSE_FRAMES_RECEIVED (-?\d+)
Value OUTPUT_PACKETS (-?\d+)
Value BYTES_SENT (-?\d+)
Value OUTPUT_ERR_NUM (-?\d+)
Value COLLISIONS_NUM (-?\d+)
Value EXCESSIVE_COLLISIONS_NUM (-?\d+)
Value LATE_COLLISIONS_NUM (-?\d+)
Value PAUSE_FRAMES_SENT (-?\d+)
Value SYMBOL_ERR_NUM (-?\d+)
Value CARRIER_NUM (-?\d+)
Value SQE_TEST_ERR_NUM (-?\d+)
Value List OUTPUT_QUEUE_NUM (\d+)
Value List OUTPUT_QUEUE_PACKETS_PASSED (\d+)
Value List OUTPUT_QUEUE_PACKETS_DROPPED (\d+)

Start
^\s*-+\s*show\s+interfaces\s+\S+\s*-+\s*$$ -> Continue.Record
^\s*-+\s*show\s+interfaces\s+\S+\s*-+\s*$$
^\s*${INTERFACE}\s+is\s+${STATUS}\s+\(.*\)\s*$$
^\s*Interface\s+index\s+is\s+${IFACE_INDEX}\s*$$
^\s*.*,\s*MAC\s+address\s+is\s+${MAC_ADDRESS}\s*$$
^\s*Description:\s*${DESCRIPTION}\s*$$
^\s*Interface\s+MTU\s+is\s+${MTU}\s*$$
^\s*Port\s+is\s+\S+\s*$$
^\s*${DUPLEX_TYPE},\s+${SPEED},\s+link\s+type\s+is\s+${LINK_TYPE},\s+media\s+type\s+is\s+${MEDIA_TYPE}\s*$$
^\s*Link\s+is\s+up\s+for\s+${UPTIME}\s*$$
^\s*Link\s+is\s+down\s+for\s+${DOWNTIME}\s*$$
^\s*Advertised\s+link\s+modes\s*:\s*${LINK_MODES}.*$$ -> Continue
^\s*Advertised\s+link\s+modes\s*:\s*(?:\d+baseT/(?:Full|Half))\s+${LINK_MODES}\s*$$ -> Continue
^\s*Advertised\s+link\s+modes\s*:\s*(?:\d+baseT/(?:Full|Half)).*$$
^\s*${LINK_MODES}.*$$ -> Continue
^\s*(?:\d+baseT/(?:Full|Half))\s+${LINK_MODES}\s*$$ -> Continue
^\s*(?:\d+baseT/(?:Full|Half)).*$$
^\s*Link\s+aggregation\s+type\s+is\s+${LINK_AGGREGATION_TYPE}\s*$$
^\s*No.\s+of\s+members\s+in\s+this\s+port-channel:\s+${IFACE_IN_PO_NUM}\s+\(active\s+${ACTIVE_IFACE_IN_PO_NUM}\)\s*$$
^\s*${IFACE_IN_PO},.*,\s*${IFACE_IN_PO_BANDWIDTH}\s+\(${IFACE_IN_PO_STATUS}\)\s*$$
^\s*Active\s+bandwidth\s+is\s+${SUM_BANDWIDTH}\s*$$
^\s*Flow\s+control\s+is\s+${FLOW_CONTROL_STATUS},\s+MDIX\s+mode\s+is\s+${MDIX_MODE_STATUS}\s*$$
^\s*FEC\s+is\s+${FEC_STATUS}\s*$$
^\s*1?5\s+second\s+input\s+rate\s+is\s+${INPUT_RATE}\s+Kbit/s\s*$$
^\s*1?5\s+second\s+output\s+rate\s+is\s+${OUTPUT_RATE}\s+Kbit/s\s*$$
^\s*${INPUT_PACKETS}\s+packets\s+input,\s+${BYTES_RECEIVED}\s+bytes\s+received\s*$$
^\s*${BROADCASTS_NUM}\s+broadcasts,\s+${MULTICASTS_NUM}\s+multicasts\s*$$
^\s*${INPUT_ERR_NUM}\s+input\s+errors,\s+${FCS_NUM}\s+FCS,\s+${ALIGNMENTS_NUM}\s+alignment\s*$$
^\s*${OVERSIZE_NUM}\s+oversize,\s+${INTERNAL_MAC_NUM}\s+internal\s+MAC\s*$$
^\s*${PAUSE_FRAMES_RECEIVED}\s+pause\s+frames\s+received\s*$$
^\s*${OUTPUT_PACKETS}\s+packets\s+output,\s+${BYTES_SENT}\s+bytes\s+sent\s*$$
^\s*${OUTPUT_ERR_NUM}\s+output\s+errors,\s+${COLLISIONS_NUM}\s+collisions\s*$$
^\s*${EXCESSIVE_COLLISIONS_NUM}\s+excessive\s+collisions,\s+${LATE_COLLISIONS_NUM}\s+late\s+collisions\s*$$
^\s*${PAUSE_FRAMES_SENT}\s+pause\s+frames\s+transmitted\s*$$
^\s*${SYMBOL_ERR_NUM}\s+symbol\s+errors,\s+${CARRIER_NUM}\s+carrier,\s+${SQE_TEST_ERR_NUM}\s+SQE\s+test\s+error\s*$$
^\s*Output\s+queues\s*:\s*\(queue\s+#:\s+packets\s+passed/packets\s+dropped\)
^\s*${OUTPUT_QUEUE_NUM}\s*:\s*${OUTPUT_QUEUE_PACKETS_PASSED}/${OUTPUT_QUEUE_PACKETS_DROPPED}\s*$$
^\s*$$
^. -> Error
73 changes: 73 additions & 0 deletions ntc_templates/templates/eltex_show_interfaces_description.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Value INTERFACE ((?!Port|Ch|-)\S+)
Value INTERFACE_MODE (Trunk|Access(?:\s*\(\d+\))?|Customer(?:\s*\(\d+\))?)
Value ADMIN_STATE (Up|Down)
Value LINK_STATE (Up|Down|Not Present)
Value DESCRIPTION (.*?)

Start
^\s*Admin\s+Link\s*$$
^\s*Port\s+Description\s*$$ -> Port2
^\s*Port\s+State\s+State\s+Description\s*$$ -> Port4
^\s*Port\s+Port\s+Mode\s+\(VLAN\)\s+State\s+State\s+Description\s*$$ -> Port5
^\s*Ch\s+Description\s*$$ -> Ch2
^\s*Ch\s+State\s+State\s+Description\s*$$ -> Ch4
^\s*Ch\s+Port\s+Mode\s+\(VLAN\)\s+State\s+State\s+Description\s*$$ -> Ch5
^\s*Vlan\s+Admin\s+State\s+Link\s+State\s+Description\s*$$ -> Vlan
^\s*Loopback\s+State\s+State\s+Description\s*$$ -> Loopback
^\s*Oob-eth\s+State\s+State\s+Description\s*$$ -> Oob
^\s*$$
^. -> Error

Port2
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Port4
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Port5
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}(?:\s+${INTERFACE_MODE})?\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Ch2
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Ch4
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Ch5
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}(?:\s+${INTERFACE_MODE})?\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Vlan
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Loopback
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Oob
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${ADMIN_STATE}\s+${LINK_STATE}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$ -> Start
^. -> Error
69 changes: 69 additions & 0 deletions ntc_templates/templates/eltex_show_interfaces_status.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Value INTERFACE (\S+)
Value TYPE (\S+)
Value DUPLEX (\S+)
Value SPEED (\d+|--)
Value BW (\S+)
Value NEG (Enabled|Disabled|--)
Value FLOW_CTRL (On|Off|--)
Value LINK_STATE ((Up|Down(?:\s+\(\S+\))?|Not Present))
Value UP_TIME (\d+,\d{2}:\d{2}:\d{2}|--)
Value BACK_PRESSURE (\S+)
Value MDIX_MODE (On|Off|--)
Value INTERFACE_MODE (.*?)

Start
^\s*(?:Flow\s+)?Link(?:(?:\s+Up(\s+)?[Tt]ime)?\s+Back\s+Mdix)?\s*$$
^\s*Port\s+Type\s+Speed\s+control\s+State\s+Port\s+Mode\s*$$ -> Port6
^\s*Port\s+Type\s+Duplex\s+Speed\s+Neg\s+ctrl\s+State\s+\(d,h:m:s\)\s+Pressure\s+Mode\s+Port\s+Mode.*$$ -> Port11
^\s*Port\s+Type\s+Duplex\s+Speed\s+Neg\s+ctrl\s+State\s+Pressure\s+Mode\s+Port\s+Mode\s*$$ -> Port10
^\s*Ch\s+BW\s+control\s+State\s+Port\s+Mode\s*$$ -> Ch5
^\s*Ch\s+Duplex\s+BW\s+Neg\s+control\s+State\s+Port\s+Mode\s*$$ -> Ch7
^\s*Ch\s+Type\s+Duplex\s+Speed\s+Neg\s+control\s+State\s+Port\s+Mode.*$$ -> Ch8
^\s*Oob\s+ -> Oob
^\s*nc\s+\(not\s+connected\)\s*:\s+The\s+interface\s+is\s+not\s+connected\.\s*$$
^\s*err\s+\(error-disabled\)\s*:\s+The\s+interface\s+was\s+suspended\s+by\s+the\s+system\.\s*$$
^\s*adm\s+\(admin\.shutdown\)\s*:\s+The\s+interface\s+was\s+suspended\s+by\s+administrator\.\s*$$
^\s*$$
^. -> Error

Port6
^(?:\s*-+)+\s*$$
^${INTERFACE}\s+${TYPE}\s+${SPEED}\s+${FLOW_CTRL}\s+${LINK_STATE}\s+${INTERFACE_MODE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Port11
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${TYPE}\s+${DUPLEX}\s+${SPEED}\s+${NEG}\s+${FLOW_CTRL}\s+${LINK_STATE}\s+${UP_TIME}\s+${BACK_PRESSURE}\s+${MDIX_MODE}\s+${INTERFACE_MODE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Port10
^(?:\s*-+)+\s*$$
^${INTERFACE}\s+${TYPE}\s+${DUPLEX}\s+${SPEED}\s+${NEG}\s+${FLOW_CTRL}\s+${LINK_STATE}\s+${BACK_PRESSURE}\s+${MDIX_MODE}\s+${INTERFACE_MODE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Ch5
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${BW}\s+${FLOW_CTRL}\s+${LINK_STATE}\s+${INTERFACE_MODE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Ch7
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${DUPLEX}\s+${BW}\s+${NEG}\s+${FLOW_CTRL}\s+${LINK_STATE}\s+${INTERFACE_MODE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Ch8
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${TYPE}\s+${DUPLEX}\s+${SPEED}\s+${NEG}\s+${FLOW_CTRL}\s+${LINK_STATE}\s+${INTERFACE_MODE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error

Oob
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}\s+${TYPE}\s+${DUPLEX}\s+${SPEED}\s+${NEG}\s+${LINK_STATE}\s*$$ -> Record
^\s*$$ -> Start
^. -> Error
88 changes: 88 additions & 0 deletions ntc_templates/templates/eltex_show_interfaces_switchport.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Value INTERFACE (.*?)
Value INTERFACE_MODE (.*?)
Value GVRP_STATUS (.*?)
Value INGRESS_FILTERING (.*?)
Value ACCEPTABLE_FRAME_TYPE (.*?)
Value NATIVE_VLAN (.*?)
Value PROTECTED (.*?)
Value List VLAN (\d+)
Value List NAME (.*?)
Value List EGRESS_RULE (Untagged|Tagged)
Value List INTERFACE_MEMBERSHIP_TYPE (\S+)
Value List ADDED_BY (\S+)
Value List FORBIDDEN_VLAN (\d+)
Value List FORBIDDEN_VLAN_NAME (.*?)
Value List PROTOCOL_BASED_VLAN_GROUP_ID (\d+)
Value List PROTOCOL_BASED_VLAN_ID (\d+)
Value List MAC_BASED_VLAN_GROUP_ID (\d+)
Value List MAC_BASED_VLAN_ID (\d+)
Value List SUBNET_BASED_VLAN_GROUP_ID (\d+)
Value List SUBNET_BASED_VLAN_ID (\d+)

Start
^\s*Added\s+by\s*:\s+D-Default,\s+S-Static,\s+G-GVRP,\s+R-Radius\s+Assigned\s+VLAN,\s+T-Guest\s+VLAN,\s+V-Voice\s+VLAN\s*$$
^\s*Port\s*:.*$$ -> Continue.Record
^\s*Port\s*:\s*${INTERFACE}\s*$$
^\s*Port\s+Mode\s*:\s*${INTERFACE_MODE}\s*$$
^\s*Gvrp\s+Status\s*:\s*${GVRP_STATUS}\s*$$
^\s*Ingress\s+Filtering\s*:\s*${INGRESS_FILTERING}\s*$$
^\s*Acceptable\s+Frame\s+Type\s*:\s*${ACCEPTABLE_FRAME_TYPE}\s*$$
^\s*Ingress\s+UnTagged\s+VLAN\s*\(\s*NATIVE\s*\)\s*:\s*${NATIVE_VLAN}\s*$$
^\s*Protected\s*:\s*${PROTECTED}\s*$$
^\s*Port\s+is\s+member\s+in\s*:\s*$$ -> VlanMemberTable
^\s*Forbidden\s+VLAN[Ss]\s*:\s*$$ -> ForbiddenVlansTable
^\s*Classification\s+rules\s*:\s*$$ -> ClassificationRules
^\s*Protocol\s+based\s+VLANs\s*:\s*$$ -> ProtocolBasedVlansTable
^\s*Mac\s+based\s+VLANs\s*:\s*$$ -> MacBasedVlansTable
^\s*Subnet\s+based\s+VLANs\s*:\s*$$ -> SubnetBasedVlansTable
^\s*$$
^. -> Error

VlanMemberTable
^\s*Vlan\s+Name\s+Egress\s+rule\s+Port\s+Membership\s+Type\s*$$ -> VlanMemberTableType1
^\s*Vlan\s+Name\s+Egress\s+rule\s+Added\s+by\s*$$ -> VlanMemberTableType2
^\s*$$
^. -> Error

VlanMemberTableType1
^(?:\s*-+)+\s*$$
^\s*${VLAN}\s+${NAME}\s+${EGRESS_RULE}\s+${INTERFACE_MEMBERSHIP_TYPE}\s*$$
^\s*$$ -> Start
^. -> Error

VlanMemberTableType2
^(?:\s*-+)+\s*$$
^\s*${VLAN}\s+${NAME}\s+${EGRESS_RULE}\s+${ADDED_BY}\s*$$
^\s*$$ -> Start
^. -> Error

ForbiddenVlansTable
^\s*Vlan\s+Name\s*$$
^(?:\s*-+)+\s*$$
^\s*${FORBIDDEN_VLAN}\s+${FORBIDDEN_VLAN_NAME}\s*$$
^\s*$$ -> Start
^. -> Error

ClassificationRules
^\s*$$ -> Start

ProtocolBasedVlansTable
^\s*Group\s+ID\s+Vlan\s+ID\s*$$
^(?:\s*-+)+\s*$$
^\s*${PROTOCOL_BASED_VLAN_GROUP_ID}\s+${PROTOCOL_BASED_VLAN_ID}\s*$$
^\s*$$ -> Start
^. -> Error

MacBasedVlansTable
^\s*Group\s+ID\s+Vlan\s+ID\s*$$
^(?:\s*-+)+\s*$$
^\s*${MAC_BASED_VLAN_GROUP_ID}\s+${MAC_BASED_VLAN_ID}\s*$$
^\s*$$ -> Start
^. -> Error

SubnetBasedVlansTable
^\s*Group\s+ID\s+Vlan\s+ID\s*$$
^(?:\s*-+)+\s*$$
^\s*${SUBNET_BASED_VLAN_GROUP_ID}\s+${SUBNET_BASED_VLAN_ID}\s*$$
^\s*$$ -> Start
^. -> Error
53 changes: 53 additions & 0 deletions ntc_templates/templates/eltex_show_ip_interface.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Value GATEWAY_IP (\S+)
Value GATEWAY_STATUS (\S+)
Value GATEWAY_TYPE (\S+)
Value IP (\S+)
Value INTERFACE (.*?)
Value INTERFACE_STATUS_ADMIN (\S+)
Value INTERFACE_STATUS_OPER (\S+)
Value TYPE (Static|DHCP)
Value DIRECTED_BROADCAST (disable|enable)
Value PRECEDENCE (Yes|No)
Value REDIRECT (enable|disable)
Value STATUS (\S+)

Start
^\s*Gateway\s+IP\s+Address\s+Activity\s+status\s+Type\s*$$ -> Gateway
^\s*IP\s+Address\s+I/F\s+Type\s+Status\s*$$ -> Column4
^\s*IP\s+Address\s+I/F\s+Type\s+Directed\s+Precedence\s+Status\s*$$ -> Column6
^\s*IP\s+Address\s+I/F\s+I/F\s+Status\s+Type\s+Directed\s+Prec\s+Redirect\s+Status\s*$$ -> Column8
^\s*$$
^. -> Error

Gateway
^(?:\s*-+)+\s*$$
^${GATEWAY_IP}\s+${GATEWAY_STATUS}\s+${GATEWAY_TYPE}\s*$$ -> Record
^\s*IP\s+Address\s+I/F\s+Type\s+Status\s*$$ -> Column4
^\s*$$
^. -> Error

Column4
^(?:\s*-+)+\s*$$
^${IP}\s+${INTERFACE}\s+${TYPE}\s+${STATUS}\s*$$ -> Record
# Skip wrapped lines
^\s+received\s*$$
^\s*$$
^. -> Error

Column6
^(?:\s*-+)+\s*$$
^\s+Broadcast\s*$$
^${IP}\s+${INTERFACE}\s+${TYPE}\s+${DIRECTED_BROADCAST}\s+${PRECEDENCE}\s+${STATUS}\s*$$ -> Record
# Skip wrapped lines
^\s+received\s*$$
^\s*$$
^. -> Error

Column8
^\s+admin/oper\s+Broadcast\s*$$
^(?:\s*-+)+\s*$$
^${IP}\s+${INTERFACE}(?:\s+${INTERFACE_STATUS_ADMIN}/${INTERFACE_STATUS_OPER})?\s+${TYPE}\s+${DIRECTED_BROADCAST}\s+${PRECEDENCE}\s+${REDIRECT}\s+${STATUS}\s*$$ -> Record
# Skip wrapped lines
^\s+received\s*$$
^\s*$$
^. -> Error
Loading

0 comments on commit 22c0103

Please sign in to comment.