Connectivity metrics: change how interface names are logged
This patch deprecates the ifname field for specific metrics events of types DhcpClientEvent, DhcpErrorEvent, IpReachabilityEvent and IpManagerEvent. Instead ifnames are logged in ConnectivityMetricsEvent, allowing for link layer inference. Test: updated unit tests, $ runtest frameworks-net passes Bug: 34901696 Change-Id: I8bfabcb115bbd5289471d653c153a40bb48f28cd
This commit is contained in:
@@ -55,7 +55,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
public void testLinkLayerInferrence() {
|
public void testLinkLayerInferrence() {
|
||||||
ConnectivityMetricsEvent ev = describeIpEvent(
|
ConnectivityMetricsEvent ev = describeIpEvent(
|
||||||
aType(IpReachabilityEvent.class),
|
aType(IpReachabilityEvent.class),
|
||||||
aString("wlan0"),
|
|
||||||
anInt(IpReachabilityEvent.NUD_FAILED));
|
anInt(IpReachabilityEvent.NUD_FAILED));
|
||||||
|
|
||||||
String want = joinLines(
|
String want = joinLines(
|
||||||
@@ -68,7 +67,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -87,7 +86,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 3",
|
" transports: 3",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -105,7 +104,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 1",
|
" transports: 1",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -123,7 +122,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -140,7 +139,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -157,7 +156,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -174,7 +173,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
@@ -221,7 +220,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
public void testDhcpClientEventSerialization() {
|
public void testDhcpClientEventSerialization() {
|
||||||
ConnectivityMetricsEvent ev = describeIpEvent(
|
ConnectivityMetricsEvent ev = describeIpEvent(
|
||||||
aType(DhcpClientEvent.class),
|
aType(DhcpClientEvent.class),
|
||||||
aString("wlan0"),
|
|
||||||
aString("SomeState"),
|
aString("SomeState"),
|
||||||
anInt(192));
|
anInt(192));
|
||||||
|
|
||||||
@@ -235,7 +233,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" dhcp_event <",
|
" dhcp_event <",
|
||||||
" duration_ms: 192",
|
" duration_ms: 192",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" state_transition: \"SomeState\"",
|
" state_transition: \"SomeState\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
@@ -248,7 +246,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
public void testDhcpErrorEventSerialization() {
|
public void testDhcpErrorEventSerialization() {
|
||||||
ConnectivityMetricsEvent ev = describeIpEvent(
|
ConnectivityMetricsEvent ev = describeIpEvent(
|
||||||
aType(DhcpErrorEvent.class),
|
aType(DhcpErrorEvent.class),
|
||||||
aString("wlan0"),
|
|
||||||
anInt(DhcpErrorEvent.L4_NOT_UDP));
|
anInt(DhcpErrorEvent.L4_NOT_UDP));
|
||||||
|
|
||||||
String want = joinLines(
|
String want = joinLines(
|
||||||
@@ -261,7 +258,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" dhcp_event <",
|
" dhcp_event <",
|
||||||
" duration_ms: 0",
|
" duration_ms: 0",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" error_code: 50397184",
|
" error_code: 50397184",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
@@ -326,7 +323,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
public void testIpManagerEventSerialization() {
|
public void testIpManagerEventSerialization() {
|
||||||
ConnectivityMetricsEvent ev = describeIpEvent(
|
ConnectivityMetricsEvent ev = describeIpEvent(
|
||||||
aType(IpManagerEvent.class),
|
aType(IpManagerEvent.class),
|
||||||
aString("wlan0"),
|
|
||||||
anInt(IpManagerEvent.PROVISIONING_OK),
|
anInt(IpManagerEvent.PROVISIONING_OK),
|
||||||
aLong(5678));
|
aLong(5678));
|
||||||
|
|
||||||
@@ -340,7 +336,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_provisioning_event <",
|
" ip_provisioning_event <",
|
||||||
" event_type: 1",
|
" event_type: 1",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" latency_ms: 5678",
|
" latency_ms: 5678",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
@@ -353,7 +349,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
public void testIpReachabilityEventSerialization() {
|
public void testIpReachabilityEventSerialization() {
|
||||||
ConnectivityMetricsEvent ev = describeIpEvent(
|
ConnectivityMetricsEvent ev = describeIpEvent(
|
||||||
aType(IpReachabilityEvent.class),
|
aType(IpReachabilityEvent.class),
|
||||||
aString("wlan0"),
|
|
||||||
anInt(IpReachabilityEvent.NUD_FAILED));
|
anInt(IpReachabilityEvent.NUD_FAILED));
|
||||||
|
|
||||||
String want = joinLines(
|
String want = joinLines(
|
||||||
@@ -366,7 +361,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"version: 2");
|
"version: 2");
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import org.mockito.MockitoAnnotations;
|
|||||||
|
|
||||||
public class IpConnectivityMetricsTest extends TestCase {
|
public class IpConnectivityMetricsTest extends TestCase {
|
||||||
static final IpReachabilityEvent FAKE_EV =
|
static final IpReachabilityEvent FAKE_EV =
|
||||||
new IpReachabilityEvent("wlan0", IpReachabilityEvent.NUD_FAILED);
|
new IpReachabilityEvent(IpReachabilityEvent.NUD_FAILED);
|
||||||
|
|
||||||
@Mock Context mCtx;
|
@Mock Context mCtx;
|
||||||
@Mock IIpConnectivityMetrics mMockService;
|
@Mock IIpConnectivityMetrics mMockService;
|
||||||
@@ -154,47 +154,51 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
apfStats.programUpdatesAllowingMulticast = 3;
|
apfStats.programUpdatesAllowingMulticast = 3;
|
||||||
apfStats.maxProgramSize = 2048;
|
apfStats.maxProgramSize = 2048;
|
||||||
Parcelable[] events = {
|
Parcelable[] events = {
|
||||||
new IpReachabilityEvent("wlan0", IpReachabilityEvent.NUD_FAILED),
|
new IpReachabilityEvent(IpReachabilityEvent.NUD_FAILED),
|
||||||
new DhcpClientEvent("wlan0", "SomeState", 192),
|
new DhcpClientEvent("SomeState", 192),
|
||||||
new DefaultNetworkEvent(102, new int[]{1,2,3}, 101, true, false),
|
new DefaultNetworkEvent(102, new int[]{1,2,3}, 101, true, false),
|
||||||
new IpManagerEvent("wlan0", IpManagerEvent.PROVISIONING_OK, 5678),
|
new IpManagerEvent(IpManagerEvent.PROVISIONING_OK, 5678),
|
||||||
new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204),
|
new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204),
|
||||||
apfStats,
|
apfStats,
|
||||||
new RaEvent(2000, 400, 300, -1, 1000, -1)
|
new RaEvent(2000, 400, 300, -1, 1000, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < events.length; i++) {
|
for (int i = 0; i < events.length; i++) {
|
||||||
logger.log(100 * (i + 1), events[i]);
|
ConnectivityMetricsEvent ev = new ConnectivityMetricsEvent();
|
||||||
|
ev.timestamp = 100 * (i + 1);
|
||||||
|
ev.ifname = "wlan0";
|
||||||
|
ev.data = events[i];
|
||||||
|
logger.log(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
String want = joinLines(
|
String want = joinLines(
|
||||||
"dropped_events: 0",
|
"dropped_events: 0",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 100",
|
" time_ms: 100",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_reachability_event <",
|
" ip_reachability_event <",
|
||||||
" event_type: 512",
|
" event_type: 512",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 200",
|
" time_ms: 200",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
" dhcp_event <",
|
" dhcp_event <",
|
||||||
" duration_ms: 192",
|
" duration_ms: 192",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" state_transition: \"SomeState\"",
|
" state_transition: \"SomeState\"",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 300",
|
" time_ms: 300",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
@@ -213,19 +217,19 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
">",
|
">",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 400",
|
" time_ms: 400",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
" ip_provisioning_event <",
|
" ip_provisioning_event <",
|
||||||
" event_type: 1",
|
" event_type: 1",
|
||||||
" if_name: \"wlan0\"",
|
" if_name: \"\"",
|
||||||
" latency_ms: 5678",
|
" latency_ms: 5678",
|
||||||
" >",
|
" >",
|
||||||
">",
|
">",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 500",
|
" time_ms: 500",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
@@ -240,7 +244,7 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
">",
|
">",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 600",
|
" time_ms: 600",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
@@ -259,7 +263,7 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
">",
|
">",
|
||||||
"events <",
|
"events <",
|
||||||
" if_name: \"\"",
|
" if_name: \"\"",
|
||||||
" link_layer: 0",
|
" link_layer: 4",
|
||||||
" network_id: 0",
|
" network_id: 0",
|
||||||
" time_ms: 700",
|
" time_ms: 700",
|
||||||
" transports: 0",
|
" transports: 0",
|
||||||
|
|||||||
Reference in New Issue
Block a user