def __init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps): """Initialize a managed object (MO). This should not be called directly. Instead initialize the Mo from the model that you need. Args: parentMoOrDn (str or cobra.mit.naming.Dn or cobra.mit.mo.Mo): The parent managed object (MO) or distinguished name (Dn). markDirty (bool): If True, the MO is marked has having changes that need to be committed. If False the Mo is not marked as having changes that need to be committed. *namingVals: Required values that are used to name the Mo, i.e. they become part of the MOs distinguished name. **creationProps: Properties to be set at the time the MO is created, these properties can also be set after the property is created if needed. Raises: NotImplementedError: If this class is called directly """ if self.__class__ == Mo: raise NotImplementedError('Mo cannot be instantiated.') BaseMo.__init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps)
def delete(self): """ Mark the Mo ad deleted. If this mo is committed, the corresponding mo in the backend will be deleted. """ BaseMo._delete(self)
def numChildren(self): """Get the number of children. Returns: int: The number of children that this Mo has. """ return BaseMo._numChildren(self)
def children(self): """Get the children iterator. Returns: iterator: An iterator for the children of this Mo. """ return BaseMo._children(self)
def dirtyProps(self): """Get the properties that are marked as dirty. Returns: set: The set of properties that are dirty. """ return BaseMo._dirtyProps(self)
def parent(self): """Get the parent Mo. Returns: cobra.mit.mo.Mo: The parent Mo. """ return BaseMo._parent(self)
def dn(self): # pylint:disable=invalid-name """Get the distinguished name. Returns: cobra.mit.naming.Dn: The Dn for this Mo. """ return BaseMo._dn(self)
def status(self): """Get the status. Returns: cobra.internal.base.moimpl.MoStatus: The status for this Mo. """ return BaseMo._status(self)
def rn(self): # pylint:disable=invalid-name """Get the relative name. Returns: cobra.mit.naming.Rn: The relative name for this Mo. """ return BaseMo._rn(self)
def parentDn(self): """Get the parent distinguished name. Returns: cobra.mit.naming.Dn: The parent Dn. """ return BaseMo._parentDn(self)
def isPropDirty(self, propName): """Check if a property has been modified on this managed object. Args: propName (str): The property name as a string Returns: bool: True if the property has been modified and not commited, False otherwise """ return BaseMo._isPropDirty(self, propName)
def numChildren(self): """ Returns the number of child managed objects (MOs). """ return BaseMo._numChildren(self)
def children(self): """ Returns the child managed objects (MOs). """ return BaseMo._children(self)
def dirtyProps(self): """ Returns modified properties that have not been committed. """ return BaseMo._dirtyProps(self)
def parent(self): """ Returns the parent managed object (MO). """ return BaseMo._parent(self)
def dn(self): """ Returns the distinguished name (Dn) of the managed object (MO). """ return BaseMo._dn(self)
def __getattr__(self, propName): """ Returns a managed object (MO) attribute. """ return BaseMo.__getattr__(self, propName)
def __init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps): if self.__class__ == Mo: raise NotImplementedError('Mo cannot be instantiated.') BaseMo.__init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps)
def status(self): """ Returns the managed object (MO) status. """ return BaseMo._status(self)
def parentDn(self): """ Returns the distinguished name (Dn) of the parent managed object (MO). """ return BaseMo._parentDn(self)
def resetProps(self): """ Resets managed object (MO) properties, discarding uncommitted changes. """ BaseMo._resetProps(self)
def isPropDirty(self, propName): """ Returns a value indicating whether a given property has a new value that has not been committed. """ return BaseMo._isPropDirty(self, propName)
def __getattr__(self, propName): """Implement getattr().""" return BaseMo.__getattr__(self, propName)
def rn(self): """ Returns the relative name (Rn) of the managed object (MO). """ return BaseMo._rn(self)
def resetProps(self): """Reset the managed object (MO) properties. This will discard uncommitted changes. """ BaseMo._resetProps(self)
def __setattr__(self, propName, propValue): """Implement setattr().""" BaseMo.__setattr__(self, propName, propValue)
def __setattr__(self, propName, propValue): """ Sets a managed object (MO) attribute. """ BaseMo.__setattr__(self, propName, propValue)
def test_baseMo_init_raises(self): with pytest.raises(NotImplementedError): BaseMo('uni', True)