Trigger revalidation of VCN, underlying networks
This change adds triggers additional revalidation of the VCN and underlying networks in the following cases: Triggers VCN Network revalidation after mobility events. This is the most likely time that the VCN will suddenly fail to validate, this helps to detect it as quickly as possible. Triggers underlying network validation if the VCN validation fails; if the underlying network fails, the VCN will migrate away. When the VCN fails to validate, it is unclear whether it is a VCN dataplane issue, or an underlying network issue. Bug: 222351571 Test: atest FrameworksVcnTests Change-Id: I4d77e9977ae7dbf0fcc1cccb29b25c57002a6daf
This commit is contained in:
@@ -544,6 +544,7 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
private final boolean mIsMobileDataEnabled;
|
||||
|
||||
@NonNull private final IpSecManager mIpSecManager;
|
||||
@NonNull private final ConnectivityManager mConnectivityManager;
|
||||
|
||||
@Nullable private IpSecTunnelInterface mTunnelIface = null;
|
||||
|
||||
@@ -701,6 +702,7 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
mLastSnapshot,
|
||||
mUnderlyingNetworkControllerCallback);
|
||||
mIpSecManager = mVcnContext.getContext().getSystemService(IpSecManager.class);
|
||||
mConnectivityManager = mVcnContext.getContext().getSystemService(ConnectivityManager.class);
|
||||
|
||||
addState(mDisconnectedState);
|
||||
addState(mDisconnectingState);
|
||||
@@ -1683,6 +1685,14 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
clearFailedAttemptCounterAndSafeModeAlarm();
|
||||
break;
|
||||
case NetworkAgent.VALIDATION_STATUS_NOT_VALID:
|
||||
// Trigger re-validation of underlying networks; if it
|
||||
// fails, the VCN will attempt to migrate away.
|
||||
if (mUnderlying != null) {
|
||||
mConnectivityManager.reportNetworkConnectivity(
|
||||
mUnderlying.network,
|
||||
false /* hasConnectivity */);
|
||||
}
|
||||
|
||||
// Will only set a new alarm if no safe mode alarm is
|
||||
// currently scheduled.
|
||||
setSafeModeAlarm();
|
||||
@@ -1869,6 +1879,10 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
IpSecManager.DIRECTION_OUT);
|
||||
|
||||
updateNetworkAgent(mTunnelIface, mNetworkAgent, mChildConfig);
|
||||
|
||||
// Trigger re-validation after migration events.
|
||||
mConnectivityManager.reportNetworkConnectivity(
|
||||
mNetworkAgent.getNetwork(), false /* hasConnectivity */);
|
||||
}
|
||||
|
||||
private void handleUnderlyingNetworkChanged(@NonNull Message msg) {
|
||||
|
||||
@@ -252,6 +252,9 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
|
||||
&& TEST_TCP_BUFFER_SIZES_2.equals(lp.getTcpBufferSizes())));
|
||||
verify(mNetworkAgent)
|
||||
.setUnderlyingNetworks(eq(singletonList(TEST_UNDERLYING_NETWORK_RECORD_2.network)));
|
||||
|
||||
// Verify revalidation is triggered on VCN network
|
||||
verify(mConnMgr).reportNetworkConnectivity(eq(mNetworkAgent.getNetwork()), eq(false));
|
||||
}
|
||||
|
||||
private void triggerChildOpened() {
|
||||
@@ -425,6 +428,9 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
|
||||
triggerValidation(NetworkAgent.VALIDATION_STATUS_NOT_VALID);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
verify(mConnMgr)
|
||||
.reportNetworkConnectivity(eq(TEST_UNDERLYING_NETWORK_RECORD_1.network), eq(false));
|
||||
|
||||
final ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(mDeps, times(2))
|
||||
.newWakeupMessage(
|
||||
|
||||
Reference in New Issue
Block a user