|
12 | 12 | StepLogger.start()
|
13 | 13 |
|
14 | 14 |
|
15 |
| -e = Environment('nm.env') |
| 15 | +e = Environment("nm.env") |
16 | 16 | t = e.get_target()
|
17 |
| -d = t.get_driver('NetworkInterfaceDriver') |
| 17 | +d = t.get_driver("NetworkInterfaceDriver") |
18 | 18 |
|
19 | 19 | # based on https://developer.gnome.org/NetworkManager/stable/ch01.html, but adapted to python dicts
|
20 | 20 | s_client = {
|
21 |
| - 'connection': { |
22 |
| - 'type': "802-11-wireless", |
| 21 | + "connection": { |
| 22 | + "type": "802-11-wireless", |
23 | 23 | },
|
24 |
| - '802-11-wireless': { |
25 |
| - 'mode': "infrastructure", |
26 |
| - 'ssid': "local-rpi", |
| 24 | + "802-11-wireless": { |
| 25 | + "mode": "infrastructure", |
| 26 | + "ssid": "local-rpi", |
27 | 27 | },
|
28 |
| - '802-11-wireless-security': { |
29 |
| - 'key-mgmt': "wpa-psk", |
30 |
| - 'psk': "obMinwyurArc5", |
| 28 | + "802-11-wireless-security": { |
| 29 | + "key-mgmt": "wpa-psk", |
| 30 | + "psk": "obMinwyurArc5", |
31 | 31 | },
|
32 |
| - 'ipv4': { |
33 |
| - 'method': "auto", |
34 |
| - 'ignore-auto-dns': True, |
35 |
| - 'ignore-auto-routes': True, |
36 |
| - 'never-default': True, |
| 32 | + "ipv4": { |
| 33 | + "method": "auto", |
| 34 | + "ignore-auto-dns": True, |
| 35 | + "ignore-auto-routes": True, |
| 36 | + "never-default": True, |
37 | 37 | },
|
38 |
| - 'ipv6': { |
39 |
| - 'method': "link-local", |
| 38 | + "ipv6": { |
| 39 | + "method": "link-local", |
40 | 40 | },
|
41 | 41 | }
|
42 | 42 | s_ap = {
|
43 |
| - 'connection': { |
44 |
| - 'type': "802-11-wireless", |
| 43 | + "connection": { |
| 44 | + "type": "802-11-wireless", |
45 | 45 | },
|
46 |
| - '802-11-wireless': { |
47 |
| - 'mode': "ap", |
48 |
| - 'ssid': "local-rpi", |
| 46 | + "802-11-wireless": { |
| 47 | + "mode": "ap", |
| 48 | + "ssid": "local-rpi", |
49 | 49 | },
|
50 |
| - '802-11-wireless-security': { |
51 |
| - 'key-mgmt': "wpa-psk", |
52 |
| - 'psk': "obMinwyurArc5", |
| 50 | + "802-11-wireless-security": { |
| 51 | + "key-mgmt": "wpa-psk", |
| 52 | + "psk": "obMinwyurArc5", |
53 | 53 | },
|
54 |
| - 'ipv4': { |
| 54 | + "ipv4": { |
55 | 55 | #'method': "auto",
|
56 | 56 | #'method': "link-local",
|
57 |
| - 'method': "shared", |
58 |
| - 'addresses': ["172.16.0.2/29"], |
| 57 | + "method": "shared", |
| 58 | + "addresses": ["172.16.0.2/29"], |
59 | 59 | },
|
60 |
| - 'ipv6': { |
61 |
| - 'method': "link-local", |
| 60 | + "ipv6": { |
| 61 | + "method": "link-local", |
62 | 62 | },
|
63 | 63 | }
|
64 | 64 |
|
65 | 65 | d.disable()
|
66 |
| -d.wait_state('disconnected') |
| 66 | +d.wait_state("disconnected") |
67 | 67 | print("access points after scan")
|
68 | 68 | pprint(d.get_access_points())
|
69 | 69 |
|
70 | 70 | d.configure(s_ap)
|
71 |
| -d.wait_state('activated') |
| 71 | +d.wait_state("activated") |
72 | 72 | print("settings in AP mode")
|
73 | 73 | pprint(d.get_settings())
|
74 | 74 | print("state in AP mode")
|
75 | 75 | pprint(d.get_state())
|
76 | 76 |
|
77 |
| -#d.configure(s_client) |
78 |
| -#d.wait_state('activated') |
79 |
| -#print("settings in client mode") |
80 |
| -#pprint(d.get_settings()) |
81 |
| -#print("state in client mode") |
82 |
| -#pprint(d.get_state()) |
83 |
| - |
| 77 | +# d.configure(s_client) |
| 78 | +# d.wait_state('activated') |
| 79 | +# print("settings in client mode") |
| 80 | +# pprint(d.get_settings()) |
| 81 | +# print("state in client mode") |
| 82 | +# pprint(d.get_state()) |
0 commit comments