Merge ~alfonsosanchezbeato/network-manager:test-ci into network-manager:snap-1.10
- Git
- lp:~alfonsosanchezbeato/network-manager
- test-ci
- Merge into snap-1.10
Status: | Merged |
---|---|
Approved by: | Tony Espy |
Approved revision: | 44bb1fd711241a032021ea6780d926c7aff51f6e |
Merged at revision: | 068ecec4f35b4a37eb2c0abb971398fce492cee9 |
Proposed branch: | ~alfonsosanchezbeato/network-manager:test-ci |
Merge into: | network-manager:snap-1.10 |
Diff against target: |
2793 lines (+2389/-17) 50 files modified
debian/patches/series (+1/-0) debian/patches/snap-support-ppp.patch (+134/-0) docs/snap/configure-cellular-connections.md (+124/-0) docs/snap/configure-wifi-connections.md (+80/-0) docs/snap/edit-connections.md (+155/-0) docs/snap/enable-ethernet-support.md (+38/-0) docs/snap/explore-network-status.md (+52/-0) docs/snap/faq.md (+18/-0) docs/snap/index.md (+42/-0) docs/snap/installation.md (+62/-0) docs/snap/logging-messages.md (+43/-0) docs/snap/metadata.yaml (+49/-0) docs/snap/reference/available-commands.md (+19/-0) docs/snap/reference/configuration/ethernet_support.md (+47/-0) docs/snap/reference/dbus-api.md (+9/-0) docs/snap/reference/snap-configuration/debug.md (+51/-0) docs/snap/reference/snap-configuration/wifi-powersave.md (+38/-0) docs/snap/reference/snap-configuration/wowlan.md (+126/-0) docs/snap/release-notes.md (+35/-0) docs/snap/report-bug.md (+36/-0) docs/snap/routing-tables.md (+96/-0) run-tests.sh (+88/-0) snap-common/bin/snap-config.sh (+7/-8) snap-patch/resolvconf.patch (+31/-0) snap/snapcraft.yaml (+21/-9) spread.yaml (+85/-0) tests/full/correct-dns-setup/task.yaml (+47/-0) tests/full/immutable-netplan-config/task.yaml (+10/-0) tests/full/ipv6-address-assignment/task.yaml (+27/-0) tests/full/ipv6-router-advertisements/task.yaml (+70/-0) tests/full/no-netplan-default-config/task.yaml (+41/-0) tests/full/system-network-is-active/task.yaml (+9/-0) tests/full/wol-enabled-by-default/task.yaml (+60/-0) tests/lib/prepare-all.sh (+63/-0) tests/lib/prepare.sh (+46/-0) tests/lib/restore-each.sh (+40/-0) tests/lib/snap-names.sh (+7/-0) tests/lib/utilities.sh (+166/-0) tests/main/aliases/task.yaml (+13/-0) tests/main/can-exec-iptables/task.yaml (+11/-0) tests/main/debug-config-option/task.yaml (+27/-0) tests/main/documentation-builds/task.yaml (+14/-0) tests/main/ethernet-managed-by-networkmanager/task.yaml (+16/-0) tests/main/installation/task.yaml (+17/-0) tests/main/set-hostname/task.yaml (+17/-0) tests/main/static-ip-configuration/task.yaml (+49/-0) tests/main/wifi-connect-secured-ap/task.yaml (+14/-0) tests/main/wifi-powersave-config-option/task.yaml (+31/-0) tests/main/wifi-wowlan-config-option/task.yaml (+77/-0) tests/main/wifi-wowlan-enabled-correctly/task.yaml (+30/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tony Espy | Approve | ||
System Enablement Bot | continuous-integration | Approve | |
Review via email: mp+368284@code.launchpad.net |
Commit message
* Add iptables to the snap
* Do not call nmcli while NM is not running
* Add spread tests
Description of the change
* Add iptables to the snap
* Do not call nmcli while NM is not running
* Add spread tests
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:f8c29a5afb8
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:f8c29a5afb8
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:f8c29a5afb8
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:f8c29a5afb8
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:c5de2c6c3dd
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:8a5c6f56d85
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:e76b07fb22e
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Tony Espy (awe) wrote : | # |
All looks good, however I have a question about your inclusion of resolvconf in the snap:
snap: add pppd and resolconf scripts to the snap
These files cannot be accessed from the snap anymore in UC18. Note that
the resolvconf scripts will be used only when installed in a UC16
system.
I think what you mean is that "these files" are no longer accessible from the core18 base snap.
Also instead of copying the scripts directly into the snap, a better approach would be to consume the resolvconf debian package via 'stage-packages'.
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
@Tony, correct, that is what I was referring to. I have changed the commit message to reflect that, and also added an explanation on why I included the resolvconf files:
<<
snap: add pppd and resolvconf scripts to the snap
These files cannot be accessed from the snap anymore as they are not
included in the core18 base. Note that the resolvconf scripts will be
used only when installed in a UC16 system.
The resolvconf files had to be modified to use the right folders, that
is the reason for including them instead of staging from the debian
package.
>>
Tony Espy (awe) wrote : | # |
> @Tony, correct, that is what I was referring to. I have changed the commit
> message to reflect that, and also added an explanation on why I included the
> resolvconf files:
>
> <<
> snap: add pppd and resolvconf scripts to the snap
>
> These files cannot be accessed from the snap anymore as they are not
> included in the core18 base. Note that the resolvconf scripts will be
> used only when installed in a UC16 system.
>
> The resolvconf files had to be modified to use the right folders, that
> is the reason for including them instead of staging from the debian
> package.
> >>
Sure, but you couldn't you do this by applying patches to the files pulled out of the stage-package? Using your approach we're flying blind wrt to resolvconf CVEs.
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
@Tony, fair enough. Done.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:44bb1fd7112
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:44bb1fd7112
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Tony Espy (awe) wrote : | # |
Thanks for the changes, LGTM!
Tony Espy (awe) wrote : | # |
One last comment, could you use different feature name branches for your future MPs? Otherwise we end up with duplicate merge commit messages like this:
Merge remote-tracking branch 'abeato/test-ci' into snap-1.10
Preview Diff
1 | diff --git a/README.snap b/README-SNAP.txt | |||
2 | 0 | similarity index 100% | 0 | similarity index 100% |
3 | 1 | rename from README.snap | 1 | rename from README.snap |
4 | 2 | rename to README-SNAP.txt | 2 | rename to README-SNAP.txt |
5 | diff --git a/debian/patches/series b/debian/patches/series | |||
6 | index 0632066..3267d3c 100644 | |||
7 | --- a/debian/patches/series | |||
8 | +++ b/debian/patches/series | |||
9 | @@ -16,3 +16,4 @@ disable-libnm-glib-wifi-ap-test.patch | |||
10 | 16 | disable-libnm-glib-test-devices-array.patch | 16 | disable-libnm-glib-test-devices-array.patch |
11 | 17 | add-snap-support.patch | 17 | add-snap-support.patch |
12 | 18 | disable-tests-that-fail-under-launchpad-builds.patch | 18 | disable-tests-that-fail-under-launchpad-builds.patch |
13 | 19 | snap-support-ppp.patch | ||
14 | diff --git a/debian/patches/snap-support-ppp.patch b/debian/patches/snap-support-ppp.patch | |||
15 | 19 | new file mode 100644 | 20 | new file mode 100644 |
16 | index 0000000..5b13a63 | |||
17 | --- /dev/null | |||
18 | +++ b/debian/patches/snap-support-ppp.patch | |||
19 | @@ -0,0 +1,134 @@ | |||
20 | 1 | Index: build/src/ppp/nm-ppp-manager-call.c | ||
21 | 2 | =================================================================== | ||
22 | 3 | --- build.orig/src/ppp/nm-ppp-manager-call.c | ||
23 | 4 | +++ build/src/ppp/nm-ppp-manager-call.c | ||
24 | 5 | @@ -30,7 +30,7 @@ | ||
25 | 6 | #include "nm-core-utils.h" | ||
26 | 7 | #include "nm-ppp-plugin-api.h" | ||
27 | 8 | |||
28 | 9 | -#define PPP_PLUGIN_PATH NMPLUGINDIR "/libnm-ppp-plugin.so" | ||
29 | 10 | +#define PPP_PLUGIN_PATH "libnm-ppp-plugin.so" | ||
30 | 11 | |||
31 | 12 | /*****************************************************************************/ | ||
32 | 13 | |||
33 | 14 | @@ -39,42 +39,45 @@ static NMPPPOps *ppp_ops = NULL; | ||
34 | 15 | NMPPPManager * | ||
35 | 16 | nm_ppp_manager_create (const char *iface, GError **error) | ||
36 | 17 | { | ||
37 | 18 | - NMPPPManager *ret; | ||
38 | 19 | + NMPPPManager *ret = NULL; | ||
39 | 20 | GModule *plugin; | ||
40 | 21 | GError *error_local = NULL; | ||
41 | 22 | NMPPPOps *ops; | ||
42 | 23 | struct stat st; | ||
43 | 24 | int errsv; | ||
44 | 25 | + char *libnm_ppp_path; | ||
45 | 26 | + | ||
46 | 27 | + libnm_ppp_path = g_strdup_printf ("%s/%s", nm_utils_get_plugin_dir (), PPP_PLUGIN_PATH); | ||
47 | 28 | |||
48 | 29 | if (G_UNLIKELY (!ppp_ops)) { | ||
49 | 30 | - if (stat (PPP_PLUGIN_PATH, &st) != 0) { | ||
50 | 31 | + if (stat (libnm_ppp_path, &st) != 0) { | ||
51 | 32 | errsv = errno; | ||
52 | 33 | - g_set_error_literal (error, | ||
53 | 34 | - NM_MANAGER_ERROR, NM_MANAGER_ERROR_MISSING_PLUGIN, | ||
54 | 35 | - "the PPP plugin " PPP_PLUGIN_PATH " is not installed"); | ||
55 | 36 | - return NULL; | ||
56 | 37 | + g_set_error (error, | ||
57 | 38 | + NM_MANAGER_ERROR, NM_MANAGER_ERROR_MISSING_PLUGIN, | ||
58 | 39 | + "the PPP plugin %s is not installed", libnm_ppp_path); | ||
59 | 40 | + goto end; | ||
60 | 41 | } | ||
61 | 42 | |||
62 | 43 | - if (!nm_utils_validate_plugin (PPP_PLUGIN_PATH, &st, &error_local)) { | ||
63 | 44 | + if (!nm_utils_validate_plugin (libnm_ppp_path, &st, &error_local)) { | ||
64 | 45 | g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_MISSING_PLUGIN, | ||
65 | 46 | - "could not load the PPP plugin " PPP_PLUGIN_PATH ": %s", | ||
66 | 47 | - error_local->message); | ||
67 | 48 | + "could not load the PPP plugin %s: %s", | ||
68 | 49 | + libnm_ppp_path, error_local->message); | ||
69 | 50 | g_clear_error (&error_local); | ||
70 | 51 | - return NULL; | ||
71 | 52 | + goto end; | ||
72 | 53 | } | ||
73 | 54 | |||
74 | 55 | - plugin = g_module_open (PPP_PLUGIN_PATH, G_MODULE_BIND_LOCAL); | ||
75 | 56 | + plugin = g_module_open (libnm_ppp_path, G_MODULE_BIND_LOCAL); | ||
76 | 57 | if (!plugin) { | ||
77 | 58 | g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_MISSING_PLUGIN, | ||
78 | 59 | - "could not load the PPP plugin " PPP_PLUGIN_PATH ": %s", | ||
79 | 60 | - g_module_error ()); | ||
80 | 61 | - return NULL; | ||
81 | 62 | + "could not load the PPP plugin %s: %s", | ||
82 | 63 | + libnm_ppp_path, g_module_error ()); | ||
83 | 64 | + goto end; | ||
84 | 65 | } | ||
85 | 66 | |||
86 | 67 | if (!g_module_symbol (plugin, "ppp_ops", (gpointer) &ops)) { | ||
87 | 68 | g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_MISSING_PLUGIN, | ||
88 | 69 | "error loading the PPP plugin: %s", g_module_error ()); | ||
89 | 70 | - return NULL; | ||
90 | 71 | + goto end; | ||
91 | 72 | } | ||
92 | 73 | |||
93 | 74 | /* after loading glib types from the plugin, we cannot unload the library anymore. | ||
94 | 75 | @@ -90,11 +93,14 @@ nm_ppp_manager_create (const char *iface | ||
95 | 76 | |||
96 | 77 | ppp_ops = ops; | ||
97 | 78 | |||
98 | 79 | - nm_log_info (LOGD_CORE | LOGD_PPP, "loaded PPP plugin " PPP_PLUGIN_PATH); | ||
99 | 80 | + nm_log_info (LOGD_CORE | LOGD_PPP, "loaded PPP plugin %s", libnm_ppp_path); | ||
100 | 81 | } | ||
101 | 82 | |||
102 | 83 | ret = ppp_ops->create (iface); | ||
103 | 84 | g_return_val_if_fail (ret, NULL); | ||
104 | 85 | + | ||
105 | 86 | +end: | ||
106 | 87 | + g_free (libnm_ppp_path); | ||
107 | 88 | return ret; | ||
108 | 89 | } | ||
109 | 90 | |||
110 | 91 | Index: build/src/nm-core-utils.c | ||
111 | 92 | =================================================================== | ||
112 | 93 | --- build.orig/src/nm-core-utils.c | ||
113 | 94 | +++ build/src/nm-core-utils.c | ||
114 | 95 | @@ -1171,10 +1171,38 @@ const char *const NM_PATHS_DEFAULT[] = { | ||
115 | 96 | NULL, | ||
116 | 97 | }; | ||
117 | 98 | |||
118 | 99 | +const char *const * | ||
119 | 100 | +utils_get_search_paths(void) | ||
120 | 101 | +{ | ||
121 | 102 | + static char **paths; | ||
122 | 103 | + | ||
123 | 104 | + const char *snap_path; | ||
124 | 105 | + | ||
125 | 106 | + if (paths) | ||
126 | 107 | + return (const char *const *) paths; | ||
127 | 108 | + | ||
128 | 109 | + snap_path = getenv("SNAP"); | ||
129 | 110 | + if (snap_path) { | ||
130 | 111 | + unsigned np, i; | ||
131 | 112 | + | ||
132 | 113 | + np = g_strv_length((char **) NM_PATHS_DEFAULT); | ||
133 | 114 | + paths = malloc(sizeof(char *)*(np*2 + 1)); | ||
134 | 115 | + for (i = 0; i < np; ++i) { | ||
135 | 116 | + paths[i] = g_strdup_printf("%s%s", snap_path, NM_PATHS_DEFAULT[i]); | ||
136 | 117 | + paths[np + i] = g_strdup(NM_PATHS_DEFAULT[i]); | ||
137 | 118 | + } | ||
138 | 119 | + paths[2*np] = NULL; | ||
139 | 120 | + } else { | ||
140 | 121 | + paths = g_strdupv((char **) NM_PATHS_DEFAULT);; | ||
141 | 122 | + } | ||
142 | 123 | + | ||
143 | 124 | + return (const char *const *) paths; | ||
144 | 125 | +} | ||
145 | 126 | + | ||
146 | 127 | const char * | ||
147 | 128 | nm_utils_find_helper(const char *progname, const char *try_first, GError **error) | ||
148 | 129 | { | ||
149 | 130 | - return nm_utils_file_search_in_paths (progname, try_first, NM_PATHS_DEFAULT, G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, error); | ||
150 | 131 | + return nm_utils_file_search_in_paths (progname, try_first, utils_get_search_paths (), G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, error); | ||
151 | 132 | } | ||
152 | 133 | |||
153 | 134 | /*****************************************************************************/ | ||
154 | diff --git a/docs/snap/configure-cellular-connections.md b/docs/snap/configure-cellular-connections.md | |||
155 | 0 | new file mode 100644 | 135 | new file mode 100644 |
156 | index 0000000..215f2dc | |||
157 | --- /dev/null | |||
158 | +++ b/docs/snap/configure-cellular-connections.md | |||
159 | @@ -0,0 +1,124 @@ | |||
160 | 1 | --- | ||
161 | 2 | title: "Configure Cellular Connections" | ||
162 | 3 | table_of_contents: False | ||
163 | 4 | --- | ||
164 | 5 | |||
165 | 6 | # Configure Cellular Connections | ||
166 | 7 | |||
167 | 8 | Check whether a modem was properly detected via: | ||
168 | 9 | |||
169 | 10 | ``` | ||
170 | 11 | $ sudo modem-manager.mmcli -L | ||
171 | 12 | Found 1 modems: | ||
172 | 13 | /org/freedesktop/ModemManager1/Modem/0 [description] | ||
173 | 14 | ``` | ||
174 | 15 | |||
175 | 16 | In this case we have just one modem, with index 0 (the number at the end of the DBus object path). | ||
176 | 17 | |||
177 | 18 | Show detailed information about the modem: | ||
178 | 19 | |||
179 | 20 | ``` | ||
180 | 21 | $ sudo modem-manager.mmcli -m 0 | ||
181 | 22 | /org/freedesktop/ModemManager1/Modem/0 (device id '871faa978a12ccb25b9fa30d15667571ab38ed88') | ||
182 | 23 | ------------------------- | ||
183 | 24 | Hardware | manufacturer: 'ZTE INCORPORATED' | ||
184 | 25 | | model: 'MF626' | ||
185 | 26 | | revision: 'MF626V1.0.0B06' | ||
186 | 27 | | supported: 'gsm-umts' | ||
187 | 28 | | current: 'gsm-umts' | ||
188 | 29 | | equipment id: '357037039840195' | ||
189 | 30 | ------------------------- | ||
190 | 31 | System | device: '/sys/devices/pci0000:00/0000:00:01.2/usb1/1-1' | ||
191 | 32 | | drivers: 'option1' | ||
192 | 33 | | plugin: 'ZTE' | ||
193 | 34 | | primary port: 'ttyUSB3' | ||
194 | 35 | | ports: 'ttyUSB0 (qcdm), ttyUSB1 (at), ttyUSB3 (at)' | ||
195 | 36 | ------------------------- | ||
196 | 37 | Numbers | own : 'unknown' | ||
197 | 38 | ------------------------- | ||
198 | 39 | Status | lock: 'sim-pin' | ||
199 | 40 | | unlock retries: 'sim-pin (3), sim-puk (10)' | ||
200 | 41 | | state: 'locked' | ||
201 | 42 | | power state: 'on' | ||
202 | 43 | | access tech: 'unknown' | ||
203 | 44 | | signal quality: '0' (cached) | ||
204 | 45 | ------------------------- | ||
205 | 46 | Modes | supported: 'allowed: any; preferred: none' | ||
206 | 47 | | current: 'allowed: any; preferred: none' | ||
207 | 48 | ------------------------- | ||
208 | 49 | Bands | supported: 'unknown' | ||
209 | 50 | | current: 'unknown' | ||
210 | 51 | ------------------------- | ||
211 | 52 | IP | supported: 'none' | ||
212 | 53 | ------------------------- | ||
213 | 54 | SIM | path: '/org/freedesktop/ModemManager1/SIM/0' | ||
214 | 55 | |||
215 | 56 | ------------------------- | ||
216 | 57 | Bearers | paths: 'none' | ||
217 | 58 | ``` | ||
218 | 59 | |||
219 | 60 | In this case we can see that the SIM has PIN locking enabled and its state is | ||
220 | 61 | ‘locked’. To enter the PIN, we need to know the SIM index, which in this | ||
221 | 62 | case is 0 (it is the number at the end of /org/freedesktop/ModemManager1/SIM/0). | ||
222 | 63 | Once the index is known, we can enter the SIM PIN with: | ||
223 | 64 | |||
224 | 65 | ``` | ||
225 | 66 | $ sudo modem-manager.mmcli -i 0 --pin=<PIN> | ||
226 | 67 | successfully sent PIN code to the SIM | ||
227 | 68 | ``` | ||
228 | 69 | |||
229 | 70 | Some more commands for handling SIM PINs include: | ||
230 | 71 | |||
231 | 72 | ``` | ||
232 | 73 | $ sudo modem-manager.mmcli -i 0 --pin=<PIN> --enable-pin | ||
233 | 74 | $ sudo modem-manager.mmcli -i 0 --pin=<PIN> --disable-pin | ||
234 | 75 | $ sudo modem-manager.mmcli -i 0 --pin=<PIN> --change-pin=<NEW_PIN> | ||
235 | 76 | $ sudo modem-manager.mmcli -i 0 --puk=<PUK> | ||
236 | 77 | ``` | ||
237 | 78 | |||
238 | 79 | Which respectively enables PIN locking, disables PIN locking, changes the PIN code, | ||
239 | 80 | and unlocks a [PUK](https://en.wikipedia.org/wiki/Personal_unblocking_code)-locked SIM. | ||
240 | 81 | |||
241 | 82 | After that we can add a cellular connection with: | ||
242 | 83 | |||
243 | 84 | ``` | ||
244 | 85 | $ nmcli c add type gsm ifname <interface> con-name <name> apn <operator_apn> | ||
245 | 86 | $ nmcli r wwan on | ||
246 | 87 | ``` | ||
247 | 88 | |||
248 | 89 | where <interface> is the string listed as “primary port” in the output from 'sudo mmcli -m <N>' | ||
249 | 90 | (as previously described), | ||
250 | 91 | <name> is an arbitrary name used to identify the connection, and <operator_apn> is | ||
251 | 92 | the APN name for your cellular data plan. Note that <interface> is usually a serial | ||
252 | 93 | port with pattern /dev/tty*, not a networking interface. The reason for ModemManager | ||
253 | 94 | to use that instead of the networking interface is that this last one can appear/disappear | ||
254 | 95 | dynamically while the ports do not if the hardware configuration remains unchanged. | ||
255 | 96 | For instance, the networking interface can be ppp0, ppp1, etc., and it might be | ||
256 | 97 | different each time it is possible to have other ppp connections with, say, VPNs. | ||
257 | 98 | |||
258 | 99 | After executing these commands, NetworkManager will automatically try to bring up | ||
259 | 100 | the cellular connection whenever ModemManager reports that the modem has | ||
260 | 101 | registered (the state of the modem can be checked with the previously introduced | ||
261 | 102 | command “sudo modem-manager.mmcli -m <N>”). When done successfully, NetworkManager | ||
262 | 103 | will create routes for the new network interface, with less priority than | ||
263 | 104 | Ethernet or WiFi interfaces. To disable the connection, we can do: | ||
264 | 105 | |||
265 | 106 | ``` | ||
266 | 107 | $ nmcli r wwan off | ||
267 | 108 | ``` | ||
268 | 109 | |||
269 | 110 | or change the autoconnect property and turn the connection off if we need more | ||
270 | 111 | fine-grained control: | ||
271 | 112 | |||
272 | 113 | ``` | ||
273 | 114 | $ nmcli c modify <name> connection.autoconnect [yes|no] | ||
274 | 115 | $ nmcli c down <name> | ||
275 | 116 | ``` | ||
276 | 117 | |||
277 | 118 | Finally, note that we can provide the PIN (so it is entered automatically) or more | ||
278 | 119 | needed APN provisioning information when creating/modifying the WWAN connection. | ||
279 | 120 | For instance: | ||
280 | 121 | |||
281 | 122 | ``` | ||
282 | 123 | $ nmcli c add type gsm ifname <interface> con-name <name> apn <operator_apn> username <user> password <password> pin <PIN> | ||
283 | 124 | ``` | ||
284 | diff --git a/docs/snap/configure-wifi-connections.md b/docs/snap/configure-wifi-connections.md | |||
285 | 0 | new file mode 100644 | 125 | new file mode 100644 |
286 | index 0000000..4602dfd | |||
287 | --- /dev/null | |||
288 | +++ b/docs/snap/configure-wifi-connections.md | |||
289 | @@ -0,0 +1,80 @@ | |||
290 | 1 | --- | ||
291 | 2 | title: "Configure WiFi Connections" | ||
292 | 3 | table_of_contents: True | ||
293 | 4 | --- | ||
294 | 5 | |||
295 | 6 | # Configure WiFi Connections | ||
296 | 7 | |||
297 | 8 | This section explains how to establish a WiFi connection. It covers creating and | ||
298 | 9 | modyfying connections as well as directly connecting. | ||
299 | 10 | |||
300 | 11 | ## Establish a Wireless Connection | ||
301 | 12 | |||
302 | 13 | This section will show how to establish a wifi connection to the wireles | ||
303 | 14 | network. Note that directly connecting will implicitly create a connection (that | ||
304 | 15 | can be seen with "nmcli c"). The naming of such will follow "SSID N" pattern, | ||
305 | 16 | where N is a number. | ||
306 | 17 | |||
307 | 18 | First, determine the name of the WiFi interface: | ||
308 | 19 | |||
309 | 20 | ``` | ||
310 | 21 | $ nmcli d | ||
311 | 22 | DEVICE TYPE STATE CONNECTION | ||
312 | 23 | ... | ||
313 | 24 | wlan0 wifi disconnected -- | ||
314 | 25 | ``` | ||
315 | 26 | |||
316 | 27 | Make sure the WiFi radio is on (which is its default state): | ||
317 | 28 | |||
318 | 29 | ``` | ||
319 | 30 | $ nmcli r wifi on | ||
320 | 31 | ``` | ||
321 | 32 | |||
322 | 33 | Then, list the available WiFi networks: | ||
323 | 34 | |||
324 | 35 | ``` | ||
325 | 36 | $ nmcli d wifi list | ||
326 | 37 | * SSID MODE CHAN RATE SIGNAL BARS SECURITY | ||
327 | 38 | ... | ||
328 | 39 | my_wifi Infra 5 54 Mbit/s 89 ▂▄▆█ WPA2 | ||
329 | 40 | ``` | ||
330 | 41 | |||
331 | 42 | As an example, to connect to the access point 'my_wifi', you would use the | ||
332 | 43 | following command: | ||
333 | 44 | |||
334 | 45 | ``` | ||
335 | 46 | $ nmcli d wifi connect my_wifi password <password> | ||
336 | 47 | ``` | ||
337 | 48 | |||
338 | 49 | <password> is the password for the connection which needs to have 8-63 | ||
339 | 50 | characters or 64 hexadecimal characters to specify a full 256-bit key. | ||
340 | 51 | |||
341 | 52 | ## Connect to a Hidden Network | ||
342 | 53 | |||
343 | 54 | A hidden network is a normal wireless network that simply does not broadcast | ||
344 | 55 | it's SSID unless solicited. This means that its name cannot be searched and | ||
345 | 56 | must be known from some other source. | ||
346 | 57 | |||
347 | 58 | Issue the following command to create a connection associated with a hidden | ||
348 | 59 | network <ssid>: | ||
349 | 60 | |||
350 | 61 | ``` | ||
351 | 62 | $ nmcli c add type wifi con-name <name> ifname wlan0 ssid <ssid> | ||
352 | 63 | $ nmcli c modify <name> wifi-sec.key-mgmt wpa-psk wifi-sec.psk <password> | ||
353 | 64 | ``` | ||
354 | 65 | |||
355 | 66 | Now you can establish a connection by typing: | ||
356 | 67 | |||
357 | 68 | ``` | ||
358 | 69 | $ nmcli c up <name> | ||
359 | 70 | ``` | ||
360 | 71 | |||
361 | 72 | <name> is an arbitrary name given to the connection and <password> | ||
362 | 73 | is the password to the network. It needs to have between 8-63 characters or 64 | ||
363 | 74 | hexadecimal characters in order to specify a full 256-bit key. | ||
364 | 75 | |||
365 | 76 | ## Further Information | ||
366 | 77 | |||
367 | 78 | You will find further information and more detailed examples on following pages: | ||
368 | 79 | |||
369 | 80 | * <https://developer.gnome.org/NetworkManager/unstable/nmcli.html> | ||
370 | diff --git a/docs/snap/edit-connections.md b/docs/snap/edit-connections.md | |||
371 | 0 | new file mode 100644 | 81 | new file mode 100644 |
372 | index 0000000..0c9d087 | |||
373 | --- /dev/null | |||
374 | +++ b/docs/snap/edit-connections.md | |||
375 | @@ -0,0 +1,155 @@ | |||
376 | 1 | --- | ||
377 | 2 | title: "Edit Connections" | ||
378 | 3 | table_of_contents: True | ||
379 | 4 | --- | ||
380 | 5 | |||
381 | 6 | # Edit Connections | ||
382 | 7 | |||
383 | 8 | This part will show you how to use a network-manager built-in editor to modify | ||
384 | 9 | the connections as well as provide a reference for setting some of the | ||
385 | 10 | settings. | ||
386 | 11 | |||
387 | 12 | ## Using nmcli Console | ||
388 | 13 | |||
389 | 14 | Aside from offering the possibility to manage and modify the network connections | ||
390 | 15 | using the command-line, network-manager offers a built-in, interactive | ||
391 | 16 | console to achieve the same. In order to use it type: | ||
392 | 17 | |||
393 | 18 | ``` | ||
394 | 19 | $ nmcli connection edit | ||
395 | 20 | ``` | ||
396 | 21 | |||
397 | 22 | It will bring up an interactive console. In the first step you will be prompted | ||
398 | 23 | to enter the connection type. The list of valid connection types will be | ||
399 | 24 | displayed on the screen. Once you select one you will be taken to the nmcli | ||
400 | 25 | console where you have the possibility to modify its parameters. | ||
401 | 26 | |||
402 | 27 | Alternatively, if you know the valid connection types, you could jump straight | ||
403 | 28 | to the nmcli console by providing the type as a parameter: | ||
404 | 29 | |||
405 | 30 | ``` | ||
406 | 31 | $ nmcli connection edit type <type> | ||
407 | 32 | ``` | ||
408 | 33 | |||
409 | 34 | where <type> must be a valid connection type such as 'wifi'. | ||
410 | 35 | |||
411 | 36 | An attempt to edit the wifi connection type would look like: | ||
412 | 37 | |||
413 | 38 | ``` | ||
414 | 39 | $ nmcli c edit | ||
415 | 40 | |||
416 | 41 | Valid connection types: generic, 802-3-ethernet (ethernet), pppoe, | ||
417 | 42 | 802-11-wireless (wifi), wimax, gsm, cdma, infiniband, adsl, bluetooth, vpn, | ||
418 | 43 | 802-11-olpc-mesh (olpc-mesh), vlan, bond, team, bridge, bond-slave, team-slave, | ||
419 | 44 | bridge-slave, no-slave, tun, ip-tunnel, macvlan, vxlan | ||
420 | 45 | Enter connection type: wifi | ||
421 | 46 | |||
422 | 47 | ===| nmcli interactive connection editor |=== | ||
423 | 48 | |||
424 | 49 | Adding a new '802-11-wireless' connection | ||
425 | 50 | |||
426 | 51 | Type 'help' or '?' for available commands. | ||
427 | 52 | Type 'describe [<setting>.<prop>]' for detailed property description. | ||
428 | 53 | |||
429 | 54 | You may edit the following settings: connection, 802-11-wireless (wifi), | ||
430 | 55 | 802-11-wireless-security (wifi-sec), 802-1x, ipv4, ipv6 | ||
431 | 56 | nmcli> | ||
432 | 57 | ``` | ||
433 | 58 | |||
434 | 59 | From now on it is possible to edit the wifi connection settings. The list of | ||
435 | 60 | settings is provided as in the example above. The nmcli console offers a set of | ||
436 | 61 | commands that can be used to navigate between settings. To get the list of | ||
437 | 62 | available commands type 'help' or '?' | ||
438 | 63 | |||
439 | 64 | ``` | ||
440 | 65 | nmcli> ? | ||
441 | 66 | ------------------------------------------------------------------------------ | ||
442 | 67 | ---[ Main menu ]--- | ||
443 | 68 | goto [<setting> | <prop>] :: go to a setting or property | ||
444 | 69 | remove <setting>[.<prop>] | <prop> :: remove setting or reset property value | ||
445 | 70 | set [<setting>.<prop> <value>] :: set property value | ||
446 | 71 | describe [<setting>.<prop>] :: describe property | ||
447 | 72 | print [all | <setting>[.<prop>]] :: print the connection | ||
448 | 73 | verify [all | fix] :: verify the connection | ||
449 | 74 | save [persistent|temporary] :: save the connection | ||
450 | 75 | activate [<ifname>] [/<ap>|<nsp>] :: activate the connection | ||
451 | 76 | back :: go one level up (back) | ||
452 | 77 | help/? [<command>] :: print this help | ||
453 | 78 | nmcli <conf-option> <value> :: nmcli configuration | ||
454 | 79 | quit :: exit nmcli | ||
455 | 80 | ------------------------------------------------------------------------------ | ||
456 | 81 | nmcli> | ||
457 | 82 | ``` | ||
458 | 83 | |||
459 | 84 | ## Change Connection Details | ||
460 | 85 | |||
461 | 86 | This section will show how to change some of the connection details including | ||
462 | 87 | IPv4 and IPv6 settings. | ||
463 | 88 | |||
464 | 89 | It is important to understand that every option can be modified using either the | ||
465 | 90 | command-line or the editor. The advantage of the editor is that it shows which | ||
466 | 91 | options are availabe for modification in contrast to the command-line which does | ||
467 | 92 | not. | ||
468 | 93 | |||
469 | 94 | It is possible however to learn about the available settings from the | ||
470 | 95 | command-line by printing the connection details. Type: | ||
471 | 96 | |||
472 | 97 | ``` | ||
473 | 98 | $ nmcli c show <name> | ||
474 | 99 | ``` | ||
475 | 100 | |||
476 | 101 | where <name> is the connection name. | ||
477 | 102 | |||
478 | 103 | The above will bring a fairly long list of text on the terminal, therefore it is | ||
479 | 104 | best to either use a pager or grep to make the results manageable. | ||
480 | 105 | |||
481 | 106 | ### IPv4 and IPv6 Options | ||
482 | 107 | |||
483 | 108 | For example for IPv4 settings one would do: | ||
484 | 109 | |||
485 | 110 | ``` | ||
486 | 111 | $ nmcli c show <name> | grep ipv4 | ||
487 | 112 | ipv4.method: auto | ||
488 | 113 | ipv4.dns: | ||
489 | 114 | ipv4.dns-search: | ||
490 | 115 | ipv4.dns-options: (default) | ||
491 | 116 | ipv4.addresses: | ||
492 | 117 | ipv4.gateway: -- | ||
493 | 118 | ipv4.routes: | ||
494 | 119 | ipv4.route-metric: -1 | ||
495 | 120 | ipv4.ignore-auto-routes: no | ||
496 | 121 | ipv4.ignore-auto-dns: no | ||
497 | 122 | ipv4.dhcp-client-id: -- | ||
498 | 123 | ipv4.dhcp-timeout: 0 | ||
499 | 124 | ipv4.dhcp-send-hostname: yes | ||
500 | 125 | ipv4.dhcp-hostname: -- | ||
501 | 126 | ipv4.dhcp-fqdn: -- | ||
502 | 127 | ipv4.never-default: no | ||
503 | 128 | ipv4.may-fail: yes | ||
504 | 129 | ipv4.dad-timeout: -1 (default) | ||
505 | 130 | ``` | ||
506 | 131 | |||
507 | 132 | For example setting up the DNS server would require typing: | ||
508 | 133 | |||
509 | 134 | ``` | ||
510 | 135 | $ nmcli c modify <name> ipv4.dns "8.8.8.8" | ||
511 | 136 | ``` | ||
512 | 137 | |||
513 | 138 | The rest of the settings can be modified in the same fashion. | ||
514 | 139 | |||
515 | 140 | ### WiFi Powersave Option | ||
516 | 141 | |||
517 | 142 | The WiFi powersave option can have one of the following values: | ||
518 | 143 | |||
519 | 144 | | Value | Meaning | | ||
520 | 145 | |-------|---------------------------------------------------| | ||
521 | 146 | | 0 | Default | | ||
522 | 147 | | 1 | Ignore, do not touch currently configured setting | | ||
523 | 148 | | 2 | Disable | | ||
524 | 149 | | 3 | Enable | | ||
525 | 150 | |||
526 | 151 | Changing it is as simple as: | ||
527 | 152 | |||
528 | 153 | ``` | ||
529 | 154 | $ nmcli c modify <name> 802-11-wireless.powersave 2 | ||
530 | 155 | ``` | ||
531 | diff --git a/docs/snap/enable-ethernet-support.md b/docs/snap/enable-ethernet-support.md | |||
532 | 0 | new file mode 100644 | 156 | new file mode 100644 |
533 | index 0000000..1aebf45 | |||
534 | --- /dev/null | |||
535 | +++ b/docs/snap/enable-ethernet-support.md | |||
536 | @@ -0,0 +1,38 @@ | |||
537 | 1 | --- | ||
538 | 2 | title: "Enable Ethernet Support" | ||
539 | 3 | table_of_contents: False | ||
540 | 4 | --- | ||
541 | 5 | |||
542 | 6 | # Enable Ethernet Support | ||
543 | 7 | |||
544 | 8 | The default netplan configuration files in Ubuntu Core leave management of | ||
545 | 9 | Ethernet devices to networkd. Therefore, to avoid conflicts, the | ||
546 | 10 | network-manager snap does not manage Ethernet devices by default. The user has | ||
547 | 11 | to take care to enable it after installation if desired. | ||
548 | 12 | |||
549 | 13 | ## Configure System for Ethernet Support | ||
550 | 14 | |||
551 | 15 | Before following the instructions below, backup the contents of /etc/netplan to | ||
552 | 16 | be able to restore it at a later point. | ||
553 | 17 | |||
554 | 18 | Also, note that this change might lead to a system without properly configured | ||
555 | 19 | network connections, which would lead to problems accessing the device, so be | ||
556 | 20 | careful when doing this. | ||
557 | 21 | |||
558 | 22 | To enable ethernet support, you have to set the `ethernet.enable` property to | ||
559 | 23 | `true`. See how to do this [here](reference/configuration/ethernet_support.md). | ||
560 | 24 | When this is done, configuration files for netplan are created so | ||
561 | 25 | network-manager is the default netplan renderer. When set to `false` (the | ||
562 | 26 | default), the NM snap explicitly disables the management of ethernet devices to | ||
563 | 27 | avoid conflicts with networkd. | ||
564 | 28 | |||
565 | 29 | Rebooting the system will be needed for the changes to take effect. | ||
566 | 30 | |||
567 | 31 | After the reboot, NetworkManager should automatically set up attached Ethernet | ||
568 | 32 | ports or use existing netplan configuration files to setup connections. | ||
569 | 33 | |||
570 | 34 | Once logged into the system you may check the current connection status by | ||
571 | 35 | |||
572 | 36 | ``` | ||
573 | 37 | $ nmcli c show | ||
574 | 38 | ``` | ||
575 | diff --git a/docs/snap/explore-network-status.md b/docs/snap/explore-network-status.md | |||
576 | 0 | new file mode 100644 | 39 | new file mode 100644 |
577 | index 0000000..7b43950 | |||
578 | --- /dev/null | |||
579 | +++ b/docs/snap/explore-network-status.md | |||
580 | @@ -0,0 +1,52 @@ | |||
581 | 1 | --- | ||
582 | 2 | title: "Explore Network Status" | ||
583 | 3 | table_of_contents: False | ||
584 | 4 | --- | ||
585 | 5 | |||
586 | 6 | # Exploring Network Status | ||
587 | 7 | |||
588 | 8 | This section shows how to use the nmcli command-line tool to examine the status | ||
589 | 9 | of NetworkManager’s connections and devices. | ||
590 | 10 | |||
591 | 11 | Show the status of devices known to NetworkManager: | ||
592 | 12 | |||
593 | 13 | ``` | ||
594 | 14 | $ nmcli d | ||
595 | 15 | ``` | ||
596 | 16 | |||
597 | 17 | Show more information for this option: | ||
598 | 18 | |||
599 | 19 | ``` | ||
600 | 20 | $ nmcli d --help | ||
601 | 21 | ``` | ||
602 | 22 | |||
603 | 23 | Show the current status of each of NetworkManager’s connections: | ||
604 | 24 | |||
605 | 25 | ``` | ||
606 | 26 | $ nmcli c | ||
607 | 27 | ``` | ||
608 | 28 | |||
609 | 29 | Command “c” is for connections but is a abbreviated form of the real command | ||
610 | 30 | "connections". As for the devices command, “--help” shows more information for | ||
611 | 31 | this option. Finally, we can see the state of radio interfaces, including WiFi | ||
612 | 32 | and WWAN (cellular) with: | ||
613 | 33 | |||
614 | 34 | ``` | ||
615 | 35 | $ nmcli r | ||
616 | 36 | WIFI-HW WIFI WWAN-HW WWAN | ||
617 | 37 | enabled enabled enabled enabled | ||
618 | 38 | ``` | ||
619 | 39 | |||
620 | 40 | It is important to make sure that WiFi/WWAN radios are enabled so the respective | ||
621 | 41 | connection types can establish a connection (we will specify how to this in | ||
622 | 42 | following sections). As with the other commands, “--help” shows usage information. | ||
623 | 43 | |||
624 | 44 | Observe NetworkManage activity (changes in connectivity state, devices or | ||
625 | 45 | connection properties): | ||
626 | 46 | |||
627 | 47 | ``` | ||
628 | 48 | $ nmcli monitor | ||
629 | 49 | ``` | ||
630 | 50 | |||
631 | 51 | See nmcli connection monitor and nmcli device monitor to watch for changes in | ||
632 | 52 | certain connections or devices. | ||
633 | diff --git a/docs/snap/faq.md b/docs/snap/faq.md | |||
634 | 0 | new file mode 100644 | 53 | new file mode 100644 |
635 | index 0000000..ede5b21 | |||
636 | --- /dev/null | |||
637 | +++ b/docs/snap/faq.md | |||
638 | @@ -0,0 +1,18 @@ | |||
639 | 1 | --- | ||
640 | 2 | title: "FAQ" | ||
641 | 3 | table_of_contents: False | ||
642 | 4 | --- | ||
643 | 5 | |||
644 | 6 | # FAQ | ||
645 | 7 | |||
646 | 8 | This section covers some of the most commonly encountered problems and attempts | ||
647 | 9 | to provide solutions for them. | ||
648 | 10 | |||
649 | 11 | ## Ethernet devices are not used | ||
650 | 12 | |||
651 | 13 | ### Possible cause: Ethernet support is disabled for NetworkManager | ||
652 | 14 | |||
653 | 15 | By default the network-manager snap disables Ethernet support to avoid conflicts | ||
654 | 16 | with networkd/netplan which are used by default on Ubuntu Core 16. See | ||
655 | 17 | *[Enable Ethernet Support](enable-ethernet-support.md)* for details on how to | ||
656 | 18 | enable it. | ||
657 | diff --git a/docs/snap/index.md b/docs/snap/index.md | |||
658 | 0 | new file mode 100644 | 19 | new file mode 100644 |
659 | index 0000000..81dcc30 | |||
660 | --- /dev/null | |||
661 | +++ b/docs/snap/index.md | |||
662 | @@ -0,0 +1,42 @@ | |||
663 | 1 | --- | ||
664 | 2 | title: "NetworkManager" | ||
665 | 3 | table_of_contents: False | ||
666 | 4 | --- | ||
667 | 5 | |||
668 | 6 | # About NetworkManager | ||
669 | 7 | |||
670 | 8 | NetworkManager is a system network service that manages your network | ||
671 | 9 | devices and connections, attempts to keep network connectivity active | ||
672 | 10 | when available. It manages Ethernet, WiFi, mobile broadband (WWAN) and | ||
673 | 11 | PPPoE devices while also providing VPN integration with a variety of | ||
674 | 12 | different VPN serivces. | ||
675 | 13 | |||
676 | 14 | By default network management on [Ubuntu Core](https://www.ubuntu.com/core) is | ||
677 | 15 | handled by systemd's | ||
678 | 16 | [networkd](https://www.freedesktop.org/software/systemd/man/systemd-networkd.service.html) | ||
679 | 17 | and [netplan](https://launchpad.net/netplan). While NetworkManager has some | ||
680 | 18 | support to handle netplan configuration files, Ethernet support is disabled by | ||
681 | 19 | default and has to be turned on explicitly to avoid conflicts with existing | ||
682 | 20 | network configuration. | ||
683 | 21 | |||
684 | 22 | ## What NetworkManager Offers | ||
685 | 23 | |||
686 | 24 | The upstream NetworkManager project offers a wide range of features which are | ||
687 | 25 | partially available in the snap version. However, | ||
688 | 26 | as the snap should be always delivered in high quality we don't have yet all | ||
689 | 27 | upstream features enabled. | ||
690 | 28 | |||
691 | 29 | Currently we provide support for the following high level features: | ||
692 | 30 | |||
693 | 31 | * WiFi connectivity | ||
694 | 32 | * WWAN connectivity (together with ModemManager) | ||
695 | 33 | * Ethernet connectivity | ||
696 | 34 | |||
697 | 35 | Currently we do not support the following features: | ||
698 | 36 | |||
699 | 37 | * VPN | ||
700 | 38 | |||
701 | 39 | ## Upstream documentation | ||
702 | 40 | |||
703 | 41 | Existing documentation from the upstream project can be found | ||
704 | 42 | [here](https://wiki.gnome.org/Projects/NetworkManager). | ||
705 | diff --git a/docs/snap/installation.md b/docs/snap/installation.md | |||
706 | 0 | new file mode 100644 | 43 | new file mode 100644 |
707 | index 0000000..b031d79 | |||
708 | --- /dev/null | |||
709 | +++ b/docs/snap/installation.md | |||
710 | @@ -0,0 +1,62 @@ | |||
711 | 1 | --- | ||
712 | 2 | title: "Install NetworkManager" | ||
713 | 3 | table_of_contents: True | ||
714 | 4 | --- | ||
715 | 5 | |||
716 | 6 | # Install NetworkManager | ||
717 | 7 | |||
718 | 8 | The NetworkManager snap is currently available from the Ubuntu Store. It can | ||
719 | 9 | be installed on any system that supports snaps but is only recommended on | ||
720 | 10 | [Ubuntu Core](https://www.ubuntu.com/core) at the moment. | ||
721 | 11 | |||
722 | 12 | You can install the snap with the following command: | ||
723 | 13 | |||
724 | 14 | ``` | ||
725 | 15 | $ snap install network-manager | ||
726 | 16 | network-manager 1.2.2-10 from 'canonical' installed | ||
727 | 17 | ``` | ||
728 | 18 | |||
729 | 19 | Although the network-manager snap is available from other channels (candidate, beta, edge), | ||
730 | 20 | only the stable version should be used for production devices. Their meaning is internal | ||
731 | 21 | to the development team of the network-manager snap. | ||
732 | 22 | |||
733 | 23 | All necessary plugs and slots will be automatically connected within the | ||
734 | 24 | installation process. You can verify this with: | ||
735 | 25 | |||
736 | 26 | ``` | ||
737 | 27 | $ snap interfaces network-manager | ||
738 | 28 | Slot Plug | ||
739 | 29 | :network-setup-observe network-manager | ||
740 | 30 | :ppp network-manager | ||
741 | 31 | network-manager:service network-manager:nmcli | ||
742 | 32 | - network-manager:modem-manager | ||
743 | 33 | ``` | ||
744 | 34 | |||
745 | 35 | **NOTE:** The _network-manager:modem-manager_ plug only gets connected when the | ||
746 | 36 | _modem-manager_ snap is installed too. Otherwise it stays disconnected. | ||
747 | 37 | |||
748 | 38 | Once the installation has successfully finished the | ||
749 | 39 | NetworkManager service is running in the background. You can check its current | ||
750 | 40 | status with | ||
751 | 41 | |||
752 | 42 | ``` | ||
753 | 43 | $ systemctl status snap.networkmanager | ||
754 | 44 | ● snap.networkmanager.service - Service for snap application networkmanager | ||
755 | 45 | Loaded: loaded (/etc/systemd/system/snap.networkmanager.service; enabled; vendor preset: enabled) | ||
756 | 46 | Active: active (running) since Thu 2017-02-16 09:59:39 UTC; 16s ago | ||
757 | 47 | Main PID: 1389 (networkmanager) | ||
758 | 48 | [...] | ||
759 | 49 | ``` | ||
760 | 50 | |||
761 | 51 | Now you have NetworkManager successfully installed. | ||
762 | 52 | |||
763 | 53 | ## Next Steps | ||
764 | 54 | |||
765 | 55 | * [Enable Ethernet Support](enable-ethernet-support.md) | ||
766 | 56 | * [Explore Network Status](explore-network-status.md) | ||
767 | 57 | * [Configure WiFi Connections](configure-wifi-connections.md) | ||
768 | 58 | * [Configure Cellular Connections](configure-cellular-connections.md) | ||
769 | 59 | * [Edit Network Connections](edit-connections.md) | ||
770 | 60 | * [Routing Tables](routing-tables.md) | ||
771 | 61 | * [Logging Messages](logging-messages.md) | ||
772 | 62 | * [Enable Debug Support](reference/snap-configuration/debug.md) | ||
773 | diff --git a/docs/snap/logging-messages.md b/docs/snap/logging-messages.md | |||
774 | 0 | new file mode 100644 | 63 | new file mode 100644 |
775 | index 0000000..d242808 | |||
776 | --- /dev/null | |||
777 | +++ b/docs/snap/logging-messages.md | |||
778 | @@ -0,0 +1,43 @@ | |||
779 | 1 | --- | ||
780 | 2 | title: "Logging Messages" | ||
781 | 3 | table_of_contents: False | ||
782 | 4 | --- | ||
783 | 5 | |||
784 | 6 | # Logging Messages | ||
785 | 7 | |||
786 | 8 | This section will show how to modify the logging levels by NetworkManager. | ||
787 | 9 | |||
788 | 10 | NetworkManager supports on the fly changing of the logging levels and allows for | ||
789 | 11 | a fine control over what is logged. | ||
790 | 12 | |||
791 | 13 | First check what is the current logging setup, type: | ||
792 | 14 | |||
793 | 15 | ``` | ||
794 | 16 | $ nmcli general logging | ||
795 | 17 | ``` | ||
796 | 18 | |||
797 | 19 | As a result you will be presented with the information about the current | ||
798 | 20 | configuration: | ||
799 | 21 | |||
800 | 22 | ``` | ||
801 | 23 | LEVEL DOMAINS | ||
802 | 24 | INFO PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6,AUTOIP4,DNS,VPN,SHARING,SUPPLICANT,AGENTS,SETTINGS,SUSPEND,CORE,DEVICE,OLPC,INFINIBAND,FIREWALL,ADSL,BOND,VLAN,BRIDGE,TEAM,CONCHECK,DCB,DISPATCH,AUDIT,SYSTEMD | ||
803 | 25 | ``` | ||
804 | 26 | |||
805 | 27 | It is possible to change the level either globally or for each domain | ||
806 | 28 | separately. The command to achieve this is: | ||
807 | 29 | |||
808 | 30 | ``` | ||
809 | 31 | $ nmcli general logging [level <level> [domain <domain>]] | ||
810 | 32 | ``` | ||
811 | 33 | |||
812 | 34 | The <level> is the desired log level. You can choose from the following: | ||
813 | 35 | |||
814 | 36 | * **ERR:** will log only critical errors | ||
815 | 37 | * **WARN:** will log warnin messages | ||
816 | 38 | * **INFO:** will log various informational messages | ||
817 | 39 | * **DEBUG:** enables verbose logging for debugging purposes | ||
818 | 40 | |||
819 | 41 | <domain> is the category of messages that shall be logged with given | ||
820 | 42 | severity. **WIFI** will include only WiFi related messages, **IP4** will include | ||
821 | 43 | only IPv4 related messages and so on.. | ||
822 | diff --git a/docs/snap/metadata.yaml b/docs/snap/metadata.yaml | |||
823 | 0 | new file mode 100644 | 44 | new file mode 100644 |
824 | index 0000000..82bf35f | |||
825 | --- /dev/null | |||
826 | +++ b/docs/snap/metadata.yaml | |||
827 | @@ -0,0 +1,49 @@ | |||
828 | 1 | site_title: NetworkManager documentation | ||
829 | 2 | site_logo_url: https://assets.ubuntu.com/v1/c5cb0f8e-picto-ubuntu.svg | ||
830 | 3 | navigation: | ||
831 | 4 | - title: Introduction | ||
832 | 5 | children: | ||
833 | 6 | - title: About NetworkManager | ||
834 | 7 | location: index.md | ||
835 | 8 | - title: Install & Configure | ||
836 | 9 | children: | ||
837 | 10 | - title: Install NetworkManager | ||
838 | 11 | location: installation.md | ||
839 | 12 | - title: Explore Network Status | ||
840 | 13 | location: explore-network-status.md | ||
841 | 14 | - title: Configure WiFi Connections | ||
842 | 15 | location: configure-wifi-connections.md | ||
843 | 16 | - title: Configure Cellular Connections | ||
844 | 17 | location: configure-cellular-connections.md | ||
845 | 18 | - title: Enable Ethernet Support | ||
846 | 19 | location: enable-ethernet-support.md | ||
847 | 20 | - title: Edit Connections | ||
848 | 21 | location: edit-connections.md | ||
849 | 22 | - title: Routing Tables | ||
850 | 23 | location: routing-tables.md | ||
851 | 24 | - title: Logging Messages | ||
852 | 25 | location: logging-messages.md | ||
853 | 26 | - title: Reference | ||
854 | 27 | children: | ||
855 | 28 | - title: Snap Configuration | ||
856 | 29 | children: | ||
857 | 30 | - title: Ethernet Support | ||
858 | 31 | location: reference/configuration/ethernet_support.md | ||
859 | 32 | - title: Debug | ||
860 | 33 | location: reference/snap-configuration/debug.md | ||
861 | 34 | - title: Wake on WLAN | ||
862 | 35 | location: reference/snap-configuration/wowlan.md | ||
863 | 36 | - title: WiFi Powersave | ||
864 | 37 | location: reference/snap-configuration/wifi-powersave.md | ||
865 | 38 | - title: Available Commands | ||
866 | 39 | location: reference/available-commands.md | ||
867 | 40 | - title: DBUS API | ||
868 | 41 | location: reference/dbus-api.md | ||
869 | 42 | - title: Troubleshoot | ||
870 | 43 | children: | ||
871 | 44 | - title: FAQ | ||
872 | 45 | location: faq.md | ||
873 | 46 | - title: Release Notes | ||
874 | 47 | location: release-notes.md | ||
875 | 48 | - title: Report a Bug | ||
876 | 49 | location: report-bug.md | ||
877 | diff --git a/docs/snap/reference/available-commands.md b/docs/snap/reference/available-commands.md | |||
878 | 0 | new file mode 100644 | 50 | new file mode 100644 |
879 | index 0000000..18b3cec | |||
880 | --- /dev/null | |||
881 | +++ b/docs/snap/reference/available-commands.md | |||
882 | @@ -0,0 +1,19 @@ | |||
883 | 1 | --- | ||
884 | 2 | title: Available Commands | ||
885 | 3 | table_of_contents: true | ||
886 | 4 | --- | ||
887 | 5 | |||
888 | 6 | # Available Commands | ||
889 | 7 | |||
890 | 8 | The NetworkManager upstream project comes with a few commands which can be used | ||
891 | 9 | to control and manage the NetworkManager service. This page gives a short overview | ||
892 | 10 | of those commands which are available as part of the snap and what they are used for. | ||
893 | 11 | Further details about their usage is given on linked pages. | ||
894 | 12 | |||
895 | 13 | ## nmcli | ||
896 | 14 | |||
897 | 15 | The nmcli command offers a command-line based way to control and manage the | ||
898 | 16 | NetworkManager service. | ||
899 | 17 | |||
900 | 18 | An explanatory description of the command and available options are available | ||
901 | 19 | [here](https://developer.gnome.org/NetworkManager/1.2/nmcli.html) | ||
902 | diff --git a/docs/snap/reference/configuration/ethernet_support.md b/docs/snap/reference/configuration/ethernet_support.md | |||
903 | 0 | new file mode 100644 | 20 | new file mode 100644 |
904 | index 0000000..fbc5929 | |||
905 | --- /dev/null | |||
906 | +++ b/docs/snap/reference/configuration/ethernet_support.md | |||
907 | @@ -0,0 +1,47 @@ | |||
908 | 1 | --- | ||
909 | 2 | title: Ethernet Support | ||
910 | 3 | table_of_contents: true | ||
911 | 4 | --- | ||
912 | 5 | |||
913 | 6 | # Ethernet Support | ||
914 | 7 | |||
915 | 8 | *Available since:* 1.2.2-12 | ||
916 | 9 | |||
917 | 10 | The NetworkManager snap provides a configuration option to adjust | ||
918 | 11 | if it should manage ethernet network connections. | ||
919 | 12 | |||
920 | 13 | By default the NetworkManager snap **does not** manage ethernet network | ||
921 | 14 | devices as it would conflict with the default network management in | ||
922 | 15 | Ubuntu Core which is handled by [netplan](https://launchpad.net/netplan) and | ||
923 | 16 | [networkd](https://www.freedesktop.org/software/systemd/man/systemd-networkd.service.html). | ||
924 | 17 | |||
925 | 18 | ## Enable Ethernet Support | ||
926 | 19 | |||
927 | 20 | To enable management of ethernet network devices the snap provides the | ||
928 | 21 | *ethernet.enable* configuration option. | ||
929 | 22 | |||
930 | 23 | This configuration option accepts the following values | ||
931 | 24 | |||
932 | 25 | * **false (default):** Ethernet support is disabled. All network | ||
933 | 26 | devices matching the expression 'en*' or 'eth*' will be ignored. | ||
934 | 27 | * **true:** All ethernet devices available on the system will be | ||
935 | 28 | managed by NetworkManager. networkd will not manage any of these | ||
936 | 29 | anymore. | ||
937 | 30 | |||
938 | 31 | Changing the *ethernet* configuration option needs a reboot of the | ||
939 | 32 | device it's running on. | ||
940 | 33 | |||
941 | 34 | After the device has rebooted ethernet support is enabled NetworkManager will | ||
942 | 35 | take over management of all available ethernet network devices on the device. | ||
943 | 36 | |||
944 | 37 | NetworkManager will reuse existing configurations files from */etc/netplan* | ||
945 | 38 | when ethernet support is enabled. Those will marked as immutable inside | ||
946 | 39 | NetworkManager and any changes need to be written manually into the relevant | ||
947 | 40 | files in */etc/netplan*. | ||
948 | 41 | |||
949 | 42 | Example: | ||
950 | 43 | |||
951 | 44 | ``` | ||
952 | 45 | $ snap set network-manager ethernet.enable=true | ||
953 | 46 | $ sudo reboot | ||
954 | 47 | ``` | ||
955 | diff --git a/docs/snap/reference/dbus-api.md b/docs/snap/reference/dbus-api.md | |||
956 | 0 | new file mode 100644 | 48 | new file mode 100644 |
957 | index 0000000..7cece10 | |||
958 | --- /dev/null | |||
959 | +++ b/docs/snap/reference/dbus-api.md | |||
960 | @@ -0,0 +1,9 @@ | |||
961 | 1 | --- | ||
962 | 2 | title: "DBUS API" | ||
963 | 3 | table_of_contents: False | ||
964 | 4 | --- | ||
965 | 5 | |||
966 | 6 | # DBUS API | ||
967 | 7 | |||
968 | 8 | Documentation of the DBus API is provided by the NetworkManager upstream project | ||
969 | 9 | [here](https://developer.gnome.org/NetworkManager/1.2/spec.html). | ||
970 | diff --git a/docs/snap/reference/snap-configuration/debug.md b/docs/snap/reference/snap-configuration/debug.md | |||
971 | 0 | new file mode 100644 | 10 | new file mode 100644 |
972 | index 0000000..e16d17c | |||
973 | --- /dev/null | |||
974 | +++ b/docs/snap/reference/snap-configuration/debug.md | |||
975 | @@ -0,0 +1,51 @@ | |||
976 | 1 | --- | ||
977 | 2 | title: Debug | ||
978 | 3 | table_of_contents: True | ||
979 | 4 | --- | ||
980 | 5 | |||
981 | 6 | # Debug | ||
982 | 7 | |||
983 | 8 | Debug is a feature that controls the amount of logs produced by the network-manager | ||
984 | 9 | snap. It is useful for collecting information required to either report a bug or | ||
985 | 10 | investigate a network-manager failure (if happens). | ||
986 | 11 | |||
987 | 12 | It is disabled by default and has to be explicitely turned on for usage. | ||
988 | 13 | |||
989 | 14 | Note that the debug logs may contain sensitive information. | ||
990 | 15 | |||
991 | 16 | ## Enable Debug | ||
992 | 17 | |||
993 | 18 | The network-manager snap provides a single configuration option which can be used to | ||
994 | 19 | turn the debug feature either on or off: | ||
995 | 20 | |||
996 | 21 | * **debug.enable** | ||
997 | 22 | |||
998 | 23 | The option takes a boolean value. The meaning of the possible values are: | ||
999 | 24 | |||
1000 | 25 | * **true:** Enable logging debug information | ||
1001 | 26 | * **false (default):** Disable logging debug information | ||
1002 | 27 | |||
1003 | 28 | Changing the **debug** configuration option has immediate effect and also | ||
1004 | 29 | affects future executions of the NM daemon. | ||
1005 | 30 | |||
1006 | 31 | **Example:** Enable debug feature | ||
1007 | 32 | |||
1008 | 33 | ``` | ||
1009 | 34 | $ snap set network-manager debug.enable=true | ||
1010 | 35 | ``` | ||
1011 | 36 | |||
1012 | 37 | <br/> | ||
1013 | 38 | **Example:** Disable debug feature. | ||
1014 | 39 | |||
1015 | 40 | ``` | ||
1016 | 41 | $ snap set network-manager debug.enable=false | ||
1017 | 42 | ``` | ||
1018 | 43 | |||
1019 | 44 | ## Viewing logs | ||
1020 | 45 | |||
1021 | 46 | The debug information, when enabled, will be available in the journal and can | ||
1022 | 47 | be viewed with: | ||
1023 | 48 | |||
1024 | 49 | ``` | ||
1025 | 50 | $ journalctl --no-pager -u snap.network-manager.networkmanager.service | ||
1026 | 51 | ``` | ||
1027 | diff --git a/docs/snap/reference/snap-configuration/wifi-powersave.md b/docs/snap/reference/snap-configuration/wifi-powersave.md | |||
1028 | 0 | new file mode 100644 | 52 | new file mode 100644 |
1029 | index 0000000..8b9e68f | |||
1030 | --- /dev/null | |||
1031 | +++ b/docs/snap/reference/snap-configuration/wifi-powersave.md | |||
1032 | @@ -0,0 +1,38 @@ | |||
1033 | 1 | --- | ||
1034 | 2 | title: WiFi Powersave | ||
1035 | 3 | table_of_contents: True | ||
1036 | 4 | --- | ||
1037 | 5 | |||
1038 | 6 | # WiFi Powersave | ||
1039 | 7 | |||
1040 | 8 | WiFi Powersave is a feature that allows a device to suspend its radio activity | ||
1041 | 9 | after a fixed period of inactivity. The device remains idle for a fixed time, | ||
1042 | 10 | usualy about 100ms, and once it is reached it wakes up to check if the | ||
1043 | 11 | infrastructure has any packets queued up for it. | ||
1044 | 12 | |||
1045 | 13 | The NetworkManager snap allows to configure this option by either enabling or | ||
1046 | 14 | disabling the powersave feature. | ||
1047 | 15 | |||
1048 | 16 | You can read more about the WiFi Powersave feature on the following sites: | ||
1049 | 17 | |||
1050 | 18 | * | ||
1051 | 19 | <https://wireless.wiki.kernel.org/en/developers/documentation/ieee80211/power-savings> | ||
1052 | 20 | |||
1053 | 21 | ### Enable WiFi Powersave | ||
1054 | 22 | |||
1055 | 23 | To allow users to enable or disable WiFi Powersave, the snap provides a single | ||
1056 | 24 | configuration option: | ||
1057 | 25 | |||
1058 | 26 | * wifi.powersave | ||
1059 | 27 | |||
1060 | 28 | Option can be set via the configuration API snaps provide. See | ||
1061 | 29 | <https://docs.ubuntu.com/core/en/guides/build-device/config-hooks> for more | ||
1062 | 30 | details. | ||
1063 | 31 | |||
1064 | 32 | #### wifi.powersave | ||
1065 | 33 | |||
1066 | 34 | This configuration option accepts the following values: | ||
1067 | 35 | |||
1068 | 36 | * **disabled (default):** WiFi powersaving is disabled | ||
1069 | 37 | * **enabled:** WiFi powersaving is enabled | ||
1070 | 38 | |||
1071 | diff --git a/docs/snap/reference/snap-configuration/wowlan.md b/docs/snap/reference/snap-configuration/wowlan.md | |||
1072 | 0 | new file mode 100644 | 39 | new file mode 100644 |
1073 | index 0000000..2ae0791 | |||
1074 | --- /dev/null | |||
1075 | +++ b/docs/snap/reference/snap-configuration/wowlan.md | |||
1076 | @@ -0,0 +1,126 @@ | |||
1077 | 1 | --- | ||
1078 | 2 | title: Wake on WLAN | ||
1079 | 3 | table_of_contents: True | ||
1080 | 4 | --- | ||
1081 | 5 | |||
1082 | 6 | # Wake on WLAN | ||
1083 | 7 | |||
1084 | 8 | *Available since:* 1.2.2-11 | ||
1085 | 9 | |||
1086 | 10 | Wake on WLAN (called WoWLAN in the following) is a feature which allows a device | ||
1087 | 11 | to be woken up from standby power states to faciliate device management. It is based | ||
1088 | 12 | on the well well-established standard for Wake on LAN. The functionality is not entirely | ||
1089 | 13 | equivalent to Wake on LAN and there are some limitations. | ||
1090 | 14 | |||
1091 | 15 | The NetworkManager snap allows its users to configure one or more triggers to allow | ||
1092 | 16 | the device it operates on to be woken up remotely. | ||
1093 | 17 | |||
1094 | 18 | An important precondition for WoWLAN to work is that your device's kernel WiFi driver | ||
1095 | 19 | has support for it. If it is has support for WoWLAN it may only support a subset | ||
1096 | 20 | of possible triggers. | ||
1097 | 21 | |||
1098 | 22 | You can read more about the kernel side implementation on the following sites: | ||
1099 | 23 | |||
1100 | 24 | * <https://wireless.wiki.kernel.org/en/users/documentation/wowlan> | ||
1101 | 25 | |||
1102 | 26 | ### Enable Wake on WLAN Globally | ||
1103 | 27 | |||
1104 | 28 | To allow users to enable or disable WoWLAN, the snap provides two configuration | ||
1105 | 29 | options: | ||
1106 | 30 | |||
1107 | 31 | * **wifi.wake-on-wlan** | ||
1108 | 32 | * **wifi.wake-on-wlan-password** | ||
1109 | 33 | |||
1110 | 34 | Both options can be set via the configuration API snaps provide. See | ||
1111 | 35 | <https://docs.ubuntu.com/core/en/guides/build-device/config-hooks> for more | ||
1112 | 36 | details. | ||
1113 | 37 | |||
1114 | 38 | Both configuration options will affect all wireless network devices. If you | ||
1115 | 39 | want to change it just for a single wireless connection please have a look at | ||
1116 | 40 | the chapter [Per Connection Configuration](#per-connection-configuration) below. | ||
1117 | 41 | |||
1118 | 42 | |||
1119 | 43 | #### wifi.wake-on-wlan | ||
1120 | 44 | |||
1121 | 45 | This configuration option accepts the following values: | ||
1122 | 46 | |||
1123 | 47 | * **disabled (default):** Wake on WLAN is disabled for all wireless network devices. | ||
1124 | 48 | * **any:** Wake on WLAN is enabled and any possible trigger will cause the system to wake up. | ||
1125 | 49 | * **disconnect:** If a connection to a station gets disconnected the device will be woken up. | ||
1126 | 50 | * **magic:** Wake on WLAN is enabled and only a received magic packet will cause the | ||
1127 | 51 | system to wake up. The magic packet has the same structure as the one | ||
1128 | 52 | used for Wake on LAN. For more details see <https://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet> | ||
1129 | 53 | The content of the magic packet can be extended with the | ||
1130 | 54 | wifi.wake-on-wlan-password option to require the client to send a | ||
1131 | 55 | specific byte sequence functioning as a password so that not anyone | ||
1132 | 56 | unpriviledged can wake up the system. | ||
1133 | 57 | * **gtk-rekey-failure:** A failure of a GTK rekey operation will cause the device to wake up. | ||
1134 | 58 | * **4way-handshake:** Reiteration of the 4way handshake will cause the device to wake up. | ||
1135 | 59 | * **rfkill-release:** Release of a rfkill will cause the device to wake up. | ||
1136 | 60 | * **tcp:** Any incoming TCP packet will cause the device to wake up. | ||
1137 | 61 | |||
1138 | 62 | Example: | ||
1139 | 63 | |||
1140 | 64 | ``` | ||
1141 | 65 | $ snap set network-manager wifi.wake-on-wlan=magic | ||
1142 | 66 | ``` | ||
1143 | 67 | |||
1144 | 68 | #### wifi.wake-on-wlan-password | ||
1145 | 69 | |||
1146 | 70 | This configuration option accepts a textual value. If specified, the value will | ||
1147 | 71 | be used in addition to the wireless device MAC address to function as a password | ||
1148 | 72 | that disallows unpriviledged actors to wake up the device. | ||
1149 | 73 | |||
1150 | 74 | Example: | ||
1151 | 75 | |||
1152 | 76 | ``` | ||
1153 | 77 | $ snap set network-manager wifi.wake-on-wlan-password=MyPassword | ||
1154 | 78 | ``` | ||
1155 | 79 | </br> | ||
1156 | 80 | ### Per Connection Configuration | ||
1157 | 81 | |||
1158 | 82 | To configure WoWLAN per connection you have to use the *nmcli* utility which comes | ||
1159 | 83 | with the NetworkManager snap. It allows you to configure the same two options | ||
1160 | 84 | as the snap accepts. However, the *wifi.wake-on-wlan* option takes a numeric value | ||
1161 | 85 | instead of a textual one. | ||
1162 | 86 | |||
1163 | 87 | The *wifi.wake-on-wlan* option accepts the following values (see above for a detailed | ||
1164 | 88 | description of each value) | ||
1165 | 89 | |||
1166 | 90 | * **0:** disabled | ||
1167 | 91 | * **1:** Use global default configuration | ||
1168 | 92 | * **2:** any | ||
1169 | 93 | * **4:** disconnect | ||
1170 | 94 | * **8:** magic | ||
1171 | 95 | * **16:** gtk-rekey-failure | ||
1172 | 96 | * **32:** 4way-handshake | ||
1173 | 97 | * **128:** rfkill-release | ||
1174 | 98 | * **256:** tcp | ||
1175 | 99 | |||
1176 | 100 | The *wifi.wake-on-wlan-password* option accepts the same values as the snap | ||
1177 | 101 | configuration option. | ||
1178 | 102 | |||
1179 | 103 | Example: | ||
1180 | 104 | |||
1181 | 105 | ``` | ||
1182 | 106 | $ nmcli c modify my-connection wifi.wake-on-wlan 2 | ||
1183 | 107 | $ nmcli c modify my-connection wifi.wake-on-wlan-password Test1234 | ||
1184 | 108 | ``` | ||
1185 | 109 | </br> | ||
1186 | 110 | ### Verify WoWLAN Configuration | ||
1187 | 111 | |||
1188 | 112 | NetworkManager will use the kernel to configure WoWLAN on the hardware level. | ||
1189 | 113 | The *iw* utility provides a simple way to verify the right option is configured. | ||
1190 | 114 | |||
1191 | 115 | If you don't have the *iw* utility on your system you can install it with the | ||
1192 | 116 | *wireless-tools* snap. | ||
1193 | 117 | |||
1194 | 118 | ``` | ||
1195 | 119 | $ snap install --devmode wireless-tools | ||
1196 | 120 | $ sudo wireless-tools.iw phy phy0 wowlan show | ||
1197 | 121 | WoWLAN is enabled: | ||
1198 | 122 | * wake up on magic packet | ||
1199 | 123 | ``` | ||
1200 | 124 | |||
1201 | 125 | See the help output of the *iw* command for more documentation and available | ||
1202 | 126 | options. | ||
1203 | diff --git a/docs/snap/release-notes.md b/docs/snap/release-notes.md | |||
1204 | 0 | new file mode 100644 | 127 | new file mode 100644 |
1205 | index 0000000..8a96cee | |||
1206 | --- /dev/null | |||
1207 | +++ b/docs/snap/release-notes.md | |||
1208 | @@ -0,0 +1,35 @@ | |||
1209 | 1 | --- | ||
1210 | 2 | title: "Release Notes" | ||
1211 | 3 | table_of_contents: False | ||
1212 | 4 | --- | ||
1213 | 5 | |||
1214 | 6 | # Release Notes | ||
1215 | 7 | |||
1216 | 8 | The version numbers mentioned on this page correspond to those released in the | ||
1217 | 9 | Ubuntu snap store. | ||
1218 | 10 | |||
1219 | 11 | You can check with the following command which version you have currently | ||
1220 | 12 | installed: | ||
1221 | 13 | |||
1222 | 14 | ``` | ||
1223 | 15 | $ snap info network-manager | ||
1224 | 16 | name: network-manager | ||
1225 | 17 | summary: "Network management based on NeworkManager" | ||
1226 | 18 | publisher: canonical | ||
1227 | 19 | description: | | ||
1228 | 20 | Network management of wired Ethernet, WiFi and mobile data connection based on | ||
1229 | 21 | NetworkManager and ModemManager | ||
1230 | 22 | commands: | ||
1231 | 23 | - nmcli | ||
1232 | 24 | tracking: stable | ||
1233 | 25 | installed: 1.2.2-10 (73) 5MB - | ||
1234 | 26 | [...] | ||
1235 | 27 | ``` | ||
1236 | 28 | </br> | ||
1237 | 29 | ## 1.2.2-11 | ||
1238 | 30 | |||
1239 | 31 | * Wake-on-WLAN can be configured via snap/nmcli | ||
1240 | 32 | * Automatic reconfiguration of network devices when device comes back from a | ||
1241 | 33 | low power state | ||
1242 | 34 | * Snap alias available for nmcli | ||
1243 | 35 | * WiFi powersave is configurable via snap configuration | ||
1244 | diff --git a/docs/snap/report-bug.md b/docs/snap/report-bug.md | |||
1245 | 0 | new file mode 100644 | 36 | new file mode 100644 |
1246 | index 0000000..ba02a2e | |||
1247 | --- /dev/null | |||
1248 | +++ b/docs/snap/report-bug.md | |||
1249 | @@ -0,0 +1,36 @@ | |||
1250 | 1 | --- | ||
1251 | 2 | title: "Report a Bug" | ||
1252 | 3 | table_of_contents: False | ||
1253 | 4 | --- | ||
1254 | 5 | |||
1255 | 6 | # Report a Bug | ||
1256 | 7 | |||
1257 | 8 | Bugs can be reported [here](https://bugs.launchpad.net/snappy-hwe-snaps/+filebug). | ||
1258 | 9 | |||
1259 | 10 | When submitting a bug report, please attach system log coming from the journal: | ||
1260 | 11 | |||
1261 | 12 | * $ journalctl --no-pager > system-log | ||
1262 | 13 | |||
1263 | 14 | And the output of the following two commands: | ||
1264 | 15 | |||
1265 | 16 | ``` | ||
1266 | 17 | $ nmcli d | ||
1267 | 18 | $ nmcli c | ||
1268 | 19 | ``` | ||
1269 | 20 | |||
1270 | 21 | It is a good idea to set the log level to DEBUG so that the verbose information | ||
1271 | 22 | is provided. To do this for NetworkManager please see the [Logging Messages](logging-messages.md) | ||
1272 | 23 | page. | ||
1273 | 24 | |||
1274 | 25 | If there is a modem and the modem-manager snap is installed, also add the output | ||
1275 | 26 | of | ||
1276 | 27 | |||
1277 | 28 | ``` | ||
1278 | 29 | $ sudo modem-manager.mmcli -m <N> | ||
1279 | 30 | ``` | ||
1280 | 31 | |||
1281 | 32 | With being <N> the modem number as reported by | ||
1282 | 33 | |||
1283 | 34 | ``` | ||
1284 | 35 | $ sudo modem-manager.mmcli -L | ||
1285 | 36 | ``` | ||
1286 | diff --git a/docs/snap/routing-tables.md b/docs/snap/routing-tables.md | |||
1287 | 0 | new file mode 100644 | 37 | new file mode 100644 |
1288 | index 0000000..85b4ff8 | |||
1289 | --- /dev/null | |||
1290 | +++ b/docs/snap/routing-tables.md | |||
1291 | @@ -0,0 +1,96 @@ | |||
1292 | 1 | --- | ||
1293 | 2 | title: "Routing Tables" | ||
1294 | 3 | table_of_contents: True | ||
1295 | 4 | --- | ||
1296 | 5 | |||
1297 | 6 | # Routing Tables | ||
1298 | 7 | |||
1299 | 8 | This section describes the way to setup routing table as well as it explains the | ||
1300 | 9 | logic used to prioritize interfaces. | ||
1301 | 10 | |||
1302 | 11 | The routing table is stored in the kernel which merely acts upon it. The route | ||
1303 | 12 | itself is set by the user-space tools. There is no preference as any tool | ||
1304 | 13 | created for this reason will do. It can be either a DHCP client, ip command or | ||
1305 | 14 | route command. | ||
1306 | 15 | |||
1307 | 16 | It is important to understand that NetworkManager changes the routing table | ||
1308 | 17 | whenever it creates a new connection. | ||
1309 | 18 | |||
1310 | 19 | Routing table acts as a junction and is there to show where the different | ||
1311 | 20 | network subnets will be routed to. An example of a routing table is shown below. | ||
1312 | 21 | |||
1313 | 22 | ``` | ||
1314 | 23 | $ ip route | ||
1315 | 24 | default via 10.0.0.1 dev wlp3s0 proto static metric 600 | ||
1316 | 25 | 10.0.0.0/24 dev wlp3s0 proto kernel scope link src 10.0.0.73 metric 600 | ||
1317 | 26 | 10.0.1.0/24 dev lxcbr0 proto kernel scope link src 10.0.1.1 | ||
1318 | 27 | 169.254.0.0/16 dev docker0 scope link metric 1000 linkdown | ||
1319 | 28 | 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown | ||
1320 | 29 | 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown | ||
1321 | 30 | ``` | ||
1322 | 31 | |||
1323 | 32 | The first column is the <Destination> subnet with the "default" being a | ||
1324 | 33 | wildcard for everything else. The "via" fragment points to the <Gateway> | ||
1325 | 34 | however when it is missing it indicates that that network is connected directly | ||
1326 | 35 | and instead it describes a source address. | ||
1327 | 36 | |||
1328 | 37 | The <Metric> column translates to the number of hops required to reach the | ||
1329 | 38 | destination and is used to determine which route shall be preferred when there | ||
1330 | 39 | are more than one route available for a specific destination. Since it | ||
1331 | 40 | reassembles the concept of distance the lower it's value is the better. | ||
1332 | 41 | |||
1333 | 42 | The <Metric> value can be set manually however when NetworkManager creates | ||
1334 | 43 | a connection the following defaults are applied: | ||
1335 | 44 | |||
1336 | 45 | * Ethernet is preferred over WiFi | ||
1337 | 46 | * WiFi is preferred over WWAN | ||
1338 | 47 | |||
1339 | 48 | # Editing the Routing Tables | ||
1340 | 49 | |||
1341 | 50 | The routing table can be added or modified using the standard *ip* command which | ||
1342 | 51 | is available on Ubuntu Core. | ||
1343 | 52 | |||
1344 | 53 | You can find more information on it on the following page: | ||
1345 | 54 | |||
1346 | 55 | * <https://linux.die.net/man/8/ip?> | ||
1347 | 56 | |||
1348 | 57 | Separately it is possible to modify routing information per single connection | ||
1349 | 58 | using the nmcli tool. The parameters such as: gateway, routes and metrics can be | ||
1350 | 59 | modified. | ||
1351 | 60 | |||
1352 | 61 | The following options are responsible: | ||
1353 | 62 | |||
1354 | 63 | ``` | ||
1355 | 64 | ipv4.gateway: | ||
1356 | 65 | ipv4.routes: | ||
1357 | 66 | ipv4.route-metric: | ||
1358 | 67 | |||
1359 | 68 | ipv6.gateway: | ||
1360 | 69 | ipv6.routes: | ||
1361 | 70 | ipv6.route-metric: | ||
1362 | 71 | ``` | ||
1363 | 72 | |||
1364 | 73 | These options can be modified in a following way: | ||
1365 | 74 | |||
1366 | 75 | ``` | ||
1367 | 76 | $ nmcli connection modify <name> +ipv4.routes <destination> ipv4.gateway <gateway> | ||
1368 | 77 | $ nmcli connection modify <name> ipv4.route-metric <metric> | ||
1369 | 78 | ``` | ||
1370 | 79 | |||
1371 | 80 | Where <name> is the connection name. You can obtain it by listing | ||
1372 | 81 | available connections on the system: | ||
1373 | 82 | |||
1374 | 83 | ``` | ||
1375 | 84 | $ nmcli c show | ||
1376 | 85 | ``` | ||
1377 | 86 | |||
1378 | 87 | <destination> is the destination network provided as a static IP address, | ||
1379 | 88 | subnet or "default". <gateway> is the new gateway information. | ||
1380 | 89 | <metric> is the new metric information. | ||
1381 | 90 | |||
1382 | 91 | Note that this kind of changes can be made separately for each connection thus | ||
1383 | 92 | it is possible to provide a fine grained control over how the packets directed | ||
1384 | 93 | to different networks are routed. | ||
1385 | 94 | |||
1386 | 95 | It is also important to understand that bringing up and down connections with | ||
1387 | 96 | different values set for these options is in fact changing the routing table. | ||
1388 | diff --git a/run-tests.sh b/run-tests.sh | |||
1389 | 0 | new file mode 100755 | 97 | new file mode 100755 |
1390 | index 0000000..7ce726e | |||
1391 | --- /dev/null | |||
1392 | +++ b/run-tests.sh | |||
1393 | @@ -0,0 +1,88 @@ | |||
1394 | 1 | #!/bin/bash | ||
1395 | 2 | # | ||
1396 | 3 | # Copyright (C) 2016 Canonical Ltd | ||
1397 | 4 | # | ||
1398 | 5 | # This program is free software: you can redistribute it and/or modify | ||
1399 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
1400 | 7 | # published by the Free Software Foundation. | ||
1401 | 8 | # | ||
1402 | 9 | # This program is distributed in the hope that it will be useful, | ||
1403 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1404 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1405 | 12 | # GNU General Public License for more details. | ||
1406 | 13 | # | ||
1407 | 14 | # You should have received a copy of the GNU General Public License | ||
1408 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1409 | 16 | |||
1410 | 17 | set -ex | ||
1411 | 18 | |||
1412 | 19 | TESTS_EXTRAS_URL="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tests-extras" | ||
1413 | 20 | TESTS_EXTRAS_PATH="tests-extras" | ||
1414 | 21 | |||
1415 | 22 | show_help() { | ||
1416 | 23 | exec cat <<'EOF' | ||
1417 | 24 | Usage: run-tests.sh [OPTIONS] | ||
1418 | 25 | |||
1419 | 26 | This is fetch & forget script and what it does is to fetch the | ||
1420 | 27 | tests-extras repository and execute the run-tests.sh script from | ||
1421 | 28 | there passing arguments as-is. | ||
1422 | 29 | |||
1423 | 30 | When you see this message you don't have the tests-extras repository | ||
1424 | 31 | successfully populated in your workspace yet. Please rerun without | ||
1425 | 32 | specifying --help to proceed with the initial clone of the git repository. | ||
1426 | 33 | EOF | ||
1427 | 34 | } | ||
1428 | 35 | |||
1429 | 36 | # Clone the tests-extras repository | ||
1430 | 37 | clone_tests_extras() { | ||
1431 | 38 | echo "INFO: Fetching tests-extras scripts into $TESTS_EXTRAS_PATH ..." | ||
1432 | 39 | if ! git clone -b master $TESTS_EXTRAS_URL $TESTS_EXTRAS_PATH >/dev/null 2>&1; then | ||
1433 | 40 | echo "ERROR: Failed to fetch the $TESTS_EXTRAS_URL repo, exiting.." | ||
1434 | 41 | exit 1 | ||
1435 | 42 | fi | ||
1436 | 43 | } | ||
1437 | 44 | |||
1438 | 45 | # Make sure the already cloned tests-extras repository is in a known and update | ||
1439 | 46 | # state before it is going to be used. | ||
1440 | 47 | restore_and_update_tests_extras() { | ||
1441 | 48 | echo "INFO: Restoring and updating $TESTS_EXTRAS_PATH" | ||
1442 | 49 | cd $TESTS_EXTRAS_PATH && git reset --hard && git clean -dfx && git pull | ||
1443 | 50 | cd - | ||
1444 | 51 | } | ||
1445 | 52 | |||
1446 | 53 | # ============================================================================== | ||
1447 | 54 | # This is fetch & forget script and what it does is to fetch the tests-extras | ||
1448 | 55 | # repo and execute the run-tests.sh script from there passing arguments as-is. | ||
1449 | 56 | # | ||
1450 | 57 | # The tests-extras repository ends up checked out in the snap tree but as a | ||
1451 | 58 | # hidden directory which is re-used since then. | ||
1452 | 59 | |||
1453 | 60 | # Find snap to use in the tests | ||
1454 | 61 | snaps=$(find . -maxdepth 1 -type f -name \ | ||
1455 | 62 | "network-manager_*_$(dpkg-architecture -q DEB_HOST_ARCH).snap") | ||
1456 | 63 | while read -r snap_file; do | ||
1457 | 64 | if [ -n "$snap" ]; then | ||
1458 | 65 | printf "More than one snap revision in the folder\n" | ||
1459 | 66 | exit 1 | ||
1460 | 67 | fi | ||
1461 | 68 | snap=$PWD/${snap_file#*/} | ||
1462 | 69 | done < <(printf "%s\n" "$snaps") | ||
1463 | 70 | |||
1464 | 71 | [ ! -d "$TESTS_EXTRAS_PATH" ] && [ "$1" = "--help" ] && show_help | ||
1465 | 72 | |||
1466 | 73 | if [ -d "$TESTS_EXTRAS_PATH" ]; then | ||
1467 | 74 | restore_and_update_tests_extras | ||
1468 | 75 | else | ||
1469 | 76 | clone_tests_extras | ||
1470 | 77 | fi | ||
1471 | 78 | |||
1472 | 79 | # Any project-specific options for test-runner should be specified in | ||
1473 | 80 | # .tests_config under EXTRA_ARGS | ||
1474 | 81 | if [ -f ".tests_config" ]; then | ||
1475 | 82 | # shellcheck disable=SC1091 | ||
1476 | 83 | . .tests_config | ||
1477 | 84 | fi | ||
1478 | 85 | |||
1479 | 86 | echo "INFO: Executing tests runner" | ||
1480 | 87 | # shellcheck disable=SC2086 | ||
1481 | 88 | cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@" --snap="$snap" $EXTRA_ARGS | ||
1482 | diff --git a/snap-common/bin/snap-config.sh b/snap-common/bin/snap-config.sh | |||
1483 | index 1c61ddc..7107a2c 100644 | |||
1484 | --- a/snap-common/bin/snap-config.sh | |||
1485 | +++ b/snap-common/bin/snap-config.sh | |||
1486 | @@ -119,15 +119,9 @@ _switch_debug_enable() { | |||
1487 | 119 | # We create/remove the file for future executions and also change | 119 | # We create/remove the file for future executions and also change |
1488 | 120 | # the logging level of the running daemon. | 120 | # the logging level of the running daemon. |
1489 | 121 | if [ "$1" = "true" ]; then | 121 | if [ "$1" = "true" ]; then |
1494 | 122 | if [ ! -f "$DEBUG_FILE" ]; then | 122 | touch "$DEBUG_FILE" |
1491 | 123 | touch "$DEBUG_FILE" | ||
1492 | 124 | "$SNAP"/bin/nmcli-internal g log level DEBUG | ||
1493 | 125 | fi | ||
1495 | 126 | else | 123 | else |
1500 | 127 | if [ -f "$DEBUG_FILE" ]; then | 124 | rm -f "$DEBUG_FILE" |
1497 | 128 | rm -f "$DEBUG_FILE" | ||
1498 | 129 | "$SNAP"/bin/nmcli-internal g log level INFO | ||
1499 | 130 | fi | ||
1501 | 131 | fi | 125 | fi |
1502 | 132 | } | 126 | } |
1503 | 133 | 127 | ||
1504 | @@ -157,6 +151,11 @@ _switch_connectivity_check() { | |||
1505 | 157 | # $1: true/false | 151 | # $1: true/false |
1506 | 158 | _switch_defaultrenderer() { | 152 | _switch_defaultrenderer() { |
1507 | 159 | path=/etc/netplan/00-default-nm-renderer.yaml | 153 | path=/etc/netplan/00-default-nm-renderer.yaml |
1508 | 154 | |||
1509 | 155 | # Remove related configuration file from older NM snap versions. | ||
1510 | 156 | # We let netplan do whatever is needed. | ||
1511 | 157 | rm -f "$SNAP_DATA"/conf.d/disable-ethernet.conf | ||
1512 | 158 | |||
1513 | 160 | if [ "$1" = true ] || [ "$1" = yes ]; then | 159 | if [ "$1" = true ] || [ "$1" = yes ]; then |
1514 | 161 | if [ ! -f "$path" ]; then | 160 | if [ ! -f "$path" ]; then |
1515 | 162 | printf "network:\n renderer: NetworkManager\n" > "$path" | 161 | printf "network:\n renderer: NetworkManager\n" > "$path" |
1516 | diff --git a/snap-patch/resolvconf.patch b/snap-patch/resolvconf.patch | |||
1517 | 163 | new file mode 100644 | 162 | new file mode 100644 |
1518 | index 0000000..2538bb9 | |||
1519 | --- /dev/null | |||
1520 | +++ b/snap-patch/resolvconf.patch | |||
1521 | @@ -0,0 +1,31 @@ | |||
1522 | 1 | --- a/etc/resolvconf/update.d/libc 2017-11-29 19:26:46.000000000 +0100 | ||
1523 | 2 | +++ b/etc/resolvconf/update.d/libc 2019-06-07 08:55:49.486028633 +0200 | ||
1524 | 3 | @@ -18,7 +18,7 @@ | ||
1525 | 4 | set -e | ||
1526 | 5 | PATH=/sbin:/bin | ||
1527 | 6 | |||
1528 | 7 | -[ -x /lib/resolvconf/list-records ] || exit 1 | ||
1529 | 8 | +[ -x "$SNAP"/lib/resolvconf/list-records ] || exit 1 | ||
1530 | 9 | |||
1531 | 10 | # Default override | ||
1532 | 11 | [ -r /etc/default/resolvconf ] && . /etc/default/resolvconf | ||
1533 | 12 | @@ -107,7 +107,7 @@ | ||
1534 | 13 | done | ||
1535 | 14 | } | ||
1536 | 15 | |||
1537 | 16 | -RSLVCNFFILES="$(/lib/resolvconf/list-records)" | ||
1538 | 17 | +RSLVCNFFILES="$($SNAP/lib/resolvconf/list-records)" | ||
1539 | 18 | |||
1540 | 19 | [ -f "$BASEFILE" ] && RSLVCNFFILES="$RSLVCNFFILES | ||
1541 | 20 | $BASEFILE" | ||
1542 | 21 | --- a/sbin/resolvconf 2019-05-06 10:39:40.000000000 +0200 | ||
1543 | 22 | +++ b/sbin/resolvconf 2019-06-07 08:55:49.514029312 +0200 | ||
1544 | 23 | @@ -63,7 +63,7 @@ | ||
1545 | 24 | update_and_exit() | ||
1546 | 25 | { | ||
1547 | 26 | rm -f "$POSTPONED_UPDATE_FLAGFILE" | ||
1548 | 27 | - exec run-parts ${1:+--arg="$1"} ${2:+--arg="$2"} /etc/resolvconf/update.d | ||
1549 | 28 | + exec run-parts ${1:+--arg="$1"} ${2:+--arg="$2"} "$SNAP"/etc/resolvconf/update.d | ||
1550 | 29 | } | ||
1551 | 30 | |||
1552 | 31 | # Handle commands that don't require normalized_stdin() | ||
1553 | diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml | |||
1554 | index 290ab83..d07b5ed 100644 | |||
1555 | --- a/snap/snapcraft.yaml | |||
1556 | +++ b/snap/snapcraft.yaml | |||
1557 | @@ -123,15 +123,14 @@ parts: | |||
1558 | 123 | - --with-dhcpcd=no | 123 | - --with-dhcpcd=no |
1559 | 124 | - --with-dhclient=no | 124 | - --with-dhclient=no |
1560 | 125 | - --with-dnsmasq=no | 125 | - --with-dnsmasq=no |
1561 | 126 | - --with-iptables=/snap/$SNAPCRAFT_PROJECT_NAME/current/sbin/iptables | ||
1562 | 126 | - --with-systemd-journal=yes | 127 | - --with-systemd-journal=yes |
1567 | 127 | # from 1.10 deb: | 128 | - --libexecdir=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib/NetworkManager |
1568 | 128 | - --libexecdir=/usr/lib/NetworkManager | 129 | - --with-pppd=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/sbin/pppd |
1569 | 129 | - --with-pppd=/usr/sbin/pppd | 130 | - --with-resolvconf=/snap/$SNAPCRAFT_PROJECT_NAME/current/sbin/resolvconf |
1566 | 130 | - --with-resolvconf=no | ||
1570 | 131 | # | 131 | # |
1572 | 132 | # TODO: iptables & dnsmasq are used for AP mode; not | 132 | # TODO: dnsmasq is used for AP mode; not |
1573 | 133 | # currently supported by the snap: | 133 | # currently supported by the snap: |
1574 | 134 | # - --with-iptables=/sbin/iptables | ||
1575 | 135 | # - --with-dnsmasq=/usr/sbin/dnsmasq | 134 | # - --with-dnsmasq=/usr/sbin/dnsmasq |
1576 | 136 | - --with-dnssec-trigger=/usr/lib/dnssec-trigger/dnssec-trigger-script | 135 | - --with-dnssec-trigger=/usr/lib/dnssec-trigger/dnssec-trigger-script |
1577 | 137 | - --with-systemdsystemunitdir=/lib/systemd/system | 136 | - --with-systemdsystemunitdir=/lib/systemd/system |
1578 | @@ -175,6 +174,7 @@ parts: | |||
1579 | 175 | # Run all tests NetworkManager ships by default | 174 | # Run all tests NetworkManager ships by default |
1580 | 176 | make check | 175 | make check |
1581 | 177 | stage-packages: | 176 | stage-packages: |
1582 | 177 | - iptables | ||
1583 | 178 | - iputils-arping | 178 | - iputils-arping |
1584 | 179 | - libasn1-8-heimdal | 179 | - libasn1-8-heimdal |
1585 | 180 | - libdbus-glib-1-2 | 180 | - libdbus-glib-1-2 |
1586 | @@ -223,6 +223,12 @@ parts: | |||
1587 | 223 | - libslang2 | 223 | - libslang2 |
1588 | 224 | - libtasn1-6 | 224 | - libtasn1-6 |
1589 | 225 | - libwind0-heimdal | 225 | - libwind0-heimdal |
1590 | 226 | - ppp | ||
1591 | 227 | - resolvconf | ||
1592 | 228 | |||
1593 | 229 | override-stage: | | ||
1594 | 230 | snapcraftctl stage | ||
1595 | 231 | patch -p1 < "$SNAPCRAFT_PART_SRC"/snap-patch/resolvconf.patch | ||
1596 | 226 | 232 | ||
1597 | 227 | # Filter files pulled in by stage-packages so they aren't | 233 | # Filter files pulled in by stage-packages so they aren't |
1598 | 228 | # included in the final snap. We only need them to build | 234 | # included in the final snap. We only need them to build |
1599 | @@ -231,21 +237,26 @@ parts: | |||
1600 | 231 | # here are the results of the network manager build. | 237 | # here are the results of the network manager build. |
1601 | 232 | filesets: | 238 | filesets: |
1602 | 233 | binaries: | 239 | binaries: |
1603 | 240 | - sbin/*tables* | ||
1604 | 241 | - sbin/resolvconf | ||
1605 | 234 | - usr/bin/arping | 242 | - usr/bin/arping |
1606 | 235 | - usr/bin/nmcli | 243 | - usr/bin/nmcli |
1607 | 236 | - usr/bin/nmtui | 244 | - usr/bin/nmtui |
1608 | 237 | - usr/bin/nmtui-connect | 245 | - usr/bin/nmtui-connect |
1609 | 238 | - usr/bin/nmtui-edit | 246 | - usr/bin/nmtui-edit |
1610 | 239 | - usr/bin/nmtui-hostname | 247 | - usr/bin/nmtui-hostname |
1611 | 248 | - usr/sbin/pppd | ||
1612 | 240 | - usr/lib/*/NetworkManager | 249 | - usr/lib/*/NetworkManager |
1613 | 241 | - usr/lib/pppd/2.4.5/nm-pppd-plugin.so | 250 | - usr/lib/pppd/2.4.5/nm-pppd-plugin.so |
1614 | 242 | - usr/lib/NetworkManager | 251 | - usr/lib/NetworkManager |
1615 | 243 | - usr/sbin/NetworkManager | 252 | - usr/sbin/NetworkManager |
1616 | 244 | configs: | 253 | configs: |
1617 | 245 | - etc/NetworkManager/* | 254 | - etc/NetworkManager/* |
1618 | 255 | - etc/resolvconf/update.d/libc | ||
1619 | 246 | docs: | 256 | docs: |
1620 | 247 | - usr/share/doc/*/copyright | 257 | - usr/share/doc/*/copyright |
1621 | 248 | libs: | 258 | libs: |
1622 | 259 | - lib/resolvconf/list-records | ||
1623 | 249 | - lib/*/libnewt* | 260 | - lib/*/libnewt* |
1624 | 250 | - lib/*/libslang* | 261 | - lib/*/libslang* |
1625 | 251 | - usr/lib/libnm* | 262 | - usr/lib/libnm* |
1626 | @@ -258,6 +269,8 @@ parts: | |||
1627 | 258 | - usr/lib/*/libheimbase* | 269 | - usr/lib/*/libheimbase* |
1628 | 259 | - usr/lib/*/libheimntlm* | 270 | - usr/lib/*/libheimntlm* |
1629 | 260 | - usr/lib/*/libhx509* | 271 | - usr/lib/*/libhx509* |
1630 | 272 | - usr/lib/*/libip4tc* | ||
1631 | 273 | - usr/lib/*/libip6tc* | ||
1632 | 261 | # required for teamdctl | 274 | # required for teamdctl |
1633 | 262 | - usr/lib/*/libjansson* | 275 | - usr/lib/*/libjansson* |
1634 | 263 | - usr/lib/*/libkrb5*26* | 276 | - usr/lib/*/libkrb5*26* |
1635 | @@ -267,12 +280,14 @@ parts: | |||
1636 | 267 | - usr/lib/*/libmm-glib* | 280 | - usr/lib/*/libmm-glib* |
1637 | 268 | - usr/lib/*/libndp* | 281 | - usr/lib/*/libndp* |
1638 | 269 | - usr/lib/*/libnghttp2* | 282 | - usr/lib/*/libnghttp2* |
1639 | 283 | - usr/lib/*/libpcap* | ||
1640 | 270 | - usr/lib/*/libpsl* | 284 | - usr/lib/*/libpsl* |
1641 | 271 | - usr/lib/*/libroken* | 285 | - usr/lib/*/libroken* |
1642 | 272 | - usr/lib/*/librtmp* | 286 | - usr/lib/*/librtmp* |
1643 | 273 | - usr/lib/*/libsasl2* | 287 | - usr/lib/*/libsasl2* |
1644 | 274 | - usr/lib/*/libteamdctl* | 288 | - usr/lib/*/libteamdctl* |
1645 | 275 | - usr/lib/*/libwind* | 289 | - usr/lib/*/libwind* |
1646 | 290 | - usr/lib/*/libxtables* | ||
1647 | 276 | unwanted: | 291 | unwanted: |
1648 | 277 | # We don't use dhclient so we don't need this helper | 292 | # We don't use dhclient so we don't need this helper |
1649 | 278 | - -usr/lib/NetworkManager/nm-dhcp-helper | 293 | - -usr/lib/NetworkManager/nm-dhcp-helper |
1650 | @@ -288,6 +303,3 @@ parts: | |||
1651 | 288 | - $docs | 303 | - $docs |
1652 | 289 | - $libs | 304 | - $libs |
1653 | 290 | - $unwanted | 305 | - $unwanted |
1654 | 291 | |||
1655 | 292 | |||
1656 | 293 | |||
1657 | diff --git a/spread.yaml b/spread.yaml | |||
1658 | 294 | new file mode 100644 | 306 | new file mode 100644 |
1659 | index 0000000..83abb24 | |||
1660 | --- /dev/null | |||
1661 | +++ b/spread.yaml | |||
1662 | @@ -0,0 +1,85 @@ | |||
1663 | 1 | # | ||
1664 | 2 | # Copyright (C) 2015, 2016 Canonical Ltd | ||
1665 | 3 | # | ||
1666 | 4 | # This program is free software: you can redistribute it and/or modify | ||
1667 | 5 | # it under the terms of the GNU General Public License version 3 as | ||
1668 | 6 | # published by the Free Software Foundation. | ||
1669 | 7 | # | ||
1670 | 8 | # This program is distributed in the hope that it will be useful, | ||
1671 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1672 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1673 | 11 | # GNU General Public License for more details. | ||
1674 | 12 | # | ||
1675 | 13 | # You should have received a copy of the GNU General Public License | ||
1676 | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1677 | 15 | |||
1678 | 16 | |||
1679 | 17 | project: network-manager | ||
1680 | 18 | |||
1681 | 19 | environment: | ||
1682 | 20 | PROJECT_PATH: /home/network-manager | ||
1683 | 21 | TESTSLIB: $PROJECT_PATH/tests/lib | ||
1684 | 22 | SNAP_NAME: network-manager | ||
1685 | 23 | # Allow the host to pass the channel to use for the test run | ||
1686 | 24 | SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL) | ||
1687 | 25 | |||
1688 | 26 | backends: | ||
1689 | 27 | qemu: | ||
1690 | 28 | systems: | ||
1691 | 29 | - ubuntu-core-16: | ||
1692 | 30 | username: test | ||
1693 | 31 | password: test | ||
1694 | 32 | |||
1695 | 33 | # Put this somewhere where we have read-write access | ||
1696 | 34 | path: /home/network-manager | ||
1697 | 35 | |||
1698 | 36 | exclude: | ||
1699 | 37 | - .git | ||
1700 | 38 | |||
1701 | 39 | prepare: | | ||
1702 | 40 | . $TESTSLIB/prepare-all.sh | ||
1703 | 41 | |||
1704 | 42 | prepare-each: | | ||
1705 | 43 | # Cleanup logs so we can just dump what has happened in the debug-each | ||
1706 | 44 | # step below after a test case ran. | ||
1707 | 45 | journalctl --rotate | ||
1708 | 46 | sleep .1 | ||
1709 | 47 | journalctl --vacuum-time=1ms | ||
1710 | 48 | dmesg -c > /dev/null | ||
1711 | 49 | |||
1712 | 50 | debug-each: | | ||
1713 | 51 | journalctl | ||
1714 | 52 | dmesg | grep DENIED || true | ||
1715 | 53 | |||
1716 | 54 | # Default is 15 min but we use a higher one here as we build the entire | ||
1717 | 55 | # network-manager snap inside the global prepare step so we need quite | ||
1718 | 56 | # some time. Once we can reuse artifacts from other builds we can change | ||
1719 | 57 | # this back to the default. | ||
1720 | 58 | kill-timeout: 30m | ||
1721 | 59 | |||
1722 | 60 | suites: | ||
1723 | 61 | tests/main/: | ||
1724 | 62 | summary: Full-system tests for NetworkManager without ethernet support | ||
1725 | 63 | systems: | ||
1726 | 64 | - ubuntu-core-16 | ||
1727 | 65 | prepare: | | ||
1728 | 66 | . $TESTSLIB/prepare.sh | ||
1729 | 67 | restore-each: | | ||
1730 | 68 | . $TESTSLIB/restore-each.sh | ||
1731 | 69 | tests/full/: | ||
1732 | 70 | summary: Full-system tests for NetworkManager being the only network management service | ||
1733 | 71 | systems: | ||
1734 | 72 | - ubuntu-core-16 | ||
1735 | 73 | prepare: | | ||
1736 | 74 | . $TESTSLIB/utilities.sh | ||
1737 | 75 | stop_after_first_reboot | ||
1738 | 76 | switch_netplan_to_network_manager | ||
1739 | 77 | . $TESTSLIB/prepare.sh | ||
1740 | 78 | REBOOT | ||
1741 | 79 | restore-each: | | ||
1742 | 80 | . $TESTSLIB/restore-each.sh | ||
1743 | 81 | restore: | | ||
1744 | 82 | . $TESTSLIB/utilities.sh | ||
1745 | 83 | stop_after_first_reboot | ||
1746 | 84 | switch_netplan_to_networkd | ||
1747 | 85 | REBOOT | ||
1748 | diff --git a/tests/full/correct-dns-setup/task.yaml b/tests/full/correct-dns-setup/task.yaml | |||
1749 | 0 | new file mode 100644 | 86 | new file mode 100644 |
1750 | index 0000000..9b6dfe0 | |||
1751 | --- /dev/null | |||
1752 | +++ b/tests/full/correct-dns-setup/task.yaml | |||
1753 | @@ -0,0 +1,47 @@ | |||
1754 | 1 | summary: Verify correct DNS setup | ||
1755 | 2 | |||
1756 | 3 | execute: | | ||
1757 | 4 | . $TESTSLIB/utilities.sh | ||
1758 | 5 | case $SPREAD_REBOOT in | ||
1759 | 6 | 0) | ||
1760 | 7 | # For correct timing if the device has just booted | ||
1761 | 8 | wait_for_network_manager | ||
1762 | 9 | |||
1763 | 10 | # Precondition is a existing network connection | ||
1764 | 11 | /snap/bin/network-manager.nmcli d | grep 'eth0.*connected' | ||
1765 | 12 | |||
1766 | 13 | # We get a default nameserver from the gateway | ||
1767 | 14 | if [ "$SPREAD_BACKEND" = "qemu" ] ; then | ||
1768 | 15 | cat /etc/resolv.conf | grep 'nameserver 10.0.2.3' | ||
1769 | 16 | fi | ||
1770 | 17 | |||
1771 | 18 | # Ensure we can resolve a hostname correctly; must give a | ||
1772 | 19 | # valid IP address | ||
1773 | 20 | address=`python3 -c 'import socket; print(socket.gethostbyname("ubuntu.com"))' 2> /dev/null || echo "invalid"` | ||
1774 | 21 | [ "$address" != "invalid" ] && [[ $address =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] | ||
1775 | 22 | |||
1776 | 23 | # Now lets switch to a system where we have a configuration | ||
1777 | 24 | # for ethernet we can change | ||
1778 | 25 | rm /etc/netplan/00-snapd-config.yaml | ||
1779 | 26 | REBOOT | ||
1780 | 27 | ;; | ||
1781 | 28 | 1) | ||
1782 | 29 | /snap/bin/network-manager.nmcli d | grep 'eth0.*connected' | ||
1783 | 30 | /snap/bin/network-manager.nmcli d | grep -v netplan | ||
1784 | 31 | |||
1785 | 32 | connection=$(/snap/bin/network-manager.nmcli -m multiline -f UUID c show --active | awk '{print$2;exit}') | ||
1786 | 33 | /snap/bin/network-manager.nmcli c modify $connection ipv4.dns 8.8.8.8 | ||
1787 | 34 | # We need to bring up the connection again here to get the DNS | ||
1788 | 35 | # server really applied to the system. | ||
1789 | 36 | /snap/bin/network-manager.nmcli c up $connection | ||
1790 | 37 | |||
1791 | 38 | # Give system a moment to settle | ||
1792 | 39 | sleep 1 | ||
1793 | 40 | |||
1794 | 41 | grep 'nameserver 8.8.8.8' /etc/resolv.conf | ||
1795 | 42 | address=`python3 -c 'import socket; print(socket.gethostbyname("ubuntu.com"))' 2> /dev/null || echo "invalid"` | ||
1796 | 43 | [ "$address" != "invalid" ] && [[ $address =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] | ||
1797 | 44 | ;; | ||
1798 | 45 | *) | ||
1799 | 46 | ;; | ||
1800 | 47 | esac | ||
1801 | diff --git a/tests/full/immutable-netplan-config/task.yaml b/tests/full/immutable-netplan-config/task.yaml | |||
1802 | 0 | new file mode 100644 | 48 | new file mode 100644 |
1803 | index 0000000..c218478 | |||
1804 | --- /dev/null | |||
1805 | +++ b/tests/full/immutable-netplan-config/task.yaml | |||
1806 | @@ -0,0 +1,10 @@ | |||
1807 | 1 | summary: Verify that netplan configuration files are immutable | ||
1808 | 2 | |||
1809 | 3 | execute: | | ||
1810 | 4 | # Ensure we're using a configuration generated from netplan | ||
1811 | 5 | test -e /etc/netplan/00-snapd-config.yaml | ||
1812 | 6 | test -e /run/NetworkManager/system-connections/netplan-eth0 | ||
1813 | 7 | |||
1814 | 8 | /snap/bin/network-manager.nmcli c | MATCH 'netplan.eth0.*eth0' | ||
1815 | 9 | # Try to change the DNS server used on this connection | ||
1816 | 10 | test ! `/snap/bin/network-manager.nmcli c modify netplan-eth0 ipv4.dns 8.8.8.8` | ||
1817 | diff --git a/tests/full/ipv6-address-assignment/task.yaml b/tests/full/ipv6-address-assignment/task.yaml | |||
1818 | 0 | new file mode 100644 | 11 | new file mode 100644 |
1819 | index 0000000..e36ef00 | |||
1820 | --- /dev/null | |||
1821 | +++ b/tests/full/ipv6-address-assignment/task.yaml | |||
1822 | @@ -0,0 +1,27 @@ | |||
1823 | 1 | summary: Verify NetworkManager can assign a static IPv6 address to an interface | ||
1824 | 2 | |||
1825 | 3 | restore: | | ||
1826 | 4 | # Ensure that the created virtual network interfaces are removed | ||
1827 | 5 | # in any case when we're done | ||
1828 | 6 | if [ -e /sys/class/net/veth0 ] ; then | ||
1829 | 7 | ip link delete veth0 | ||
1830 | 8 | fi | ||
1831 | 9 | |||
1832 | 10 | execute: | | ||
1833 | 11 | . $TESTSLIB/utilities.sh | ||
1834 | 12 | |||
1835 | 13 | # Ensure that we have IPv6 support enabled in the kernel | ||
1836 | 14 | test -e /proc/net/if_inet6 | ||
1837 | 15 | |||
1838 | 16 | ip link add dev veth0 type veth peer name veth1 | ||
1839 | 17 | |||
1840 | 18 | wait_for_network_manager | ||
1841 | 19 | |||
1842 | 20 | connection=veth-ipv6 | ||
1843 | 21 | /snap/bin/network-manager.nmcli c add con-name $connection ifname veth0 type ethernet \ | ||
1844 | 22 | ip6 abbe::cafe | ||
1845 | 23 | /snap/bin/network-manager.nmcli c up $connection | ||
1846 | 24 | |||
1847 | 25 | # Verify that NetworkManager assigned the correct IPv6 address | ||
1848 | 26 | # to the interface | ||
1849 | 27 | ifconfig veth0 | grep 'abbe::cafe/128' | ||
1850 | diff --git a/tests/full/ipv6-router-advertisements/task.yaml b/tests/full/ipv6-router-advertisements/task.yaml | |||
1851 | 0 | new file mode 100644 | 28 | new file mode 100644 |
1852 | index 0000000..4af402b | |||
1853 | --- /dev/null | |||
1854 | +++ b/tests/full/ipv6-router-advertisements/task.yaml | |||
1855 | @@ -0,0 +1,70 @@ | |||
1856 | 1 | summary: Test IPv6 address assignment via router advertisements | ||
1857 | 2 | |||
1858 | 3 | restore: | | ||
1859 | 4 | # Ensure that the created virtual network interfaces are removed | ||
1860 | 5 | # in any case when we're done | ||
1861 | 6 | if [ -e /sys/class/net/veth0 ] ; then | ||
1862 | 7 | ip link delete veth0 | ||
1863 | 8 | fi | ||
1864 | 9 | |||
1865 | 10 | execute: | | ||
1866 | 11 | . $TESTSLIB/utilities.sh | ||
1867 | 12 | |||
1868 | 13 | # Ensure that we have IPv6 support enabled in the kernel | ||
1869 | 14 | test -e /proc/net/if_inet6 | ||
1870 | 15 | |||
1871 | 16 | snap install --devmode se-test-tools | ||
1872 | 17 | snap connect se-test-tools:home core | ||
1873 | 18 | snap connect se-test-tools:network-control core | ||
1874 | 19 | |||
1875 | 20 | # Create virtual ethernet interface pair | ||
1876 | 21 | sudo ip link add dev veth0 type veth peer name veth1 | ||
1877 | 22 | |||
1878 | 23 | # As the virtual ethernet devices don't get IPv6 setup | ||
1879 | 24 | # correctly by default we have to do this | ||
1880 | 25 | sudo sysctl -w net.ipv6.conf.veth0.disable_ipv6=0 | ||
1881 | 26 | sudo sysctl -w net.ipv6.conf.veth1.disable_ipv6=0 | ||
1882 | 27 | veth0_lla=$(mac_to_ipv6 `cat /sys/class/net/veth0/address`) | ||
1883 | 28 | veth1_lla=$(mac_to_ipv6 `cat /sys/class/net/veth1/address`) | ||
1884 | 29 | |||
1885 | 30 | # The radvd daemon will send out router advertisements on veth1 | ||
1886 | 31 | # so that we can receive them on veth0 end | ||
1887 | 32 | cat <<-EOF > /home/test/radvd.conf | ||
1888 | 33 | interface veth1 { | ||
1889 | 34 | AdvSendAdvert on; | ||
1890 | 35 | prefix 2001:db8:1:2::/64 {}; | ||
1891 | 36 | }; | ||
1892 | 37 | EOF | ||
1893 | 38 | |||
1894 | 39 | # To ensure that nobody touches veth1 we tell NetworkManager | ||
1895 | 40 | # explicitly to do that. | ||
1896 | 41 | /snap/bin/network-manager.nmcli d set veth1 managed no | ||
1897 | 42 | |||
1898 | 43 | # Assign our link-local addresses | ||
1899 | 44 | if ! ip addr show dev veth0 | grep 'inet6.*scope link.*' ; then | ||
1900 | 45 | sudo ip addr add dev veth0 scope link $veth0_lla | ||
1901 | 46 | fi | ||
1902 | 47 | if ! ip addr show dev veth1 | grep 'inet6.*scope link.*' ; then | ||
1903 | 48 | sudo ip addr add dev veth1 scope link $veth1_lla | ||
1904 | 49 | fi | ||
1905 | 50 | |||
1906 | 51 | # This will get our router advertisement daemon started and we | ||
1907 | 52 | # now configure NetworkManager | ||
1908 | 53 | sudo se-test-tools.radvd -C /home/test/radvd.conf -n -d 5 -m stderr -p /home/test/radvd.pid & | ||
1909 | 54 | |||
1910 | 55 | # Give things a bit more time to settle | ||
1911 | 56 | sleep 10 | ||
1912 | 57 | ip addr show dev veth0 | ||
1913 | 58 | |||
1914 | 59 | # At this point veth0 should have now a global IPv6 address | ||
1915 | 60 | # assigned via router advertisements | ||
1916 | 61 | ip addr show dev veth0 | grep 'inet6 2001:db8:1:2:.*/64 scope global' | ||
1917 | 62 | # but veth1 should not have any | ||
1918 | 63 | ip addr show dev veth1 | grep -v 'inet6.*scope global' | ||
1919 | 64 | |||
1920 | 65 | # NetworkManager should report the same addresses for IPv6 | ||
1921 | 66 | /snap/bin/network-manager.nmcli d show veth0 | grep 'GENERAL.STATE.*connected' | ||
1922 | 67 | /snap/bin/network-manager.nmcli d show veth0 | grep 'IP6.ADDRESS.*2001:db8:1:2.*/64' | ||
1923 | 68 | |||
1924 | 69 | # Stop the radvd daemon | ||
1925 | 70 | kill -TERM `cat /home/test/radvd.pid` | ||
1926 | diff --git a/tests/full/no-netplan-default-config/task.yaml b/tests/full/no-netplan-default-config/task.yaml | |||
1927 | 0 | new file mode 100644 | 71 | new file mode 100644 |
1928 | index 0000000..66a75c6 | |||
1929 | --- /dev/null | |||
1930 | +++ b/tests/full/no-netplan-default-config/task.yaml | |||
1931 | @@ -0,0 +1,41 @@ | |||
1932 | 1 | summary: Verify ethernet is auto-connected when no default netplan configuration exists | ||
1933 | 2 | |||
1934 | 3 | prepare: | | ||
1935 | 4 | cp /etc/netplan/00-snapd-config.yaml /etc/netplan/00-snapd-config.yaml.orig | ||
1936 | 5 | |||
1937 | 6 | restore: | | ||
1938 | 7 | mv /etc/netplan/00-snapd-config.yaml.orig /etc/netplan/00-snapd-config.yaml | ||
1939 | 8 | |||
1940 | 9 | execute: | | ||
1941 | 10 | . $TESTSLIB/utilities.sh | ||
1942 | 11 | case "$SPREAD_REBOOT" in | ||
1943 | 12 | 0) | ||
1944 | 13 | # Remove all configuration files from netplan to get a system | ||
1945 | 14 | # without generated configuration files from netplan | ||
1946 | 15 | if [ -e /usr/lib/snapd/generate-network-conf ] ; then | ||
1947 | 16 | echo "" > /etc/netplan/00-snapd-config.yaml | ||
1948 | 17 | else | ||
1949 | 18 | rm /etc/netplan/00-snapd-config.yaml | ||
1950 | 19 | fi | ||
1951 | 20 | REBOOT | ||
1952 | 21 | ;; | ||
1953 | 22 | 1) | ||
1954 | 23 | # We should be automatically connected now and not via a configuration | ||
1955 | 24 | # generated from netplan | ||
1956 | 25 | wait_for_network_manager | ||
1957 | 26 | /snap/bin/network-manager.nmcli d | grep 'eth0.*connected' | ||
1958 | 27 | networkctl status eth0 | grep unmanaged | ||
1959 | 28 | /snap/bin/network-manager.nmcli c show --active | grep eth0 | grep -v netplan | ||
1960 | 29 | |||
1961 | 30 | # We should only have a single active configuration | ||
1962 | 31 | test `/snap/bin/network-manager.nmcli -m multiline -f UUID c show --active | wc -l` -eq 1 | ||
1963 | 32 | |||
1964 | 33 | # Verify that we can modify the automatically created connection | ||
1965 | 34 | connection=$(/snap/bin/network-manager.nmcli -m multiline -f UUID c show --active | awk '{print$2;exit}') | ||
1966 | 35 | /snap/bin/network-manager.nmcli c modify $connection 802-3-ethernet.wake-on-lan magic | ||
1967 | 36 | wol_value=$(/snap/bin/network-manager.nmcli -f 802-3-ethernet.wake-on-lan c show $connection | xargs | cut -d':' -f 2) | ||
1968 | 37 | test "$wol_value" = " magic" | ||
1969 | 38 | ;; | ||
1970 | 39 | *) | ||
1971 | 40 | ;; | ||
1972 | 41 | esac | ||
1973 | diff --git a/tests/full/system-network-is-active/task.yaml b/tests/full/system-network-is-active/task.yaml | |||
1974 | 0 | new file mode 100644 | 42 | new file mode 100644 |
1975 | index 0000000..22d7830 | |||
1976 | --- /dev/null | |||
1977 | +++ b/tests/full/system-network-is-active/task.yaml | |||
1978 | @@ -0,0 +1,9 @@ | |||
1979 | 1 | summary: Ethernet network should be managed by NetworkManager | ||
1980 | 2 | |||
1981 | 3 | execute: | | ||
1982 | 4 | . $TESTSLIB/utilities.sh | ||
1983 | 5 | # Verify NetworManager handles ethernet and marks it as connected | ||
1984 | 6 | test -e /etc/netplan/00-default-nm-renderer.yaml | ||
1985 | 7 | wait_for_network_manager | ||
1986 | 8 | /snap/bin/network-manager.nmcli d | grep 'eth0.*connected' | ||
1987 | 9 | networkctl status eth0 | grep unmanaged | ||
1988 | diff --git a/tests/full/wol-enabled-by-default/task.yaml b/tests/full/wol-enabled-by-default/task.yaml | |||
1989 | 0 | new file mode 100644 | 10 | new file mode 100644 |
1990 | index 0000000..9d7d034 | |||
1991 | --- /dev/null | |||
1992 | +++ b/tests/full/wol-enabled-by-default/task.yaml | |||
1993 | @@ -0,0 +1,60 @@ | |||
1994 | 1 | summary: Verify that wake-on-lan is enabled by default for all ethernet connections | ||
1995 | 2 | |||
1996 | 3 | execute: | | ||
1997 | 4 | . $TESTSLIB/utilities.sh | ||
1998 | 5 | nmcli=/snap/bin/network-manager.nmcli | ||
1999 | 6 | case "$SPREAD_REBOOT" in | ||
2000 | 7 | 0) | ||
2001 | 8 | # For correct timing if the device has just booted | ||
2002 | 9 | wait_for_network_manager | ||
2003 | 10 | |||
2004 | 11 | # The config file needs to be present and have the correct default set | ||
2005 | 12 | test -e /var/snap/network-manager/current/conf.d/enable-wol.conf | ||
2006 | 13 | cat /var/snap/network-manager/current/conf.d/enable-wol.conf | grep '802-3-ethernet.wake-on-lan=64' | ||
2007 | 14 | |||
2008 | 15 | # Precondition is a existing network connection | ||
2009 | 16 | $nmcli d | grep 'eth0.*connected' | ||
2010 | 17 | |||
2011 | 18 | # The netplan configuration file has WoL disabled by default as | ||
2012 | 19 | # the default one the core snap provides does not explicitly | ||
2013 | 20 | # enable WoL. | ||
2014 | 21 | connection=$($nmcli -m multiline -f UUID c show --active | awk '{print$2;exit}') | ||
2015 | 22 | $nmcli -m multiline -f connection.id c show $connection | grep 'netplan-eth0' | ||
2016 | 23 | $nmcli -m multiline -f connection.type c show $connection | grep '802-3-ethernet' | ||
2017 | 24 | $nmcli -m multiline -f 802-3-ethernet.wake-on-lan c show $connection | | ||
2018 | 25 | grep '^802-3-ethernet.wake-on-lan: *--$' | ||
2019 | 26 | |||
2020 | 27 | # Now prepare for the next boot where we will run without a netplan | ||
2021 | 28 | # config to get eth0 correctly configured. | ||
2022 | 29 | rm /etc/netplan/00-snapd-config.yaml | ||
2023 | 30 | REBOOT | ||
2024 | 31 | ;; | ||
2025 | 32 | 1) | ||
2026 | 33 | # For correct timing if the device has just booted | ||
2027 | 34 | wait_for_network_manager | ||
2028 | 35 | |||
2029 | 36 | # Precondition is a existing network connection | ||
2030 | 37 | $nmcli d | grep 'eth0.*connected' | ||
2031 | 38 | |||
2032 | 39 | # Connection should have the default wake-on-lan setting | ||
2033 | 40 | connection=$($nmcli -m multiline -f UUID c show | awk '{print$2;exit}') | ||
2034 | 41 | $nmcli -m multiline -f connection.type c show $connection | grep '802-3-ethernet' | ||
2035 | 42 | # wake-on-lan should be set to respect the global defaults here | ||
2036 | 43 | $nmcli -m multiline -f 802-3-ethernet.wake-on-lan c show $connection | grep 'default' | ||
2037 | 44 | |||
2038 | 45 | # We can sadly only verify that the value was correctly applied when | ||
2039 | 46 | # we're running the tests on a real device. QEMU doesn't support setting | ||
2040 | 47 | # the WoL value of the ethernet network device. | ||
2041 | 48 | if [ -z "`cat /proc/cpuinfo | grep QEMU`" ] ; then | ||
2042 | 49 | # Get the tools snap to have the ethtool tool available | ||
2043 | 50 | snap install --devmode --edge se-test-tools | ||
2044 | 51 | snap connect se-test-tools:network core | ||
2045 | 52 | snap connect se-test-tools:network-bind core | ||
2046 | 53 | snap connect se-test-tools:network-control core | ||
2047 | 54 | |||
2048 | 55 | # See `man ethtool` for details; 'g' means 'wakeup when magic packet comes in' | ||
2049 | 56 | # and is the default behavior we want. | ||
2050 | 57 | /snap/bin/se-test-tools.ethtool eth0 | grep 'Wake-up: g' | ||
2051 | 58 | fi | ||
2052 | 59 | ;; | ||
2053 | 60 | esac | ||
2054 | diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh | |||
2055 | 0 | new file mode 100644 | 61 | new file mode 100644 |
2056 | index 0000000..fa8fb6b | |||
2057 | --- /dev/null | |||
2058 | +++ b/tests/lib/prepare-all.sh | |||
2059 | @@ -0,0 +1,63 @@ | |||
2060 | 1 | #!/bin/bash -x | ||
2061 | 2 | |||
2062 | 3 | # Create a service to get the mac80211_hwsim driver loaded on system | ||
2063 | 4 | # startup so that we don't need to load it again in our tests as | ||
2064 | 5 | # load/unload multiple times in a running system can lead to kernel | ||
2065 | 6 | # crashes. | ||
2066 | 7 | cat << EOF > /etc/systemd/system/load-mac80211-hwsim.service | ||
2067 | 8 | [Unit] | ||
2068 | 9 | Description=Load mac8022_hwsim driver | ||
2069 | 10 | [Service] | ||
2070 | 11 | ExecStart=/sbin/modprobe mac80211_hwsim radios=2 | ||
2071 | 12 | [Install] | ||
2072 | 13 | WantedBy=multi-user.target | ||
2073 | 14 | EOF | ||
2074 | 15 | |||
2075 | 16 | systemctl enable load-mac80211-hwsim | ||
2076 | 17 | systemctl start load-mac80211-hwsim | ||
2077 | 18 | |||
2078 | 19 | # We don't have to build a snap when we should use one from a | ||
2079 | 20 | # channel | ||
2080 | 21 | if [ -n "$SNAP_CHANNEL" ] ; then | ||
2081 | 22 | exit 0 | ||
2082 | 23 | fi | ||
2083 | 24 | |||
2084 | 25 | # If there is a network-manager snap prebuilt for us, lets take | ||
2085 | 26 | # that one to speed things up. | ||
2086 | 27 | if [ -f /writable/system-data/network-manager_*_amd64.snap ]; then | ||
2087 | 28 | mv /writable/system-data/network-manager_*_amd64.snap /home/network-manager/ | ||
2088 | 29 | fi | ||
2089 | 30 | if [ -f /home/network-manager/network-manager_*_amd64.snap ] ; then | ||
2090 | 31 | exit 0 | ||
2091 | 32 | fi | ||
2092 | 33 | |||
2093 | 34 | # Setup classic snap and build the network-manager snap in there | ||
2094 | 35 | snap install --devmode --beta classic | ||
2095 | 36 | cat <<-EOF > /home/test/build-snap.sh | ||
2096 | 37 | #!/bin/sh | ||
2097 | 38 | set -ex | ||
2098 | 39 | |||
2099 | 40 | export DEBIAN_FRONTEND=noninteractive | ||
2100 | 41 | |||
2101 | 42 | # FIXME: Enable propose for now until problems with conflicting systemd | ||
2102 | 43 | # packages between the Ubuntu Core image ppa and the archive are fixed. | ||
2103 | 44 | echo "deb http://archive.ubuntu.com/ubuntu/ xenial-proposed restricted main universe" > /etc/apt/sources.list.d/ubuntu-proposed.list | ||
2104 | 45 | echo "deb http://ppa.launchpad.net/snappy-dev/image/ubuntu xenial main" > /etc/apt/sources.list.d/ubuntu-image-ppa.list | ||
2105 | 46 | |||
2106 | 47 | |||
2107 | 48 | # Ensure we have the latest updates installed as the core snap | ||
2108 | 49 | # may be a bit out of date. | ||
2109 | 50 | apt update | ||
2110 | 51 | apt -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' full-upgrade -y --force-yes | ||
2111 | 52 | |||
2112 | 53 | apt install -y --force-yes snapcraft | ||
2113 | 54 | cd /home/network-manager | ||
2114 | 55 | snapcraft clean | ||
2115 | 56 | snapcraft | ||
2116 | 57 | EOF | ||
2117 | 58 | chmod +x /home/test/build-snap.sh | ||
2118 | 59 | sudo classic /home/test/build-snap.sh | ||
2119 | 60 | snap remove classic | ||
2120 | 61 | |||
2121 | 62 | # Make sure we have a snap build | ||
2122 | 63 | test -e /home/network-manager/network-manager_*_amd64.snap | ||
2123 | diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh | |||
2124 | 0 | new file mode 100644 | 64 | new file mode 100644 |
2125 | index 0000000..6565405 | |||
2126 | --- /dev/null | |||
2127 | +++ b/tests/lib/prepare.sh | |||
2128 | @@ -0,0 +1,46 @@ | |||
2129 | 1 | #!/bin/bash | ||
2130 | 2 | . $TESTSLIB/utilities.sh | ||
2131 | 3 | |||
2132 | 4 | echo "Wait for firstboot change to be ready" | ||
2133 | 5 | while ! snap changes | grep -q "Done"; do | ||
2134 | 6 | snap changes || true | ||
2135 | 7 | snap change 1 || true | ||
2136 | 8 | sleep 1 | ||
2137 | 9 | done | ||
2138 | 10 | |||
2139 | 11 | echo "Ensure fundamental snaps are still present" | ||
2140 | 12 | . $TESTSLIB/snap-names.sh | ||
2141 | 13 | for name in $gadget_name $kernel_name $core_name; do | ||
2142 | 14 | if ! snap list | grep -q $name ; then | ||
2143 | 15 | echo "Not all fundamental snaps are available, all-snap image not valid" | ||
2144 | 16 | echo "Currently installed snaps:" | ||
2145 | 17 | snap list | ||
2146 | 18 | exit 1 | ||
2147 | 19 | fi | ||
2148 | 20 | done | ||
2149 | 21 | |||
2150 | 22 | # Remove any existing state archive from other test suites | ||
2151 | 23 | rm -f /home/network-manager/snapd-state.tar.gz | ||
2152 | 24 | rm -f /home/network-manager/nm-state.tar.gz | ||
2153 | 25 | |||
2154 | 26 | # TODO install from stable once NM 1.10 is released there | ||
2155 | 27 | snap_install network-manager --channel=1.10/beta | ||
2156 | 28 | |||
2157 | 29 | # Snapshot of the current snapd state for a later restore | ||
2158 | 30 | systemctl stop snapd.service snapd.socket | ||
2159 | 31 | tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan | ||
2160 | 32 | systemctl start snapd.socket | ||
2161 | 33 | |||
2162 | 34 | # Make sure the original netplan configuration is applied and active | ||
2163 | 35 | # (we do this before re-starting NM to avoid race conditions in some tests) | ||
2164 | 36 | netplan generate | ||
2165 | 37 | netplan apply | ||
2166 | 38 | |||
2167 | 39 | # And also snapshot NetworkManager's state | ||
2168 | 40 | systemctl stop snap.network-manager.networkmanager | ||
2169 | 41 | tar czf $SPREAD_PATH/nm-state.tar.gz /var/snap/network-manager | ||
2170 | 42 | systemctl start snap.network-manager.networkmanager | ||
2171 | 43 | |||
2172 | 44 | # For debugging dump all snaps and connected slots/plugs | ||
2173 | 45 | snap list | ||
2174 | 46 | snap interfaces | ||
2175 | diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh | |||
2176 | 0 | new file mode 100644 | 47 | new file mode 100644 |
2177 | index 0000000..b8cdac1 | |||
2178 | --- /dev/null | |||
2179 | +++ b/tests/lib/restore-each.sh | |||
2180 | @@ -0,0 +1,40 @@ | |||
2181 | 1 | #!/bin/bash | ||
2182 | 2 | |||
2183 | 3 | . $TESTSLIB/snap-names.sh | ||
2184 | 4 | . $TESTSLIB/utilities.sh | ||
2185 | 5 | |||
2186 | 6 | # Remove all snaps not being the core, gadget, kernel or snap we're testing | ||
2187 | 7 | for snap in /snap/*; do | ||
2188 | 8 | snap="${snap:6}" | ||
2189 | 9 | case "$snap" in | ||
2190 | 10 | "bin" | "$gadget_name" | "$kernel_name" | core* | "$SNAP_NAME" ) | ||
2191 | 11 | ;; | ||
2192 | 12 | *) | ||
2193 | 13 | snap remove "$snap" | ||
2194 | 14 | ;; | ||
2195 | 15 | esac | ||
2196 | 16 | done | ||
2197 | 17 | |||
2198 | 18 | # Drop any generated or modified netplan configuration files. The original | ||
2199 | 19 | # ones will be restored below. | ||
2200 | 20 | rm -f /etc/netplan/* | ||
2201 | 21 | |||
2202 | 22 | # Ensure we have the same state for snapd as we had before | ||
2203 | 23 | systemctl stop snapd.service snapd.socket | ||
2204 | 24 | rm -rf /var/lib/snapd/* | ||
2205 | 25 | tar xzf $SPREAD_PATH/snapd-state.tar.gz -C / | ||
2206 | 26 | rm -rf /root/.snap | ||
2207 | 27 | systemctl start snapd.service snapd.socket | ||
2208 | 28 | wait_for_systemd_service snapd.service | ||
2209 | 29 | wait_for_systemd_service snapd.socket | ||
2210 | 30 | |||
2211 | 31 | # Make sure the original netplan configuration is applied and active | ||
2212 | 32 | # (we do this before re-starting NM to avoid race conditions in some tests) | ||
2213 | 33 | netplan generate | ||
2214 | 34 | netplan apply | ||
2215 | 35 | |||
2216 | 36 | systemctl stop snap.network-manager.networkmanager | ||
2217 | 37 | rm -rf /var/snap/network-manager/* | ||
2218 | 38 | tar xzf $SPREAD_PATH/nm-state.tar.gz -C / | ||
2219 | 39 | systemctl start snap.network-manager.networkmanager | ||
2220 | 40 | wait_for_network_manager | ||
2221 | diff --git a/tests/lib/snap-names.sh b/tests/lib/snap-names.sh | |||
2222 | 0 | new file mode 100644 | 41 | new file mode 100644 |
2223 | index 0000000..f15b09a | |||
2224 | --- /dev/null | |||
2225 | +++ b/tests/lib/snap-names.sh | |||
2226 | @@ -0,0 +1,7 @@ | |||
2227 | 1 | #!/bin/bash | ||
2228 | 2 | gadget_name=$(snap list | sed -n 's/^\(pc\|pi[23]\|dragonboard\) .*/\1/p') | ||
2229 | 3 | kernel_name=$gadget_name-kernel | ||
2230 | 4 | core_name=$(snap list | awk '/^(ubuntu-)?core / {print $1; exit}') | ||
2231 | 5 | if [ "$kernel_name" = "pi3-kernel" ] ; then | ||
2232 | 6 | kernel_name=pi2-kernel | ||
2233 | 7 | fi | ||
2234 | diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh | |||
2235 | 0 | new file mode 100644 | 8 | new file mode 100644 |
2236 | index 0000000..6144a89 | |||
2237 | --- /dev/null | |||
2238 | +++ b/tests/lib/utilities.sh | |||
2239 | @@ -0,0 +1,166 @@ | |||
2240 | 1 | #!/bin/sh | ||
2241 | 2 | |||
2242 | 3 | snap_install() { | ||
2243 | 4 | name=$1 | ||
2244 | 5 | if [ -n "$SNAP_CHANNEL" ] ; then | ||
2245 | 6 | # Don't reinstall if we have it installed already | ||
2246 | 7 | if ! snap list | grep $name ; then | ||
2247 | 8 | snap install --$SNAP_CHANNEL $name | ||
2248 | 9 | fi | ||
2249 | 10 | else | ||
2250 | 11 | # Need first install from store to get all necessary assertions into | ||
2251 | 12 | # place. Second local install will then bring in our locally built | ||
2252 | 13 | # snap. | ||
2253 | 14 | snap install $name $2 | ||
2254 | 15 | snap install --dangerous $PROJECT_PATH/$name*_amd64.snap | ||
2255 | 16 | fi | ||
2256 | 17 | } | ||
2257 | 18 | |||
2258 | 19 | switch_netplan_to_network_manager() { | ||
2259 | 20 | if [ -e /etc/netplan/00-default-nm-renderer.yaml ] ; then | ||
2260 | 21 | return 0 | ||
2261 | 22 | fi | ||
2262 | 23 | |||
2263 | 24 | # set 'defaultrenderer' in case the snap is already installed | ||
2264 | 25 | if snap list | grep -q network-manager ; then | ||
2265 | 26 | snap set network-manager defaultrenderer=true | ||
2266 | 27 | # Leave some time for NM wrapper to write netplan config | ||
2267 | 28 | repeat_until_done "test -e /etc/netplan/00-default-nm-renderer.yaml" | ||
2268 | 29 | else | ||
2269 | 30 | cat << EOF > /etc/netplan/00-default-nm-renderer.yaml | ||
2270 | 31 | network: | ||
2271 | 32 | renderer: NetworkManager | ||
2272 | 33 | EOF | ||
2273 | 34 | fi | ||
2274 | 35 | } | ||
2275 | 36 | |||
2276 | 37 | switch_netplan_to_networkd() { | ||
2277 | 38 | if [ ! -e /etc/netplan/00-default-nm-renderer.yaml ] ; then | ||
2278 | 39 | return 0 | ||
2279 | 40 | fi | ||
2280 | 41 | |||
2281 | 42 | # unset 'defaultrenderer' in case the snap is already installed | ||
2282 | 43 | if snap list | grep -q network-manager ; then | ||
2283 | 44 | snap set network-manager defaultrenderer=false | ||
2284 | 45 | # Leave some time for NM wrapper to remove netplan config | ||
2285 | 46 | repeat_until_done "test ! -e /etc/netplan/00-default-nm-renderer.yaml" | ||
2286 | 47 | else | ||
2287 | 48 | rm /etc/netplan/00-default-nm-renderer.yaml | ||
2288 | 49 | fi | ||
2289 | 50 | } | ||
2290 | 51 | |||
2291 | 52 | # waits for a service to be active. Besides that, waits enough | ||
2292 | 53 | # time after detecting it to be active to prevent restarting | ||
2293 | 54 | # same service too quickly several times. | ||
2294 | 55 | # $1 service name | ||
2295 | 56 | # $2 start limit interval in seconds (default set to 10. Exec `systemctl show THE_SERVICE -p StartLimitInterval` to verify) | ||
2296 | 57 | # $3 start limit burst. Times allowed to start the service in start_limit_interval time (default set to 5. Exec `systemctl show THE_SERVICE -p StartLimitBurst` to verify) | ||
2297 | 58 | wait_for_systemd_service() { | ||
2298 | 59 | while ! systemctl status $1 ; do | ||
2299 | 60 | sleep 1 | ||
2300 | 61 | done | ||
2301 | 62 | # As debian services default limit is to allow 5 restarts in a 10sec period | ||
2302 | 63 | # (StartLimitInterval=10000000 and StartLimitBurst=5), having enough wait time we | ||
2303 | 64 | # prevent "service: Start request repeated too quickly" error. | ||
2304 | 65 | # | ||
2305 | 66 | # You can check those values for certain service by typing: | ||
2306 | 67 | # $systemctl show THE_SERVICE -p StartLimitInterval,StartLimitBurst | ||
2307 | 68 | # | ||
2308 | 69 | if [ $# -ge 2 ]; then | ||
2309 | 70 | start_limit_interval = $2 | ||
2310 | 71 | else | ||
2311 | 72 | start_limit_interval=$(systemctl show $1 -p StartLimitInterval | sed 's/StartLimitInterval=//') | ||
2312 | 73 | # original limit interval is provided in microseconds. | ||
2313 | 74 | start_limit_interval=$((start_limit_interval / 1000000)) | ||
2314 | 75 | fi | ||
2315 | 76 | |||
2316 | 77 | if [ $# -eq 3 ]; then | ||
2317 | 78 | start_limit_burst = $3 | ||
2318 | 79 | else | ||
2319 | 80 | start_limit_burst=$(systemctl show $1 -p StartLimitBurst | sed 's/StartLimitBurst=//') | ||
2320 | 81 | fi | ||
2321 | 82 | |||
2322 | 83 | # adding 1 to be sure we exceed the limit | ||
2323 | 84 | sleep_time=$((1 + $start_limit_interval / $start_limit_burst)) | ||
2324 | 85 | sleep $sleep_time | ||
2325 | 86 | } | ||
2326 | 87 | |||
2327 | 88 | wait_for_network_manager() { | ||
2328 | 89 | wait_for_systemd_service snap.network-manager.networkmanager | ||
2329 | 90 | } | ||
2330 | 91 | |||
2331 | 92 | stop_after_first_reboot() { | ||
2332 | 93 | if [ $SPREAD_REBOOT -gt 0 ] ; then | ||
2333 | 94 | exit 0 | ||
2334 | 95 | fi | ||
2335 | 96 | } | ||
2336 | 97 | |||
2337 | 98 | mac_to_ipv6() { | ||
2338 | 99 | mac=$1 | ||
2339 | 100 | ipv6_address=fe80::$(printf %02x $((0x${mac%%:*} ^ 2))) | ||
2340 | 101 | mac=${mac#*:} | ||
2341 | 102 | ipv6_address=$ipv6_address${mac%:*:*:*}ff:fe | ||
2342 | 103 | mac=${mac#*:*:} | ||
2343 | 104 | ipv6_address=$ipv6_address${mac%:*}${mac##*:} | ||
2344 | 105 | echo $ipv6_address | ||
2345 | 106 | } | ||
2346 | 107 | |||
2347 | 108 | # Creates an AP using wifi-ap | ||
2348 | 109 | # $1: SSID name | ||
2349 | 110 | # $2: Passphrase. If present, AP will use WPA2, otherwise it will be open. | ||
2350 | 111 | create_ap() { | ||
2351 | 112 | if [ $# -lt 1 ]; then | ||
2352 | 113 | echo "Not enough arguments for $0" | ||
2353 | 114 | return 1 | ||
2354 | 115 | fi | ||
2355 | 116 | |||
2356 | 117 | snap install wifi-ap | ||
2357 | 118 | # wifi-ap needs a bit of time to settle down | ||
2358 | 119 | repeat_until_done 'wifi-ap.status | MATCH "ap.active: true"' 0.5 | ||
2359 | 120 | |||
2360 | 121 | /snap/bin/wifi-ap.config set wifi.interface=wlan0 | ||
2361 | 122 | /snap/bin/wifi-ap.config set wifi.ssid="$1" | ||
2362 | 123 | if [ $# -ge 2 ]; then | ||
2363 | 124 | /snap/bin/wifi-ap.config set wifi.security=wpa2 | ||
2364 | 125 | /snap/bin/wifi-ap.config set wifi.security-passphrase="$2" | ||
2365 | 126 | else | ||
2366 | 127 | /snap/bin/wifi-ap.config set wifi.security=open | ||
2367 | 128 | fi | ||
2368 | 129 | |||
2369 | 130 | # NM some times still detects the wifi as WPA2 instead of open, so we need | ||
2370 | 131 | # to re-start to force it to refresh. See LP: #1704085. Before that, we have | ||
2371 | 132 | # to wait to make sure the AP sends the beacon frames so wpa_supplicant | ||
2372 | 133 | # detects the AP changes and reports the right environment to the new NM | ||
2373 | 134 | # instance. | ||
2374 | 135 | sleep 30 | ||
2375 | 136 | |||
2376 | 137 | systemctl restart snap.network-manager.networkmanager.service | ||
2377 | 138 | repeat_until_done "busctl status org.freedesktop.NetworkManager &> /dev/null" 0.5 | ||
2378 | 139 | |||
2379 | 140 | repeat_until_done "network-manager.nmcli d wifi | MATCH $1" 5 | ||
2380 | 141 | } | ||
2381 | 142 | |||
2382 | 143 | # $1 instruction to execute repeatedly until complete or max times | ||
2383 | 144 | # $2 sleep time between retries. Default 1sec | ||
2384 | 145 | # $3 max_iterations. Default 20 | ||
2385 | 146 | repeat_until_done() { | ||
2386 | 147 | timeout=1 | ||
2387 | 148 | if [ $# -ge 2 ]; then | ||
2388 | 149 | timeout=$2 | ||
2389 | 150 | fi | ||
2390 | 151 | |||
2391 | 152 | max_iterations=20 | ||
2392 | 153 | if [ $# -ge 3 ]; then | ||
2393 | 154 | max_iterations=$3 | ||
2394 | 155 | fi | ||
2395 | 156 | |||
2396 | 157 | i=0 | ||
2397 | 158 | while [ $i -lt $max_iterations ] ; do | ||
2398 | 159 | if $(eval $1) ; then | ||
2399 | 160 | break | ||
2400 | 161 | fi | ||
2401 | 162 | sleep $timeout | ||
2402 | 163 | let i=i+1 | ||
2403 | 164 | done | ||
2404 | 165 | test $i -lt $max_iterations | ||
2405 | 166 | } | ||
2406 | diff --git a/tests/main/aliases/task.yaml b/tests/main/aliases/task.yaml | |||
2407 | 0 | new file mode 100644 | 167 | new file mode 100644 |
2408 | index 0000000..1ae0e05 | |||
2409 | --- /dev/null | |||
2410 | +++ b/tests/main/aliases/task.yaml | |||
2411 | @@ -0,0 +1,13 @@ | |||
2412 | 1 | summary: Verify aliases provided by the snap are correctly enabled | ||
2413 | 2 | |||
2414 | 3 | execute: | | ||
2415 | 4 | # FIXME: Aliases should be not in place automatically unless we | ||
2416 | 5 | # have them approved from the store in our snap-declaration assertion. | ||
2417 | 6 | test ! -e /snap/bin/nmcli | ||
2418 | 7 | |||
2419 | 8 | snap alias $SNAP_NAME.nmcli nmcli | ||
2420 | 9 | |||
2421 | 10 | test -e /snap/bin/nmcli | ||
2422 | 11 | |||
2423 | 12 | # Verify the alias works without any problems | ||
2424 | 13 | /snap/bin/nmcli g | ||
2425 | diff --git a/tests/main/can-exec-iptables/task.yaml b/tests/main/can-exec-iptables/task.yaml | |||
2426 | 0 | new file mode 100644 | 14 | new file mode 100644 |
2427 | index 0000000..eeffe75 | |||
2428 | --- /dev/null | |||
2429 | +++ b/tests/main/can-exec-iptables/task.yaml | |||
2430 | @@ -0,0 +1,11 @@ | |||
2431 | 1 | summary: Verify the NetworkManager snap is allowed to modify the iptables firewall configuration | ||
2432 | 2 | |||
2433 | 3 | execute: | | ||
2434 | 4 | # Running a simple command in the runtime environment of our service | ||
2435 | 5 | # binary will tell us if we're allowed to execute the iptables binary | ||
2436 | 6 | # from the core snap or not. | ||
2437 | 7 | snap run --shell network-manager.networkmanager <<EOF | ||
2438 | 8 | set -ex | ||
2439 | 9 | export LD_LIBRARY_PATH=/snap/network-manager/current/lib:/snap/network-manager/current/usr/lib:/snap/network-manager/current/lib/$(arch)-linux-gnu:/snap/network-manager/current/usr/lib/$(arch)-linux-gnu:/snap/network-manager/current/usr/lib/NetworkManager | ||
2440 | 10 | /snap/network-manager/current/sbin/iptables -L | ||
2441 | 11 | EOF | ||
2442 | diff --git a/tests/main/debug-config-option/task.yaml b/tests/main/debug-config-option/task.yaml | |||
2443 | 0 | new file mode 100644 | 12 | new file mode 100644 |
2444 | index 0000000..3ffa20e | |||
2445 | --- /dev/null | |||
2446 | +++ b/tests/main/debug-config-option/task.yaml | |||
2447 | @@ -0,0 +1,27 @@ | |||
2448 | 1 | summary: Test network-manager snap debug configuration | ||
2449 | 2 | |||
2450 | 3 | execute: | | ||
2451 | 4 | . $TESTSLIB/utilities.sh | ||
2452 | 5 | |||
2453 | 6 | test "$(snap get network-manager debug.enable)" = "false" | ||
2454 | 7 | if journalctl --no-pager -u snap.network-manager.networkmanager.service | | ||
2455 | 8 | MATCH "<debug>"; then | ||
2456 | 9 | echo "Debug traces found with disabled debug option" | ||
2457 | 10 | exit 1 | ||
2458 | 11 | fi | ||
2459 | 12 | |||
2460 | 13 | snap set network-manager debug.enable=true | ||
2461 | 14 | test "$(snap get network-manager debug.enable)" = "true" | ||
2462 | 15 | # NM will create the file after being re-started by the hook, wait a bit | ||
2463 | 16 | wait_for_network_manager | ||
2464 | 17 | sleep 5 | ||
2465 | 18 | test -f /var/snap/network-manager/current/.debug_enabled | ||
2466 | 19 | network-manager.nmcli g log | MATCH "^DEBUG" | ||
2467 | 20 | |||
2468 | 21 | snap set network-manager debug.enable=false | ||
2469 | 22 | test "$(snap get network-manager debug.enable)" = "false" | ||
2470 | 23 | # NM will create the file after being re-started by the hook, wait a bit | ||
2471 | 24 | wait_for_network_manager | ||
2472 | 25 | sleep 5 | ||
2473 | 26 | test ! -f /var/snap/network-manager/current/.debug_enabled | ||
2474 | 27 | network-manager.nmcli g log | MATCH "^INFO" | ||
2475 | diff --git a/tests/main/documentation-builds/task.yaml b/tests/main/documentation-builds/task.yaml | |||
2476 | 0 | new file mode 100644 | 28 | new file mode 100644 |
2477 | index 0000000..fd2a358 | |||
2478 | --- /dev/null | |||
2479 | +++ b/tests/main/documentation-builds/task.yaml | |||
2480 | @@ -0,0 +1,14 @@ | |||
2481 | 1 | summary: Verify the project documentation is building without errors | ||
2482 | 2 | |||
2483 | 3 | execute: | | ||
2484 | 4 | # Need to install in devmode as otherwise the snap can't access our project | ||
2485 | 5 | # home which is outside of the home directory of our current user. | ||
2486 | 6 | snap install --devmode documentation-builder | ||
2487 | 7 | |||
2488 | 8 | outdir=$PROJECT_PATH/docs/snap/build | ||
2489 | 9 | |||
2490 | 10 | cd $PROJECT_PATH/docs/snap | ||
2491 | 11 | /snap/bin/documentation-builder --output-path $outdir | ||
2492 | 12 | |||
2493 | 13 | # Ensure we have some files in the output directory | ||
2494 | 14 | test `find $outdir -type f | wc -l` -gt 0 | ||
2495 | diff --git a/tests/main/ethernet-managed-by-networkmanager/task.yaml b/tests/main/ethernet-managed-by-networkmanager/task.yaml | |||
2496 | 0 | new file mode 100644 | 15 | new file mode 100644 |
2497 | index 0000000..a3c1b13 | |||
2498 | --- /dev/null | |||
2499 | +++ b/tests/main/ethernet-managed-by-networkmanager/task.yaml | |||
2500 | @@ -0,0 +1,16 @@ | |||
2501 | 1 | summary: When defaultrender is set NM manages ethernet | ||
2502 | 2 | |||
2503 | 3 | execute: | | ||
2504 | 4 | . $TESTSLIB/utilities.sh | ||
2505 | 5 | snap set network-manager defaultrenderer=true | ||
2506 | 6 | netplan apply | ||
2507 | 7 | # Whenever we can call netplan from the NM snap, the following line won't | ||
2508 | 8 | # be needed | ||
2509 | 9 | systemctl restart systemd-networkd | ||
2510 | 10 | sleep 5 | ||
2511 | 11 | networkctl | grep 'eth0.*unmanaged' | ||
2512 | 12 | wait_for_network_manager | ||
2513 | 13 | /snap/bin/network-manager.nmcli d | grep 'eth0.*connected' | ||
2514 | 14 | snap set network-manager defaultrenderer=false | ||
2515 | 15 | netplan apply | ||
2516 | 16 | systemctl restart systemd-networkd | ||
2517 | diff --git a/tests/main/installation/task.yaml b/tests/main/installation/task.yaml | |||
2518 | 0 | new file mode 100644 | 17 | new file mode 100644 |
2519 | index 0000000..bdaf48d | |||
2520 | --- /dev/null | |||
2521 | +++ b/tests/main/installation/task.yaml | |||
2522 | @@ -0,0 +1,17 @@ | |||
2523 | 1 | summary: Test network-manager snap installation was successful | ||
2524 | 2 | |||
2525 | 3 | execute: | | ||
2526 | 4 | . $TESTSLIB/utilities.sh | ||
2527 | 5 | |||
2528 | 6 | # Service should be up an running | ||
2529 | 7 | wait_for_network_manager | ||
2530 | 8 | |||
2531 | 9 | # .. and nmcli should be able to reach NetworkManager | ||
2532 | 10 | /snap/bin/network-manager.nmcli g | ||
2533 | 11 | |||
2534 | 12 | # Ensure all necessary plugs/slots are connected | ||
2535 | 13 | snap interfaces | grep -Pzq ":network-setup-observe +[a-z,-]*network-manager" | ||
2536 | 14 | snap interfaces | grep -Pzq ":ppp +[a-z,-]*network-manager" | ||
2537 | 15 | snap interfaces | grep -Pzq ":firewall-control +[a-z,-]*network-manager" | ||
2538 | 16 | snap interfaces | grep -Pzq ":network-setup-observe +[a-z,-]*network-manager" | ||
2539 | 17 | snap interfaces | grep -Pzq "network-manager:service +network-manager:nmcli" | ||
2540 | diff --git a/tests/main/set-hostname/task.yaml b/tests/main/set-hostname/task.yaml | |||
2541 | 0 | new file mode 100644 | 18 | new file mode 100644 |
2542 | index 0000000..69b27c8 | |||
2543 | --- /dev/null | |||
2544 | +++ b/tests/main/set-hostname/task.yaml | |||
2545 | @@ -0,0 +1,17 @@ | |||
2546 | 1 | summary: Verify we can modify the hostname of the system | ||
2547 | 2 | |||
2548 | 3 | execute: | | ||
2549 | 4 | . "$TESTSLIB/utilities.sh" | ||
2550 | 5 | |||
2551 | 6 | wait_for_network_manager | ||
2552 | 7 | |||
2553 | 8 | # Print out current hostname for nm and hostnamed to have a reference | ||
2554 | 9 | # for debugging later. | ||
2555 | 10 | /snap/bin/network-manager.nmcli general hostname | ||
2556 | 11 | hostnamectl | ||
2557 | 12 | |||
2558 | 13 | expected_hostname=foobar | ||
2559 | 14 | /snap/bin/network-manager.nmcli general hostname $expected_hostname | ||
2560 | 15 | test "`/snap/bin/network-manager.nmcli general hostname`" = "$expected_hostname" | ||
2561 | 16 | test "`hostnamectl status | grep Static`" = " Static hostname: $expected_hostname" | ||
2562 | 17 | test "`hostname`" = "$expected_hostname" | ||
2563 | diff --git a/tests/main/static-ip-configuration/task.yaml b/tests/main/static-ip-configuration/task.yaml | |||
2564 | 0 | new file mode 100644 | 18 | new file mode 100644 |
2565 | index 0000000..6c86dda | |||
2566 | --- /dev/null | |||
2567 | +++ b/tests/main/static-ip-configuration/task.yaml | |||
2568 | @@ -0,0 +1,49 @@ | |||
2569 | 1 | summary: Test static IP configuration | ||
2570 | 2 | |||
2571 | 3 | restore: | | ||
2572 | 4 | # Ensure that the created virtual network interfaces are removed | ||
2573 | 5 | # in any case when we're done | ||
2574 | 6 | if [ -e /sys/class/net/veth0 ] ; then | ||
2575 | 7 | ip link delete veth0 | ||
2576 | 8 | fi | ||
2577 | 9 | |||
2578 | 10 | execute: | | ||
2579 | 11 | . $TESTSLIB/utilities.sh | ||
2580 | 12 | |||
2581 | 13 | ip link add dev veth0 type veth peer name veth1 | ||
2582 | 14 | |||
2583 | 15 | wait_for_network_manager | ||
2584 | 16 | # NetworkManager should ignore the other side of our pipe so | ||
2585 | 17 | # that we can configure it statically. | ||
2586 | 18 | /snap/bin/network-manager.nmcli d set veth1 managed no | ||
2587 | 19 | ip addr add 10.0.1.1/24 dev veth1 | ||
2588 | 20 | |||
2589 | 21 | connection=veth0-static | ||
2590 | 22 | /snap/bin/network-manager.nmcli c add con-name $connection type ethernet ifname veth0 \ | ||
2591 | 23 | ip4 10.0.1.2/24 | ||
2592 | 24 | /snap/bin/network-manager.nmcli c up $connection | ||
2593 | 25 | /snap/bin/network-manager.nmcli d | grep 'veth0.*connected' | ||
2594 | 26 | |||
2595 | 27 | # Address should be correctly applied now | ||
2596 | 28 | expected_veth0_address="10.0.1.2/24" | ||
2597 | 29 | /snap/bin/network-manager.nmcli -m multiline -f IP4.ADDRESS c show veth0-static | grep $expected_veth0_address | ||
2598 | 30 | ip addr show dev veth0 | grep 'UP' | ||
2599 | 31 | ip addr show dev veth0 | grep $expected_veth0_address | ||
2600 | 32 | |||
2601 | 33 | # Routing needs to be in place as well | ||
2602 | 34 | expected_veth0_route="10.0.1.0/24 dev veth0 proto kernel scope link src 10.0.1.2 metric 101" | ||
2603 | 35 | ip route | grep "$expected_veth0_route" | ||
2604 | 36 | |||
2605 | 37 | # Disable connection and ensure IP configuration is removed | ||
2606 | 38 | /snap/bin/network-manager.nmcli c down $connection | ||
2607 | 39 | ip addr show dev veth0 | grep -v $expected_veth0_address | ||
2608 | 40 | ip route | grep -v "$expected_veth0_route" | ||
2609 | 41 | |||
2610 | 42 | # Enabling network connection again and removing it should remove | ||
2611 | 43 | # the IP configuration too | ||
2612 | 44 | /snap/bin/network-manager.nmcli c up $connection | ||
2613 | 45 | ip addr show dev veth0 | grep $expected_veth0_address | ||
2614 | 46 | ip route | grep "$expected_veth0_route" | ||
2615 | 47 | /snap/bin/network-manager.nmcli c delete $connection | ||
2616 | 48 | ip addr show dev veth0 | grep -v $expected_veth0_address | ||
2617 | 49 | ip route | grep -v "$expected_veth0_route" | ||
2618 | diff --git a/tests/main/wifi-connect-secured-ap/task.yaml b/tests/main/wifi-connect-secured-ap/task.yaml | |||
2619 | 0 | new file mode 100644 | 50 | new file mode 100644 |
2620 | index 0000000..46c2ba6 | |||
2621 | --- /dev/null | |||
2622 | +++ b/tests/main/wifi-connect-secured-ap/task.yaml | |||
2623 | @@ -0,0 +1,14 @@ | |||
2624 | 1 | summary: Test connection to a secured WiFi AP | ||
2625 | 2 | |||
2626 | 3 | environment: | ||
2627 | 4 | WIFI_SSID: Ubuntu | ||
2628 | 5 | WIFI_PASSPHRASE: Test1234 | ||
2629 | 6 | |||
2630 | 7 | execute: | | ||
2631 | 8 | . $TESTSLIB/utilities.sh | ||
2632 | 9 | |||
2633 | 10 | create_ap "$WIFI_SSID" "$WIFI_PASSPHRASE" | ||
2634 | 11 | |||
2635 | 12 | # Connect to the AP and ensure the connection was established | ||
2636 | 13 | /snap/bin/network-manager.nmcli d wifi connect $WIFI_SSID password $WIFI_PASSPHRASE | ||
2637 | 14 | /snap/bin/network-manager.nmcli d | grep 'wlan1.*connected' | ||
2638 | diff --git a/tests/main/wifi-powersave-config-option/task.yaml b/tests/main/wifi-powersave-config-option/task.yaml | |||
2639 | 0 | new file mode 100644 | 15 | new file mode 100644 |
2640 | index 0000000..621256e | |||
2641 | --- /dev/null | |||
2642 | +++ b/tests/main/wifi-powersave-config-option/task.yaml | |||
2643 | @@ -0,0 +1,31 @@ | |||
2644 | 1 | summary: Verify WiFi powersave can be enabled via a snap config option | ||
2645 | 2 | |||
2646 | 3 | environment: | ||
2647 | 4 | WIFI_POWERSAVE_CONF_PATH: /var/snap/network-manager/current/conf.d/wifi-powersave.conf | ||
2648 | 5 | |||
2649 | 6 | execute: | | ||
2650 | 7 | . $TESTSLIB/utilities.sh | ||
2651 | 8 | |||
2652 | 9 | # The mac80211_hwsim driver does not support the powersave mode | ||
2653 | 10 | # so we can't check this reliable. | ||
2654 | 11 | |||
2655 | 12 | test "`snap get network-manager wifi.powersave`" = "disabled" | ||
2656 | 13 | grep "wifi.powersave = 2" $WIFI_POWERSAVE_CONF_PATH | ||
2657 | 14 | |||
2658 | 15 | # Try to enable and disable again | ||
2659 | 16 | snap set network-manager wifi.powersave=enabled | ||
2660 | 17 | wait_for_network_manager | ||
2661 | 18 | test "`snap get network-manager wifi.powersave`" = "enabled" | ||
2662 | 19 | grep "wifi.powersave = 3" $WIFI_POWERSAVE_CONF_PATH | ||
2663 | 20 | |||
2664 | 21 | snap set network-manager wifi.powersave=disabled | ||
2665 | 22 | wait_for_network_manager | ||
2666 | 23 | test "`snap get network-manager wifi.powersave`" = "disabled" | ||
2667 | 24 | grep "wifi.powersave = 2" $WIFI_POWERSAVE_CONF_PATH | ||
2668 | 25 | |||
2669 | 26 | # Specifying no value means the snap should use the default | ||
2670 | 27 | # which is 'disable' | ||
2671 | 28 | snap set network-manager wifi.powersave= | ||
2672 | 29 | wait_for_network_manager | ||
2673 | 30 | test "`snap get network-manager wifi.powersave`" = "disabled" | ||
2674 | 31 | grep "wifi.powersave = 2" $WIFI_POWERSAVE_CONF_PATH | ||
2675 | diff --git a/tests/main/wifi-wowlan-config-option/task.yaml b/tests/main/wifi-wowlan-config-option/task.yaml | |||
2676 | 0 | new file mode 100644 | 32 | new file mode 100644 |
2677 | index 0000000..a0e1e0b | |||
2678 | --- /dev/null | |||
2679 | +++ b/tests/main/wifi-wowlan-config-option/task.yaml | |||
2680 | @@ -0,0 +1,77 @@ | |||
2681 | 1 | summary: Verify WiFi WoWLAN can be enabled via a snap config option | ||
2682 | 2 | |||
2683 | 3 | environment: | ||
2684 | 4 | WIFI_WOWL_CONF_PATH: /var/snap/network-manager/current/conf.d/wifi-wowlan.conf | ||
2685 | 5 | |||
2686 | 6 | execute: | | ||
2687 | 7 | . $TESTSLIB/utilities.sh | ||
2688 | 8 | |||
2689 | 9 | # The mac80211_hwsim driver does not support WoWLAN so we can't | ||
2690 | 10 | # check this reliable on the hardware level and will only check | ||
2691 | 11 | # in the following that the correct configuration for | ||
2692 | 12 | # NetworkManager itself is written out. | ||
2693 | 13 | |||
2694 | 14 | test `snap get network-manager wifi.wake-on-wlan` = disabled | ||
2695 | 15 | grep "^wifi.wake-on-wlan=0$" $WIFI_WOWL_CONF_PATH | ||
2696 | 16 | |||
2697 | 17 | test "`snap get network-manager wifi.wake-on-wlan-password`" = "" | ||
2698 | 18 | grep -v "^wifi.wake-on-wlan-password=.*$" $WIFI_WOWL_CONF_PATH | ||
2699 | 19 | |||
2700 | 20 | snap set network-manager wifi.wake-on-wlan-password=Test1234 | ||
2701 | 21 | wait_for_network_manager | ||
2702 | 22 | grep "^wifi.wake-on-wlan-password=Test1234$" $WIFI_WOWL_CONF_PATH | ||
2703 | 23 | # Setting the password alone should keep the actual WoWLAN value | ||
2704 | 24 | # still unset so that NetworkManager uses its default. | ||
2705 | 25 | grep -v "^wifi.wake-on-wlan=.*$" $WIFI_WOWL_CONF_PATH | ||
2706 | 26 | |||
2707 | 27 | snap set network-manager wifi.wake-on-wlan=magic | ||
2708 | 28 | wait_for_network_manager | ||
2709 | 29 | grep "^wifi.wake-on-wlan=8$" $WIFI_WOWL_CONF_PATH | ||
2710 | 30 | grep "^wifi.wake-on-wlan-password=Test1234$" $WIFI_WOWL_CONF_PATH | ||
2711 | 31 | |||
2712 | 32 | # Test all other possible keys for the wifi.wake-on-wlan option | ||
2713 | 33 | snap set network-manager wifi.wake-on-wlan=disabled | ||
2714 | 34 | wait_for_network_manager | ||
2715 | 35 | grep "^wifi.wake-on-wlan=0$" $WIFI_WOWL_CONF_PATH | ||
2716 | 36 | |||
2717 | 37 | snap set network-manager wifi.wake-on-wlan=any | ||
2718 | 38 | wait_for_network_manager | ||
2719 | 39 | grep "^wifi.wake-on-wlan=2$" $WIFI_WOWL_CONF_PATH | ||
2720 | 40 | |||
2721 | 41 | snap set network-manager wifi.wake-on-wlan=disconnect | ||
2722 | 42 | wait_for_network_manager | ||
2723 | 43 | grep "^wifi.wake-on-wlan=4$" $WIFI_WOWL_CONF_PATH | ||
2724 | 44 | |||
2725 | 45 | snap set network-manager wifi.wake-on-wlan=magic | ||
2726 | 46 | wait_for_network_manager | ||
2727 | 47 | grep "^wifi.wake-on-wlan=8$" $WIFI_WOWL_CONF_PATH | ||
2728 | 48 | |||
2729 | 49 | snap set network-manager wifi.wake-on-wlan=gtk-rekey-failure | ||
2730 | 50 | wait_for_network_manager | ||
2731 | 51 | grep "^wifi.wake-on-wlan=16$" $WIFI_WOWL_CONF_PATH | ||
2732 | 52 | |||
2733 | 53 | snap set network-manager wifi.wake-on-wlan=eap-identity-request | ||
2734 | 54 | wait_for_network_manager | ||
2735 | 55 | grep "^wifi.wake-on-wlan=32$" $WIFI_WOWL_CONF_PATH | ||
2736 | 56 | |||
2737 | 57 | snap set network-manager wifi.wake-on-wlan=4way-handshake | ||
2738 | 58 | wait_for_network_manager | ||
2739 | 59 | grep "^wifi.wake-on-wlan=64$" $WIFI_WOWL_CONF_PATH | ||
2740 | 60 | |||
2741 | 61 | snap set network-manager wifi.wake-on-wlan=rfkill-release | ||
2742 | 62 | wait_for_network_manager | ||
2743 | 63 | grep "^wifi.wake-on-wlan=128$" $WIFI_WOWL_CONF_PATH | ||
2744 | 64 | |||
2745 | 65 | snap set network-manager wifi.wake-on-wlan=tcp | ||
2746 | 66 | wait_for_network_manager | ||
2747 | 67 | grep "^wifi.wake-on-wlan=256$" $WIFI_WOWL_CONF_PATH | ||
2748 | 68 | |||
2749 | 69 | # Not setting any concrete value should remove the configuration | ||
2750 | 70 | snap set network-manager wifi.wake-on-wlan-password= | ||
2751 | 71 | wait_for_network_manager | ||
2752 | 72 | grep -v "^wifi.wake-on-wlan-password=.*$" $WIFI_WOWL_CONF_PATH | ||
2753 | 73 | |||
2754 | 74 | snap set network-manager wifi.wake-on-wlan= | ||
2755 | 75 | wait_for_network_manager | ||
2756 | 76 | grep -v "^wifi.wake-on-wlan=.*$" $WIFI_WOWL_CONF_PATH | ||
2757 | 77 | grep -v "^wifi.wake-on-wlan-password=.*$" $WIFI_WOWL_CONF_PATH | ||
2758 | diff --git a/tests/main/wifi-wowlan-enabled-correctly/task.yaml b/tests/main/wifi-wowlan-enabled-correctly/task.yaml | |||
2759 | 0 | new file mode 100644 | 78 | new file mode 100644 |
2760 | index 0000000..8fcaecc | |||
2761 | --- /dev/null | |||
2762 | +++ b/tests/main/wifi-wowlan-enabled-correctly/task.yaml | |||
2763 | @@ -0,0 +1,30 @@ | |||
2764 | 1 | summary: Verify WiFi WoWLAN can be enabled in NetworkManager globally via a snap config option | ||
2765 | 2 | |||
2766 | 3 | execute: | | ||
2767 | 4 | . $TESTSLIB/utilities.sh | ||
2768 | 5 | |||
2769 | 6 | # Enable WoWLAN globally for all new WiFi connections | ||
2770 | 7 | snap set network-manager wifi.wake-on-wlan=any | ||
2771 | 8 | wait_for_network_manager | ||
2772 | 9 | |||
2773 | 10 | # Get us an AP via the wifi-ap we can use to create a connection to | ||
2774 | 11 | create_ap Ubuntu | ||
2775 | 12 | |||
2776 | 13 | # Connect to the AP and ensure the connection was established | ||
2777 | 14 | /snap/bin/network-manager.nmcli d wifi | grep Ubuntu | ||
2778 | 15 | /snap/bin/network-manager.nmcli d wifi connect Ubuntu | ||
2779 | 16 | /snap/bin/network-manager.nmcli d | grep 'wlan1.*connected' | ||
2780 | 17 | |||
2781 | 18 | # Now that we're connected a new connection exists which we can look at | ||
2782 | 19 | # to verify that the WoWLAN key is correctly set. | ||
2783 | 20 | /snap/bin/network-manager.nmcli c show Ubuntu | grep '802-11-wireless.wake-on-wlan:.*0x1 (default)' | ||
2784 | 21 | |||
2785 | 22 | if [ "$SPREAD_SYSTEM" = "hw-ubuntu-core-16" ]; then | ||
2786 | 23 | if ! iw phy phy0 info | grep -q "WoWLAN support:" ; then | ||
2787 | 24 | echo "INFO: Hardware does not support WoWLAN so we're not testing application" | ||
2788 | 25 | echo " of the configuration option on the hardware." | ||
2789 | 26 | exit 0 | ||
2790 | 27 | fi | ||
2791 | 28 | iw phy phy0 wowlan show | grep "WoWLAN is enabled" | ||
2792 | 29 | iw phy phy0 wowlan show | grep "wake up on special any trigger" | ||
2793 | 30 | fi |
FAILED: Continuous integration, rev:9226cba7432 fe640ff3933f671 1e119879ea00c6 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build- prepare/ 383/ /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= amd64/416/ console /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= arm64/416 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= armhf/416 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= i386/416 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-docs/ 1208 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-cleanup/ 950 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-update- mp/996/ console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build- prepare/ 383/rebuild
https:/