[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:
|
||||
port_nhipv6_map[ipnhfmbr] = ipnhaddr
|
||||
elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute':
|
||||
prefix = ipnh.find(str(QName(ns, "AssociatedTo"))).text
|
||||
ifname = ipnh.find(str(QName(ns, "AttachTo"))).text
|
||||
nexthop = ipnh.find(str(QName(ns, "Address"))).text
|
||||
prefix = ipnh.find(str(QName(ns, "Address"))).text
|
||||
ifname = []
|
||||
nexthop = []
|
||||
for nexthop_tuple in ipnh.find(str(QName(ns, "AttachTo"))).text.split(";"):
|
||||
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
|
||||
static_routes[prefix] = {'nexthop': nexthop, 'ifname': ifname, 'advertise': advertise}
|
||||
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:
|
||||
subnet_check_ip = list(port_nhipv4_map.values())[0]
|
||||
for subnet_range in ip_intfs_map:
|
||||
|
@ -121,11 +121,9 @@
|
||||
<IPNextHop>
|
||||
<ElementType>IPNextHop</ElementType>
|
||||
<Name i:nil="true"/>
|
||||
<AssociatedTo>8.0.0.1/32</AssociatedTo>
|
||||
<Address>192.168.1.2,192.168.2.2</Address>
|
||||
<AttachTo>PortChannel40,PortChannel50</AttachTo>
|
||||
<Address>8.0.0.1</Address>
|
||||
<AttachTo>PortChannel40,192.168.1.2;PortChannel50,192.168.2.2</AttachTo>
|
||||
<Type>StaticRoute</Type>
|
||||
<Advertise>false</Advertise>
|
||||
</IPNextHop>
|
||||
</IPNextHops>
|
||||
<DataAcls/>
|
||||
@ -213,11 +211,9 @@
|
||||
<IPNextHop>
|
||||
<ElementType>IPNextHop</ElementType>
|
||||
<Name i:nil="true"/>
|
||||
<AssociatedTo>8.0.0.1/32</AssociatedTo>
|
||||
<Address>192.168.1.2,192.168.2.2</Address>
|
||||
<AttachTo>PortChannel40,PortChannel50</AttachTo>
|
||||
<Address>8.0.0.1</Address>
|
||||
<AttachTo>PortChannel40,192.168.1.2;PortChannel50,192.168.2.2</AttachTo>
|
||||
<Type>StaticRoute</Type>
|
||||
<Advertise>false</Advertise>
|
||||
</IPNextHop>
|
||||
</IPNextHops>
|
||||
</DeviceDataPlaneInfo>
|
||||
|
Reference in New Issue
Block a user