blob: b99f26ced01e8d93504d9976fac32b65a2fedd6c [file] [log] [blame] [view]
Davide Pesavento2bf35a62017-04-02 00:41:06 -04001## NetworkMonitor test
2
3These instructions are only for Linux.
4
5Run the network-monitor integrated test binary, e.g.:
6```
7./build/tests/integrated/network-monitor
8```
9Note: sudo is not required.
10
11You should see an `onInterfaceAdded` message for each ethernet and loopback
12network interface present on the system, followed by an `onAddressAdded`
13message for each IPv4/IPv6 address on each interface. Finally,
14`onEnumerationCompleted` is printed, along with a summary of all interfaces
15discovered thus far.
16
17[The following commands assume eth0 is the name of an ethernet interface
18on the machine. If your interfaces are named differently, replace eth0
19with the name of any ethernet interface that you have available.]
20
21Command | Expected output
22--------|----------------
23sudo ip link add link eth0 name nmtest0 type vlan id 42 | `nmtest0: onInterfaceAdded`
24sudo ip link set dev nmtest0 mtu 1342 | `nmtest0: onMtuChanged <old_mtu> -> 1342` (`old_mtu` is most likely 1500)
25sudo ip link set dev nmtest0 up | `nmtest0: onStateChanged down -> <new_state>` (`new_state` is one of: running, dormant, no-carrier)
26sudo ip address add 198.51.100.100/24 dev nmtest0 | `nmtest0: onAddressAdded 198.51.100.100/24`
27sudo ip address del 198.51.100.100/24 dev nmtest0 | `nmtest0: onAddressRemoved 198.51.100.100/24`
28sudo ip address add 2001:db8::1/80 dev nmtest0 | `nmtest0: onAddressAdded 2001:db8::1/80`
29sudo ip address del 2001:db8::1/80 dev nmtest0 | `nmtest0: onAddressRemoved 2001:db8::1/80`
30sudo ip link delete dev nmtest0 | `nmtest0: onInterfaceRemoved`
31
32If you unplug the ethernet cable from your network card, you should see:
33```
34eth0: onStateChanged running -> no-carrier
35nmtest0: onStateChanged running -> no-carrier
36```
37
38Plugging the cable back in should produce the following messages:
39```
40eth0: onStateChanged no-carrier -> running
41nmtest0: onStateChanged no-carrier -> running
42```