From 185a5529ec81ac209c5cd9163de9ee2c01d54320 Mon Sep 17 00:00:00 2001 From: Petar Pisnjak <133650263+ppisnjak@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:14:55 +0100 Subject: [PATCH 1/8] Update cisco_asa_show_running-config_object_network.textfsm Added better FQDN object support. Cisco ASA config shows following options: network-object mode commands/options: WORD < 128 char Fully Qualified Domain Name - FQDN must begin and end with a digit/letter. Only letters, digits, and hyphen are allowed as internal characters. Labels are separated by a dot. v4 IPv4 FQDN object v6 IPv6 FQDN object Objects can be specified as v4 or v6 or can be created without specification. This enables correct parsing since before they would be parsed as "v4" or "v6". --- .../cisco_asa_show_running-config_object_network.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm index 1d7f771f63..ba5d90d447 100644 --- a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm +++ b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm @@ -19,5 +19,5 @@ Start ^\s+subnet\s+${NETWORK}\/${PREFIX_LENGTH}\s* ^\s+range\s+${START_IP}\s+${END_IP}\s* ^\s+host\s+${HOST}\s* - ^\s+fqdn\s+${FQDN}\s* + ^\s+fqdn\s(?:v4|v6)?\s*${FQDN}\s* ^. -> Error From c4c0bf0b619e3ab1f4778a700226f192c824ce39 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Mon, 30 Dec 2024 08:36:56 -0500 Subject: [PATCH 2/8] Regenerate existing ASA sh run obj net parsed data --- ...asa_show_running-config_object_network.yml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml index e6d371fba1..d315053330 100644 --- a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml +++ b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml @@ -1,8 +1,8 @@ --- parsed_sample: - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "" name: "corp" netmask: "255.0.0.0" @@ -11,8 +11,8 @@ parsed_sample: start_ip: "" type: "subnet" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "" name: "internal" netmask: "255.255.255.0" @@ -21,8 +21,8 @@ parsed_sample: start_ip: "" type: "subnet" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "10.10.11.1" name: "host-10.10.11.1" netmask: "" @@ -31,8 +31,8 @@ parsed_sample: start_ip: "" type: "host" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "10.75.51.11" name: "block" netmask: "" @@ -41,8 +41,8 @@ parsed_sample: start_ip: "" type: "host" - description: "dmz GW ip" - fqdn: "" end_ip: "" + fqdn: "" host: "11.1.2.2" name: "dmz" netmask: "" @@ -51,8 +51,8 @@ parsed_sample: start_ip: "" type: "host" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "10.1.11.8" name: "server-vip" netmask: "" @@ -61,8 +61,8 @@ parsed_sample: start_ip: "" type: "host" - description: "" - fqdn: "" end_ip: "10.10.10.60" + fqdn: "" host: "" name: "visitors" netmask: "" @@ -71,8 +71,8 @@ parsed_sample: start_ip: "10.10.10.4" type: "range" - description: "" - fqdn: "" end_ip: "10.75.51.100" + fqdn: "" host: "" name: "contractor" netmask: "" @@ -81,8 +81,8 @@ parsed_sample: start_ip: "10.75.51.15" type: "range" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "2606:4700:4700::1111" name: "cloudflare-ipv6-dns-primary" netmask: "" @@ -91,8 +91,8 @@ parsed_sample: start_ip: "" type: "host" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "2001:4860:4860::8888" name: "google-ipv6-dns-primary" netmask: "" @@ -101,8 +101,8 @@ parsed_sample: start_ip: "" type: "host" - description: "" - fqdn: "" end_ip: "fd00::ffff" + fqdn: "" host: "" name: "internal-ipv6-range" netmask: "" @@ -111,8 +111,8 @@ parsed_sample: start_ip: "fd00::" type: "range" - description: "" - fqdn: "" end_ip: "" + fqdn: "" host: "" name: "internal-ipv6-subnet" netmask: "" @@ -121,8 +121,8 @@ parsed_sample: start_ip: "" type: "subnet" - description: "" - fqdn: "google.com" end_ip: "" + fqdn: "google.com" host: "" name: "fqdn_test" netmask: "" From 35b372fb8b21a9b8b7fe085141b788d382f0e4e0 Mon Sep 17 00:00:00 2001 From: ppisnjak Date: Mon, 30 Dec 2024 22:16:09 +0100 Subject: [PATCH 3/8] Added test files for my changes --- ...asa_show_running-config_object_network.raw | 4 ++++ ...asa_show_running-config_object_network.yml | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.raw b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.raw index 5f386df3b2..71f0c9a921 100644 --- a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.raw +++ b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.raw @@ -25,3 +25,7 @@ object network internal-ipv6-subnet subnet fd00::/8 object network fqdn_test fqdn google.com +object network fqdn_test_v4 + fqdn v4 example.com +object network fqdn_test_v6 + fqdn v6 example.com diff --git a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml index d315053330..fe02de953c 100644 --- a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml +++ b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml @@ -130,3 +130,23 @@ parsed_sample: prefix_length: "" start_ip: "" type: "fqdn" + - description: "" + end_ip: "" + fqdn: "example.com" + host: "" + name: "fqdn_test_v4" + netmask: "" + network: "" + prefix_length: "" + start_ip: "" + type: "fqdn" + description: "" + end_ip: "" + fqdn: "example.com" + host: "" + name: "fqdn_test_v6" + netmask: "" + network: "" + prefix_length: "" + start_ip: "" + type: "fqdn" From fac936536c64472bf4edaa457f8e725e1e1e58bd Mon Sep 17 00:00:00 2001 From: Petar Pisnjak <133650263+ppisnjak@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:10:09 +0100 Subject: [PATCH 4/8] Update ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm I agree, honestly this is my first commit so, not sure what is the best practice. Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com> --- .../cisco_asa_show_running-config_object_network.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm index ba5d90d447..3f4a534687 100644 --- a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm +++ b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm @@ -19,5 +19,5 @@ Start ^\s+subnet\s+${NETWORK}\/${PREFIX_LENGTH}\s* ^\s+range\s+${START_IP}\s+${END_IP}\s* ^\s+host\s+${HOST}\s* - ^\s+fqdn\s(?:v4|v6)?\s*${FQDN}\s* + ^\s+fqdn\s+(?:v4|v6)?\s*${FQDN}\s* ^. -> Error From 0801ad352b2dbf0df63de0710958dbed27d9efa6 Mon Sep 17 00:00:00 2001 From: ppisnjak Date: Tue, 7 Jan 2025 12:56:04 +0100 Subject: [PATCH 5/8] added support for IPv10 --- .../cisco_asa_show_running-config_object_network.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm index ba5d90d447..6e4db77094 100644 --- a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm +++ b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm @@ -19,5 +19,5 @@ Start ^\s+subnet\s+${NETWORK}\/${PREFIX_LENGTH}\s* ^\s+range\s+${START_IP}\s+${END_IP}\s* ^\s+host\s+${HOST}\s* - ^\s+fqdn\s(?:v4|v6)?\s*${FQDN}\s* + ^\s+fqdn\s+(?:v\d+\s+)?${FQDN}\s* ^. -> Error From 6cd140eb0df95debcd2d2a47364adcb39e94e6f5 Mon Sep 17 00:00:00 2001 From: ppisnjak Date: Tue, 7 Jan 2025 13:01:43 +0100 Subject: [PATCH 6/8] added IPv10 support --- .../cisco_asa_show_running-config_object_network.textfsm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm index 940751ca0f..6e4db77094 100644 --- a/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm +++ b/ntc_templates/templates/cisco_asa_show_running-config_object_network.textfsm @@ -19,9 +19,5 @@ Start ^\s+subnet\s+${NETWORK}\/${PREFIX_LENGTH}\s* ^\s+range\s+${START_IP}\s+${END_IP}\s* ^\s+host\s+${HOST}\s* -<<<<<<< HEAD ^\s+fqdn\s+(?:v\d+\s+)?${FQDN}\s* -======= - ^\s+fqdn\s+(?:v4|v6)?\s*${FQDN}\s* ->>>>>>> fac936536c64472bf4edaa457f8e725e1e1e58bd ^. -> Error From 01a2e8ef8510d74b1c2cdc11c31e4f65c8824eed Mon Sep 17 00:00:00 2001 From: Jacob McGill <9847006+jmcgill298@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:38:43 -0500 Subject: [PATCH 7/8] Update tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml --- .../cisco_asa_show_running-config_object_network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml index fe02de953c..8f3c976b7e 100644 --- a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml +++ b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml @@ -140,7 +140,7 @@ parsed_sample: prefix_length: "" start_ip: "" type: "fqdn" - description: "" + description: "" end_ip: "" fqdn: "example.com" host: "" From dc944003beffeef2a9308537a24bc51bdb59248a Mon Sep 17 00:00:00 2001 From: Jacob McGill <9847006+jmcgill298@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:39:10 -0500 Subject: [PATCH 8/8] Update tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml --- .../cisco_asa_show_running-config_object_network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml index 8f3c976b7e..b6ebb90d25 100644 --- a/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml +++ b/tests/cisco_asa/show_running-config_object_network/cisco_asa_show_running-config_object_network.yml @@ -140,7 +140,7 @@ parsed_sample: prefix_length: "" start_ip: "" type: "fqdn" - description: "" + - description: "" end_ip: "" fqdn: "example.com" host: ""