From 97533993211eed8427e28f7b582992ca38b0a910 Mon Sep 17 00:00:00 2001 From: pskliarenko <“pskliarenko@bsh.ru”> Date: Sun, 10 Sep 2023 22:08:59 +0400 Subject: [PATCH] Template + test --- .../cisco_ios_show_ip_dhcp_binding.textfsm | 17 +++++++++++++++++ ntc_templates/templates/index | 1 + .../cisco_ios_show_ip_dhcp_binding.raw | 6 ++++++ .../cisco_ios_show_ip_dhcp_binding.yml | 10 ++++++++++ 4 files changed, 34 insertions(+) create mode 100644 ntc_templates/templates/cisco_ios_show_ip_dhcp_binding.textfsm create mode 100644 tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.raw create mode 100644 tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.yml diff --git a/ntc_templates/templates/cisco_ios_show_ip_dhcp_binding.textfsm b/ntc_templates/templates/cisco_ios_show_ip_dhcp_binding.textfsm new file mode 100644 index 0000000000..dbd8f8ecbe --- /dev/null +++ b/ntc_templates/templates/cisco_ios_show_ip_dhcp_binding.textfsm @@ -0,0 +1,17 @@ +Value IP_ADDRESS (\S+) +Value HARDWARE_ADDRESS (\S+) +Value EXPIRATION (\S+) +Value TYPE (\S+) + +Start + ^\s*Bindings from all pools not associated with VRF:\s*$$ + ^\s*IP\s+address\s+Client-ID/(?:Hardware\s+address/(?:User\s+name)?)?\s+Lease expiration\s+Type\s*$$ -> DhcpTable + ^\s*$$ + ^. -> Error + +DhcpTable + ^\s*Hardware\s+address/\s*$$ + ^\s*User\s+name\s*$$ + ^\s*${IP_ADDRESS}\s+${HARDWARE_ADDRESS}\s+${EXPIRATION}\s+${TYPE}\s*$$ -> Record + ^\s*$$ + ^. -> Error diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 3a5b516184..d88f45228b 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -244,6 +244,7 @@ cisco_ios_show_ip_ospf_database.textfsm, .*, cisco_ios, sh[[ow]] ip ospf data[[b cisco_ios_show_ip_ospf_neighbor.textfsm, .*, cisco_ios, sh[[ow]] ip ospf nei[[ghbor]] cisco_ios_show_ip_route_summary.textfsm, .*, cisco_ios, sh[[ow]] ip ro[[ute]] sum[[mary]] cisco_ios_show_ip_access-lists.textfsm, .*, cisco_ios, sh[[ow]] ip acce[[ss-lists]] +cisco_ios_show_ip_dhcp_binding.textfsm, .*, cisco_ios, sh[[ow]] ip dh[[cp]] b[[inding]] cisco_ios_show_mpls_interfaces.textfsm, .*, cisco_ios, sh[[ow]] mpls interfa[[ces]] cisco_ios_show_power_available.textfsm, .*, cisco_ios, sh[[ow]] pow[[er]] a[[vailable]] cisco_ios_show_access-session.textfsm, .*, cisco_ios, show access-s[[ession]] diff --git a/tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.raw b/tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.raw new file mode 100644 index 0000000000..02b38d7725 --- /dev/null +++ b/tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.raw @@ -0,0 +1,6 @@ +Bindings from all pools not associated with VRF: +IP address Client-ID/ Lease expiration Type + Hardware address/ + User name +10.100.88.26 01aa.aaaa.aaaa.aa Infinite Manual +10.100.88.197 01dd.dddd.dddd.dd Infinite Manual diff --git a/tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.yml b/tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.yml new file mode 100644 index 0000000000..d2fc8bd41b --- /dev/null +++ b/tests/cisco_ios/show_ip_dhcp_binding/cisco_ios_show_ip_dhcp_binding.yml @@ -0,0 +1,10 @@ +--- +parsed_sample: + - expiration: "Infinite" + hardware_address: "01aa.aaaa.aaaa.aa" + ip_address: "10.100.88.26" + type: "Manual" + - expiration: "Infinite" + hardware_address: "01dd.dddd.dddd.dd" + ip_address: "10.100.88.197" + type: "Manual"