Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions osism/commands/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,23 @@ def get_parser(self, prog_name):
type=str,
help="Limit selected hosts to an additional pattern",
)
parser.add_argument(
"--afi",
type=str,
nargs="+",
choices=[
"ipv4Unicast",
"ipv4Multicast",
"ipv4Vpn",
"ipv4Flowspec",
"ipv6Unicast",
"ipv6Multicast",
"ipv6Vpn",
"ipv6Flowspec",
"l2VpnEvpn",
],
help="Filter by address family (e.g. ipv4Unicast ipv6Unicast)",
)
return parser

def take_action(self, parsed_args):
Expand Down Expand Up @@ -395,7 +412,13 @@ def take_action(self, parsed_args):

bgp_data = json.loads(bgp_result.stdout)

afi_filter = None
if parsed_args.afi:
afi_filter = {a.lower() for a in parsed_args.afi}

for afi, afi_data in bgp_data.items():
if afi_filter is not None and afi.lower() not in afi_filter:
continue
peers = afi_data.get("peers", {})
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
for peer_name, peer_data in peers.items():
table.append(
Expand Down