noc.sa.interfaces.base

Module Contents

class noc.sa.interfaces.base.NoneParameter(required=True)

Bases: noc.core.interface.parameter.BaseParameter

Checks value is None

clean(self, value)
class noc.sa.interfaces.base.StringParameter(required=True, default=None, choices=None, aliases=None)

Bases: noc.core.interface.parameter.BaseParameter

Check value is string

clean(self, value)
class noc.sa.interfaces.base.UnicodeParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is unicode

clean(self, value)
class noc.sa.interfaces.base.REStringParameter(regexp, required=True, default=None)

Bases: noc.sa.interfaces.base.StringParameter

Check value is string matching regular expression

clean(self, value)
class noc.sa.interfaces.base.REParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is valid regular expression

clean(self, value)
class noc.sa.interfaces.base.PyExpParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is valid python expression

clean(self, value)
class noc.sa.interfaces.base.BooleanParameter

Bases: noc.core.interface.parameter.BaseParameter

Check value is boolean

clean(self, value)
get_form_field(self, label=None)
class noc.sa.interfaces.base.IntParameter(required=True, default=None, min_value=None, max_value=None)

Bases: noc.core.interface.parameter.BaseParameter

Check value is integer

clean(self, value)
class noc.sa.interfaces.base.FloatParameter(required=True, default=None, min_value=None, max_value=None)

Bases: noc.core.interface.parameter.BaseParameter

Check value is float

clean(self, value)
class noc.sa.interfaces.base.ListParameter

Bases: noc.core.interface.parameter.BaseParameter

Check value is list

clean(self, value)
form_clean(self, value)
class noc.sa.interfaces.base.InstanceOfParameter(cls, required=True, default=None)

Bases: noc.core.interface.parameter.BaseParameter

Check value is an instance of class

is_valid_instance(self, value)
is_valid_classname(self, value)
clean(self, value)
class noc.sa.interfaces.base.SubclassOfParameter(cls, required=True, default=None)

Bases: noc.core.interface.parameter.BaseParameter

Check value is subclass of given class

is_valid_classname(self, value)
is_valid_class(self, value)
clean(self, value)
class noc.sa.interfaces.base.ListOfParameter(element, required=True, default=None, convert=False)

Bases: noc.sa.interfaces.base.ListParameter

Check value is a list of given parameter type

clean(self, value)
script_clean_input(self, profile, value)
script_clean_result(self, profile, value)
class noc.sa.interfaces.base.StringListParameter(required=True, default=None, convert=False, choices=None)

Bases: noc.sa.interfaces.base.ListOfParameter

Check value is list of strings

class noc.sa.interfaces.base.DictParameter(required=True, default=None, attrs=None, truncate=False)

Bases: noc.core.interface.parameter.BaseParameter

Check value is a dict

clean(self, value)
script_clean_input(self, profile, value)
script_clean_result(self, profile, value)
class noc.sa.interfaces.base.DictListParameter(required=True, default=None, attrs=None, convert=False)

Bases: noc.sa.interfaces.base.ListOfParameter

Check value is a list of dicts of given structure

class noc.sa.interfaces.base.DateTimeParameter

Bases: noc.sa.interfaces.base.StringParameter

rx_datetime
clean(self, value)
form_clean(self, value)
class noc.sa.interfaces.base.DateTimeShiftParameter

Bases: noc.sa.interfaces.base.StringParameter

rx_datetime
clean(self, value)
form_clean(self, value)
class noc.sa.interfaces.base.IPv4Parameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is IPv4 address

clean(self, value)
class noc.sa.interfaces.base.IPv4PrefixParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is IPv4 prefix

clean(self, value)
class noc.sa.interfaces.base.IPv6Parameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is IPv6 address

clean(self, value)
class noc.sa.interfaces.base.IPv6PrefixParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is IPv6 prefix

clean(self, value)
class noc.sa.interfaces.base.IPParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is IPv4 or IPv6 address

clean(self, value)
class noc.sa.interfaces.base.PrefixParameter

Bases: noc.sa.interfaces.base.StringParameter

clean(self, value)
>>> PrefixParameter().clean("192.168.0.0/24")
'192.168.0.0/24'
class noc.sa.interfaces.base.VLANIDParameter(required=True, default=None)

Bases: noc.sa.interfaces.base.IntParameter

Check value is VLAN ID

class noc.sa.interfaces.base.VLANStackParameter(required=True, default=None)

Bases: noc.sa.interfaces.base.ListOfParameter

Check value is a stack of of VLAN ID

clean(self, value)
class noc.sa.interfaces.base.VLANIDListParameter(required=True, default=None)

Bases: noc.sa.interfaces.base.ListOfParameter

Check value is a list of arbitrary vlans

class noc.sa.interfaces.base.VLANIDMapParameter

Bases: noc.sa.interfaces.base.StringParameter

Check value is vlan map/vc filter

clean(self, value)
class noc.sa.interfaces.base.MACAddressParameter(required=True, default=None, accept_bin=True)

Bases: noc.sa.interfaces.base.StringParameter

Check value is MAC address

clean(self, value)
class noc.sa.interfaces.base.InterfaceNameParameter

Bases: noc.sa.interfaces.base.StringParameter

script_clean_input(self, profile, value)
script_clean_result(self, profile, value)
class noc.sa.interfaces.base.OIDParameter

Bases: noc.core.interface.parameter.BaseParameter

>>> OIDParameter().clean("1.3.6.1.2.1.1.1.0")
'1.3.6.1.2.1.1.1.0'
>>> OIDParameter(default="1.3.6.1.2.1.1.1.0").clean(None)
'1.3.6.1.2.1.1.1.0'
>>> OIDParameter().clean("1.3.6.1.2.1.1.X.0")  #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
    ...
ValueError: OIDParameter: '1.3.6.1.2.1.1.X.0'
clean(self, value)
class noc.sa.interfaces.base.RDParameter

Bases: noc.core.interface.parameter.BaseParameter

clean(self, value)
>>> RDParameter().clean("100:4294967295")
'100:4294967295'
>>> RDParameter().clean("10.10.10.10:10")
'10.10.10.10:10'
>>> RDParameter().clean("100000:500")
'100000:500'
>>> RDParameter().clean("100000L:100")
'100000:100'
class noc.sa.interfaces.base.GeoPointParameter

Bases: noc.core.interface.parameter.BaseParameter

>>> GeoPointParameter().clean([180, 90])
[180.0, 90.0]
>>> GeoPointParameter().clean([75.5, "90"])
[75.5, 90.0]
>>> GeoPointParameter().clean("[180, 85.5]")
[180.0, 85.5]
>>> GeoPointParameter().clean([1])  #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
ValueError: GeoPointParameter: [1]
clean(self, value)
class noc.sa.interfaces.base.ModelParameter(model, required=True)

Bases: noc.core.interface.parameter.BaseParameter

Model reference parameter

clean(self, value)
noc.sa.interfaces.base.DocFieldMap
class noc.sa.interfaces.base.DocumentParameter(document, required=True)

Bases: noc.core.interface.parameter.BaseParameter

Document reference parameter

clean(self, value)
class noc.sa.interfaces.base.EmbeddedDocumentParameter(document, required=True)

Bases: noc.core.interface.parameter.BaseParameter

clean(self, value)
class noc.sa.interfaces.base.TagsParameter

Bases: noc.core.interface.parameter.BaseParameter

>>> TagsParameter().clean([1, 2, "tags"])
[u'1', u'2', u'tags']
>>> TagsParameter().clean([1, 2, "tags "])
[u'1', u'2', u'tags']
>>> TagsParameter().clean("1,2,tags")
[u'1', u'2', u'tags']
>>> TagsParameter().clean("1 , 2,  tags")
[u'1', u'2', u'tags']
clean(self, value)
class noc.sa.interfaces.base.ColorParameter

Bases: noc.core.interface.parameter.BaseParameter

clean(self, value)
class noc.sa.interfaces.base.ObjectIdParameter(required=True, default=None)

Bases: noc.sa.interfaces.base.REStringParameter