Merge "Set underlying network of VCN"

This commit is contained in:
Lucas Lin 2021-11-03 00:44:40 +00:00 committed by Gerrit Code Review
commit 74ef57b885
3 changed files with 6 additions and 5 deletions

View File

@ -1663,8 +1663,6 @@ public class VcnGatewayConnection extends StateMachine {
} /* validationStatusCallback */);
agent.register();
agent.setUnderlyingNetworks(
mUnderlying == null ? null : Collections.singletonList(mUnderlying.network));
agent.markConnected();
return agent;
@ -2039,6 +2037,7 @@ public class VcnGatewayConnection extends StateMachine {
"Unknown transport type or missing TransportInfo/NetworkSpecifier for"
+ " non-null underlying network");
}
builder.setUnderlyingNetworks(List.of(underlying.network));
} else {
Slog.wtf(
TAG,

View File

@ -297,8 +297,6 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
any(),
any());
verify(mNetworkAgent).register();
verify(mNetworkAgent)
.setUnderlyingNetworks(eq(singletonList(TEST_UNDERLYING_NETWORK_RECORD_1.network)));
verify(mNetworkAgent).markConnected();
verify(mIpSecSvc)
@ -313,6 +311,7 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
final NetworkCapabilities nc = ncCaptor.getValue();
assertTrue(nc.hasTransport(TRANSPORT_CELLULAR));
assertFalse(nc.hasTransport(TRANSPORT_WIFI));
assertEquals(List.of(TEST_UNDERLYING_NETWORK_RECORD_1.network), nc.getUnderlyingNetworks());
for (int cap : mConfig.getAllExposedCapabilities()) {
assertTrue(nc.hasCapability(cap));
}

View File

@ -61,6 +61,7 @@ import org.junit.runner.RunWith;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@ -116,8 +117,9 @@ public class VcnGatewayConnectionTest extends VcnGatewayConnectionTestBase {
capBuilder.setLinkUpstreamBandwidthKbps(TEST_UPSTREAM_BANDWIDTH);
capBuilder.setLinkDownstreamBandwidthKbps(TEST_DOWNSTREAM_BANDWIDTH);
capBuilder.setAdministratorUids(new int[] {TEST_UID});
final Network underlyingNetwork = mock(Network.class, CALLS_REAL_METHODS);
UnderlyingNetworkRecord record = new UnderlyingNetworkRecord(
mock(Network.class, CALLS_REAL_METHODS),
underlyingNetwork,
capBuilder.build(), new LinkProperties(), false);
final NetworkCapabilities vcnCaps =
VcnGatewayConnection.buildNetworkCapabilities(
@ -128,6 +130,7 @@ public class VcnGatewayConnectionTest extends VcnGatewayConnectionTestBase {
assertTrue(vcnCaps.hasTransport(TRANSPORT_CELLULAR));
assertTrue(vcnCaps.hasCapability(NET_CAPABILITY_NOT_METERED));
assertTrue(vcnCaps.hasCapability(NET_CAPABILITY_NOT_ROAMING));
assertTrue(vcnCaps.getUnderlyingNetworks().equals(List.of(underlyingNetwork)));
for (int cap : VcnGatewayConnectionConfigTest.EXPOSED_CAPS) {
if (cap == NET_CAPABILITY_INTERNET || cap == NET_CAPABILITY_DUN) {