@@ -251,15 +251,6 @@ def parse_asic_png(png, asic_name, hostname):
251251 devices [name ] = device_data
252252 return (neighbors , devices , port_speeds )
253253
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-
263254def parse_dpg (dpg , hname ):
264255 aclintfs = None
265256 mgmtintfs = None
@@ -278,6 +269,7 @@ def parse_dpg(dpg, hname):
278269 """
279270 if mgmtintfs is None and child .find (str (QName (ns , "ManagementIPInterfaces" ))) is not None :
280271 mgmtintfs = child .find (str (QName (ns , "ManagementIPInterfaces" )))
272+
281273 hostname = child .find (str (QName (ns , "Hostname" )))
282274 if hostname .text .lower () != hname .lower ():
283275 continue
@@ -298,7 +290,12 @@ def parse_dpg(dpg, hname):
298290 ipprefix = ipintf .find (str (QName (ns , "Prefix" ))).text
299291 intfs [(intfname , ipprefix )] = {}
300292
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 )] = {}
302299
303300 mvrfConfigs = child .find (str (QName (ns , "MgmtVrfConfigs" )))
304301 mvrf = {}
@@ -455,13 +452,6 @@ def parse_dpg(dpg, hname):
455452 return intfs , lo_intfs , mvrf , mgmt_intf , vlans , vlan_members , pcs , pc_members , acls , vni
456453 return None , None , None , None , None , None , None , None , None , None
457454
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
465455
466456def parse_cpg (cpg , hname ):
467457 bgp_sessions = {}
@@ -836,7 +826,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
836826 cloudtype = None
837827 hostname = None
838828 linkmetas = {}
839- host_lo_intfs = None
840829
841830 # hostname is the asic_name, get the asic_id from the asic_name
842831 if asic_name is not None :
@@ -878,7 +867,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
878867 else :
879868 if child .tag == str (QName (ns , "DpgDec" )):
880869 (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 )
882870 elif child .tag == str (QName (ns , "CpgDec" )):
883871 (bgp_sessions , bgp_asn , bgp_peers_with_range , bgp_monitors ) = parse_cpg (child , asic_name )
884872 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
942930 for lo_intf in lo_intfs :
943931 results ['LOOPBACK_INTERFACE' ][lo_intf ] = lo_intfs [lo_intf ]
944932 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-
951933 results ['MGMT_VRF_CONFIG' ] = mvrf
952934
953935 phyport_intfs = {}
0 commit comments