5
5
import json
6
6
7
7
# Get restore count of all processes supporting warm restart
8
- def swss_get_RestoreCount (state_db ):
8
+ def swss_get_RestoreCount (dvs , state_db ):
9
9
restore_count = {}
10
10
warmtbl = swsscommon .Table (state_db , swsscommon .STATE_WARM_RESTART_TABLE_NAME )
11
11
keys = warmtbl .getKeys ()
12
12
assert len (keys ) != 0
13
13
for key in keys :
14
+ if key not in dvs .swssd :
15
+ continue
14
16
(status , fvs ) = warmtbl .get (key )
15
17
assert status == True
16
18
for fv in fvs :
@@ -20,12 +22,14 @@ def swss_get_RestoreCount(state_db):
20
22
return restore_count
21
23
22
24
# function to check the restore count incremented by 1 for all processes supporting warm restart
23
- def swss_check_RestoreCount (state_db , restore_count ):
25
+ def swss_check_RestoreCount (dvs , state_db , restore_count ):
24
26
warmtbl = swsscommon .Table (state_db , swsscommon .STATE_WARM_RESTART_TABLE_NAME )
25
27
keys = warmtbl .getKeys ()
26
28
print (keys )
27
29
assert len (keys ) > 0
28
30
for key in keys :
31
+ if key not in dvs .swssd :
32
+ continue
29
33
(status , fvs ) = warmtbl .get (key )
30
34
assert status == True
31
35
for fv in fvs :
@@ -144,7 +148,7 @@ def test_PortSyncdWarmRestart(dvs, testlog):
144
148
(status , fvs ) = neighTbl .get ("Ethernet20:11.0.0.10" )
145
149
assert status == True
146
150
147
- restore_count = swss_get_RestoreCount (state_db )
151
+ restore_count = swss_get_RestoreCount (dvs , state_db )
148
152
149
153
# restart portsyncd
150
154
dvs .runcmd (['sh' , '-c' , 'pkill -x portsyncd' ])
@@ -255,7 +259,7 @@ def test_VlanMgrdWarmRestart(dvs, testlog):
255
259
(exitcode , bv_before ) = dvs .runcmd ("bridge vlan" )
256
260
print (bv_before )
257
261
258
- restore_count = swss_get_RestoreCount (state_db )
262
+ restore_count = swss_get_RestoreCount (dvs , state_db )
259
263
260
264
dvs .runcmd (['sh' , '-c' , 'pkill -x vlanmgrd' ])
261
265
@@ -376,7 +380,7 @@ def test_swss_neighbor_syncup(dvs, testlog):
376
380
#
377
381
378
382
# get restore_count
379
- restore_count = swss_get_RestoreCount (state_db )
383
+ restore_count = swss_get_RestoreCount (dvs , state_db )
380
384
381
385
# stop neighsyncd and sairedis.rec
382
386
stop_neighsyncd (dvs )
@@ -425,7 +429,7 @@ def test_swss_neighbor_syncup(dvs, testlog):
425
429
# just that if we want to add the same neighbor again, use "change" instead of "add"
426
430
427
431
# get restore_count
428
- restore_count = swss_get_RestoreCount (state_db )
432
+ restore_count = swss_get_RestoreCount (dvs , state_db )
429
433
430
434
# stop neighsyncd
431
435
stop_neighsyncd (dvs )
@@ -496,7 +500,7 @@ def test_swss_neighbor_syncup(dvs, testlog):
496
500
# Check the timer is not retrieved from configDB since it is not configured
497
501
498
502
# get restore_count
499
- restore_count = swss_get_RestoreCount (state_db )
503
+ restore_count = swss_get_RestoreCount (dvs , state_db )
500
504
501
505
# stop neighsyncd
502
506
stop_neighsyncd (dvs )
@@ -571,7 +575,7 @@ def test_swss_neighbor_syncup(dvs, testlog):
571
575
dvs .runcmd ("config warm_restart neighsyncd_timer {}" .format (timer_value ))
572
576
573
577
# get restore_count
574
- restore_count = swss_get_RestoreCount (state_db )
578
+ restore_count = swss_get_RestoreCount (dvs , state_db )
575
579
576
580
# stop neighsyncd
577
581
stop_neighsyncd (dvs )
@@ -719,7 +723,7 @@ def test_swss_port_state_syncup(dvs, testlog):
719
723
720
724
tbl = swsscommon .Table (appl_db , swsscommon .APP_PORT_TABLE_NAME )
721
725
722
- restore_count = swss_get_RestoreCount (state_db )
726
+ restore_count = swss_get_RestoreCount (dvs , state_db )
723
727
724
728
# update port admin state
725
729
dvs .runcmd ("ifconfig Ethernet0 10.0.0.0/31 up" )
@@ -766,7 +770,7 @@ def test_swss_port_state_syncup(dvs, testlog):
766
770
dvs .start_swss ()
767
771
time .sleep (10 )
768
772
769
- swss_check_RestoreCount (state_db , restore_count )
773
+ swss_check_RestoreCount (dvs , state_db , restore_count )
770
774
771
775
for i in [0 , 1 , 2 ]:
772
776
(status , fvs ) = tbl .get ("Ethernet%d" % (i * 4 ))
0 commit comments