From f0da4a00863ce1e0fc1097b2a4208a0c136dc451 Mon Sep 17 00:00:00 2001 From: Peter Bruno Date: Wed, 20 Nov 2024 16:49:37 -0500 Subject: [PATCH 1/5] add support for IPv6 object groups addresses and masks --- .../templates/cisco_ios_show_object-group.textfsm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntc_templates/templates/cisco_ios_show_object-group.textfsm b/ntc_templates/templates/cisco_ios_show_object-group.textfsm index cce83b80fc..9a4ddae1ef 100644 --- a/ntc_templates/templates/cisco_ios_show_object-group.textfsm +++ b/ntc_templates/templates/cisco_ios_show_object-group.textfsm @@ -1,13 +1,13 @@ -Value Required,Filldown TYPE (Service|Network) +Value Required,Filldown TYPE (Service|Network|V6-Service|V6-Network) Value Required,Filldown NAME (\S+) Value DESCRIPTION (.+) Value NESTED_GROUPS (\S+) Value ANY (any) -Value HOST (\d+\.\d+\.\d+\.\d+) +Value HOST (((\d+\.\d+\.\d+\.\d+)|([A-Fa-f0-9:]+:+)+[A-Fa-f0-9]+)) Value HOST_RANGE_START (\d+\.\d+\.\d+\.\d+) Value HOST_RANGE_END (\d+\.\d+\.\d+\.\d+) -Value NETWORK (\d+\.\d+\.\d+\.\d+) -Value NETMASK (\d+\.\d+\.\d+\.\d+) +Value NETWORK ((\d+\.\d+\.\d+\.\d+)|([A-Fa-f0-9:]+:+[A-Fa-f0-9:]+)) +Value NETMASK ((\d+\.\d+\.\d+\.\d+)|((?:\/\d{1,3}))) Value PROTOCOL (\S+) Value PORT_MATCH (eq|neq|range|lt|gt) Value PORT ((? Continue.Clearall + ^(Service|Network|V6-Service|V6-Network) -> Continue.Clearall ^${TYPE}\s+object\s+group\s+${NAME}\s*$$ -> Record ^\s+Description\s+${DESCRIPTION}$$ -> Record ^\s+group-object\s+${NESTED_GROUPS}\s*$$ -> Record - ^\s+(host\s+${HOST}|range\s+${HOST_RANGE_START}\s+${HOST_RANGE_END}|${ANY}|${NETWORK}\s+${NETMASK})\s*$$ -> Record + ^\s+(host\s+${HOST}|range\s+${HOST_RANGE_START}\s+${HOST_RANGE_END}|${ANY}|${NETWORK}\s*${NETMASK})\s*$$ -> Record ^\s+icmp\s+${ICMP_TYPE}\s*$$ -> Record ^\s+${PROTOCOL}\s+${PORT_MATCH}\s+(${PORT_RANGE_START}\s+${PORT_RANGE_END}|${PORT})\s*$$ -> Record ^\s+${PROTOCOL}\s*$$ -> Record From 019483c886be2be585fe88dad776ddcd9791de28 Mon Sep 17 00:00:00 2001 From: Peter Bruno Date: Wed, 20 Nov 2024 17:12:12 -0500 Subject: [PATCH 2/5] added support for ipv6 icmp types --- ntc_templates/templates/cisco_ios_show_object-group.textfsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntc_templates/templates/cisco_ios_show_object-group.textfsm b/ntc_templates/templates/cisco_ios_show_object-group.textfsm index 9a4ddae1ef..e3cf7db3ee 100644 --- a/ntc_templates/templates/cisco_ios_show_object-group.textfsm +++ b/ntc_templates/templates/cisco_ios_show_object-group.textfsm @@ -14,6 +14,7 @@ Value PORT ((? Continue.Clearall @@ -21,11 +22,10 @@ Start ^\s+Description\s+${DESCRIPTION}$$ -> Record ^\s+group-object\s+${NESTED_GROUPS}\s*$$ -> Record ^\s+(host\s+${HOST}|range\s+${HOST_RANGE_START}\s+${HOST_RANGE_END}|${ANY}|${NETWORK}\s*${NETMASK})\s*$$ -> Record - ^\s+icmp\s+${ICMP_TYPE}\s*$$ -> Record + ^\s+icmp\s+(${ICMP_TYPE}|${ICMP6_TYPE})\s*$$ -> Record ^\s+${PROTOCOL}\s+${PORT_MATCH}\s+(${PORT_RANGE_START}\s+${PORT_RANGE_END}|${PORT})\s*$$ -> Record ^\s+${PROTOCOL}\s*$$ -> Record ^\s*$$ ^. -> Error EOF - From 53c07f913bdebc6c9a3ed61b4496a6bba184a8cd Mon Sep 17 00:00:00 2001 From: Peter Bruno Date: Wed, 20 Nov 2024 19:55:13 -0500 Subject: [PATCH 3/5] ipv6 tests --- .../cisco_ios_show_object-group-v6.raw | 9 ++ .../cisco_ios_show_object-group-v6.yml | 138 ++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw create mode 100644 tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml diff --git a/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw new file mode 100644 index 0000000000..298e699fec --- /dev/null +++ b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw @@ -0,0 +1,9 @@ +V6-Network object group TEST-v6-obj + host 2001:db8::1:1111 + host 2001:db8::2:2222 + 2001:db8:111:1::/48 + 2001:db8:222:2::/48 +V6-Service object group TEST-v6-icmp + icmp echo-request + icmp echo-reply + \ No newline at end of file diff --git a/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml new file mode 100644 index 0000000000..b9d4ae2917 --- /dev/null +++ b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml @@ -0,0 +1,138 @@ +--- +parsed_sample: + - ANY: '' + DESCRIPTION: '' + HOST: '' + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: '' + NAME: TEST-v6-icmp + NESTED_GROUPS: '' + NETMASK: '' + NETWORK: '' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Service + - ANY: '' + DESCRIPTION: '' + HOST: '' + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: echo-request + ICMP_TYPE: '' + NAME: TEST-v6-icmp + NESTED_GROUPS: '' + NETMASK: '' + NETWORK: '' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Service + - ANY: '' + DESCRIPTION: '' + HOST: '' + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: echo-reply + NAME: TEST-v6-icmp + NESTED_GROUPS: '' + NETMASK: '' + NETWORK: '' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Service + - ANY: '' + DESCRIPTION: '' + HOST: '' + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: '' + NAME: TEST-v6-obj + NESTED_GROUPS: '' + NETMASK: '' + NETWORK: '' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Network + - ANY: '' + DESCRIPTION: '' + HOST: 2001:DB8::1:1111 + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: '' + NAME: TEST-v6-obj + NESTED_GROUPS: '' + NETMASK: '' + NETWORK: '' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Network + - ANY: '' + DESCRIPTION: '' + HOST: 2001:DB8::2:2222 + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: '' + NAME: TEST-v6-obj + NESTED_GROUPS: '' + NETMASK: '' + NETWORK: '' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Network + - ANY: '' + DESCRIPTION: '' + HOST: '' + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: '' + NAME: TEST-v6-obj + NESTED_GROUPS: '' + NETMASK: /48 + NETWORK: '2001:DB8:111:1::' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Network + - ANY: '' + DESCRIPTION: '' + HOST: '' + HOST_RANGE_END: '' + HOST_RANGE_START: '' + ICMP6_TYPE: '' + ICMP_TYPE: '' + NAME: TEST-v6-obj + NESTED_GROUPS: '' + NETMASK: /48 + NETWORK: '2001:DB8:222:2::' + PORT: '' + PORT_MATCH: '' + PORT_RANGE_END: '' + PORT_RANGE_START: '' + PROTOCOL: '' + TYPE: V6-Network \ No newline at end of file From 0a3697733939d8ef433060b2c96285bf3a1ee781 Mon Sep 17 00:00:00 2001 From: Peter Bruno Date: Mon, 25 Nov 2024 17:22:39 -0500 Subject: [PATCH 4/5] fixed quote type for yamllint --- .../cisco_ios_show_object-group-v6.yml | 228 +++++++++--------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml index b9d4ae2917..a106b86920 100644 --- a/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml +++ b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.yml @@ -1,138 +1,138 @@ --- parsed_sample: - - ANY: '' - DESCRIPTION: '' - HOST: '' - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' - ICMP_TYPE: '' + - ANY: "" + DESCRIPTION: "" + HOST: "" + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" + ICMP_TYPE: "" NAME: TEST-v6-icmp - NESTED_GROUPS: '' - NETMASK: '' - NETWORK: '' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NESTED_GROUPS: "" + NETMASK: "" + NETWORK: "" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Service - - ANY: '' - DESCRIPTION: '' - HOST: '' - HOST_RANGE_END: '' - HOST_RANGE_START: '' + - ANY: "" + DESCRIPTION: "" + HOST: "" + HOST_RANGE_END: "" + HOST_RANGE_START: "" ICMP6_TYPE: echo-request - ICMP_TYPE: '' + ICMP_TYPE: "" NAME: TEST-v6-icmp - NESTED_GROUPS: '' - NETMASK: '' - NETWORK: '' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NESTED_GROUPS: "" + NETMASK: "" + NETWORK: "" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Service - - ANY: '' - DESCRIPTION: '' - HOST: '' - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' + - ANY: "" + DESCRIPTION: "" + HOST: "" + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" ICMP_TYPE: echo-reply NAME: TEST-v6-icmp - NESTED_GROUPS: '' - NETMASK: '' - NETWORK: '' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NESTED_GROUPS: "" + NETMASK: "" + NETWORK: "" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Service - - ANY: '' - DESCRIPTION: '' - HOST: '' - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' - ICMP_TYPE: '' + - ANY: "" + DESCRIPTION: "" + HOST: "" + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" + ICMP_TYPE: "" NAME: TEST-v6-obj - NESTED_GROUPS: '' - NETMASK: '' - NETWORK: '' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NESTED_GROUPS: "" + NETMASK: "" + NETWORK: "" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Network - - ANY: '' - DESCRIPTION: '' + - ANY: "" + DESCRIPTION: "" HOST: 2001:DB8::1:1111 - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' - ICMP_TYPE: '' + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" + ICMP_TYPE: "" NAME: TEST-v6-obj - NESTED_GROUPS: '' - NETMASK: '' - NETWORK: '' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NESTED_GROUPS: "" + NETMASK: "" + NETWORK: "" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Network - - ANY: '' - DESCRIPTION: '' + - ANY: "" + DESCRIPTION: "" HOST: 2001:DB8::2:2222 - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' - ICMP_TYPE: '' + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" + ICMP_TYPE: "" NAME: TEST-v6-obj - NESTED_GROUPS: '' - NETMASK: '' - NETWORK: '' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NESTED_GROUPS: "" + NETMASK: "" + NETWORK: "" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Network - - ANY: '' - DESCRIPTION: '' - HOST: '' - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' - ICMP_TYPE: '' + - ANY: "" + DESCRIPTION: "" + HOST: "" + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" + ICMP_TYPE: "" NAME: TEST-v6-obj - NESTED_GROUPS: '' + NESTED_GROUPS: "" NETMASK: /48 - NETWORK: '2001:DB8:111:1::' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NETWORK: "2001:DB8:111:1::" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Network - - ANY: '' - DESCRIPTION: '' - HOST: '' - HOST_RANGE_END: '' - HOST_RANGE_START: '' - ICMP6_TYPE: '' - ICMP_TYPE: '' + - ANY: "" + DESCRIPTION: "" + HOST: "" + HOST_RANGE_END: "" + HOST_RANGE_START: "" + ICMP6_TYPE: "" + ICMP_TYPE: "" NAME: TEST-v6-obj - NESTED_GROUPS: '' + NESTED_GROUPS: "" NETMASK: /48 - NETWORK: '2001:DB8:222:2::' - PORT: '' - PORT_MATCH: '' - PORT_RANGE_END: '' - PORT_RANGE_START: '' - PROTOCOL: '' + NETWORK: "2001:DB8:222:2::" + PORT: "" + PORT_MATCH: "" + PORT_RANGE_END: "" + PORT_RANGE_START: "" + PROTOCOL: "" TYPE: V6-Network \ No newline at end of file From 704416da686f426757eabf20d0f9424e7441e1fc Mon Sep 17 00:00:00 2001 From: Peter Bruno Date: Tue, 26 Nov 2024 15:58:20 -0500 Subject: [PATCH 5/5] Update tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw Co-authored-by: Jacob McGill <9847006+jmcgill298@users.noreply.github.com> --- .../show_object-group/cisco_ios_show_object-group-v6.raw | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw index 298e699fec..bd8932f03c 100644 --- a/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw +++ b/tests/cisco_ios/show_object-group/cisco_ios_show_object-group-v6.raw @@ -5,5 +5,4 @@ V6-Network object group TEST-v6-obj 2001:db8:222:2::/48 V6-Service object group TEST-v6-icmp icmp echo-request - icmp echo-reply - \ No newline at end of file + icmp echo-reply \ No newline at end of file