This file is indexed.

/usr/lib/python3/dist-packages/provisioningserver/rpc/cluster.py is in python3-maas-provisioningserver 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
# Copyright 2014-2016 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""RPC declarations for clusters.

These are commands that a cluster controller ought to respond to.
"""

__all__ = [
    "Authenticate",
    "ConfigureDHCPv4",
    "ConfigureDHCPv4",
    "ConfigureDHCPv4_V2",
    "ConfigureDHCPv6",
    "ConfigureDHCPv6",
    "ConfigureDHCPv6_V2",
    "DescribePowerTypes",
    "DescribeNOSTypes",
    "GetPreseedData",
    "Identify",
    "ListBootImages",
    "ListOperatingSystems",
    "ListSupportedArchitectures",
    "PowerCycle",
    "PowerDriverCheck",
    "PowerOff",
    "PowerOn",
    "PowerQuery",
    "ScanNetworks",
    "ValidateDHCPv4Config",
    "ValidateDHCPv4Config_V2",
    "ValidateDHCPv6Config",
    "ValidateDHCPv6Config_V2",
    "ValidateLicenseKey",
]

from provisioningserver.rpc import exceptions
from provisioningserver.rpc.arguments import (
    AmpDiscoveredMachine,
    AmpDiscoveredPod,
    AmpDiscoveredPodHints,
    AmpList,
    AmpRequestedMachine,
    Bytes,
    CompressedAmpList,
    IPAddress,
    IPNetwork,
    ParsedURL,
    StructureAsJSON,
)
from provisioningserver.rpc.common import (
    Authenticate,
    Identify,
)
from twisted.protocols import amp


class ListBootImages(amp.Command):
    """List the boot images available on this rack controller.

    :since: 1.5
    """

    arguments = []
    response = [
        (b"images", AmpList(
            [(b"osystem", amp.Unicode()),
             (b"architecture", amp.Unicode()),
             (b"subarchitecture", amp.Unicode()),
             (b"release", amp.Unicode()),
             (b"label", amp.Unicode()),
             (b"purpose", amp.Unicode()),
             (b"xinstall_type", amp.Unicode()),
             (b"xinstall_path", amp.Unicode())]))
    ]
    errors = []


class ListBootImagesV2(amp.Command):
    """List the boot images available on this rack controller.

    This command compresses the images list to allow more images in the
    response and to remove the amp.TooLong error.

    :since: 1.7.6
    """

    arguments = []
    response = [
        (b"images", CompressedAmpList(
            [(b"osystem", amp.Unicode()),
             (b"architecture", amp.Unicode()),
             (b"subarchitecture", amp.Unicode()),
             (b"release", amp.Unicode()),
             (b"label", amp.Unicode()),
             (b"purpose", amp.Unicode()),
             (b"xinstall_type", amp.Unicode()),
             (b"xinstall_path", amp.Unicode())]))
    ]
    errors = []


class DescribePowerTypes(amp.Command):
    """Get a JSON Schema describing this rack's power types.

    :since: 1.5
    """

    arguments = []
    response = [
        (b"power_types", StructureAsJSON()),
    ]
    errors = []


class DescribeNOSTypes(amp.Command):
    """Get a JSON Schema describing this rack's NOS types.

    :since: 2.3
    """

    arguments = []
    response = [
        (b"nos_types", StructureAsJSON()),
    ]
    errors = []


class ListSupportedArchitectures(amp.Command):
    """Report the cluster's supported architectures.

    :since: 1.5
    """

    arguments = []
    response = [
        (b"architectures", AmpList([
            (b"name", amp.Unicode()),
            (b"description", amp.Unicode()),
            ])),
    ]
    errors = []


class ListOperatingSystems(amp.Command):
    """Report the cluster's supported operating systems.

    :since: 1.7
    """

    arguments = []
    response = [
        (b"osystems", AmpList([
            (b"name", amp.Unicode()),
            (b"title", amp.Unicode()),
            (b"releases", AmpList([
                (b"name", amp.Unicode()),
                (b"title", amp.Unicode()),
                (b"requires_license_key", amp.Boolean()),
                (b"can_commission", amp.Boolean()),
            ])),
            (b"default_release", amp.Unicode(optional=True)),
            (b"default_commissioning_release", amp.Unicode(optional=True)),
        ])),
    ]
    errors = []


class GetOSReleaseTitle(amp.Command):
    """Get the title for the operating systems release.

    :since: 1.7
    """

    arguments = [
        (b"osystem", amp.Unicode()),
        (b"release", amp.Unicode()),
    ]
    response = [
        (b"title", amp.Unicode()),
    ]
    errors = {
        exceptions.NoSuchOperatingSystem: (
            b"NoSuchOperatingSystem"),
    }


class ValidateLicenseKey(amp.Command):
    """Validate an OS license key.

    :since: 1.7
    """

    arguments = [
        (b"osystem", amp.Unicode()),
        (b"release", amp.Unicode()),
        (b"key", amp.Unicode()),
    ]
    response = [
        (b"is_valid", amp.Boolean()),
    ]
    errors = {
        exceptions.NoSuchOperatingSystem: (
            b"NoSuchOperatingSystem"),
    }


class PowerDriverCheck(amp.Command):
    """Check power driver on cluster for missing packages

    :since: 1.9
    """

    arguments = [
        (b"power_type", amp.Unicode()),
    ]
    response = [
        (b"missing_packages", amp.ListOf(amp.Unicode())),
    ]
    errors = {
        exceptions.UnknownPowerType: (
            b"UnknownPowerType"),
        NotImplementedError: (
            b"NotImplementedError"),
    }


class GetPreseedData(amp.Command):
    """Get OS-specific preseed data.

    :since: 1.7
    """

    arguments = [
        (b"osystem", amp.Unicode()),
        (b"preseed_type", amp.Unicode()),
        (b"node_system_id", amp.Unicode()),
        (b"node_hostname", amp.Unicode()),
        (b"consumer_key", amp.Unicode()),
        (b"token_key", amp.Unicode()),
        (b"token_secret", amp.Unicode()),
        (b"metadata_url", ParsedURL()),
    ]
    response = [
        (b"data", StructureAsJSON()),
    ]
    errors = {
        exceptions.NoSuchOperatingSystem: (
            b"NoSuchOperatingSystem"),
        NotImplementedError: (
            b"NotImplementedError"),
    }


class _Power(amp.Command):
    """Base class for power control commands.

    :since: 1.7
    """

    arguments = [
        (b"system_id", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"power_type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = []
    errors = {
        exceptions.UnknownPowerType: (
            b"UnknownPowerType"),
        NotImplementedError: (
            b"NotImplementedError"),
        exceptions.PowerActionFail: (
            b"PowerActionFail"),
        exceptions.PowerActionAlreadyInProgress: (
            b"PowerActionAlreadyInProgress"),
    }


class PowerOn(_Power):
    """Turn a node's power on.

    :since: 1.7
    """


class PowerOff(_Power):
    """Turn a node's power off.

    :since: 1.7
    """


class PowerQuery(_Power):
    """Query a node's power state.

    :since: 1.7
    """
    response = [
        (b"state", amp.Unicode()),
        (b"error_msg", amp.Unicode(optional=True)),
    ]


class PowerCycle(_Power):
    """Turn a node's power off (if on), then turn a
    node's power on.

    :since: 2.0
    """


class _ConfigureDHCP(amp.Command):
    """Configure a DHCP server.

    :since: 2.0
    """
    arguments = [
        (b"omapi_key", amp.Unicode()),
        (b"failover_peers", AmpList([
            (b"name", amp.Unicode()),
            (b"mode", amp.Unicode()),
            (b"address", amp.Unicode()),
            (b"peer_address", amp.Unicode()),
            ])),
        (b"shared_networks", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"subnets", AmpList([
                (b"subnet", amp.Unicode()),
                (b"subnet_mask", amp.Unicode()),
                (b"subnet_cidr", amp.Unicode()),
                (b"broadcast_ip", amp.Unicode()),
                (b"router_ip", amp.Unicode()),
                # dns_servers is a space- or comma-separated list (it's not
                # clear which) of IP addresses. In _ConfigureDHCP_V2 is it a
                # list proper.
                (b"dns_servers", amp.Unicode()),
                # ntp_server (note: singular) is a space- or comma-separated
                # list (it's not clear which) of IP addresses and/or
                # hostnames. In _ConfigureDHCP_V2 is it a list proper.
                (b"ntp_server", amp.Unicode()),
                (b"domain_name", amp.Unicode()),
                (b"search_list", amp.ListOf(amp.Unicode(), optional=True)),
                (b"pools", AmpList([
                    (b"ip_range_low", amp.Unicode()),
                    (b"ip_range_high", amp.Unicode()),
                    (b"failover_peer", amp.Unicode(optional=True)),
                    ])),
                (b"dhcp_snippets", AmpList([
                    (b"name", amp.Unicode()),
                    (b"description", amp.Unicode(optional=True)),
                    (b"value", amp.Unicode()),
                    ], optional=True)),
                ])),
            (b"mtu", amp.Integer(optional=True)),
        ])),
        (b"hosts", CompressedAmpList([
            (b"host", amp.Unicode()),
            (b"mac", amp.Unicode()),
            (b"ip", amp.Unicode()),
            (b"dhcp_snippets", AmpList([
                (b"name", amp.Unicode()),
                (b"description", amp.Unicode(optional=True)),
                (b"value", amp.Unicode()),
                ], optional=True)),
            ])),
        (b"interfaces", AmpList([
            (b"name", amp.Unicode()),
            ])),
        (b"global_dhcp_snippets", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"description", amp.Unicode(optional=True)),
            (b"value", amp.Unicode()),
            ], optional=True)),
        ]
    response = []
    errors = {exceptions.CannotConfigureDHCP: b"CannotConfigureDHCP"}


class _ConfigureDHCP_V2(amp.Command):
    """Configure a DHCP server.

    :since: 2.1
    """
    arguments = [
        (b"omapi_key", amp.Unicode()),
        (b"failover_peers", AmpList([
            (b"name", amp.Unicode()),
            (b"mode", amp.Unicode()),
            (b"address", amp.Unicode()),
            (b"peer_address", amp.Unicode()),
            ])),
        (b"shared_networks", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"subnets", AmpList([
                (b"subnet", amp.Unicode()),
                (b"subnet_mask", amp.Unicode()),
                (b"subnet_cidr", amp.Unicode()),
                (b"broadcast_ip", amp.Unicode()),
                (b"router_ip", amp.Unicode()),
                (b"dns_servers", amp.ListOf(IPAddress())),
                (b"ntp_servers", amp.ListOf(amp.Unicode())),
                (b"domain_name", amp.Unicode()),
                (b"search_list", amp.ListOf(amp.Unicode(), optional=True)),
                (b"pools", AmpList([
                    (b"ip_range_low", amp.Unicode()),
                    (b"ip_range_high", amp.Unicode()),
                    (b"failover_peer", amp.Unicode(optional=True)),
                    ])),
                (b"dhcp_snippets", AmpList([
                    (b"name", amp.Unicode()),
                    (b"description", amp.Unicode(optional=True)),
                    (b"value", amp.Unicode()),
                    ], optional=True)),
                ])),
            (b"mtu", amp.Integer(optional=True)),
        ])),
        (b"hosts", CompressedAmpList([
            (b"host", amp.Unicode()),
            (b"mac", amp.Unicode()),
            (b"ip", amp.Unicode()),
            (b"dhcp_snippets", AmpList([
                (b"name", amp.Unicode()),
                (b"description", amp.Unicode(optional=True)),
                (b"value", amp.Unicode()),
                ], optional=True)),
            ])),
        (b"interfaces", AmpList([
            (b"name", amp.Unicode()),
            ])),
        (b"global_dhcp_snippets", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"description", amp.Unicode(optional=True)),
            (b"value", amp.Unicode()),
            ], optional=True)),
        ]
    response = []
    errors = {exceptions.CannotConfigureDHCP: b"CannotConfigureDHCP"}


class _ValidateDHCPConfig(_ConfigureDHCP):
    """Validate the configure the DHCPv4 server.

    :since: 2.0
    """
    response = [
        (b"errors", CompressedAmpList([
            (b"error", amp.Unicode()),
            (b"line_num", amp.Integer()),
            (b"line", amp.Unicode()),
            (b"position", amp.Unicode()),
            ], optional=True)),
    ]


class _ValidateDHCPConfig_V2(_ConfigureDHCP_V2):
    """Validate the configure the DHCPv4 server.

    :since: 2.1
    """
    response = [
        (b"errors", CompressedAmpList([
            (b"error", amp.Unicode()),
            (b"line_num", amp.Integer()),
            (b"line", amp.Unicode()),
            (b"position", amp.Unicode()),
            ], optional=True)),
    ]


class ConfigureDHCPv4(_ConfigureDHCP):
    """Configure the DHCPv4 server.

    :since: 2.0
    """


class ConfigureDHCPv4_V2(_ConfigureDHCP_V2):
    """Configure the DHCPv4 server.

    :since: 2.1
    """


class ValidateDHCPv4Config(_ValidateDHCPConfig):
    """Validate the configure the DHCPv4 server.

    :since: 2.0
    """


class ValidateDHCPv4Config_V2(_ValidateDHCPConfig_V2):
    """Validate the configure the DHCPv4 server.

    :since: 2.1
    """


class ConfigureDHCPv6(_ConfigureDHCP):
    """Configure the DHCPv6 server.

    :since: 2.0
    """


class ConfigureDHCPv6_V2(_ConfigureDHCP_V2):
    """Configure the DHCPv6 server.

    :since: 2.1
    """


class ValidateDHCPv6Config(_ValidateDHCPConfig):
    """Configure the DHCPv6 server.

    :since: 2.0
    """


class ValidateDHCPv6Config_V2(_ValidateDHCPConfig_V2):
    """Configure the DHCPv6 server.

    :since: 2.1
    """


class ImportBootImages(amp.Command):
    """Import boot images and report the final
    boot images that exist on the cluster.

    :since: 1.7
    """

    arguments = [
        (b"sources", AmpList(
            [(b"url", amp.Unicode()),
             (b"keyring_data", Bytes()),
             (b"selections", AmpList(
                 [(b"os", amp.Unicode()),
                  (b"release", amp.Unicode()),
                  (b"arches", amp.ListOf(amp.Unicode())),
                  (b"subarches", amp.ListOf(amp.Unicode())),
                  (b"labels", amp.ListOf(amp.Unicode()))]))])),
        (b"http_proxy", ParsedURL(optional=True)),
        (b"https_proxy", ParsedURL(optional=True)),
    ]
    response = []
    errors = []


class EvaluateTag(amp.Command):
    """Evaluate a tag against the list of nodes.

    :since: 2.0
    """

    arguments = [
        # System ID for rack controller.
        (b"system_id", amp.Unicode()),
        (b"tag_name", amp.Unicode()),
        (b"tag_definition", amp.Unicode()),
        (b"tag_nsmap", AmpList([
            (b"prefix", amp.Unicode()),
            (b"uri", amp.Unicode()),
        ])),
        # A 3-part credential string for the web API.
        (b"credentials", amp.Unicode()),
        # List of nodes the rack controller should evaluate.
        (b"nodes", AmpList([
            (b"system_id", amp.Unicode()),
        ])),
    ]
    response = []
    errors = []


class IsImportBootImagesRunning(amp.Command):
    """Check if the import boot images task is running on the cluster.

    :since: 1.7
    """
    arguments = []
    response = [
        (b"running", amp.Boolean()),
    ]
    errors = {}


class RefreshRackControllerInfo(amp.Command):
    """Refresh the rack controller's hardware and network details.

    :since: 2.0
    """
    arguments = [
        (b"system_id", amp.Unicode()),
        (b"consumer_key", amp.Unicode()),
        (b"token_key", amp.Unicode()),
        (b"token_secret", amp.Unicode()),
    ]
    response = [
        (b"hostname", amp.Unicode()),
        (b"architecture", amp.Unicode()),
        (b"osystem", amp.Unicode()),
        (b"distro_series", amp.Unicode()),
        (b"interfaces", StructureAsJSON()),
        (b"maas_version", amp.Unicode(optional=True)),
    ]
    errors = {
        exceptions.RefreshAlreadyInProgress: (
            b"RefreshAlreadyInProgress"),
    }


class AddChassis(amp.Command):
    """Probe and enlist the chassis which a rack controller can connect to.

    :since: 2.0
    """
    arguments = [
        (b"user", amp.Unicode()),
        (b"chassis_type", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"username", amp.Unicode(optional=True)),
        (b"password", amp.Unicode(optional=True)),
        (b"accept_all", amp.Boolean(optional=True)),
        (b"domain", amp.Unicode(optional=True)),
        (b"prefix_filter", amp.Unicode(optional=True)),
        (b"power_control", amp.Unicode(optional=True)),
        (b"port", amp.Integer(optional=True)),
        (b"protocol", amp.Unicode(optional=True)),
    ]
    errors = {}


class DiscoverPod(amp.Command):
    """Discover all the pod information.

    :since: 2.2
    """
    arguments = [
        (b"pod_id", amp.Integer(optional=True)),
        (b"name", amp.Unicode(optional=True)),
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = [
        (b"pod", AmpDiscoveredPod()),
    ]
    errors = {
        exceptions.UnknownPodType: (
            b"UnknownPodType"),
        NotImplementedError: (
            b"NotImplementedError"),
        exceptions.PodActionFail: (
            b"PodActionFail"),
    }


class ComposeMachine(amp.Command):
    """Compose a machine in a pod.

    :since: 2.2
    """
    arguments = [
        (b"pod_id", amp.Integer()),
        (b"name", amp.Unicode()),
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
        (b"request", AmpRequestedMachine()),
    ]
    response = [
        (b"machine", AmpDiscoveredMachine()),
        (b"hints", AmpDiscoveredPodHints()),
    ]
    errors = {
        exceptions.UnknownPodType: (
            b"UnknownPodType"),
        NotImplementedError: (
            b"NotImplementedError"),
        exceptions.PodActionFail: (
            b"PodActionFail"),
        exceptions.PodInvalidResources: (
            b"PodInvalidResources"),
    }


class DecomposeMachine(amp.Command):
    """Decompose a machine in a pod.

    :since: 2.2
    """
    arguments = [
        (b"pod_id", amp.Integer()),
        (b"name", amp.Unicode()),
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = [
        (b"hints", AmpDiscoveredPodHints()),
    ]
    errors = {
        exceptions.UnknownPodType: (
            b"UnknownPodType"),
        NotImplementedError: (
            b"NotImplementedError"),
        exceptions.PodActionFail: (
            b"PodActionFail"),
    }


class ScanNetworks(amp.Command):
    """Requests an immediate scan of attached networks.

    If the `scan_all` parameter is True, scans all subnets on Ethernet
    interfaces known to the rack controller.

    If the `force_ping` parameter is True, forces the use of `ping` even if
    `nmap` is installed.

    If the `threads` parameter is supplied, overrides the number of concurrent
    threads the rack controller is allowed to spawn while scanning the network.

    If the `cidrs` parameter is supplied, scans the specified CIDRs on the
    rack controller.

    If the `interface` paramter is supplied, limits the scan to the specified
    interface.

    If both the `cidrs` and the `interface` parameters are supplied, the rack
    will scan for the specified `cidrs` on the specified interface, no
    matter if those CIDRs appear to be configured on that interface or not.

    If a scan is already in progress, this call raises a
    `ScanNetworksAlreadyInProgress` error.

    :since: 2.1
    """
    arguments = [
        (b"scan_all", amp.Boolean(optional=True)),
        (b"force_ping", amp.Boolean(optional=True)),
        (b"slow", amp.Boolean(optional=True)),
        (b"threads", amp.Integer(optional=True)),
        (b"cidrs", amp.ListOf(IPNetwork(), optional=True)),
        (b"interface", amp.Unicode(optional=True)),
    ]
    errors = {
        exceptions.ScanNetworksAlreadyInProgress: (
            b"ScanNetworksAlreadyInProgress"
        )
    }


class DisableAndShutoffRackd(amp.Command):
    """Disable and shutdown the rackd service.

    :since: 2.0
    """
    arguments = []
    errors = {
        exceptions.CannotDisableAndShutoffRackd: (
            b"CannotDisableAndShutoffRackd"),
    }