-
Notifications
You must be signed in to change notification settings - Fork 114
Add igmp and mroute Services #762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
scetron
wants to merge
1
commit into
netenglabs:develop
Choose a base branch
from
scetron:scetron-mroutes-and-igmp
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from nubia import command | ||
from suzieq.cli.nubia_patch import argument | ||
|
||
from suzieq.cli.sqcmds.command import SqTableCommand | ||
from suzieq.sqobjects.igmp import IgmpObj | ||
|
||
|
||
@command("igmp", help="Act on Igmp") | ||
@argument("vrf", description="VRF(s), space separated") | ||
@argument("group", description="Group(s), in quotes, space separated") | ||
class IgmpCmd(SqTableCommand): | ||
"""IGMP table information""" | ||
|
||
def __init__( | ||
self, | ||
engine: str = "", | ||
hostname: str = "", | ||
start_time: str = "", | ||
end_time: str = "", | ||
view: str = "", | ||
namespace: str = "", | ||
format: str = "", # pylint: disable=redefined-builtin | ||
query_str: str = ' ', | ||
columns: str = "default", | ||
vrf: str = "", | ||
group: str = "", | ||
) -> None: | ||
super().__init__( | ||
engine=engine, | ||
hostname=hostname, | ||
start_time=start_time, | ||
end_time=end_time, | ||
view=view, | ||
namespace=namespace, | ||
columns=columns, | ||
format=format, | ||
query_str=query_str, | ||
sqobj=IgmpObj, | ||
) | ||
self.lvars = { | ||
'vrf': vrf.split(), | ||
'group': group.split() | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import ipaddress | ||
|
||
from nubia import command | ||
from suzieq.cli.nubia_patch import argument | ||
|
||
from suzieq.cli.sqcmds.command import SqTableCommand | ||
from suzieq.sqobjects.mroutes import MroutesObj | ||
|
||
|
||
@command("mroute", help="Act on Mroutes") | ||
@argument("vrf", description="VRF(s), space separated") | ||
@argument("source", description="Source(s), in quotes, space separated") | ||
@argument("group", description="Group(s), in quotes, space separated") | ||
class MrouteCmd(SqTableCommand): | ||
"""Multicast Routing table information""" | ||
|
||
def __init__( | ||
self, | ||
engine: str = "", | ||
hostname: str = "", | ||
start_time: str = "", | ||
end_time: str = "", | ||
view: str = "", | ||
namespace: str = "", | ||
format: str = "", # pylint: disable=redefined-builtin | ||
query_str: str = ' ', | ||
columns: str = "default", | ||
vrf: str = "", | ||
source: str = '', | ||
group: str = '', | ||
) -> None: | ||
super().__init__( | ||
engine=engine, | ||
hostname=hostname, | ||
start_time=start_time, | ||
end_time=end_time, | ||
view=view, | ||
namespace=namespace, | ||
columns=columns, | ||
format=format, | ||
query_str=query_str, | ||
sqobj=MroutesObj, | ||
) | ||
self.lvars = { | ||
'vrf': vrf.split(), | ||
'source': source.split(), | ||
'group': group.split() | ||
} | ||
|
||
def _json_print_handler(self, in_data): # pylint: disable=method-hidden | ||
"""This handler calls the code to print the IPNetwork as a string""" | ||
if isinstance(in_data, ipaddress.IPv4Network): | ||
return ipaddress.IPv4Network.__str__(in_data) | ||
elif isinstance(in_data, ipaddress.IPv6Network): | ||
return ipaddress.IPv6Network.__str__(in_data) | ||
return in_data | ||
|
||
def _get_ipvers(self, value: str) -> int: | ||
"""Return the IP version in use""" | ||
|
||
if ':' in value: | ||
ipvers = 6 | ||
elif '.' in value: | ||
ipvers = 4 | ||
else: | ||
ipvers = '' | ||
|
||
return ipvers | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
service: igmp | ||
keys: | ||
- group | ||
scetron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- vrf | ||
- interface | ||
ignore-fields: | ||
- lastUpTime | ||
show-fields: | ||
- interface | ||
- flag | ||
- vrf | ||
|
||
apply: | ||
eos: | ||
version: all | ||
command: | ||
- command: show ip igmp groups | ||
normalize: 'groupList/*/[ | ||
"groupAddress: group", | ||
"interfaceName: interface", | ||
"uptime: lastUpTime", | ||
"lastReporter: querier", | ||
"flag: flag?|dynamic", | ||
"vrf: vrf?|default" | ||
]' | ||
- command: show ip igmp static-groups | ||
normalize: 'intfAddrs/*:interface/[ | ||
"groupAddrsList: group", | ||
"flag: flag?|static", | ||
"vrf: vrf?|default" | ||
]' | ||
nxos: | ||
version: all | ||
command: show ip igmp groups vrf all | ||
textfsm: textfsm_templates/nxos_show_ip_igmp_groups_vrf_all.tfsm | ||
merge: False | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
service: mroutes | ||
keys: | ||
- source | ||
scetron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- group | ||
- vrf | ||
ignore-fields: | ||
- statusChangeTimestamp | ||
show-fields: | ||
- source | ||
- group | ||
- rpfInterface | ||
- oifList | ||
- vrf | ||
- ipvers | ||
- rpfNeighbor | ||
- lastUpTime | ||
|
||
|
||
apply: | ||
eos: | ||
version: all | ||
command: show ip mroute | ||
normalize: '*:protocol/groups/*:group/groupSources/*:source/[ | ||
"creationTime: lastUpTime", | ||
"rpfInterface: rpfInterface", | ||
"rpf/rpfNeighbor: rpfNeighbor", | ||
"oifList: oifList", | ||
"vrf: vrf?|default" | ||
]' | ||
|
||
nxos: | ||
version: all | ||
command: show ip mroute vrf all | ||
textfsm: textfsm_templates/nxos_show_ip_mroute_vrf_all.tfsm | ||
merge: False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
scetron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"namespace": "suzieq", | ||
"name": "igmp", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "sqvers", | ||
"type": "string", | ||
"partition": 0, | ||
"default": "2.0", | ||
"suppress": true, | ||
"description": "Schema version, not selectable" | ||
}, | ||
{ | ||
"name": "group", | ||
"type": "string", | ||
"key": 3, | ||
"display": 3, | ||
"description": "The multicast group being subscribed to" | ||
}, | ||
{ | ||
"name": "interface", | ||
"type": "string", | ||
"display": 4, | ||
"description": "The interface with a subscribed to the group" | ||
}, | ||
{ | ||
"name": "flag", | ||
"type": "string", | ||
"display": 5, | ||
"description": "Whether the igmp group is dynamic or statically configured" | ||
}, | ||
{ | ||
"name": "hostname", | ||
"type": "string", | ||
"key": 1, | ||
"display": 1, | ||
"description": "Hostname of the device that returned the data" | ||
}, | ||
{ | ||
"name": "vrf", | ||
"type": "string", | ||
"key": 4, | ||
"display": 6, | ||
"description": "VRF that the group has joined" | ||
}, | ||
{ | ||
"name": "namespace", | ||
"type": "string", | ||
"key": 0, | ||
"display": 0, | ||
"description": "namespace to which the data belongs" | ||
}, | ||
{ | ||
"name": "timestamp", | ||
"type": "timestamp" | ||
}, | ||
{ | ||
"name": "active", | ||
"type": "boolean" | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
scetron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"namespace": "suzieq", | ||
"name": "mroutes", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "sqvers", | ||
"type": "string", | ||
"partition": 0, | ||
"default": "2.0", | ||
"suppress": true, | ||
"description": "Schema version, not selectable" | ||
}, | ||
{ | ||
"name": "source", | ||
"type": "string", | ||
"key": 2, | ||
"display": 2, | ||
"description": "Source advertising a given multicast group/route" | ||
}, | ||
{ | ||
"name": "group", | ||
"type": "string", | ||
"key": 3, | ||
"display": 3, | ||
"description": "multicast group" | ||
}, | ||
{ | ||
"name": "hostname", | ||
"type": "string", | ||
"key": 1, | ||
"display": 1, | ||
"description": "Device the data was gathered from" | ||
}, | ||
{ | ||
"name": "rpfInterface", | ||
"type": "string", | ||
"display": 4, | ||
"description": "Reverse path forwarding interface. The interface toward the originator of the multicast traffic" | ||
}, | ||
{ | ||
"name": "oifList", | ||
"type": { | ||
"type": "array", | ||
"items": { | ||
"name": "oif", | ||
"type": "string" | ||
} | ||
}, | ||
"display": 5, | ||
"description": "Outgoing interface list. The list of interfaces toward the multicast receivers" | ||
}, | ||
{ | ||
"name": "vrf", | ||
"type": "string", | ||
"key": 3, | ||
"display": 6, | ||
"description": "VRF the data is from on the specific device" | ||
}, | ||
{ | ||
"name": "ipvers", | ||
"type": "long", | ||
"display": 7 | ||
}, | ||
{ | ||
"name": "rpNeighbor", | ||
"type": "string", | ||
"display": 9, | ||
"description": "IP of the RPF neighbor. Should be reachable via the rpfInterface" | ||
}, | ||
{ | ||
"name": "namespace", | ||
"type": "string", | ||
"key": 0, | ||
"display": 0 | ||
}, | ||
{ | ||
"name": "timestamp", | ||
"type": "timestamp", | ||
"display": 10 | ||
}, | ||
{ | ||
"name": "active", | ||
"type": "boolean" | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.