Skip to content

Commit

Permalink
Add support for cisco show ip mroute (networktocode#216)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rhoriguchi authored and jmcgill298 committed Oct 14, 2018
1 parent 75cdab8 commit d62ff93
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 20 deletions.
21 changes: 1 addition & 20 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions templates/cisco_ios_show_ip_mroute.template
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
16 changes: 16 additions & 0 deletions tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.parsed
Original file line number Diff line number Diff line change
@@ -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: []
15 changes: 15 additions & 0 deletions tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute1.raw
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
parsed_sample: []
13 changes: 13 additions & 0 deletions tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute2.raw
Original file line number Diff line number Diff line change
@@ -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
87 changes: 87 additions & 0 deletions tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.parsed
Original file line number Diff line number Diff line change
@@ -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: []

35 changes: 35 additions & 0 deletions tests/cisco_ios/show_ip_mroute/cisco_ios_show_ip_mroute3.raw
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d62ff93

Please sign in to comment.