@@ -156,15 +156,19 @@ func performLAGFlapTest(t *testing.T, dut *ondatra.DUTDevice, aggID string, dutA
156156 gnmi .Await (t , dut , aggIntfPath .OperStatus ().State (), awaitTimeout , oc .Interface_OperStatus_UP )
157157
158158 // Get initial last-change values when the interface is UP.
159+ skipSubintf := deviations .Subinterface0StateUnsupported (dut )
159160 initialIntfLCVal , present := gnmi .Lookup (t , dut , aggIntfPath .LastChange ().State ()).Val ()
160161 if ! present {
161162 t .Fatalf ("[%s] Failed to lookup initial LastChange for interface %s" , testName , aggID )
162163 }
163- initialSubintfLCVal , present := gnmi .Lookup (t , dut , aggIntfPath .Subinterface (0 ).LastChange ().State ()).Val ()
164- if ! present {
165- t .Fatalf ("[%s] Failed to lookup initial LastChange for subinterface %s:0" , testName , aggID )
164+ var initialSubintfLCVal uint64
165+ if ! skipSubintf {
166+ initialSubintfLCVal , present = gnmi .Lookup (t , dut , aggIntfPath .Subinterface (0 ).LastChange ().State ()).Val ()
167+ if ! present {
168+ t .Fatalf ("[%s] Failed to lookup initial LastChange for subinterface %s:0" , testName , aggID )
169+ }
170+ t .Logf ("[%s] Initial LastChange values: Interface %s: %d, Subinterface %s:0: %d" , testName , aggID , initialIntfLCVal , aggID , initialSubintfLCVal )
166171 }
167- t .Logf ("[%s] Initial LastChange values: Interface %s: %d, Subinterface %s:0: %d" , testName , aggID , initialIntfLCVal , aggID , initialSubintfLCVal )
168172
169173 prevIntfLC := initialIntfLCVal
170174 prevSubintfLC := initialSubintfLCVal
@@ -181,6 +185,9 @@ func performLAGFlapTest(t *testing.T, dut *ondatra.DUTDevice, aggID string, dutA
181185 if dut .Vendor () == ondatra .JUNIPER {
182186 targetOperStatus = oc .Interface_OperStatus_LOWER_LAYER_DOWN
183187 }
188+ if dut .Vendor () == ondatra .ARISTA && (testName == "LAGMemberFlap" || testName == "OTGLAGFlap" ) {
189+ targetOperStatus = oc .Interface_OperStatus_LOWER_LAYER_DOWN
190+ }
184191 } else { // In even-numbered iterations, enable the interface.
185192 action = "Enable"
186193 enabledState = true
@@ -200,20 +207,20 @@ func performLAGFlapTest(t *testing.T, dut *ondatra.DUTDevice, aggID string, dutA
200207 t .Errorf ("[%s] Failed to lookup LastChange for interface %s after %s (state change %d)" , testName , aggID , action , i )
201208 continue
202209 }
203- currentSubintfLCVal , present := gnmi .Lookup (t , dut , aggIntfPath .Subinterface (0 ).LastChange ().State ()).Val ()
204- if ! present {
205- t .Errorf ("[%s] Failed to lookup LastChange for subinterface %s:0 after %s (state change %d)" , testName , aggID , action , i )
206- continue
207- }
208- t .Logf ("[%s] LastChange values after %s: Interface %s: %d, Subinterface %s:0: %d" , testName , action , aggID , currentIntfLCVal , aggID , currentSubintfLCVal )
209-
210- // Verify that last-change increased for both the LAG interface and its subinterface.
210+ // Verify that last-change increased for the LAG interface.
211211 validateLastChangeIncrease (t , fmt .Sprintf ("%s after %s (state change %d)" , testName , action , i ), aggID , prevIntfLC , currentIntfLCVal )
212- validateLastChangeIncrease (t , fmt .Sprintf ("%s after %s (state change %d)" , testName , action , i ), fmt .Sprintf ("%s:%d" , aggID , 0 ), prevSubintfLC , currentSubintfLCVal )
213-
214- // Store current timestamps for comparison in the next iteration.
215212 prevIntfLC = currentIntfLCVal
216- prevSubintfLC = currentSubintfLCVal
213+
214+ if ! skipSubintf {
215+ currentSubintfLCVal , present := gnmi .Lookup (t , dut , aggIntfPath .Subinterface (0 ).LastChange ().State ()).Val ()
216+ if ! present {
217+ t .Errorf ("[%s] Failed to lookup LastChange for subinterface %s:0 after %s (state change %d)" , testName , aggID , action , i )
218+ continue
219+ }
220+ t .Logf ("[%s] LastChange values after %s: Interface %s: %d, Subinterface %s:0: %d" , testName , action , aggID , currentIntfLCVal , aggID , currentSubintfLCVal )
221+ validateLastChangeIncrease (t , fmt .Sprintf ("%s after %s (state change %d)" , testName , action , i ), fmt .Sprintf ("%s:%d" , aggID , 0 ), prevSubintfLC , currentSubintfLCVal )
222+ prevSubintfLC = currentSubintfLCVal
223+ }
217224 }
218225}
219226
@@ -341,15 +348,19 @@ func TestEthernetInterfaceLastChangeState(t *testing.T) {
341348 gnmi .Await (t , dut , intfPath .OperStatus ().State (), awaitTimeout , oc .Interface_OperStatus_UP )
342349
343350 // Get initial last-change values when the interface is UP.
351+ skipSubintf := deviations .Subinterface0StateUnsupported (dut )
344352 initialIntfLCVal , present := gnmi .Lookup (t , dut , intfPath .LastChange ().State ()).Val ()
345353 if ! present {
346354 t .Fatalf ("[%s] Failed to lookup initial LastChange for interface %s" , testName , port .Name ())
347355 }
348- initialSubintfLCVal , present := gnmi .Lookup (t , dut , intfPath .Subinterface (0 ).LastChange ().State ()).Val ()
349- if ! present {
350- t .Fatalf ("[%s] Failed to lookup initial LastChange for subinterface %s:0" , testName , port .Name ())
356+ var initialSubintfLCVal uint64
357+ if ! skipSubintf {
358+ initialSubintfLCVal , present = gnmi .Lookup (t , dut , intfPath .Subinterface (0 ).LastChange ().State ()).Val ()
359+ if ! present {
360+ t .Fatalf ("[%s] Failed to lookup initial LastChange for subinterface %s:0" , testName , port .Name ())
361+ }
362+ t .Logf ("[%s] Initial LastChange values: Interface %s: %d, Subinterface %s:0: %d" , testName , port .Name (), initialIntfLCVal , port .Name (), initialSubintfLCVal )
351363 }
352- t .Logf ("[%s] Initial LastChange values: Interface %s: %d, Subinterface %s:0: %d" , testName , port .Name (), initialIntfLCVal , port .Name (), initialSubintfLCVal )
353364
354365 prevIntfLC := initialIntfLCVal
355366 prevSubintfLC := initialSubintfLCVal
@@ -382,29 +393,28 @@ func TestEthernetInterfaceLastChangeState(t *testing.T) {
382393 t .Errorf ("[%s] Failed to lookup LastChange for interface %s after %s (state change %d)" , testName , port .Name (), action , i )
383394 continue
384395 }
385- currentSubintfLCVal , present := gnmi .Lookup (t , dut , intfPath .Subinterface (0 ).LastChange ().State ()).Val ()
386- if ! present {
387- t .Errorf ("[%s] Failed to lookup LastChange for subinterface %s:0 after %s (state change %d)" , testName , port .Name (), action , i )
388- continue
389- }
390-
391- // Verify that last-change increased.
392- subIntfName := fmt .Sprintf ("%s:%d" , port .Name (), 0 )
396+ // Verify that last-change increased for the interface.
393397 if currentIntfLCVal <= prevIntfLC {
394398 t .Errorf ("[%s] State Change %d (%s): Interface %s LastChange timestamp did not increase, initial: %d, final: %d" , testName , i , action , port .Name (), prevIntfLC , currentIntfLCVal )
395399 } else {
396400 t .Logf ("[%s] State Change %d (%s): Interface %s LastChange timestamp increased as expected, initial: %d, final: %d" , testName , i , action , port .Name (), prevIntfLC , currentIntfLCVal )
397401 }
402+ prevIntfLC = currentIntfLCVal
398403
399- if currentSubintfLCVal <= prevSubintfLC {
400- t .Errorf ("[%s] State Change %d (%s): Subinterface %s LastChange timestamp did not increase, initial: %d, final: %d" , testName , i , action , subIntfName , prevSubintfLC , currentSubintfLCVal )
401- } else {
402- t .Logf ("[%s] State Change %d (%s): Subinterface %s LastChange timestamp increased as expected, initial: %d, final: %d" , testName , i , action , subIntfName , prevSubintfLC , currentSubintfLCVal )
404+ if ! skipSubintf {
405+ currentSubintfLCVal , present := gnmi .Lookup (t , dut , intfPath .Subinterface (0 ).LastChange ().State ()).Val ()
406+ if ! present {
407+ t .Errorf ("[%s] Failed to lookup LastChange for subinterface %s:0 after %s (state change %d)" , testName , port .Name (), action , i )
408+ continue
409+ }
410+ subIntfName := fmt .Sprintf ("%s:%d" , port .Name (), 0 )
411+ if currentSubintfLCVal <= prevSubintfLC {
412+ t .Errorf ("[%s] State Change %d (%s): Subinterface %s LastChange timestamp did not increase, initial: %d, final: %d" , testName , i , action , subIntfName , prevSubintfLC , currentSubintfLCVal )
413+ } else {
414+ t .Logf ("[%s] State Change %d (%s): Subinterface %s LastChange timestamp increased as expected, initial: %d, final: %d" , testName , i , action , subIntfName , prevSubintfLC , currentSubintfLCVal )
415+ }
416+ prevSubintfLC = currentSubintfLCVal
403417 }
404-
405- // Store current timestamps for the next iteration's comparison.
406- prevIntfLC = currentIntfLCVal
407- prevSubintfLC = currentSubintfLCVal
408418 }
409419 }
410420
0 commit comments