@@ -251,15 +251,6 @@ def parse_asic_png(png, asic_name, hostname):
251
251
devices [name ] = device_data
252
252
return (neighbors , devices , port_speeds )
253
253
254
- def parse_loopback_intf (child ):
255
- lointfs = child .find (str (QName (ns , "LoopbackIPInterfaces" )))
256
- lo_intfs = {}
257
- for lointf in lointfs .findall (str (QName (ns1 , "LoopbackIPInterface" ))):
258
- intfname = lointf .find (str (QName (ns , "AttachTo" ))).text
259
- ipprefix = lointf .find (str (QName (ns1 , "PrefixStr" ))).text
260
- lo_intfs [(intfname , ipprefix )] = {}
261
- return lo_intfs
262
-
263
254
def parse_dpg (dpg , hname ):
264
255
aclintfs = None
265
256
mgmtintfs = None
@@ -278,6 +269,7 @@ def parse_dpg(dpg, hname):
278
269
"""
279
270
if mgmtintfs is None and child .find (str (QName (ns , "ManagementIPInterfaces" ))) is not None :
280
271
mgmtintfs = child .find (str (QName (ns , "ManagementIPInterfaces" )))
272
+
281
273
hostname = child .find (str (QName (ns , "Hostname" )))
282
274
if hostname .text .lower () != hname .lower ():
283
275
continue
@@ -298,7 +290,12 @@ def parse_dpg(dpg, hname):
298
290
ipprefix = ipintf .find (str (QName (ns , "Prefix" ))).text
299
291
intfs [(intfname , ipprefix )] = {}
300
292
301
- lo_intfs = parse_loopback_intf (child )
293
+ lointfs = child .find (str (QName (ns , "LoopbackIPInterfaces" )))
294
+ lo_intfs = {}
295
+ for lointf in lointfs .findall (str (QName (ns1 , "LoopbackIPInterface" ))):
296
+ intfname = lointf .find (str (QName (ns , "AttachTo" ))).text
297
+ ipprefix = lointf .find (str (QName (ns1 , "PrefixStr" ))).text
298
+ lo_intfs [(intfname , ipprefix )] = {}
302
299
303
300
mvrfConfigs = child .find (str (QName (ns , "MgmtVrfConfigs" )))
304
301
mvrf = {}
@@ -455,13 +452,6 @@ def parse_dpg(dpg, hname):
455
452
return intfs , lo_intfs , mvrf , mgmt_intf , vlans , vlan_members , pcs , pc_members , acls , vni
456
453
return None , None , None , None , None , None , None , None , None , None
457
454
458
- def parse_host_loopback (dpg , hname ):
459
- for child in dpg :
460
- hostname = child .find (str (QName (ns , "Hostname" )))
461
- if hostname .text .lower () != hname .lower ():
462
- continue
463
- lo_intfs = parse_loopback_intf (child )
464
- return lo_intfs
465
455
466
456
def parse_cpg (cpg , hname ):
467
457
bgp_sessions = {}
@@ -836,7 +826,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
836
826
cloudtype = None
837
827
hostname = None
838
828
linkmetas = {}
839
- host_lo_intfs = None
840
829
841
830
# hostname is the asic_name, get the asic_id from the asic_name
842
831
if asic_name is not None :
@@ -878,7 +867,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
878
867
else :
879
868
if child .tag == str (QName (ns , "DpgDec" )):
880
869
(intfs , lo_intfs , mvrf , mgmt_intf , vlans , vlan_members , pcs , pc_members , acls , vni ) = parse_dpg (child , asic_name )
881
- host_lo_intfs = parse_host_loopback (child , hostname )
882
870
elif child .tag == str (QName (ns , "CpgDec" )):
883
871
(bgp_sessions , bgp_asn , bgp_peers_with_range , bgp_monitors ) = parse_cpg (child , asic_name )
884
872
enable_internal_bgp_session (bgp_sessions , filename , asic_name )
@@ -942,12 +930,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
942
930
for lo_intf in lo_intfs :
943
931
results ['LOOPBACK_INTERFACE' ][lo_intf ] = lo_intfs [lo_intf ]
944
932
results ['LOOPBACK_INTERFACE' ][lo_intf [0 ]] = {}
945
-
946
- if host_lo_intfs is not None :
947
- for host_lo_intf in host_lo_intfs :
948
- results ['LOOPBACK_INTERFACE' ][host_lo_intf ] = host_lo_intfs [host_lo_intf ]
949
- results ['LOOPBACK_INTERFACE' ][host_lo_intf [0 ]] = {}
950
-
951
933
results ['MGMT_VRF_CONFIG' ] = mvrf
952
934
953
935
phyport_intfs = {}
0 commit comments