| 1 |
import logging |
| 2 |
from pprint import pprint |
| 3 |
|
| 4 |
from labgrid import Environment |
| 5 |
from labgrid.logging import basicConfig, StepLogger |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
basicConfig(level=logging.DEBUG) |
| 10 |
|
| 11 |
|
| 12 |
StepLogger.start() |
| 13 |
|
| 14 |
|
| 15 |
e = Environment("nm.env") |
| 16 |
t = e.get_target() |
| 17 |
d = t.get_driver("NetworkInterfaceDriver") |
| 18 |
|
| 19 |
|
| 20 |
s_client = { |
| 21 |
"connection": { |
| 22 |
"type": "802-11-wireless", |
| 23 |
}, |
| 24 |
"802-11-wireless": { |
| 25 |
"mode": "infrastructure", |
| 26 |
"ssid": "local-rpi", |
| 27 |
}, |
| 28 |
"802-11-wireless-security": { |
| 29 |
"key-mgmt": "wpa-psk", |
| 30 |
"psk": "obMinwyurArc5", |
| 31 |
}, |
| 32 |
"ipv4": { |
| 33 |
"method": "auto", |
| 34 |
"ignore-auto-dns": True, |
| 35 |
"ignore-auto-routes": True, |
| 36 |
"never-default": True, |
| 37 |
}, |
| 38 |
"ipv6": { |
| 39 |
"method": "link-local", |
| 40 |
}, |
| 41 |
} |
| 42 |
s_ap = { |
| 43 |
"connection": { |
| 44 |
"type": "802-11-wireless", |
| 45 |
}, |
| 46 |
"802-11-wireless": { |
| 47 |
"mode": "ap", |
| 48 |
"ssid": "local-rpi", |
| 49 |
}, |
| 50 |
"802-11-wireless-security": { |
| 51 |
"key-mgmt": "wpa-psk", |
| 52 |
"psk": "obMinwyurArc5", |
| 53 |
}, |
| 54 |
"ipv4": { |
| 55 |
|
| 56 |
|
| 57 |
"method": "shared", |
| 58 |
"addresses": ["172.16.0.2/29"], |
| 59 |
}, |
| 60 |
"ipv6": { |
| 61 |
"method": "link-local", |
| 62 |
}, |
| 63 |
} |
| 64 |
|
| 65 |
d.disable() |
| 66 |
d.wait_state("disconnected") |
| 67 |
print("access points after scan") |
| 68 |
pprint(d.get_access_points()) |
| 69 |
|
| 70 |
d.configure(s_ap) |
| 71 |
d.wait_state("activated") |
| 72 |
print("settings in AP mode") |
| 73 |
pprint(d.get_settings()) |
| 74 |
print("state in AP mode") |
| 75 |
pprint(d.get_state()) |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|