Merge lp:~mpontillo/maas/maas-rack--send-beacons into lp:~maas-committers/maas/trunk
- maas-rack--send-beacons
- Merge into trunk
Proposed by
Mike Pontillo
Status: | Rejected |
---|---|
Rejected by: | MAAS Lander |
Proposed branch: | lp:~mpontillo/maas/maas-rack--send-beacons |
Merge into: | lp:~maas-committers/maas/trunk |
Prerequisite: | lp:~mpontillo/maas/beaconing-packet-format |
Diff against target: |
429 lines (+166/-10) 5 files modified
src/provisioningserver/__main__.py (+2/-0) src/provisioningserver/utils/beaconing.py (+2/-2) src/provisioningserver/utils/network.py (+1/-0) src/provisioningserver/utils/send_beacons.py (+123/-0) src/provisioningserver/utils/tests/test_network.py (+38/-8) |
To merge this branch: | bzr merge lp:~mpontillo/maas/maas-rack--send-beacons |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
MAAS Maintainers | Pending | ||
Review via email: mp+325605@code.launchpad.net |
Commit message
Add test command for sending out beacons.
Description of the change
To post a comment you must log in.
- 6090. By Mike Pontillo
-
Add tests for interface index.
- 6091. By Mike Pontillo
-
Merge branch: lp:~mpontillo/maas/get-all-interfaces--add-ifindex
Revision history for this message
MAAS Lander (maas-lander) wrote : | # |
Unmerged revisions
- 6091. By Mike Pontillo
-
Merge branch: lp:~mpontillo/maas/get-all-interfaces--add-ifindex
- 6090. By Mike Pontillo
-
Add tests for interface index.
- 6089. By Mike Pontillo
-
Add test command to send beacons out.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/provisioningserver/__main__.py' | |||
2 | --- src/provisioningserver/__main__.py 2017-06-08 20:41:27 +0000 | |||
3 | +++ src/provisioningserver/__main__.py 2017-06-14 15:45:59 +0000 | |||
4 | @@ -16,6 +16,7 @@ | |||
5 | 16 | import provisioningserver.utils.dhcp | 16 | import provisioningserver.utils.dhcp |
6 | 17 | import provisioningserver.utils.scan_network | 17 | import provisioningserver.utils.scan_network |
7 | 18 | from provisioningserver.utils.script import MainScript | 18 | from provisioningserver.utils.script import MainScript |
8 | 19 | import provisioningserver.utils.send_beacons | ||
9 | 19 | 20 | ||
10 | 20 | 21 | ||
11 | 21 | script_commands = { | 22 | script_commands = { |
12 | @@ -27,6 +28,7 @@ | |||
13 | 27 | 'observe-beacons': provisioningserver.utils.beaconing, | 28 | 'observe-beacons': provisioningserver.utils.beaconing, |
14 | 28 | 'observe-mdns': provisioningserver.utils.avahi, | 29 | 'observe-mdns': provisioningserver.utils.avahi, |
15 | 29 | 'observe-dhcp': provisioningserver.utils.dhcp, | 30 | 'observe-dhcp': provisioningserver.utils.dhcp, |
16 | 31 | 'send-beacons': provisioningserver.utils.send_beacons, | ||
17 | 30 | 'scan-network': provisioningserver.utils.scan_network, | 32 | 'scan-network': provisioningserver.utils.scan_network, |
18 | 31 | 'register': provisioningserver.register_command, | 33 | 'register': provisioningserver.register_command, |
19 | 32 | 'support-dump': provisioningserver.support_dump, | 34 | 'support-dump': provisioningserver.support_dump, |
20 | 33 | 35 | ||
21 | === modified file 'src/provisioningserver/utils/beaconing.py' | |||
22 | --- src/provisioningserver/utils/beaconing.py 2017-06-14 15:45:58 +0000 | |||
23 | +++ src/provisioningserver/utils/beaconing.py 2017-06-14 15:45:59 +0000 | |||
24 | @@ -53,7 +53,7 @@ | |||
25 | 53 | class BEACON_ENCAPSULATION: | 53 | class BEACON_ENCAPSULATION: |
26 | 54 | """Enumeration to describe beacon encapsulation types.""" | 54 | """Enumeration to describe beacon encapsulation types.""" |
27 | 55 | 55 | ||
29 | 56 | FERNET_PSK = "fernet_psk" | 56 | FERNET_PSK = "fernet-psk" |
30 | 57 | 57 | ||
31 | 58 | 58 | ||
32 | 59 | BeaconPayload = namedtuple('BeaconPayload', ( | 59 | BeaconPayload = namedtuple('BeaconPayload', ( |
33 | @@ -63,7 +63,7 @@ | |||
34 | 63 | )) | 63 | )) |
35 | 64 | 64 | ||
36 | 65 | 65 | ||
38 | 66 | def create_beacon_payload(beacon_type, data=None): | 66 | def create_beacon_payload(beacon_type, data=None) -> BeaconPayload: |
39 | 67 | """Creates a beacon payload of the specified type, with the given data. | 67 | """Creates a beacon payload of the specified type, with the given data. |
40 | 68 | 68 | ||
41 | 69 | :param beacon_type: The beacon packet type. Indicates the purpose of the | 69 | :param beacon_type: The beacon packet type. Indicates the purpose of the |
42 | 70 | 70 | ||
43 | === modified file 'src/provisioningserver/utils/network.py' | |||
44 | --- src/provisioningserver/utils/network.py 2017-04-26 21:15:06 +0000 | |||
45 | +++ src/provisioningserver/utils/network.py 2017-06-14 15:45:59 +0000 | |||
46 | @@ -1159,6 +1159,7 @@ | |||
47 | 1159 | # Create the interface definition will links for both IPv4 and IPv6. | 1159 | # Create the interface definition will links for both IPv4 and IPv6. |
48 | 1160 | interface = { | 1160 | interface = { |
49 | 1161 | "type": iface_type, | 1161 | "type": iface_type, |
50 | 1162 | "index": ipaddr['index'], | ||
51 | 1162 | "links": [], | 1163 | "links": [], |
52 | 1163 | "enabled": True if 'UP' in ipaddr['flags'] else False, | 1164 | "enabled": True if 'UP' in ipaddr['flags'] else False, |
53 | 1164 | "parents": parents, | 1165 | "parents": parents, |
54 | 1165 | 1166 | ||
55 | === added file 'src/provisioningserver/utils/send_beacons.py' | |||
56 | --- src/provisioningserver/utils/send_beacons.py 1970-01-01 00:00:00 +0000 | |||
57 | +++ src/provisioningserver/utils/send_beacons.py 2017-06-14 15:45:59 +0000 | |||
58 | @@ -0,0 +1,123 @@ | |||
59 | 1 | # Copyright 2016 Canonical Ltd. This software is licensed under the | ||
60 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
61 | 3 | |||
62 | 4 | """Utilities for scanning attached networks.""" | ||
63 | 5 | import struct | ||
64 | 6 | |||
65 | 7 | |||
66 | 8 | __all__ = [ | ||
67 | 9 | "add_arguments", | ||
68 | 10 | "run" | ||
69 | 11 | ] | ||
70 | 12 | |||
71 | 13 | import select | ||
72 | 14 | import socket | ||
73 | 15 | import sys | ||
74 | 16 | from textwrap import dedent | ||
75 | 17 | import time | ||
76 | 18 | |||
77 | 19 | from provisioningserver.utils.beaconing import ( | ||
78 | 20 | BEACON_PORT, | ||
79 | 21 | create_beacon_payload, | ||
80 | 22 | read_beacon_payload, | ||
81 | 23 | ) | ||
82 | 24 | from provisioningserver.utils.network import get_all_interfaces_definition | ||
83 | 25 | from pprint import pformat | ||
84 | 26 | |||
85 | 27 | |||
86 | 28 | def add_arguments(parser): | ||
87 | 29 | """Add this command's options to the `ArgumentParser`. | ||
88 | 30 | |||
89 | 31 | Specified by the `ActionScript` interface. | ||
90 | 32 | """ | ||
91 | 33 | parser.description = dedent("""\ | ||
92 | 34 | Send solicitation beacons to a particular address. | ||
93 | 35 | """) | ||
94 | 36 | parser.add_argument( | ||
95 | 37 | '-v', '--verbose', action='store_true', required=False, | ||
96 | 38 | help='Verbose packet output.') | ||
97 | 39 | parser.add_argument( | ||
98 | 40 | '-s', '--source', type=str, required=False, | ||
99 | 41 | help='Source address to send beacons from.') | ||
100 | 42 | parser.add_argument( | ||
101 | 43 | 'destination', type=str, nargs='?', | ||
102 | 44 | help="Destination to send beacon to. If not specified, will use the " | ||
103 | 45 | "MAAS multicast group (224.0.0.118).") | ||
104 | 46 | |||
105 | 47 | |||
106 | 48 | def do_beaconing(args, source_ip, destination_ip, interfaces, stdout): | ||
107 | 49 | """Interprets the specified `args` and `to_scan` dict to perform the scan. | ||
108 | 50 | |||
109 | 51 | Uses the specified `stdout` and `stderr` for output. | ||
110 | 52 | """ | ||
111 | 53 | clock = time.monotonic() | ||
112 | 54 | transport = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) | ||
113 | 55 | if source_ip is not None: | ||
114 | 56 | if ':' not in source_ip: | ||
115 | 57 | source_ip = "::ffff:" + source_ip | ||
116 | 58 | transport.bind((source_ip, 0)) | ||
117 | 59 | if destination_ip is None: | ||
118 | 60 | destination_ip = "::ffff:224.0.0.118" | ||
119 | 61 | elif ':' not in destination_ip: | ||
120 | 62 | destination_ip = "::ffff:" + destination_ip | ||
121 | 63 | beacon = create_beacon_payload("solicitation") | ||
122 | 64 | if "224.0.0.118" in destination_ip: | ||
123 | 65 | for ifdata in interfaces.values(): | ||
124 | 66 | for link in ifdata["links"]: | ||
125 | 67 | address = link["address"] | ||
126 | 68 | # Strip off CIDRs. | ||
127 | 69 | address = address.split("/")[0] | ||
128 | 70 | if ':' not in address: | ||
129 | 71 | transport.setsockopt( | ||
130 | 72 | socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 1) | ||
131 | 73 | transport.setsockopt( | ||
132 | 74 | socket.IPPROTO_IP, socket.IP_MULTICAST_IF, | ||
133 | 75 | socket.inet_aton(address)) | ||
134 | 76 | destination_ip = "::ffff:224.0.0.118" | ||
135 | 77 | transport.sendto( | ||
136 | 78 | beacon.packet_bytes, (destination_ip, BEACON_PORT)) | ||
137 | 79 | else: | ||
138 | 80 | # We're sending to an IPv4 multicast address, so we can't | ||
139 | 81 | # actually use IPv6 addresses here. | ||
140 | 82 | transport.setsockopt( | ||
141 | 83 | socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, 1) | ||
142 | 84 | packed_ifindex = struct.pack('I', ifdata['index']) | ||
143 | 85 | transport.setsockopt( | ||
144 | 86 | socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, | ||
145 | 87 | packed_ifindex) | ||
146 | 88 | destination_ip = "ff02::15a" | ||
147 | 89 | transport.sendto( | ||
148 | 90 | beacon.packet_bytes, (destination_ip, BEACON_PORT)) | ||
149 | 91 | else: | ||
150 | 92 | transport.sendto(beacon.packet_bytes, (destination_ip, BEACON_PORT)) | ||
151 | 93 | transport.setblocking(0) | ||
152 | 94 | clock_diff = 0 | ||
153 | 95 | timeout = 5 | ||
154 | 96 | while clock_diff < timeout: | ||
155 | 97 | ready = select.select([transport], [], [], timeout) | ||
156 | 98 | if ready[0]: | ||
157 | 99 | reply, reply_address = transport.recvfrom(16384) | ||
158 | 100 | if args.verbose: | ||
159 | 101 | print("%s: %s" % ( | ||
160 | 102 | pformat(reply), pformat(reply_address)), file=stdout) | ||
161 | 103 | reply = read_beacon_payload(reply) | ||
162 | 104 | print("%s" % pformat(reply), file=stdout) | ||
163 | 105 | clock_diff = time.monotonic() - clock | ||
164 | 106 | |||
165 | 107 | |||
166 | 108 | def run(args, stdout=sys.stdout): | ||
167 | 109 | """Scan local networks for on-link hosts. | ||
168 | 110 | |||
169 | 111 | :param args: Parsed output of the arguments added in `add_arguments()`. | ||
170 | 112 | :param stdout: Standard output stream to write to. | ||
171 | 113 | :param stderr: Standard error stream to write to. | ||
172 | 114 | """ | ||
173 | 115 | # Record the current time so we can figure out how long it took us to | ||
174 | 116 | # do all this scanning. | ||
175 | 117 | source_ip = args.source | ||
176 | 118 | destination_ip = args.destination | ||
177 | 119 | interfaces = get_all_interfaces_definition(annotate_with_monitored=False) | ||
178 | 120 | if args.verbose: | ||
179 | 121 | print("%s" % pformat(interfaces), file=stdout) | ||
180 | 122 | do_beaconing( | ||
181 | 123 | args, source_ip, destination_ip, interfaces, stdout) | ||
182 | 0 | 124 | ||
183 | === modified file 'src/provisioningserver/utils/tests/test_network.py' | |||
184 | --- src/provisioningserver/utils/tests/test_network.py 2017-04-26 02:29:43 +0000 | |||
185 | +++ src/provisioningserver/utils/tests/test_network.py 2017-06-14 15:45:59 +0000 | |||
186 | @@ -5,6 +5,7 @@ | |||
187 | 5 | 5 | ||
188 | 6 | __all__ = [] | 6 | __all__ = [] |
189 | 7 | 7 | ||
190 | 8 | import random | ||
191 | 8 | import socket | 9 | import socket |
192 | 9 | from socket import ( | 10 | from socket import ( |
193 | 10 | EAI_BADFLAGS, | 11 | EAI_BADFLAGS, |
194 | @@ -1174,6 +1175,7 @@ | |||
195 | 1174 | "flags": ["UP"], | 1175 | "flags": ["UP"], |
196 | 1175 | "inet": ["127.0.0.1/32"], | 1176 | "inet": ["127.0.0.1/32"], |
197 | 1176 | "inet6": ["::1"], | 1177 | "inet6": ["::1"], |
198 | 1178 | "index": 1, | ||
199 | 1177 | }, | 1179 | }, |
200 | 1178 | } | 1180 | } |
201 | 1179 | self.assertInterfacesResult(ip_addr, {}, {}, MatchesDict({})) | 1181 | self.assertInterfacesResult(ip_addr, {}, {}, MatchesDict({})) |
202 | @@ -1185,6 +1187,7 @@ | |||
203 | 1185 | "mac": factory.make_mac_address(), | 1187 | "mac": factory.make_mac_address(), |
204 | 1186 | "flags": ["UP"], | 1188 | "flags": ["UP"], |
205 | 1187 | "inet": ["192.168.122.2/24"], | 1189 | "inet": ["192.168.122.2/24"], |
206 | 1190 | "index": 2, | ||
207 | 1188 | }, | 1191 | }, |
208 | 1189 | } | 1192 | } |
209 | 1190 | self.assertInterfacesResult(ip_addr, {}, {}, MatchesDict({})) | 1193 | self.assertInterfacesResult(ip_addr, {}, {}, MatchesDict({})) |
210 | @@ -1194,6 +1197,7 @@ | |||
211 | 1194 | "vnet": { | 1197 | "vnet": { |
212 | 1195 | "type": "ipip", | 1198 | "type": "ipip", |
213 | 1196 | "flags": ["UP"], | 1199 | "flags": ["UP"], |
214 | 1200 | "index": 2, | ||
215 | 1197 | }, | 1201 | }, |
216 | 1198 | } | 1202 | } |
217 | 1199 | self.assertInterfacesResult(ip_addr, {}, {}, MatchesDict({})) | 1203 | self.assertInterfacesResult(ip_addr, {}, {}, MatchesDict({})) |
218 | @@ -1202,6 +1206,7 @@ | |||
219 | 1202 | ip_addr = { | 1206 | ip_addr = { |
220 | 1203 | "eth0": { | 1207 | "eth0": { |
221 | 1204 | "type": "ethernet.physical", | 1208 | "type": "ethernet.physical", |
222 | 1209 | "index": 2, | ||
223 | 1205 | "mac": factory.make_mac_address(), | 1210 | "mac": factory.make_mac_address(), |
224 | 1206 | "flags": ["UP"], | 1211 | "flags": ["UP"], |
225 | 1207 | "inet": ["192.168.122.2/24"], | 1212 | "inet": ["192.168.122.2/24"], |
226 | @@ -1210,6 +1215,7 @@ | |||
227 | 1210 | expected_result = MatchesDict({ | 1215 | expected_result = MatchesDict({ |
228 | 1211 | "eth0": MatchesDict({ | 1216 | "eth0": MatchesDict({ |
229 | 1212 | "type": Equals("physical"), | 1217 | "type": Equals("physical"), |
230 | 1218 | "index": Equals(ip_addr["eth0"]["index"]), | ||
231 | 1213 | "mac_address": Equals(ip_addr["eth0"]["mac"]), | 1219 | "mac_address": Equals(ip_addr["eth0"]["mac"]), |
232 | 1214 | "enabled": Is(True), | 1220 | "enabled": Is(True), |
233 | 1215 | "parents": Equals([]), | 1221 | "parents": Equals([]), |
234 | @@ -1226,6 +1232,7 @@ | |||
235 | 1226 | ip_addr = { | 1232 | ip_addr = { |
236 | 1227 | "eth0": { | 1233 | "eth0": { |
237 | 1228 | "type": "ethernet.physical", | 1234 | "type": "ethernet.physical", |
238 | 1235 | "index": random.randint(2, 99), | ||
239 | 1229 | "mac": factory.make_mac_address(), | 1236 | "mac": factory.make_mac_address(), |
240 | 1230 | "flags": ["UP"], | 1237 | "flags": ["UP"], |
241 | 1231 | "inet": ["192.168.122.2/24"], | 1238 | "inet": ["192.168.122.2/24"], |
242 | @@ -1239,6 +1246,7 @@ | |||
243 | 1239 | expected_result = MatchesDict({ | 1246 | expected_result = MatchesDict({ |
244 | 1240 | "eth0": MatchesDict({ | 1247 | "eth0": MatchesDict({ |
245 | 1241 | "type": Equals("physical"), | 1248 | "type": Equals("physical"), |
246 | 1249 | "index": Equals(ip_addr["eth0"]["index"]), | ||
247 | 1242 | "mac_address": Equals(ip_addr["eth0"]["mac"]), | 1250 | "mac_address": Equals(ip_addr["eth0"]["mac"]), |
248 | 1243 | "enabled": Is(True), | 1251 | "enabled": Is(True), |
249 | 1244 | "parents": Equals([]), | 1252 | "parents": Equals([]), |
250 | @@ -1256,6 +1264,7 @@ | |||
251 | 1256 | ip_addr = { | 1264 | ip_addr = { |
252 | 1257 | "eth0": { | 1265 | "eth0": { |
253 | 1258 | "type": "ethernet", | 1266 | "type": "ethernet", |
254 | 1267 | "index": random.randint(2, 99), | ||
255 | 1259 | "mac": factory.make_mac_address(), | 1268 | "mac": factory.make_mac_address(), |
256 | 1260 | "flags": ["UP"], | 1269 | "flags": ["UP"], |
257 | 1261 | "inet": ["192.168.122.2/24"], | 1270 | "inet": ["192.168.122.2/24"], |
258 | @@ -1264,6 +1273,7 @@ | |||
259 | 1264 | expected_result = MatchesDict({ | 1273 | expected_result = MatchesDict({ |
260 | 1265 | "eth0": MatchesDict({ | 1274 | "eth0": MatchesDict({ |
261 | 1266 | "type": Equals("physical"), | 1275 | "type": Equals("physical"), |
262 | 1276 | "index": Equals(ip_addr["eth0"]["index"]), | ||
263 | 1267 | "mac_address": Equals(ip_addr["eth0"]["mac"]), | 1277 | "mac_address": Equals(ip_addr["eth0"]["mac"]), |
264 | 1268 | "enabled": Is(True), | 1278 | "enabled": Is(True), |
265 | 1269 | "parents": Equals([]), | 1279 | "parents": Equals([]), |
266 | @@ -1281,6 +1291,7 @@ | |||
267 | 1281 | ip_addr = { | 1291 | ip_addr = { |
268 | 1282 | "eth0": { | 1292 | "eth0": { |
269 | 1283 | "type": "ethernet.physical", | 1293 | "type": "ethernet.physical", |
270 | 1294 | "index": random.randint(2, 99), | ||
271 | 1284 | "mac": factory.make_mac_address(), | 1295 | "mac": factory.make_mac_address(), |
272 | 1285 | "flags": ["UP"], | 1296 | "flags": ["UP"], |
273 | 1286 | "inet": ["192.168.122.2/24", "192.168.122.200/32"], | 1297 | "inet": ["192.168.122.2/24", "192.168.122.200/32"], |
274 | @@ -1292,6 +1303,7 @@ | |||
275 | 1292 | expected_result = MatchesDict({ | 1303 | expected_result = MatchesDict({ |
276 | 1293 | "eth0": MatchesDict({ | 1304 | "eth0": MatchesDict({ |
277 | 1294 | "type": Equals("physical"), | 1305 | "type": Equals("physical"), |
278 | 1306 | "index": Equals(ip_addr["eth0"]["index"]), | ||
279 | 1295 | "mac_address": Equals(ip_addr["eth0"]["mac"]), | 1307 | "mac_address": Equals(ip_addr["eth0"]["mac"]), |
280 | 1296 | "enabled": Is(True), | 1308 | "enabled": Is(True), |
281 | 1297 | "parents": Equals([]), | 1309 | "parents": Equals([]), |
282 | @@ -1315,6 +1327,7 @@ | |||
283 | 1315 | ip_addr = { | 1327 | ip_addr = { |
284 | 1316 | "eth0": { | 1328 | "eth0": { |
285 | 1317 | "type": "ethernet.physical", | 1329 | "type": "ethernet.physical", |
286 | 1330 | "index": random.randint(2, 99), | ||
287 | 1318 | "mac": factory.make_mac_address(), | 1331 | "mac": factory.make_mac_address(), |
288 | 1319 | "flags": ["UP"], | 1332 | "flags": ["UP"], |
289 | 1320 | "inet": [ | 1333 | "inet": [ |
290 | @@ -1331,6 +1344,7 @@ | |||
291 | 1331 | expected_result = MatchesDict({ | 1344 | expected_result = MatchesDict({ |
292 | 1332 | "eth0": MatchesDict({ | 1345 | "eth0": MatchesDict({ |
293 | 1333 | "type": Equals("physical"), | 1346 | "type": Equals("physical"), |
294 | 1347 | "index": Equals(ip_addr["eth0"]["index"]), | ||
295 | 1334 | "mac_address": Equals(ip_addr["eth0"]["mac"]), | 1348 | "mac_address": Equals(ip_addr["eth0"]["mac"]), |
296 | 1335 | "enabled": Is(True), | 1349 | "enabled": Is(True), |
297 | 1336 | "parents": Equals([]), | 1350 | "parents": Equals([]), |
298 | @@ -1365,21 +1379,25 @@ | |||
299 | 1365 | ip_addr = { | 1379 | ip_addr = { |
300 | 1366 | "eth0": { | 1380 | "eth0": { |
301 | 1367 | "type": "ethernet.physical", | 1381 | "type": "ethernet.physical", |
302 | 1382 | "index": 2, | ||
303 | 1368 | "mac": factory.make_mac_address(), | 1383 | "mac": factory.make_mac_address(), |
304 | 1369 | "flags": [], | 1384 | "flags": [], |
305 | 1370 | }, | 1385 | }, |
306 | 1371 | "eth1": { | 1386 | "eth1": { |
307 | 1372 | "type": "ethernet.physical", | 1387 | "type": "ethernet.physical", |
308 | 1388 | "index": 3, | ||
309 | 1373 | "mac": factory.make_mac_address(), | 1389 | "mac": factory.make_mac_address(), |
310 | 1374 | "flags": ["UP"], | 1390 | "flags": ["UP"], |
311 | 1375 | }, | 1391 | }, |
312 | 1376 | "eth2": { | 1392 | "eth2": { |
313 | 1377 | "type": "ethernet.physical", | 1393 | "type": "ethernet.physical", |
314 | 1394 | "index": 4, | ||
315 | 1378 | "mac": factory.make_mac_address(), | 1395 | "mac": factory.make_mac_address(), |
316 | 1379 | "flags": ["UP"], | 1396 | "flags": ["UP"], |
317 | 1380 | }, | 1397 | }, |
318 | 1381 | "bond0": { | 1398 | "bond0": { |
319 | 1382 | "type": "ethernet.bond", | 1399 | "type": "ethernet.bond", |
320 | 1400 | "index": 5, | ||
321 | 1383 | "mac": factory.make_mac_address(), | 1401 | "mac": factory.make_mac_address(), |
322 | 1384 | "flags": ["UP"], | 1402 | "flags": ["UP"], |
323 | 1385 | "bonded_interfaces": ["eth1", "eth2"], | 1403 | "bonded_interfaces": ["eth1", "eth2"], |
324 | @@ -1388,6 +1406,7 @@ | |||
325 | 1388 | }, | 1406 | }, |
326 | 1389 | "bond0.10": { | 1407 | "bond0.10": { |
327 | 1390 | "type": "ethernet.vlan", | 1408 | "type": "ethernet.vlan", |
328 | 1409 | "index": 6, | ||
329 | 1391 | "flags": ["UP"], | 1410 | "flags": ["UP"], |
330 | 1392 | "vid": 10, | 1411 | "vid": 10, |
331 | 1393 | "inet": ["192.168.123.2/24", "192.168.123.3/32"], | 1412 | "inet": ["192.168.123.2/24", "192.168.123.3/32"], |
332 | @@ -1395,6 +1414,7 @@ | |||
333 | 1395 | }, | 1414 | }, |
334 | 1396 | "vlan20": { | 1415 | "vlan20": { |
335 | 1397 | "type": "ethernet.vlan", | 1416 | "type": "ethernet.vlan", |
336 | 1417 | "index": 7, | ||
337 | 1398 | "mac": factory.make_mac_address(), | 1418 | "mac": factory.make_mac_address(), |
338 | 1399 | "flags": ["UP"], | 1419 | "flags": ["UP"], |
339 | 1400 | "vid": 20, | 1420 | "vid": 20, |
340 | @@ -1402,11 +1422,13 @@ | |||
341 | 1402 | }, | 1422 | }, |
342 | 1403 | "wlan0": { | 1423 | "wlan0": { |
343 | 1404 | "type": "ethernet.wireless", | 1424 | "type": "ethernet.wireless", |
344 | 1425 | "index": 8, | ||
345 | 1405 | "mac": factory.make_mac_address(), | 1426 | "mac": factory.make_mac_address(), |
346 | 1406 | "flags": ["UP"], | 1427 | "flags": ["UP"], |
347 | 1407 | }, | 1428 | }, |
348 | 1408 | "br0": { | 1429 | "br0": { |
349 | 1409 | "type": "ethernet.bridge", | 1430 | "type": "ethernet.bridge", |
350 | 1431 | "index": 9, | ||
351 | 1410 | "bridged_interfaces": ["eth0"], | 1432 | "bridged_interfaces": ["eth0"], |
352 | 1411 | "mac": factory.make_mac_address(), | 1433 | "mac": factory.make_mac_address(), |
353 | 1412 | "flags": ["UP"], | 1434 | "flags": ["UP"], |
354 | @@ -1424,6 +1446,7 @@ | |||
355 | 1424 | expected_result = MatchesDict({ | 1446 | expected_result = MatchesDict({ |
356 | 1425 | "eth0": MatchesDict({ | 1447 | "eth0": MatchesDict({ |
357 | 1426 | "type": Equals("physical"), | 1448 | "type": Equals("physical"), |
358 | 1449 | "index": Equals(2), | ||
359 | 1427 | "mac_address": Equals(ip_addr["eth0"]["mac"]), | 1450 | "mac_address": Equals(ip_addr["eth0"]["mac"]), |
360 | 1428 | "enabled": Is(False), | 1451 | "enabled": Is(False), |
361 | 1429 | "parents": Equals([]), | 1452 | "parents": Equals([]), |
362 | @@ -1432,6 +1455,7 @@ | |||
363 | 1432 | }), | 1455 | }), |
364 | 1433 | "eth1": MatchesDict({ | 1456 | "eth1": MatchesDict({ |
365 | 1434 | "type": Equals("physical"), | 1457 | "type": Equals("physical"), |
366 | 1458 | "index": Equals(3), | ||
367 | 1435 | "mac_address": Equals(ip_addr["eth1"]["mac"]), | 1459 | "mac_address": Equals(ip_addr["eth1"]["mac"]), |
368 | 1436 | "enabled": Is(True), | 1460 | "enabled": Is(True), |
369 | 1437 | "parents": Equals([]), | 1461 | "parents": Equals([]), |
370 | @@ -1440,6 +1464,7 @@ | |||
371 | 1440 | }), | 1464 | }), |
372 | 1441 | "eth2": MatchesDict({ | 1465 | "eth2": MatchesDict({ |
373 | 1442 | "type": Equals("physical"), | 1466 | "type": Equals("physical"), |
374 | 1467 | "index": Equals(4), | ||
375 | 1443 | "mac_address": Equals(ip_addr["eth2"]["mac"]), | 1468 | "mac_address": Equals(ip_addr["eth2"]["mac"]), |
376 | 1444 | "enabled": Is(True), | 1469 | "enabled": Is(True), |
377 | 1445 | "parents": Equals([]), | 1470 | "parents": Equals([]), |
378 | @@ -1448,6 +1473,7 @@ | |||
379 | 1448 | }), | 1473 | }), |
380 | 1449 | "bond0": MatchesDict({ | 1474 | "bond0": MatchesDict({ |
381 | 1450 | "type": Equals("bond"), | 1475 | "type": Equals("bond"), |
382 | 1476 | "index": Equals(5), | ||
383 | 1451 | "mac_address": Equals(ip_addr["bond0"]["mac"]), | 1477 | "mac_address": Equals(ip_addr["bond0"]["mac"]), |
384 | 1452 | "enabled": Is(True), | 1478 | "enabled": Is(True), |
385 | 1453 | "parents": Equals(["eth1", "eth2"]), | 1479 | "parents": Equals(["eth1", "eth2"]), |
386 | @@ -1471,6 +1497,7 @@ | |||
387 | 1471 | }), | 1497 | }), |
388 | 1472 | "bond0.10": MatchesDict({ | 1498 | "bond0.10": MatchesDict({ |
389 | 1473 | "type": Equals("vlan"), | 1499 | "type": Equals("vlan"), |
390 | 1500 | "index": Equals(6), | ||
391 | 1474 | "enabled": Is(True), | 1501 | "enabled": Is(True), |
392 | 1475 | "parents": Equals(["bond0"]), | 1502 | "parents": Equals(["bond0"]), |
393 | 1476 | "vid": Equals(10), | 1503 | "vid": Equals(10), |
394 | @@ -1486,24 +1513,27 @@ | |||
395 | 1486 | ), | 1513 | ), |
396 | 1487 | "source": Equals("ipaddr"), | 1514 | "source": Equals("ipaddr"), |
397 | 1488 | }), | 1515 | }), |
398 | 1516 | "vlan20": MatchesDict({ | ||
399 | 1517 | "type": Equals("vlan"), | ||
400 | 1518 | "index": Equals(7), | ||
401 | 1519 | "enabled": Is(True), | ||
402 | 1520 | "parents": Equals(["eth0"]), | ||
403 | 1521 | "links": Equals([]), | ||
404 | 1522 | "source": Equals("ipaddr"), | ||
405 | 1523 | "vid": Equals(20), | ||
406 | 1524 | }), | ||
407 | 1489 | "wlan0": MatchesDict({ | 1525 | "wlan0": MatchesDict({ |
408 | 1490 | "type": Equals("physical"), | 1526 | "type": Equals("physical"), |
409 | 1527 | "index": Equals(8), | ||
410 | 1491 | "mac_address": Equals(ip_addr["wlan0"]["mac"]), | 1528 | "mac_address": Equals(ip_addr["wlan0"]["mac"]), |
411 | 1492 | "enabled": Is(True), | 1529 | "enabled": Is(True), |
412 | 1493 | "parents": Equals([]), | 1530 | "parents": Equals([]), |
413 | 1494 | "links": Equals([]), | 1531 | "links": Equals([]), |
414 | 1495 | "source": Equals("ipaddr"), | 1532 | "source": Equals("ipaddr"), |
415 | 1496 | }), | 1533 | }), |
416 | 1497 | "vlan20": MatchesDict({ | ||
417 | 1498 | "type": Equals("vlan"), | ||
418 | 1499 | "enabled": Is(True), | ||
419 | 1500 | "parents": Equals(["eth0"]), | ||
420 | 1501 | "links": Equals([]), | ||
421 | 1502 | "source": Equals("ipaddr"), | ||
422 | 1503 | "vid": Equals(20), | ||
423 | 1504 | }), | ||
424 | 1505 | "br0": MatchesDict({ | 1534 | "br0": MatchesDict({ |
425 | 1506 | "type": Equals("bridge"), | 1535 | "type": Equals("bridge"), |
426 | 1536 | "index": Equals(9), | ||
427 | 1507 | "mac_address": Equals(ip_addr["br0"]["mac"]), | 1537 | "mac_address": Equals(ip_addr["br0"]["mac"]), |
428 | 1508 | "enabled": Is(True), | 1538 | "enabled": Is(True), |
429 | 1509 | "parents": Equals(["eth0"]), | 1539 | "parents": Equals(["eth0"]), |
Transitioned to Git.
lp:maas has now moved from Bzr to Git.
Please propose your branches with Launchpad using Git.
git clone https:/ /git.launchpad. net/maas