Skip to content

Commit 7bd6566

Browse files
lolyumssonicbld
authored andcommitted
[active-active] Fix extra toggle after default route N/A (#279)
Approach What is the motivation for this PR? Fixes #278 Fix the extra toggle after the default route N/A. (active, active, up), ok <- default route n/a -> toggle to standby (active, standby, up), n/a <- mux probe active from the periodically probe (active, active, up), n/a <- mux state standby returned from the toggle to standby (active, standby, up), n/a -> toggle to active (active, active, up), n/a <- mux state active returned from the toggle to active (active, active, up), n/a <- link prober unknown (unknown, active, up), n/a -> toggle to standby (unknown, standby, up), n/a <- mux state standby returned from toggle to standby Signed-off-by: Longxiang Lyu [email protected] Work item tracking Microsoft ADO (number only): 30186968 How did you do it? Let's check the default route state when the mux transits into (active, standby, up), if the default route state is N/A, skip the toggle to active. How did you verify/test it? UT
1 parent 7d87517 commit 7bd6566

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/link_manager/LinkManagerStateMachineActiveActive.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ void ActiveActiveStateMachine::LinkProberActiveMuxStandbyLinkUpTransitionFunctio
780780
// last siwtch mux state to standby failed, try again
781781
switchMuxState(nextState, mux_state::MuxState::Label::Standby, true);
782782
}
783-
} else {
783+
} else if (mDefaultRouteState != DefaultRoute::NA) {
784784
switchMuxState(nextState, mux_state::MuxState::Label::Active);
785785
}
786786
}

test/LinkManagerStateMachineActiveActiveTest.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,35 @@ TEST_F(LinkManagerStateMachineActiveActiveTest, MuxActivDefaultRouteState)
500500
EXPECT_EQ(mFakeMuxPort.mFakeLinkProber->mRestartTxProbeCallCount, 3);
501501
}
502502

503+
TEST_F(LinkManagerStateMachineActiveActiveTest, MuxActivDefaultRouteStateNALMuxProbeActiveAfterToggle)
504+
{
505+
setMuxActive();
506+
507+
mMuxConfig.enableDefaultRouteFeature(true);
508+
postDefaultRouteEvent("na", 1);
509+
EXPECT_EQ(mFakeMuxPort.mFakeLinkProber->mShutdownTxProbeCallCount, 1);
510+
EXPECT_EQ(mFakeMuxPort.mFakeLinkProber->mRestartTxProbeCallCount, 0);
511+
EXPECT_EQ(mDbInterfacePtr->mSetMuxStateInvokeCount, 2);
512+
EXPECT_EQ(mDbInterfacePtr->mLastSetMuxState, mux_state::MuxState::Label::Standby);
513+
VALIDATE_STATE(Active, Standby, Up);
514+
515+
// misleading mux state active from periodically probe
516+
handleProbeMuxState("active", 3);
517+
EXPECT_EQ(mDbInterfacePtr->mSetMuxStateInvokeCount, 2);
518+
EXPECT_EQ(mDbInterfacePtr->mLastSetMuxState, mux_state::MuxState::Label::Standby);
519+
VALIDATE_STATE(Active, Active, Up);
520+
521+
handleMuxState("standby", 3);
522+
EXPECT_EQ(mDbInterfacePtr->mSetMuxStateInvokeCount, 2);
523+
EXPECT_EQ(mDbInterfacePtr->mLastSetMuxState, mux_state::MuxState::Label::Standby);
524+
VALIDATE_STATE(Active, Standby, Up);
525+
526+
postLinkProberEvent(link_prober::LinkProberState::Unknown, 3);
527+
EXPECT_EQ(mDbInterfacePtr->mSetMuxStateInvokeCount, 2);
528+
EXPECT_EQ(mDbInterfacePtr->mLastSetMuxState, mux_state::MuxState::Label::Standby);
529+
VALIDATE_STATE(Unknown, Standby, Up);
530+
}
531+
503532
TEST_F(LinkManagerStateMachineActiveActiveTest, MuxActivDefaultRouteStateMuxConfigActive)
504533
{
505534
setMuxActive();

0 commit comments

Comments
 (0)