class SyncTimestamps(amp.Command): arguments = [('NewSyncTimestamp', amp.Unicode())] # just send your damn timestamp when YOU're DONE. response = []
class Ping(amp.Command): """Represents a ping command for sending to workers""" arguments = [] response = [(b'result', amp.Unicode())]
class OnlineBallotRegulator_RegisterVoterAddressBallotId(Command): arguments = [(b'voter_addres', amp.Unicode()), (b'ballot_id', amp.Integer())] response = [(b'ok', amp.Unicode())] errors = {psycopg2.ProgrammingError: b'ProgrammingError'}
class GetBootConfig(amp.Command): """Get the boot configuration for booting machine. :since: 2.0 """ arguments = [ # The system_id for the rack controller. (b"system_id", amp.Unicode()), (b"local_ip", amp.Unicode()), (b"remote_ip", amp.Unicode()), (b"arch", amp.Unicode(optional=True)), (b"subarch", amp.Unicode(optional=True)), (b"mac", amp.Unicode(optional=True)), (b"bios_boot_method", amp.Unicode(optional=True)), ] response = [ (b"arch", amp.Unicode()), (b"subarch", amp.Unicode()), (b"osystem", amp.Unicode()), (b"release", amp.Unicode()), # Kernel and initrd are optional as they were introduced # in 2.1.1. After 2.2 they can be set to manditory. (b"kernel", amp.Unicode(optional=True)), (b"initrd", amp.Unicode(optional=True)), # boot_dtb is optional as not all archs require it. (b"boot_dtb", amp.Unicode(optional=True)), (b"purpose", amp.Unicode()), (b"hostname", amp.Unicode()), (b"domain", amp.Unicode()), (b"preseed_url", amp.Unicode()), (b"fs_host", amp.Unicode()), (b"log_host", amp.Unicode()), (b"extra_opts", amp.Unicode()), (b"system_id", amp.Unicode(optional=True)), (b"http_boot", amp.Boolean(optional=True)), ] errors = { BootConfigNoResponse: b"BootConfigNoResponse", }
class EnumerateClients(amp.Command): arguments = [] response = [('handles', amp.ListOf(amp.Unicode()))]
class UpdateObserver(amp.Command): arguments = [ ('info', amp.Unicode()), ] response = []
class GetChunk(amp.Command): arguments = [(b'x', amp.Integer()), (b'y', amp.Integer())] response = [(b'chunk', amp.Unicode())]
def test_unicode(self): self._test_encode([(u"xyzzy", amp.Unicode())])
def test_listOfUnicode(self): ts = list(u"abcdef") self._test_encode([(ts, amp.ListOf(amp.Unicode()))])
""" Encodes simple Python data structures into their AMP wire formats. """ from twisted.protocols import amp def toBoxKwargs(inputKwargs): """ Encodes kwargs for an AMP remote call as box arguments, assuming the kwargs are all of the correct type. """ boxKwargs = {} for key, value in inputKwargs.iteritems(): boxKwargs[key] = _ampEncoders[value.__class__](value) return boxKwargs _ampEncoders = { int: amp.Integer().toString, float: amp.Float().toString, unicode: amp.Unicode().toString, list: lambda l: amp.ListOf(_ampEncoders[l[0].__class__].im_self).toString(l) }
class PacketPlanet(amp.Command): requiresAnswer = False arguments = [(b'id', amp.Integer()), (b'radius', amp.Integer()), (b'position_x', amp.Float()), (b'position_y', amp.Float()), (b'mass', amp.Float()), (b'image', amp.Unicode())] response = []
class TypedListProtocol2(amp.Command): arguments = [('l', amptypes.TypedList(amp.Unicode()))] response = [('l', amptypes.TypedList(amp.Unicode()))]
class TypedDictionaryProtocol2(amp.Command): arguments = [('d', amptypes.TypedDictionary(amp.Unicode(), amp.Unicode()))] response = [('d', amptypes.TypedDictionary(amp.Unicode(), amp.Unicode()))]
class Handshake(amp.Command): arguments = [('NodeId', amp.Unicode()), ('ListeningPort', amp.Integer()), ('ProtocolVersion', amp.Float())] response = [('NodeId', amp.Unicode()), ('ListeningPort', amp.Integer()), ('ProtocolVersion', amp.Float())]
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"}
class RPCUnregisterConnection(amp.Command): """Unregister worker lost connection from RPC client.""" arguments = [(b"pid", amp.Integer()), (b"connid", amp.Unicode())] response = [] errors = []
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"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"}
class Call(amp.Command): arguments = [('device', amp.String()), ('service', amp.String()), ('func', amp.String()), ('params', amp.ListOf(amp.String()))] response = [('call_result', amp.ListOf(amp.Unicode()))]
class UpdateUserPosition(amp.Command): arguments = [(b'user', amp.Unicode()), (b'x', amp.Float()), (b'y', amp.Float())] response = [(b'result', amp.Boolean())]
class GetDevices(amp.Command): arguments = [('dev_type', amp.String())] response = [('devices', amp.ListOf(amp.Unicode()))]
class UpdateChunk(amp.Command): arguments = [(b'chunk', amp.Unicode())] response = [(b'result', amp.Boolean())]
class DeviceInfo(amp.Command): arguments = [('uuid', amp.String())] response = [('name', amp.String()), ('id_', amp.String()), ('value', amp.Unicode())]
class ClientDisconnected(amp.Command): arguments = [('handle', amp.Unicode())] response = []
class Event(amp.Command): arguments = [('name', amp.String()), ('id_', amp.String()), ('value', amp.Unicode())] response = []
class ClientCommand(amp.Command): arguments = [('handle', amp.Unicode()), ('command', amp.Unicode())] response = [('result', amp.String()), ('filename', amp.String())]
class GetCWD(amp.Command): response = [(b"cwd", amp.Unicode())]
class ApplicationServer_RegisterNewUser(Command): arguments = [(b'user_id', amp.Integer()), (b'password', amp.Unicode())] response = [(b'ok', amp.Boolean())] errors = {Exception: b'Exception'}
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)), (b"token_name", amp.Unicode(optional=True)), (b"token_secret", amp.Unicode(optional=True)), (b"verify_ssl", amp.Boolean(optional=True)), ] errors = {}
class GetBootConfig(amp.Command): """Get the boot configuration for booting machine. :since: 2.0 """ arguments = [ # The system_id for the rack controller. (b"system_id", amp.Unicode()), (b"local_ip", amp.Unicode()), (b"remote_ip", amp.Unicode()), (b"arch", amp.Unicode(optional=True)), (b"subarch", amp.Unicode(optional=True)), (b"mac", amp.Unicode(optional=True)), (b"hardware_uuid", amp.Unicode(optional=True)), (b"bios_boot_method", amp.Unicode(optional=True)), ] response = [ (b"arch", amp.Unicode()), (b"subarch", amp.Unicode()), (b"osystem", amp.Unicode()), (b"release", amp.Unicode()), # Kernel and initrd are optional as they were introduced # in 2.1.1. After 2.2 they can be set to manditory. (b"kernel", amp.Unicode(optional=True)), (b"initrd", amp.Unicode(optional=True)), # boot_dtb is optional as not all archs require it. (b"boot_dtb", amp.Unicode(optional=True)), (b"purpose", amp.Unicode()), (b"hostname", amp.Unicode()), (b"domain", amp.Unicode()), (b"preseed_url", amp.Unicode()), (b"fs_host", amp.Unicode()), (b"log_host", amp.Unicode()), (b"log_port", amp.Integer(optional=True)), (b"extra_opts", amp.Unicode()), (b"system_id", amp.Unicode(optional=True)), # MAAS 2.3 introduced this parameter to toggle using TGT or HTTP to # boot. TGT support was removed in MAAS 2.4 however without this option # a MAAS 2.3 rack controller connected to a MAAS 2.4 region controller # will try to use TGT as Twisted sets optional parameters to False when # not defined. (b"http_boot", amp.Boolean(optional=True)), ] errors = { BootConfigNoResponse: b"BootConfigNoResponse", }
class ReceiveNodes(amp.Command): arguments = [('Nodes', amp.ListOf(amp.Unicode())), ('TotalNumberOfPackets', amp.Integer()), ('CurrentPacketNo', amp.Integer())] response = []