@@ -89,6 +89,53 @@ def test_Portchannel(self, dvs, testlog):
8989 lagms = lagmtbl .getKeys ()
9090 assert len (lagms ) == 0
9191
92+ def test_Portchannel_fast_rate (self , dvs , testlog ):
93+ portchannel_slow = ("PortChannel0003" , "Ethernet16" , 0 )
94+ portchannel_fast = ("PortChannel0004" , "Ethernet20" , 0 )
95+
96+ self .cdb = swsscommon .DBConnector (4 , dvs .redis_sock , 0 )
97+
98+ # Create PortChannels
99+ tbl = swsscommon .Table (self .cdb , "PORTCHANNEL" )
100+ fvs_base = [("admin_status" , "up" ), ("mtu" , "9100" ), ("oper_status" , "up" ), ("lacp_key" , "auto" )]
101+
102+ fvs_slow = swsscommon .FieldValuePairs (fvs_base + [("fast_rate" , "false" )])
103+ tbl .set (portchannel_slow [0 ], fvs_slow )
104+
105+ fvs_fast = swsscommon .FieldValuePairs (fvs_base + [("fast_rate" , "true" )])
106+ tbl .set (portchannel_fast [0 ], fvs_fast )
107+ time .sleep (1 )
108+
109+ # Add members to PortChannels
110+ tbl = swsscommon .Table (self .cdb , "PORTCHANNEL_MEMBER" )
111+ fvs = swsscommon .FieldValuePairs ([("NULL" , "NULL" )])
112+
113+ for portchannel in portchannel_slow , portchannel_fast :
114+ tbl .set (portchannel [0 ] + "|" + portchannel [1 ], fvs )
115+ time .sleep (1 )
116+
117+ # test fast rate was not set on portchannel_slow
118+ output = dvs .runcmd ("teamdctl {} state dump" .format (portchannel_slow [0 ]))[1 ]
119+ port_state_dump = json .loads (output )
120+ assert not port_state_dump ["runner" ]["fast_rate" ]
121+
122+ # test fast rate was set on portchannel_fast
123+ output = dvs .runcmd ("teamdctl {} state dump" .format (portchannel_fast [0 ]))[1 ]
124+ port_state_dump = json .loads (output )
125+ assert port_state_dump ["runner" ]["fast_rate" ]
126+
127+ # remove PortChannel members
128+ tbl = swsscommon .Table (self .cdb , "PORTCHANNEL_MEMBER" )
129+ for portchannel in portchannel_slow , portchannel_fast :
130+ tbl ._del (portchannel [0 ] + "|" + portchannel [1 ])
131+ time .sleep (1 )
132+
133+ # remove PortChannel
134+ tbl = swsscommon .Table (self .cdb , "PORTCHANNEL" )
135+ for portchannel in portchannel_slow , portchannel_fast :
136+ tbl ._del (portchannel [0 ])
137+ time .sleep (1 )
138+
92139 def test_Portchannel_lacpkey (self , dvs , testlog ):
93140 portchannelNamesAuto = [("PortChannel001" , "Ethernet0" , 1001 ),
94141 ("PortChannel002" , "Ethernet4" , 1002 ),
@@ -108,7 +155,7 @@ def test_Portchannel_lacpkey(self, dvs, testlog):
108155
109156 for portchannel in portchannelNamesAuto :
110157 tbl .set (portchannel [0 ], fvs )
111-
158+
112159 fvs_no_lacp_key = swsscommon .FieldValuePairs (
113160 [("admin_status" , "up" ), ("mtu" , "9100" ), ("oper_status" , "up" )])
114161 tbl .set (portchannelNames [0 ][0 ], fvs_no_lacp_key )
0 commit comments