@@ -457,57 +457,47 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m
457
457
'vni' : chassis_vni
458
458
}}
459
459
460
- # Find L3 physical interfaces that should be enslaved to Vnet
460
+ # For each IP interface
461
461
for intf in phyport_intfs :
462
- # We only care about L3 physical interfaces
463
- if is_ip_prefix_in_key (intf ) == False :
462
+ # A IP interface may have multiple entries.
463
+ # For example, "Ethernet0": {}", "Ethernet0|192.168.1.1": {}"
464
+ # We only care about the one without IP information
465
+ if is_ip_prefix_in_key (intf ) == True :
464
466
continue
465
-
466
- # intf = (intf name, IP prefix)
467
- intf_name = intf [0 ]
468
- neighbor_router = results ['DEVICE_NEIGHBOR' ][intf_name ]['name' ]
467
+
468
+ neighbor_router = results ['DEVICE_NEIGHBOR' ][intf ]['name' ]
469
469
470
470
# If the neighbor router is an external router
471
471
if devices [neighbor_router ]['type' ] != chassis_backend_role :
472
-
473
472
# Enslave the interface to a Vnet
474
- if intf_name in phyport_intfs :
475
- phyport_intfs [intf_name ] = {'vnet_name' : chassis_vnet }
476
- else :
477
- print >> sys .stderr , 'Warning: cannot find the key %s' % (intf_name )
478
-
479
- # Find L3 port chennel interfaces that should be enslaved to Vnet
473
+ phyport_intfs [intf ] = {'vnet_name' : chassis_vnet }
474
+
475
+ # For each port channel IP interface
480
476
for pc_intf in pc_intfs :
481
- # We only care about L3 port channel interfaces
482
- if is_ip_prefix_in_key (pc_intf ) == False :
477
+ # A port channel IP interface may have multiple entries.
478
+ # For example, "Portchannel0": {}", "Portchannel0|192.168.1.1": {}"
479
+ # We only care about the one without IP information
480
+ if is_ip_prefix_in_key (pc_intf ) == True :
483
481
continue
484
482
485
- # Get port channel interface name
486
- # pc intf = (pc intf name, IP prefix)
487
- pc_intf_name = pc_intf [0 ]
488
-
489
483
intf_name = None
490
484
# Get a physical interface that belongs to this port channel
491
485
for pc_member in pc_members :
492
- if pc_member [0 ] == pc_intf_name :
486
+ if pc_member [0 ] == pc_intf :
493
487
intf_name = pc_member [1 ]
494
488
break
495
489
496
490
if intf_name == None :
497
- print >> sys .stderr , 'Warning: cannot find any interfaces that belong to %s' % (pc_intf_name )
491
+ print >> sys .stderr , 'Warning: cannot find any interfaces that belong to %s' % (pc_intf )
498
492
continue
499
493
500
494
# Get the neighbor router of this port channel interface
501
495
neighbor_router = results ['DEVICE_NEIGHBOR' ][intf_name ]['name' ]
502
496
503
497
# If the neighbor router is an external router
504
498
if devices [neighbor_router ]['type' ] != chassis_backend_role :
505
-
506
499
# Enslave the port channel interface to a Vnet
507
- if pc_intf_name in pc_intfs :
508
- pc_intfs [pc_intf_name ] = {'vnet_name' : chassis_vnet }
509
- else :
510
- print >> sys .stderr , 'Warning: cannot find the key %s' % (pc_intf_name )
500
+ pc_intfs [pc_intf ] = {'vnet_name' : chassis_vnet }
511
501
512
502
513
503
def parse_xml (filename , platform = None , port_config_file = None ):
0 commit comments