示例#1
0
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"interface", amp.Unicode(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"}
示例#2
0
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)),
    ]
示例#3
0
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 = []
示例#4
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"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"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"}