| |
- __builtin__.object
-
- Enum
- ListIterator
- Node
-
- Action
- ActionParams
- Case
- Choice
- Container
-
- ListElement
- PresenceContainer
- Leaf
-
- EmptyLeaf
- NonEmptyLeaf
- List
- Root
- exceptions.Exception(exceptions.BaseException)
-
- BackendError
- MaagicError
class Action(Node) |
|
Represents a tailf:action node. |
|
- Method resolution order:
- Action
- Node
- __builtin__.object
Methods defined here:
- __call__(self, params=None)
- Make object callable. Calls request().
- __init__(self, backend, cs_node, parent=None)
- Initialize an Action node. Should not be called explicitly.
- __repr__(self)
- Get internal representation.
- get_input(self)
- Return a node tree representing the input node of this action.
- get_output(self)
- Return a node tree representing the output node of this action.
Note that this does not actually request the action.
Should not normally be called explicitly.
- request(self, params=None)
- Request the action and return the result as an ActionParams node.
Arguments:
params -- input parameters of the action (optional)
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ActionParams(Node) |
|
Represents the input or output parameters of a tailf:action.
The ActionParams node is the root of a tree representing either the input
or the output parameters of an action. Action parameters can be read and
set just like any other nodes in the tree. |
|
- Method resolution order:
- ActionParams
- Node
- __builtin__.object
Methods defined here:
- __init__(self, cs_node, parent, output=False)
- Initialize an ActionParams node.
Should not be called explicitly. Use 'get_input()' on an Action node
to retrieve its input parameters or 'request()' to request the action
and obtain the output parameters.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Case(Node) |
|
Represents a case node.
If this case node has any nested choice nodes, those will appear as
children of this object. |
|
- Method resolution order:
- Case
- Node
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- Check for equality.
A Case node is considered equal to the following objects:
- Any number type object that matches the tag value of this case
- Any string object that matches the yang name of this case
- Any object with string and int representations that both match those
of this case.
- __init__(self, backend, cs_node, cs_case, parent)
- Initialize a Case node. Should not be called explicitly.
- __int__(self)
- Get int representation (tag value).
- __ne__(self, other)
- Check for inequality.
- __repr__(self)
- Get internal representation.
- __str__(self)
- Get string representation.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Choice(Node) |
|
Represents a choice node. |
|
- Method resolution order:
- Choice
- Node
- __builtin__.object
Methods defined here:
- __init__(self, backend, cs_node, cs_choice, parent)
- Initialize a Choice node. Should not be called explicitly.
- __int__(self)
- Get int representation (tag value).
- __repr__(self)
- Get internal representation.
- __str__(self)
- Get string representation.
- get_value(self)
- Return the currently selected case of this choice.
The case is returned as a Case node. If no case is selected for this
choice, None is returned.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Container(Node) |
|
Represents a yang container.
A (non-presence) container node or a list element, contains other nodes. |
|
- Method resolution order:
- Container
- Node
- __builtin__.object
Methods defined here:
- __init__(self, backend, cs_node, parent=None)
- Initialize Container node. Should not be called explicitly.
- __repr__(self)
- Get internal representation.
- delete(self)
- Delete the container.
Deletes all nodes inside the container. The container itself is not
affected as it carries no state of its own.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class EmptyLeaf(Leaf) |
|
Represents a leaf with the type "empty". |
|
- Method resolution order:
- EmptyLeaf
- Leaf
- Node
- __builtin__.object
Methods defined here:
- __bool__(self)
- Return True if this leaf exists in the data tree.
- __init__(self, backend, cs_node, parent=None)
- Initialize an EmptyLeaf node. Should not be called explicitly.
- __nonzero__(self)
- Return True if this leaf exists in the data tree.
- create(self)
- Create and return this leaf in the data tree.
- delete(self)
- Delete this leaf from the data tree.
- exists(self)
- Return True if this leaf exists in the data tree.
Methods inherited from Leaf:
- __repr__(self)
- Get internal representation.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Enum(__builtin__.object) |
|
Simple represention of a yang enumeration instance.
Contains the string and integer representation of the enumeration.
An Enum object supports comparisons with other 'Enum' objects as well as
with other objects. For equality checks, strings, numbers, 'Enum' objects
and 'Value' objects are allowed. For relational operators,
all of the above except strings are acceptable.
Attributes:
string -- string representation of the enumeration
value -- integer representation of the enumeration |
|
Methods defined here:
- __eq__(self, other)
- Check enumeration for equality with another object.
The enumeraion is considered equal to the other object if one of the
following is true:
- 'other' is a number type and is equal to 'self.value'
- 'other' is a string and is equal to 'self.string'
- 'other' is a 'Value' object of type ENUM and its value value
is equal to 'self.value'
- 'other' is also an 'Enum' and has the same string and value
attributes as self
- __ge__(self, other)
- x.__ge__(y) <==> x>=y
- __gt__(self, other)
- x.__gt__(y) <==> x>y
- __init__(self, string, value)
- Initialize an Enum object from a given string and integer.
Note that an Enum object has no connection to the yang model and will
not check that the given value matches the string representation
according to the schema. Normally it is not necessary to create
Enum objects using this constructor as enum leaves can be set using
strings alone.
Arguments:
string -- string representation of the enumeration
value -- integer representation of the enumeration
- __int__(self)
- Return the integer representation of the enumeration.
- __le__(self, other)
- x.__le__(y) <==> x<=y
- __lt__(self, other)
- Compare enumeration to another object.
The value attribute of the enumeration is compared to one of the
following (the first one that is applicable):
- 'other' itself if 'other' is a number
- 'int(other)' if 'other' is a Value object
- 'other.value' if 'other' is an Enum object
- __ne__(self, other)
- Check for inequality.
- __repr__(self)
- Get internal representation.
- __str__(self)
- Return the string representation of the enumeration.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Leaf(Node) |
|
Base class for leaf nodes, subclassed by NonEmptyLeaf and EmptyLeaf. |
|
- Method resolution order:
- Leaf
- Node
- __builtin__.object
Methods defined here:
- __init__(self, backend, cs_node, parent=None)
- Initialize Leaf node. Should not be called explicitly.
- __repr__(self)
- Get internal representation.
- delete(self)
- Delete this leaf from the data tree.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class List(Node) |
|
Represents a list node.
A list can be treated mostly like a python dictionary. It supports
indexing, iteration, the len function, and the in and del operators.
New items must, however, be created explicitly using the 'create' method. |
|
- Method resolution order:
- List
- Node
- __builtin__.object
Methods defined here:
- __contains__(self, keys)
- Check if list has an item matching 'keys'.
Called when checking for existence using 'in' and 'not in'.
- __delitem__(self, keys)
- Delete list item matching 'keys'.
Called when deleting an item from the list. Example:
del mylist['key1']
- __getitem__(self, keys)
- Get a specific list item.
Get a specific item from the list using [] notation.
Return a ListElement representing the contents of the list at 'keys'.
- __init__(self, backend, cs_node, parent=None)
- Initialize a List node. Should not be called explicitly.
- __iter__(self)
- Python magic method.
Return an iterator for the list. This method will be called e.g.
when iterating the list like this:
for item in mylist: ...
- __len__(self)
- Get the length of the list.
Called when using 'len'.
- __repr__(self)
- Get internal representation.
- __setitem__(self, key, value)
- Raise an error.
- create(self, *keys)
- Create and return a new list item with the key '*keys'.
Arguments can be a single 'maapi.Key' object or one value for each key
in the list. For a keyless in-memory list (eg in action parameters),
no argument should be given.
- delete(self)
- Delete the entire list.
- exists(self, keys)
- Check if list has an item matching 'keys'.
- keys(self)
- Return all keys in the list.
Note that this will immediately retrieve every key value from the CDB.
For a long list this could be a time-consuming operation.
Not available for in-memory lists.
- move(self, key, where, to=None)
- Move the item with key 'key' in an ordered-by user list.
The destination is given by the arguments 'where' and 'to'.
Arguments:
key -- key of the element that is to be moved
where -- one of '_ncs.maapi.BEFORE', '_ncs.maapi.AFTER',
'_ncs.maapi.FIRST', or '_ncs.maapi.LAST'
Keyword arguments:
to -- key of the destination item for relative moves, only applicable
if 'where' is either 'BEFORE' or 'AFTER'.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __setattr__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ListElement(Container) |
|
Represents a list element.
This is a Container object with a specialized __repr__() method. |
|
- Method resolution order:
- ListElement
- Container
- Node
- __builtin__.object
Methods defined here:
- __repr__(self)
- Get internal representation.
Methods inherited from Container:
- __init__(self, backend, cs_node, parent=None)
- Initialize Container node. Should not be called explicitly.
- delete(self)
- Delete the container.
Deletes all nodes inside the container. The container itself is not
affected as it carries no state of its own.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ListIterator(__builtin__.object) |
|
List iterator.
An instance of this class will be returned when iterating a list. |
|
Methods defined here:
- __del__(self)
- Destructor. Destroy internal object.
- __enter__(self)
- Context manger entry point.
- __exit__(self, type_, value, tb)
- Context manger exit point.
- __init__(self, l)
- Initialize this object.
An instance of this class will be created when iteration of a
list starts. Should not be called explicitly.
- __iter__(self)
- Return iterator (which is self).
- __next__(self)
- Iterator next.
- delete(self)
- Delete the iterator.
- next(self)
- Get the next value from the iterator.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Node(__builtin__.object) |
|
Base class of all nodes in the configuration tree.
Contains magic overrides that make children in the yang tree appear as
attributes of the Node object and as elements in the list 'self'.
Attributes:
_name -- the yang name of this node
_path -- the keypath of this node in string form
_parent -- the parent of this node (or None if this node has no parent)
_cs_node -- the schema node of this node (or None if this node is not in
the schema) |
|
Methods defined here:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __init__(self, backend, cs_node, parent=None, is_root=False)
- Initialize a Node object. Should not be called explicitly.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class NonEmptyLeaf(Leaf) |
|
Represents a leaf with a type other than "empty". |
|
- Method resolution order:
- NonEmptyLeaf
- Leaf
- Node
- __builtin__.object
Methods defined here:
- __bool__(self)
- Return true if this leaf exists in the data tree.
- __init__(self, backend, cs_node, parent=None)
- Initialize a NonEmptyLeaf node. Should not be called explicitly.
- __nonzero__(self)
- Return true if this leaf exists in the data tree.
- __repr__(self)
- Get internal representation.
- delete(self)
- Delete this leaf from the data tree.
- exists(self)
- Check if leaf exists.
Return True if this leaf exists (has a value) in the data tree.
- get_value(self)
- Return the value of this leaf.
The value is returned as the most appropriate python data type.
- get_value_object(self)
- Return the value of this leaf as a Value object.
- set_cache(self, value)
- Set the cached value of this leaf without updating the data tree.
Use of this method is strongly discouraged.
- set_value(self, value)
- Set the value of this leaf.
Arguments:
value -- the value to be set. If 'value' is not a Value object, it will
be converted to one using Value.str2val.
- update_cache(self, force=False)
- Read this leaf's value from the data tree and store it in the cache.
There is no need to call this method explicitly.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PresenceContainer(Container) |
|
Represents a presence container. |
|
- Method resolution order:
- PresenceContainer
- Container
- Node
- __builtin__.object
Methods defined here:
- __bool__(self)
- Return true if this presence container exists in the data tree.
- __init__(self, backend, cs_node, parent=None)
- Initialize a PresenceContainer. Should not be called explicitly.
- __nonzero__(self)
- Return true if this presence container exists in the data tree.
- __repr__(self)
- Get internal representation.
- create(self)
- Create and return this presence container in the data tree.
- delete(self)
- Delete this presence container from the data tree.
- exists(self)
- Return true if the presence container exists in the data tree.
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __int__(self)
- Return the tag value of this node in the schema.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
- __str__(self)
- Return the name of this node in the schema.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Root(Node) |
|
Represents the root node in the configuration tree.
The root node is not represented in the schema, it is added for convenience
and can contain the top level nodes from any number of namespaces as
children. |
|
- Method resolution order:
- Root
- Node
- __builtin__.object
Methods defined here:
- __init__(self, backend=None, namespaces=None)
- Initialize a Root node.
Should not be called explicitly. Instead, use the function
'get_root()'.
Arguments:
backend -- backend to use, or 'None' for an in-memory tree
namespaces -- which namespaces to include in the tree
- __int__(self)
- Return the number 0.
- __repr__(self)
- Get internal representation.
- __str__(self)
- Return the string "(root)".
Methods inherited from Node:
- __delattr__(self, name)
- Python magic method.
- __delitem__(self, name)
- Python magic method.
- __dir__(self)
- Return a list of children available under this Node.
- __getattr__(self, name)
- Python magic method.
- __getitem__(self, name)
- Python magic method.
- __iter__(self)
- Iterate over children names under this Node.
- __setattr__(self, name, value)
- Python magic method.
- __setitem__(self, name, value)
- Python magic method.
Data descriptors inherited from Node:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |