Skip to content
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

FIX: es-report #18

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 11 additions & 6 deletions nornir_srl/connections/srlinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def get_es(self) -> Dict[str, Any]:
path_spec = {
"path": f"/system/network-instance/protocols/evpn/ethernet-segments",
"jmespath": '"system/network-instance/protocols/evpn/ethernet-segments"."bgp-instance"[]."ethernet-segment"[].{name:name, esi:esi, "mh-mode":"multi-homing-mode",\
oper:"oper-state",itfs:interface[]."ethernet-interface"|join(\' \',@), vrfs:association."network-instance"[].{ni:name, "peers":"_peers"}}',
oper:"oper-state",itf:interface[]."ethernet-interface"|join(\' \',@), "ni-peers":association."network-instance"[]."_ni_peers"|join(\', \',@) }',
"datatype": "state",
}

Expand All @@ -642,18 +642,23 @@ def set_es_peers(resp):
.get("bgp-instance", [])
):
for es in bgp_inst.get("ethernet-segment", []):
for vrf in es.get("association", {}).get("network-instance", []):
if not "association" in es:
es["association"] = {}
if not "network-instance" in es["association"]:
es["association"]["network-instance"] = []
for vrf in es["association"]["network-instance"]:
es_peers = (
vrf["bgp-instance"][0]
.get("computed-designated-forwarder-candidates", {})
.get("designated-forwarder-candidate", [])
)
vrf["_peers"] = ", ".join(
f"{peer['address']} (DF)"
vrf["_peers"] = " ".join(
f"{peer['address']}(DF)"
if peer["designated-forwarder"]
else peer["address"]
for peer in es_peers
)
vrf["_ni_peers"] = f"{vrf['name']}:[{vrf['_peers']}]"

if (
not "evpn"
Expand All @@ -678,8 +683,8 @@ def get_arp(self) -> Dict[str, Any]:
ni_itfs = self.get(paths=["/network-instance[name=*]"], datatype="config")
ni_itf_map: Dict[str, List[str]] = {}
for ni in ni_itfs[0].get("network-instance", []):
# if ni.get("type", "") == "mac-vrf":
# continue
# if ni.get("type", "") == "mac-vrf":
# continue
for ni_itf in ni.get("interface", []):
if ni_itf["name"] not in ni_itf_map:
ni_itf_map[ni_itf["name"]] = []
Expand Down
Loading
Loading