Package Products :: Package ZenModel :: Module Linkable |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenModel.Linkable

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 as published by
     8  # the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  from Products.CMFCore.utils import getToolByName
    15
    16 -class Linkable:
    17      """ A mixin allowing an object to be the
    18          endpoint of a Link object.
    19      """
    20
    21 -    def _getLinkCatalog(self):
    22          try:
    23              return getToolByName(self.dmd.ZenLinkManager, self.link_catalog)
    24          except AttributeError:
    25              return None
    26
    27 -    def index_links(self):
    28          cat = self._getLinkCatalog()
    29          if cat is not None:
    30              cat.catalog_object(self, self.getPrimaryId())
    31
    32 -    def unindex_links(self):
    33          cat = self._getLinkCatalog()
    34          if cat is not None:
    35              cat.uncatalog_object(self.getPrimaryId())
    36
    37
    38 -class Layer2Linkable(Linkable):
    39
    40      link_catalog = "layer2_catalog"
    41
    42 -    def deviceId(self): raise NotImplementedError
    43 -    def interfaceId(self): raise NotImplementedError
    44 -    def macaddress(self): raise NotImplementedError
    45 -    def lanId(self): raise NotImplementedError
    46
    47
    48 -class Layer3Linkable(Linkable):
    49
    50      link_catalog = "layer3_catalog"
    51
    52 -    def deviceId(self): raise NotImplementedError
    53 -    def ipAddressId(self): raise NotImplementedError
    54 -    def networkId(self): raise NotImplementedError
    55 -    def interfaceId(self): raise NotImplementedError
    56