@@ -164,7 +164,7 @@ def migrate_mgmt_ports_on_s6100(self):
164
164
self .appDB .set (self .appDB .APPL_DB , 'PORT_TABLE:PortConfigDone' , 'count' , str (total_count ))
165
165
log .log_notice ("Port count updated from {} to : {}" .format (portCount , self .appDB .get (self .appDB .APPL_DB , 'PORT_TABLE:PortConfigDone' , 'count' )))
166
166
return True
167
-
167
+
168
168
def migrate_intf_table (self ):
169
169
'''
170
170
Migrate all data from existing INTF table in APP DB during warmboot with IP Prefix
@@ -262,7 +262,6 @@ def migrate_config_db_buffer_tables_for_dynamic_calculation(self, speed_list, ca
262
262
@append_item_method - a function which is called to append an item to the list of pending commit items
263
263
any update to buffer configuration will be pended and won't be applied until
264
264
all configuration is checked and aligns with the default one
265
-
266
265
1. Buffer profiles for lossless PGs in BUFFER_PROFILE table will be removed
267
266
if their names have the convention of pg_lossless_<speed>_<cable_length>_profile
268
267
where the speed and cable_length belongs speed_list and cable_len_list respectively
@@ -346,15 +345,13 @@ def prepare_dynamic_buffer_for_warm_reboot(self, buffer_pools=None, buffer_profi
346
345
'''
347
346
This is the very first warm reboot of buffermgrd (dynamic) if the system reboot from old image by warm-reboot
348
347
In this case steps need to be taken to get buffermgrd prepared (for warm reboot)
349
-
350
348
During warm reboot, buffer tables should be installed in the first place.
351
349
However, it isn't able to achieve that when system is warm-rebooted from an old image
352
350
without dynamic buffer supported, because the buffer info wasn't in the APPL_DB in the old image.
353
351
The solution is to copy that info from CONFIG_DB into APPL_DB in db_migrator.
354
352
During warm-reboot, db_migrator adjusts buffer info in CONFIG_DB by removing some fields
355
353
according to requirement from dynamic buffer calculation.
356
354
The buffer info before that adjustment needs to be copied to APPL_DB.
357
-
358
355
1. set WARM_RESTART_TABLE|buffermgrd as {restore_count: 0}
359
356
2. Copy the following tables from CONFIG_DB into APPL_DB in case of warm reboot
360
357
The separator in fields that reference objects in other table needs to be updated from '|' to ':'
@@ -364,7 +361,6 @@ def prepare_dynamic_buffer_for_warm_reboot(self, buffer_pools=None, buffer_profi
364
361
- BUFFER_QUEUE, separator updated for field 'profile
365
362
- BUFFER_PORT_INGRESS_PROFILE_LIST, separator updated for field 'profile_list'
366
363
- BUFFER_PORT_EGRESS_PROFILE_LIST, separator updated for field 'profile_list'
367
-
368
364
'''
369
365
warmreboot_state = self .stateDB .get (self .stateDB .STATE_DB , 'WARM_RESTART_ENABLE_TABLE|system' , 'enable' )
370
366
mmu_size = self .stateDB .get (self .stateDB .STATE_DB , 'BUFFER_MAX_PARAM_TABLE|global' , 'mmu_size' )
@@ -569,7 +565,7 @@ def migrate_port_qos_map_global(self):
569
565
dscp_to_tc_map_table_names = self .configDB .get_keys ('DSCP_TO_TC_MAP' )
570
566
if len (dscp_to_tc_map_table_names ) == 0 :
571
567
return
572
-
568
+
573
569
qos_maps = self .configDB .get_table ('PORT_QOS_MAP' )
574
570
if 'global' not in qos_maps .keys ():
575
571
# We are unlikely to have more than 1 DSCP_TO_TC_MAP in previous versions
@@ -593,6 +589,50 @@ def migrate_route_table(self):
593
589
route_key = "ROUTE_TABLE:{}" .format (route_prefix )
594
590
self .appDB .set (self .appDB .APPL_DB , route_key , 'weight' ,'' )
595
591
592
+ def update_edgezone_aggregator_config (self ):
593
+ """
594
+ Update cable length configuration in ConfigDB for T0 neighbor interfaces
595
+ connected to EdgeZone Aggregator devices, while resetting the port values to trigger a buffer change
596
+ 1. Find a list of all interfaces connected to an EdgeZone Aggregator device.
597
+ 2. If all the cable lengths are the same, do nothing and return.
598
+ 3. If there are different cable lengths, update CABLE_LENGTH values for these interfaces with a constant value of 40m.
599
+ """
600
+ device_neighbor_metadata = self .configDB .get_table ("DEVICE_NEIGHBOR_METADATA" )
601
+ device_neighbors = self .configDB .get_table ("DEVICE_NEIGHBOR" )
602
+ cable_length = self .configDB .get_table ("CABLE_LENGTH" )
603
+ port_table = self .configDB .get_table ("PORT" )
604
+ edgezone_aggregator_devs = []
605
+ edgezone_aggregator_intfs = []
606
+ EDGEZONE_AGG_CABLE_LENGTH = "40m"
607
+ for k , v in device_neighbor_metadata .items ():
608
+ if v .get ("type" ) == "EdgeZoneAggregator" :
609
+ edgezone_aggregator_devs .append (k )
610
+
611
+ if len (edgezone_aggregator_devs ) == 0 :
612
+ return
613
+
614
+ for intf , intf_info in device_neighbors .items ():
615
+ if intf_info .get ("name" ) in edgezone_aggregator_devs :
616
+ edgezone_aggregator_intfs .append (intf )
617
+
618
+ cable_length_table = self .configDB .get_entry ("CABLE_LENGTH" , "AZURE" )
619
+ first_cable_intf = next (iter (cable_length_table ))
620
+ first_cable_length = cable_length_table [first_cable_intf ]
621
+ index = 0
622
+
623
+ for intf , length in cable_length_table .items ():
624
+ index += 1
625
+ if first_cable_length != length :
626
+ break
627
+ elif index == len (cable_length_table ):
628
+ # All cable lengths are the same, nothing to modify
629
+ return
630
+
631
+ for intf , length in cable_length_table .items ():
632
+ if intf in edgezone_aggregator_intfs :
633
+ # Set new cable length values
634
+ self .configDB .set (self .configDB .CONFIG_DB , "CABLE_LENGTH|AZURE" , intf , EDGEZONE_AGG_CABLE_LENGTH )
635
+
596
636
def version_unknown (self ):
597
637
"""
598
638
version_unknown tracks all SONiC versions that doesn't have a version
@@ -754,7 +794,7 @@ def version_2_0_1(self):
754
794
def version_2_0_2 (self ):
755
795
"""
756
796
Version 2_0_2
757
- This is the latest version for 202012 branch
797
+ This is the latest version for 202012 branch
758
798
"""
759
799
log .log_info ('Handling version_2_0_2' )
760
800
self .set_version ('version_3_0_0' )
@@ -839,7 +879,7 @@ def version_3_0_5(self):
839
879
self .stateDB .set (self .stateDB .STATE_DB , 'FAST_RESTART_ENABLE_TABLE|system' , 'enable' , enable_state )
840
880
self .set_version ('version_3_0_6' )
841
881
return 'version_3_0_6'
842
-
882
+
843
883
def version_3_0_6 (self ):
844
884
"""
845
885
Current latest version. Nothing to do here.
@@ -882,13 +922,16 @@ def common_migration_ops(self):
882
922
883
923
if self .asic_type != "mellanox" :
884
924
self .migrate_copp_table ()
885
- if self .asic_type == "broadcom" and 'Force10-S6100' in self .hwsku :
925
+ if self .asic_type == "broadcom" and 'Force10-S6100' in self .hwsku :
886
926
self .migrate_mgmt_ports_on_s6100 ()
887
927
else :
888
928
log .log_notice ("Asic Type: {}, Hwsku: {}" .format (self .asic_type , self .hwsku ))
889
929
890
930
self .migrate_route_table ()
891
931
932
+ # Updating edgezone aggregator cable length config for T0 devices
933
+ self .update_edgezone_aggregator_config ()
934
+
892
935
def migrate (self ):
893
936
version = self .get_version ()
894
937
log .log_info ('Upgrading from version ' + version )
0 commit comments