[minigraph.py]: Updated Static Route Minigraph Attribute property (#14951)
What I did: Updated Static Route Attribute in Minigraph. NGS Minigraph has define semantics of static route differently. See below for differences:- Microsoft ADO: 17956325 Before <AssociatedTo>8.0.0.1/32</AssociatedTo> <Address>192.168.1.2,192.168.2.2</Address> <AttachTo>PortChannel40,PortChannel50</AttachTo> Now: <Address>8.0.0.1</Address> <AttachTo>PortChannel40,192.168.1.2;PortChannel50,192.168.2.2</AttachTo> Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
This commit is contained in:
parent
ecb4db58a9
commit
b5b5883c27
@ -585,11 +585,23 @@ def parse_dpg(dpg, hname):
|
|||||||
elif ":" in ipnhaddr:
|
elif ":" in ipnhaddr:
|
||||||
port_nhipv6_map[ipnhfmbr] = ipnhaddr
|
port_nhipv6_map[ipnhfmbr] = ipnhaddr
|
||||||
elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute':
|
elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute':
|
||||||
prefix = ipnh.find(str(QName(ns, "AssociatedTo"))).text
|
prefix = ipnh.find(str(QName(ns, "Address"))).text
|
||||||
ifname = ipnh.find(str(QName(ns, "AttachTo"))).text
|
ifname = []
|
||||||
nexthop = ipnh.find(str(QName(ns, "Address"))).text
|
nexthop = []
|
||||||
advertise = ipnh.find(str(QName(ns, "Advertise"))).text
|
for nexthop_tuple in ipnh.find(str(QName(ns, "AttachTo"))).text.split(";"):
|
||||||
static_routes[prefix] = {'nexthop': nexthop, 'ifname': ifname, 'advertise': advertise}
|
ifname.append(nexthop_tuple.split(",")[0])
|
||||||
|
nexthop.append(nexthop_tuple.split(",")[1])
|
||||||
|
if ipnh.find(str(QName(ns, "Advertise"))):
|
||||||
|
advertise = ipnh.find(str(QName(ns, "Advertise"))).text
|
||||||
|
else:
|
||||||
|
advertise = "false"
|
||||||
|
if '/' not in prefix:
|
||||||
|
if ":" in prefix:
|
||||||
|
prefix = prefix + "/128"
|
||||||
|
else:
|
||||||
|
prefix = prefix + "/32"
|
||||||
|
static_routes[prefix] = {'nexthop': ",".join(nexthop), 'ifname': ",".join(ifname), 'advertise': advertise}
|
||||||
|
|
||||||
if port_nhipv4_map and port_nhipv6_map:
|
if port_nhipv4_map and port_nhipv6_map:
|
||||||
subnet_check_ip = list(port_nhipv4_map.values())[0]
|
subnet_check_ip = list(port_nhipv4_map.values())[0]
|
||||||
for subnet_range in ip_intfs_map:
|
for subnet_range in ip_intfs_map:
|
||||||
|
@ -121,11 +121,9 @@
|
|||||||
<IPNextHop>
|
<IPNextHop>
|
||||||
<ElementType>IPNextHop</ElementType>
|
<ElementType>IPNextHop</ElementType>
|
||||||
<Name i:nil="true"/>
|
<Name i:nil="true"/>
|
||||||
<AssociatedTo>8.0.0.1/32</AssociatedTo>
|
<Address>8.0.0.1</Address>
|
||||||
<Address>192.168.1.2,192.168.2.2</Address>
|
<AttachTo>PortChannel40,192.168.1.2;PortChannel50,192.168.2.2</AttachTo>
|
||||||
<AttachTo>PortChannel40,PortChannel50</AttachTo>
|
|
||||||
<Type>StaticRoute</Type>
|
<Type>StaticRoute</Type>
|
||||||
<Advertise>false</Advertise>
|
|
||||||
</IPNextHop>
|
</IPNextHop>
|
||||||
</IPNextHops>
|
</IPNextHops>
|
||||||
<DataAcls/>
|
<DataAcls/>
|
||||||
@ -213,11 +211,9 @@
|
|||||||
<IPNextHop>
|
<IPNextHop>
|
||||||
<ElementType>IPNextHop</ElementType>
|
<ElementType>IPNextHop</ElementType>
|
||||||
<Name i:nil="true"/>
|
<Name i:nil="true"/>
|
||||||
<AssociatedTo>8.0.0.1/32</AssociatedTo>
|
<Address>8.0.0.1</Address>
|
||||||
<Address>192.168.1.2,192.168.2.2</Address>
|
<AttachTo>PortChannel40,192.168.1.2;PortChannel50,192.168.2.2</AttachTo>
|
||||||
<AttachTo>PortChannel40,PortChannel50</AttachTo>
|
|
||||||
<Type>StaticRoute</Type>
|
<Type>StaticRoute</Type>
|
||||||
<Advertise>false</Advertise>
|
|
||||||
</IPNextHop>
|
</IPNextHop>
|
||||||
</IPNextHops>
|
</IPNextHops>
|
||||||
</DeviceDataPlaneInfo>
|
</DeviceDataPlaneInfo>
|
||||||
|
Reference in New Issue
Block a user