From d62ff93e7d49676bd5356de303a2cacc8f2158f3 Mon Sep 17 00:00:00 2001 From: Ryan Horiguchi Date: Thu, 26 Jul 2018 15:28:20 +0200 Subject: [PATCH] Add support for cisco show ip mroute (#216) * Add support for cisco show ip mroute * Rename field * Use list for fields that can repeat several times * Update .gitignore * Update empty mroute to be empty list * Update template to raise an error for unmatched lines --- .gitignore | 21 +---- templates/cisco_ios_show_ip_mroute.template | 26 ++++++ templates/index | 1 + .../cisco_ios_show_ip_mroute1.parsed | 16 ++++ .../cisco_ios_show_ip_mroute1.raw | 15 ++++ .../cisco_ios_show_ip_mroute2.parsed | 2 + .../cisco_ios_show_ip_mroute2.raw | 13 +++ .../cisco_ios_show_ip_mroute3.parsed | 87 +++++++++++++++++++ .../cisco_ios_show_ip_mroute3.raw | 35 ++++++++ 9 files changed, 196 insertions(+), 20 deletions(-) create mode 100644 templates/cisco_ios_show_ip_mroute.template create mode 100644 tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.parsed create mode 100644 tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.raw create mode 100644 tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.parsed create mode 100644 tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.raw create mode 100644 tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.parsed create mode 100644 tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.raw diff --git a/.gitignore b/.gitignore index 7af6da8c14..8204855364 100644 --- a/.gitignore +++ b/.gitignore @@ -52,26 +52,7 @@ Temporary Items # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff: -.idea/workspace.xml -.idea/tasks.xml -.idea/dictionaries -.idea/vcs.xml -.idea/jsLibraryMappings.xml - -# Sensitive or high-churn files: -.idea/dataSources.ids -.idea/dataSources.xml -.idea/dataSources.local.xml -.idea/sqlDataSources.xml -.idea/dynamic.xml -.idea/uiDesigner.xml - -# Gradle: -.idea/gradle.xml -.idea/libraries - -# Mongo Explorer plugin: -.idea/mongoSettings.xml +.idea/ ## File-based project format: *.iws diff --git a/templates/cisco_ios_show_ip_mroute.template b/templates/cisco_ios_show_ip_mroute.template new file mode 100644 index 0000000000..be28bcdc02 --- /dev/null +++ b/templates/cisco_ios_show_ip_mroute.template @@ -0,0 +1,26 @@ +Value MULTICAST_SOURCE_IP (\*|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) +Value MULTICAST_GROUP_IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) +Value UP_TIME (\d{2}:\d{2}:\d{2}) +Value EXPIRATION_TIME (\d{2}:\d{2}:\d{2}|stopped) +Value RENDEZVOUS_POINT (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) +Value FLAGS (\w*) +Value INCOMING_INTERFACE (\S+) +Value REVERSE_PATH_FORWARDING_NEIGHBOUR_IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) +Value REGISTERING (Registering) +Value List OUTGOING_INTERFACE (\S+) +Value List FORWARD_MODE (Forward\/Sparse|Forward\/Dense) +Value List OUTGOING_MULTICAST_UP_TIME (\d{2}:\d{2}:\d{2}) +Value List OUTGOING_MULTICAST_EXPIRATION_TIME (\d{2}:\d{2}:\d{2}|stopped) + +Start + ^\((\*|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}),\s(\*|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) -> Continue.Record + ^\(${MULTICAST_SOURCE_IP},\s${MULTICAST_GROUP_IP}\),\s${UP_TIME}\/${EXPIRATION_TIME}(,\sRP\s${RENDEZVOUS_POINT})?,\sflags:\s${FLAGS} + ^\s+Incoming\sinterface:\s${INCOMING_INTERFACE},\sRPF\snbr\s${REVERSE_PATH_FORWARDING_NEIGHBOUR_IP}(,\s${REGISTERING})? + ^\s+Outgoing\s+interface\s+list:(?:\s+Null|)\s*$$ + ^\s+${OUTGOING_INTERFACE},\s${FORWARD_MODE},\s${OUTGOING_MULTICAST_UP_TIME}\/${OUTGOING_MULTICAST_EXPIRATION_TIME} + ^\s*$$ + ^IP\s+Multicast\s+(?:Forwarding|Routing) + ^.*[Ff]lags + ^\s+\S+\s+-\s+ + ^\s+(?:Timers|Interface\s+state): + ^. -> Error diff --git a/templates/index b/templates/index index 111761089d..83ba553a67 100644 --- a/templates/index +++ b/templates/index @@ -140,6 +140,7 @@ cisco_ios_show_isdn_status.template, .*, cisco_ios, sh[[ow]] isd[[n]] st[[atus]] cisco_ios_show_interfaces.template, .*, cisco_ios, sh[[ow]] int[[erfaces]] cisco_ios_show_vtp_status.template, .*, cisco_ios, sh[[ow]] vtp stat[[us]] cisco_ios_show_inventory.template, .*, cisco_ios, sh[[ow]] inven[[tory]] +cisco_ios_show_ip_mroute.template, .*, cisco_ios, sh[[ow]] ip mr[[oute]] cisco_ios_show_ip_route.template, .*, cisco_ios, sh[[ow]] ip r[[oute]] cisco_ios_show_aliases.template, .*, cisco_ios, sh[[ow]] alia[[ses]] cisco_ios_show_archive.template, .*, cisco_ios, sh[[ow]] arc[[hive]] diff --git a/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.parsed b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.parsed new file mode 100644 index 0000000000..7e843a41d6 --- /dev/null +++ b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.parsed @@ -0,0 +1,16 @@ +--- +parsed_sample: + +- multicast_source_ip: "*" + multicast_group_ip: "224.0.1.40" + up_time: "01:04:48" + expiration_time: "00:02:41" + rendezvous_point: "172.16.1.1" + flags: "SJPCL" + incoming_interface: "FastEthernet0/1" + reverse_path_forwarding_neighbour_ip: "172.16.1.1" + registering: "" + outgoing_interface: [] + forward_mode: [] + outgoing_multicast_up_time: [] + outgoing_multicast_expiration_time: [] diff --git a/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.raw b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.raw new file mode 100644 index 0000000000..6126f39b01 --- /dev/null +++ b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.raw @@ -0,0 +1,15 @@ +IP Multicast Routing Table +Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected, + L - Local, P - Pruned, R - RP-bit set, F - Register flag, + T - SPT-bit set, J - Join SPT, M - MSDP created entry, + X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement, + U - URD, I - Received Source Specific Host Report, + Z - Multicast Tunnel, z - MDT-data group sender, + Y - Joined MDT-data group, y - Sending to MDT-data group + V - RD & Vector, v - Vector +Outgoing interface flags: H - Hardware switched, A - Assert winner + Timers: Uptime/Expires + Interface state: Interface, Next-Hop or VCD, State/Mode +(*, 224.0.1.40), 01:04:48/00:02:41, RP 172.16.1.1, flags: SJPCL + Incoming interface: FastEthernet0/1, RPF nbr 172.16.1.1 + Outgoing interface list: Null diff --git a/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.parsed b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.parsed new file mode 100644 index 0000000000..e77add67ed --- /dev/null +++ b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.parsed @@ -0,0 +1,2 @@ +--- +parsed_sample: [] diff --git a/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.raw b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.raw new file mode 100644 index 0000000000..a33f7ff5cc --- /dev/null +++ b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.raw @@ -0,0 +1,13 @@ +IP Multicast Forwarding is not enabled. +IP Multicast Routing Table +Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected, + L - Local, P - Pruned, R - RP-bit set, F - Register flag, + T - SPT-bit set, J - Join SPT, M - MSDP created entry, E - Extranet, + X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement, + U - URD, I - Received Source Specific Host Report, + Z - Multicast Tunnel, z - MDT-data group sender, + Y - Joined MDT-data group, y - Sending to MDT-data group, + V - RD & Vector, v - Vector +Outgoing interface flags: H - Hardware switched, A - Assert winner + Timers: Uptime/Expires + Interface state: Interface, Next-Hop or VCD, State/Mode diff --git a/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.parsed b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.parsed new file mode 100644 index 0000000000..f3a3149eee --- /dev/null +++ b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.parsed @@ -0,0 +1,87 @@ +--- +parsed_sample: + +- multicast_source_ip: "*" + multicast_group_ip: "239.0.0.1" + up_time: "00:00:58" + expiration_time: "00:02:02" + rendezvous_point: "172.16.2.1" + flags: "SJC" + incoming_interface: "FastEthernet0/1" + reverse_path_forwarding_neighbour_ip: "172.16.2.1" + registering: "" + outgoing_interface: ["Vlan1"] + forward_mode: ["Forward/Sparse"] + outgoing_multicast_up_time: ["00:00:58"] + outgoing_multicast_expiration_time: ["00:02:02"] + +- multicast_source_ip: "*" + multicast_group_ip: "239.0.0.2" + up_time: "00:01:02" + expiration_time: "00:01:57" + rendezvous_point: "172.16.2.1" + flags: "SJC" + incoming_interface: "FastEthernet0/1" + reverse_path_forwarding_neighbour_ip: "172.16.2.1" + registering: "" + outgoing_interface: ["Vlan1"] + forward_mode: ["Forward/Sparse"] + outgoing_multicast_up_time: ["00:01:03"] + outgoing_multicast_expiration_time: ["00:01:57"] + +- multicast_source_ip: "*" + multicast_group_ip: "239.0.0.3" + up_time: "00:00:58" + expiration_time: "00:02:57" + rendezvous_point: "172.16.2.1" + flags: "SJC" + incoming_interface: "FastEthernet0/1" + reverse_path_forwarding_neighbour_ip: "172.16.2.1" + registering: "" + outgoing_interface: ["Vlan1", "Vlan2"] + forward_mode: ["Forward/Sparse", "Forward/Sparse"] + outgoing_multicast_up_time: ["00:00:58", "00:00:58"] + outgoing_multicast_expiration_time: ["00:02:57", "00:02:57"] + +- multicast_source_ip: "*" + multicast_group_ip: "239.0.0.4" + up_time: "00:00:04" + expiration_time: "stopped" + rendezvous_point: "172.16.2.1" + flags: "SPF" + incoming_interface: "FastEthernet0/1" + reverse_path_forwarding_neighbour_ip: "172.16.2.1" + registering: "" + outgoing_interface: [] + forward_mode: [] + outgoing_multicast_up_time: [] + outgoing_multicast_expiration_time: [] + +- multicast_source_ip: "192.168.2.44" + multicast_group_ip: "239.0.0.5" + up_time: "00:00:07" + expiration_time: "00:02:58" + rendezvous_point: "" + flags: "FT" + incoming_interface: "Vlan1" + reverse_path_forwarding_neighbour_ip: "0.0.0.0" + registering: "Registering" + outgoing_interface: ["FastEthernet0/1"] + forward_mode: ["Forward/Dense"] + outgoing_multicast_up_time: ["00:00:07"] + outgoing_multicast_expiration_time: ["00:00:00"] + +- multicast_source_ip: "*" + multicast_group_ip: "239.0.0.6" + up_time: "00:02:36" + expiration_time: "00:02:25" + rendezvous_point: "172.16.2.1" + flags: "SJPCL" + incoming_interface: "FastEthernet0/1" + reverse_path_forwarding_neighbour_ip: "172.16.2.1" + registering: "" + outgoing_interface: [] + forward_mode: [] + outgoing_multicast_up_time: [] + outgoing_multicast_expiration_time: [] + diff --git a/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.raw b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.raw new file mode 100644 index 0000000000..8e6fba42c0 --- /dev/null +++ b/tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.raw @@ -0,0 +1,35 @@ +IP Multicast Routing Table +Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected, + L - Local, P - Pruned, R - RP-bit set, F - Register flag, + T - SPT-bit set, J - Join SPT, M - MSDP created entry, + X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement, + U - URD, I - Received Source Specific Host Report, + Z - Multicast Tunnel, z - MDT-data group sender, + Y - Joined MDT-data group, y - Sending to MDT-data group + V - RD & Vector, v - Vector +Outgoing interface flags: H - Hardware switched, A - Assert winner + Timers: Uptime/Expires + Interface state: Interface, Next-Hop or VCD, State/Mode +(*, 239.0.0.1), 00:00:58/00:02:02, RP 172.16.2.1, flags: SJC + Incoming interface: FastEthernet0/1, RPF nbr 172.16.2.1 + Outgoing interface list: + Vlan1, Forward/Sparse, 00:00:58/00:02:02 +(*, 239.0.0.2), 00:01:02/00:01:57, RP 172.16.2.1, flags: SJC + Incoming interface: FastEthernet0/1, RPF nbr 172.16.2.1 + Outgoing interface list: + Vlan1, Forward/Sparse, 00:01:03/00:01:57 +(*, 239.0.0.3), 00:00:58/00:02:57, RP 172.16.2.1, flags: SJC + Incoming interface: FastEthernet0/1, RPF nbr 172.16.2.1 + Outgoing interface list: + Vlan1, Forward/Sparse, 00:00:58/00:02:57 + Vlan2, Forward/Sparse, 00:00:58/00:02:57 +(*, 239.0.0.4), 00:00:04/stopped, RP 172.16.2.1, flags: SPF + Incoming interface: FastEthernet0/1, RPF nbr 172.16.2.1 + Outgoing interface list: Null +(192.168.2.44, 239.0.0.5), 00:00:07/00:02:58, flags: FT + Incoming interface: Vlan1, RPF nbr 0.0.0.0, Registering + Outgoing interface list: + FastEthernet0/1, Forward/Dense, 00:00:07/00:00:00 +(*, 239.0.0.6), 00:02:36/00:02:25, RP 172.16.2.1, flags: SJPCL + Incoming interface: FastEthernet0/1, RPF nbr 172.16.2.1 + Outgoing interface list: Null