blob: a9a9af146914a28f10f3bec517934e67dc6ad17e [file] [log] [blame] [view]
Alexander Afanasyev3b3355c2017-03-26 11:57:13 -05001# NetworkMonitor test
Davide Pesavento2bf35a62017-04-02 00:41:06 -04002
Alexander Afanasyev3b3355c2017-03-26 11:57:13 -05003These instructions are only for Linux and macOS.
Davide Pesavento2bf35a62017-04-02 00:41:06 -04004
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
Alexander Afanasyev3b3355c2017-03-26 11:57:13 -050017## Linux
18
Davide Pesavento2bf35a62017-04-02 00:41:06 -040019[The following commands assume eth0 is the name of an ethernet interface
20on the machine. If your interfaces are named differently, replace eth0
21with the name of any ethernet interface that you have available.]
22
23Command | Expected output
24--------|----------------
25sudo ip link add link eth0 name nmtest0 type vlan id 42 | `nmtest0: onInterfaceAdded`
26sudo ip link set dev nmtest0 mtu 1342 | `nmtest0: onMtuChanged <old_mtu> -> 1342` (`old_mtu` is most likely 1500)
27sudo ip link set dev nmtest0 up | `nmtest0: onStateChanged down -> <new_state>` (`new_state` is one of: running, dormant, no-carrier)
28sudo ip address add 198.51.100.100/24 dev nmtest0 | `nmtest0: onAddressAdded 198.51.100.100/24`
29sudo ip address del 198.51.100.100/24 dev nmtest0 | `nmtest0: onAddressRemoved 198.51.100.100/24`
30sudo ip address add 2001:db8::1/80 dev nmtest0 | `nmtest0: onAddressAdded 2001:db8::1/80`
31sudo ip address del 2001:db8::1/80 dev nmtest0 | `nmtest0: onAddressRemoved 2001:db8::1/80`
32sudo ip link delete dev nmtest0 | `nmtest0: onInterfaceRemoved`
33
34If you unplug the ethernet cable from your network card, you should see:
35```
36eth0: onStateChanged running -> no-carrier
37nmtest0: onStateChanged running -> no-carrier
38```
39
40Plugging the cable back in should produce the following messages:
41```
42eth0: onStateChanged no-carrier -> running
43nmtest0: onStateChanged no-carrier -> running
44```
Alexander Afanasyev3b3355c2017-03-26 11:57:13 -050045
46## macOS
47
48[The following commands assume en0 is the name of an ethernet interface
49on the machine. If your interfaces are named differently, replace en0
50with the name of any ethernet interface that you have available.]
51
52Command | Expected output
53--------|----------------
54sudo ifconfig vlan1 create | `vlan1: onInterfaceAdded`
55sudo ifconfig vlan1 vlan 1 vlandev en0 | `vlan1: onStateChanged down -> running`
56sudo ifconfig vlan1 198.51.100.100/24 | `vlan1: onAddressAdded 198.51.100.100/24`
57sudo ifconfig vlan1 198.51.100.100/24 remove | `vlan1: onAddressRemoved 198.51.100.100/24`
58sudo ifconfig vlan1 inet6 2001:db8::1/80 | `vlan1: onAddressAdded 2001:db8::1/80` (and potentially link-local addresses)
59sudo ifconfig vlan1 inet6 2001:db8::1/80 remove | `vlan1: onAddressRemoved 2001:db8::1/80`
60sudo ifconfig vlan1 destroy | `vlan1: onInterfaceRemoved`
61
62If you unplug the ethernet cable from your network card, you should see:
63```
64en6: onStateChanged running -> down
65```
66
67Plugging the cable back in should produce the following messages:
68```
69en6: onStateChanged down -> running
70```