Meta Module

The following sections describe the classes in the meta module.

Category

Class that represents an object category.

class cobra.mit.meta.Category(name, categoryId)[source]

Category class for Managed Object (MO) class meta or property meta.

Used to classify MOs or MO properties into various categories. The categories are defined in the ACI model package for ever MO property.

__eq__(other)[source]

Implement ==.

__ge__(other)[source]

Implement >=.

__gt__(other)[source]

Implement >.

__init__(name, categoryId)[source]

Initialize a MO property category.

Parameters:
  • name (str) – The name of the category
  • categoryId (int) – The integer representing the category id
__le__(other)[source]

Implement <=.

__lt__(other)[source]

Implement <.

__ne__(other)[source]

Implement !=.

__str__()[source]

Implement str().

ClassLoader

Class that loads a specified class.

class cobra.mit.meta.ClassLoader[source]

Import a class by name.

A convenience class to import classes from a string containing the class name

classmethod loadClass(fqClassName)[source]

Load a class from a fully qualified name.

Parameters:fqClassName (str) – A fully qualified class name as in package.module.class. For example: cobra.model.pol.Uni
Returns:The imported class
Return type:cobra.mit.mo.Mo

ClassMeta

Class that provides information about an object class.

class cobra.mit.meta.ClassMeta(className)[source]

Represents a classes metadata.

className

The class name for the meta

Type:str
moClassName

The class name for the MO

Type:None or str
label

The label for the class meta

Type:str
category

The class category

Type:None or cobra.mit.meta.Category
isAbstract

True if the class is abstract, False otherwise

Type:bool
isRelation

True if the class is a relationship object, False otherwise

Type:bool
isSource

True if the class is a source relationship object, False otherwise

Type:bool
isExplicit

True if the object is an explicit relationship, False if the object forms an indirect named relationship

Type:bool
isNamed

True if the object is a named source relationship object, False otherwise

Type:bool
writeAccessMask

The write permissions for this class

Type:long
readAccessMask

The read permissions for this class

Type:long
isDomainable

True if the MO is domainable, False otherwise

Type:bool
isReadOnly

True if the MO is readonly, False otherwise

Type:bool
isConfigurable

True if the MO can be configured, False otherwise

Type:bool
isDeletable

True if the MO can be deleted

Type:bool
isContextRoot

True if the MO is the context root

Type:bool
concreteSubClasses

A container that keeps track of all the subclasses that are concrete

Type:cobra.mit.meta.ClassMeta._ClassContainer
superClasses

A container that keeps track of all the super classes

Type:cobra.mit.meta.ClassMeta._ClassContainer
childClasses

A container that keeps track of the actual child classes

Type:cobra.mit.meta.ClassMeta._ClassContainer
childNamesAndRnPrefix

A list containing tuples where the first element is the child name and the second element is the rn prefix

Type:list of tuples
parentClasses

A container that keeps track of the actual parent classes

Type:cobra.mit.meta.ClassMeta._ClassContainer
props

A container that keeps track of all of the classes properties

Type:cobra.mit.meta._PropContainer
namingProps

A list containing cobra.mit.meta.PropMeta for each property that is a naming property.

Type:list
rnFormat

A string representing the relative name format

Type:None or str
rnPrefixes

The relative name prefixes where the first element in the tuple is the rn prefix and the second element is a bool where True means the prefix has naming properties and False otherwise.

Type:list of tuples
ctxRoot

The context root for this class.

Type:None or cobra.mit.mo.Mo
__init__(className)[source]

Initialize a ClassMeta instance.

Parameters:className (str) – The class name for this meta object
getClass()[source]

Use the className to import the class for this meta object.

Returns:The imported class for this meta object
Return type:mixed
getContextRoot(pStack=None)[source]

Get the meta’s context root.

Parameters:pStack (set) – The parent stack
Returns:The class of the context root
Return type:None or cobra.mit.mo.Mo
hasContextRoot()[source]

Check if the meta has a context root.

Returns:True if the meta has a context root and False otherwise
Return type:boo

Constant

class cobra.mit.meta.Constant(const, label, value)[source]

A class to represent constants for properties.

__eq__(other)[source]

Implement ==.

__ge__(other)[source]

Implement >=.

__gt__(other)[source]

Implement >.

__init__(const, label, value)[source]

Initialize a constant object.

Parameters:
  • const (str) – The constant string that can be used for the property
  • label (str) – The label for this constant
  • value (int) – The value for this constant
__le__(other)[source]

Implement <=.

__lt__(other)[source]

Implement <.

__ne__(other)[source]

Implement !=.

__str__()[source]

Implement str().

NamedSourceRelationMeta

class cobra.mit.meta.NamedSourceRelationMeta(className, targetClassName)[source]

The meta data for a named source relationship object.

__init__(className, targetClassName)[source]

Initialize a named source relationship meta object.

Parameters:
  • className (str) – The source Mo class name for the relationship
  • targetClassName (str) – The target class name for the relationship

PropMeta

class cobra.mit.meta.PropMeta(typeClassName, name, moPropName, propId, category)[source]

The meta data for properties of managed objects.

typeClass

The class of the property

Type:str
name

The name of the property

Type:str
moPropName

The managed object property name

Type:str
id

The property id

Type:None or int
category

The property category object

Type:cobra.mit.meta.Category
help

The help string for the property

Type:None or str
label

The label for the property

Type:None or str
unit

The units the property is in

Type:None or str
defaultValue

The default value for the property

Type:None or str
isDn

True if the property is a distingushed name, False otherwise

Type:bool
isRn

True if the property is a relative name, False otherwise

Type:bool
isConfig

True if the property is a configuration property, False otherwise

Type:bool
isImplicit

True if the property is implicitly defined, False otherwise

Type:bool
isOper

True if the property is an operations property, False otherwise

Type:bool
isAdmin

True if the property is an admin property, False otherwise

Type:bool
isCreateOnly

True if the property can only be set when the MO is created, False otherwise

Type:bool
isNaming

True if the property is a naming property, False otherwise

Type:bool
isStats

True if the property is a stats property, False otherwise

Type:bool
isPassword

True if the property is a password property, False otherwise

Type:bool
needDelimiter

True if the property needs delimiters, False otherwise

Type:bool
constants

A dictionary where the keys are the constants const and the values are the constants objects

Type:dict of cobra.mit.meta.Constants
constsToLabels

A dictionary mapping the properties constants consts to the constants label

Type:dict
labelsToConsts

A dictionary mapping the properties constants labels to the constants consts

Type:dict
__eq__(other)[source]

Implement ==.

__ge__(other)[source]

Implement >=.

__gt__(other)[source]

Implement >.

__hash__()[source]

Implement hash().

__init__(typeClassName, name, moPropName, propId, category)[source]

Initialize a PropMeta instance.

Parameters:
  • typeClassName (str) – The class for the type of python object that should be used to represent this property
  • moPropName (str) – The managed object property name
  • propId (int) – The property Id number
  • category (cobra.mit.meta.Category) – The property category
__le__(other)[source]

Implement <=.

__lt__(other)[source]

Implement <.

__ne__(other)[source]

Implement !=.

__str__()[source]

Implement str().

isValidValue(value)[source]

Check a value against the validators in the meta.

Parameters:value (str) – The value to check
Returns:True if the value is valid for this property or False otherwise
Return type:bool
static makeValue(value)[source]

Create a property using a value.

Parameters:value (str) – The value to set the property to
Returns:The value
Return type:str

SourceRelationMeta

class cobra.mit.meta.SourceRelationMeta(className, targetClassName)[source]

The meta data for a source object in a relationship.

__init__(className, targetClassName)[source]

Initialize a source relationship meta object.

Parameters:
  • className (str) – The source Mo class name for the relationship
  • targetClassName (str) – The target class name for the relationship
getTargetClass()[source]

Import and returns the target class for a relationship.

Returns:The target class
Return type:cobra.mit.mo.Mo

TargetRelationMeta

class cobra.mit.meta.TargetRelationMeta(className, sourceClassName)[source]

The meta data for a target object in a relationship.

__init__(className, sourceClassName)[source]

Initialize a target relationship meta object.

Parameters:
  • className (str) – The target Mo class name for the relationship
  • sourceClassName (str) – The source class name for the relationship
getSourceClass()[source]

Import and return the source class.

Returns:The source class
Return type:cobra.mit.mo.Mo