yanger: Add oprational information about vxlan interfaces

This commit is contained in:
Mattias Walström
2025-01-24 10:56:58 +01:00
parent 6a384bf48b
commit 70bcebc451
2 changed files with 18 additions and 4 deletions
@@ -45,6 +45,8 @@ def iplink2yang_type(iplink):
return "infix-if-type:dummy"
case "gretap"|"ip6gretap":
return "infix-if-type:gretap"
case "vxlan":
return "infix-if-type:vxlan"
case "veth":
return "infix-if-type:veth"
case "vlan":
@@ -121,6 +123,9 @@ def interface(iplink, ipaddr):
case "infix-if-type:ethernet":
if eth := ethernet.ethernet(iplink):
interface["ieee802-ethernet-interface:ethernet"] = eth
case "infix-if-type:vxlan":
if vxlan := tun.vxlan(iplink):
interface["infix-interfaces:vxlan"] = vxlan
case "infix-if-type:gre"|"infix-if-type:gretap":
if gre := tun.gre(iplink):
interface["infix-interfaces:gre"] = gre
+13 -4
View File
@@ -1,7 +1,16 @@
def _get_local_remote(info):
return {
"local": info.get("local") or info.get("local6"),
"remote": info.get("remote") or info.get("remote6"),
}
def gre(iplink):
info=iplink.get("linkinfo", {}).get("info_data", {})
return {
"local": info["local"],
"remote": info["remote"],
}
return _get_local_remote(info)
def vxlan(iplink):
info=iplink.get("linkinfo", {}).get("info_data", {})
data=_get_local_remote(info)
data.update({"vni": info["id"]})
return data