ironic.api.controllers.v1.types module

class ironic.api.controllers.v1.types.BooleanType[source]

Bases: wsme.types.UserType

A simple boolean type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'boolean'
static validate(value)[source]
class ironic.api.controllers.v1.types.EventType[source]

Bases: wsme.types.UserType

A simple Event type.

basetype

alias of wsme.types.DictType

event_validators = {'network.bind_port': <function EventType._validate_network_port_event>, 'network.delete_port': <function EventType._validate_network_port_event>, 'network.unbind_port': <function EventType._validate_network_port_event>}
mandatory_fields = {'event'}
name = 'event'
valid_events = {'network.bind_port', 'network.delete_port', 'network.unbind_port'}
static validate(value)[source]

Validate the input

Parameters

value – A event dict

Returns

value

Raises

Invalid if event not in proper format

class ironic.api.controllers.v1.types.JsonPatchType(**kw)[source]

Bases: ironic.api.controllers.base.Base

A complex type that represents a single json-patch operation.

static internal_attrs()[source]

Returns a list of internal attributes.

Internal attributes can’t be added, replaced or removed. This method may be overwritten by derived class.

classmethod non_removable_attrs()[source]

Returns a set of names of attributes that may not be removed.

Attributes whose ‘mandatory’ property is True are automatically added to this set. To add additional attributes to the set, override the field _extra_non_removable_attrs in subclasses, with a set of the form {‘/foo’, ‘/bar’}.

op

Complex type attribute definition.

Example:

class MyComplexType(wsme.types.Base):
    optionalvalue = int
    mandatoryvalue = wsattr(int, mandatory=True)
    named_value = wsattr(int, name='named.value')

After inspection, the non-wsattr attributes will be replaced, and the above class will be equivalent to:

class MyComplexType(wsme.types.Base):
    optionalvalue = wsattr(int)
    mandatoryvalue = wsattr(int, mandatory=True)
path

Complex type attribute definition.

Example:

class MyComplexType(wsme.types.Base):
    optionalvalue = int
    mandatoryvalue = wsattr(int, mandatory=True)
    named_value = wsattr(int, name='named.value')

After inspection, the non-wsattr attributes will be replaced, and the above class will be equivalent to:

class MyComplexType(wsme.types.Base):
    optionalvalue = wsattr(int)
    mandatoryvalue = wsattr(int, mandatory=True)
static validate(patch)[source]
value

Complex type attribute definition.

Example:

class MyComplexType(wsme.types.Base):
    optionalvalue = int
    mandatoryvalue = wsattr(int, mandatory=True)
    named_value = wsattr(int, name='named.value')

After inspection, the non-wsattr attributes will be replaced, and the above class will be equivalent to:

class MyComplexType(wsme.types.Base):
    optionalvalue = wsattr(int)
    mandatoryvalue = wsattr(int, mandatory=True)
class ironic.api.controllers.v1.types.JsonType[source]

Bases: wsme.types.UserType

A simple JSON type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'json'
static validate(value)[source]
class ironic.api.controllers.v1.types.ListType[source]

Bases: wsme.types.UserType

A simple list type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'list'
static validate(value)[source]

Validate and convert the input to a ListType.

Parameters

value – A comma separated string of values

Returns

A list of unique values (lower-cased), maintaining the same order

class ironic.api.controllers.v1.types.LocalLinkConnectionType[source]

Bases: wsme.types.UserType

A type describing local link connection.

basetype

alias of wsme.types.DictType

static frombasetype(value)[source]
mandatory_fields_list = [{'port_id', 'switch_id'}, {'port_id', 'hostname'}]
name = 'locallinkconnection'
optional_field = {'switch_info'}
smart_nic_mandatory_fields = {'hostname', 'port_id'}
valid_fields = {'hostname', 'port_id', 'switch_id', 'switch_info'}
static validate(value)[source]

Validate and convert the input to a LocalLinkConnectionType.

Parameters

value – A dictionary of values to validate, switch_id is a MAC address or an OpenFlow based datapath_id, switch_info is an optional field. Required Smart NIC fields are port_id and hostname.

For example:

{
   'switch_id': mac_or_datapath_id(),
   'port_id': 'Ethernet3/1',
   'switch_info': 'switch1'
}

Or for Smart NIC:

{
   'port_id': 'rep0-0',
   'hostname': 'host1-bf'
}
Returns

A dictionary.

Raises

Invalid if some of the keys in the dictionary being validated are unknown, invalid, or some required ones are missing.

static validate_for_smart_nic(value)[source]

Validates Smart NIC field are present ‘port_id’ and ‘hostname’

Parameters

value – local link information of type Dictionary.

Returns

True if both fields ‘port_id’ and ‘hostname’ are present in ‘value’, False otherwise.

class ironic.api.controllers.v1.types.MacAddressType[source]

Bases: wsme.types.UserType

A simple MAC address type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'macaddress'
static validate(value)[source]
class ironic.api.controllers.v1.types.NameType[source]

Bases: wsme.types.UserType

A simple logical name type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'name'
static validate(value)[source]
class ironic.api.controllers.v1.types.UuidOrNameType[source]

Bases: wsme.types.UserType

A simple UUID or logical name type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'uuid_or_name'
static validate(value)[source]
class ironic.api.controllers.v1.types.UuidType[source]

Bases: wsme.types.UserType

A simple UUID type.

basetype

alias of builtins.str

static frombasetype(value)[source]
name = 'uuid'
static validate(value)[source]
class ironic.api.controllers.v1.types.VifType[source]

Bases: ironic.api.controllers.v1.types.JsonType

basetype

alias of builtins.str

static frombasetype(value)[source]
mandatory_fields = {'id'}
name = 'viftype'
static validate(value)[source]