예제 #1
0
파일: poe.py 프로젝트: plan1230/nav
    def handle(self):
        if self.netbox.master:
            self._logger.debug("this is a virtual instance of %s, not polling",
                               self.netbox.master)
            returnValue(None)

        poemib = PowerEthernetMib(self.agent)
        if self.netbox.type and self.netbox.type.vendor.id == 'cisco':
            cisco_mib = CiscoPowerEthernetExtMib(self.agent)
            port_phy_index = yield cisco_mib.retrieve_column(
                "cpeExtPsePortEntPhyIndex")
            group_phy_index = yield cisco_mib.retrieve_column(
                "cpeExtMainPseEntPhyIndex")
            entity_mib = EntityMib(self.agent)
            alias_mapping = yield entity_mib.get_alias_mapping()
            port_ifindices = self._resolve_ifindex(port_phy_index,
                                                   alias_mapping)
        else:
            port_ifindices = {}
            group_phy_index = {}

        groups = yield poemib.get_groups_table()
        self._process_groups(groups, group_phy_index)

        ports = yield poemib.get_ports_table()
        self._process_ports(ports, port_ifindices)
        self._log_invalid_portgroups()
예제 #2
0
파일: psu.py 프로젝트: yytsui/nav
 def __init__(self, *args, **kwargs):
     """ Constructor..."""
     super(PowerSupplyUnit, self).__init__(*args, **kwargs)
     self.entity_mib = EntityMib(self.agent)
     self.entity_fru_control = None
     self.vendor_id = None
     if self.netbox.type:
         self.vendor_id = self.netbox.type.get_enterprise_id()
     if self.vendor_id == VENDOR_ID_CISCOSYSTEMS:
         self.entity_fru_control = CiscoEntityFruControlMib(self.agent)
     elif self.vendor_id == VENDOR_ID_HEWLETT_PACKARD:
         self.entity_fru_control = HpEntityFruControlMib(self.agent)
예제 #3
0
파일: mibs_test.py 프로젝트: hmpf/nav
    def _get_units(func, entity_physical_table):
        mib = EntityMib(Mock("AgentProxy"))

        def mock_retrieve(columns):
            return defer.succeed(entity_physical_table)

        mib.retrieve_columns = mock_retrieve
        df = getattr(mib, func)()
        assert df.called
        if isinstance(df.result, failure.Failure):
            df.result.raiseException()
        return df.result
예제 #4
0
파일: mibs_test.py 프로젝트: bj0rns0der/nav
    def test_empty_logical_type_should_not_raise(self):
        mib = EntityMib(Mock('AgentProxy'))
        def mock_retrieve(columns):
            return defer.succeed(
                {1: {'entLogicalDescr': None,
                     'entLogicalType': None,
                     'entLogicalCommunity': None}}
                )

        mib.retrieve_columns = mock_retrieve
        df = mib.retrieve_alternate_bridge_mibs()
        self.assertTrue(df.called)
        if isinstance(df.result, failure.Failure):
            df.result.raiseException()
예제 #5
0
파일: poe.py 프로젝트: hmpf/nav
    def _map_cisco_power_ports_to_ifindex(self):
        """Uses the Cisco proprietary CISCO-POWER-ETHERNET-EXT-MIB to map the group/port
        index pairs used exclusively in PORT-ETHERNET-MIB to an actual ifIndex, that
        most other MIBs (and NAV's Interface model) uses for identification of
        interfaces/ports.

        POWER-ETHERNET-MIB provides only a very vague identification of power-enabled
        ports. These identifiers are not universally and consistently mappable to an
        ifIndex, for example. A more conclusive mapping to interfaces may be provided
        on a vendor-by-vendor basis. The only supported vendor for mapping in this
        codebase so far is Cisco.

        Cisco's mapping is indirect via the ENTITY-MIB - each entry from the power
        ethernet tables is mapped to a physical port in ENTITY-MIB::entPhysicalTable
        via its entPhysicalIndex. This table, in turn, can map physical ports to
        interface indexes from the IF-MIB::ifTable.
        """
        cisco_mib = CiscoPowerEthernetExtMib(self.agent)
        port_phy_index = yield cisco_mib.retrieve_column("cpeExtPsePortEntPhyIndex")
        group_phy_index = yield cisco_mib.retrieve_column("cpeExtMainPseEntPhyIndex")
        entity_mib = EntityMib(self.agent)
        alias_mapping = yield entity_mib.get_alias_mapping()
        port_ifindices = self._resolve_ifindex(port_phy_index, alias_mapping)
        returnValue((group_phy_index, port_ifindices))
예제 #6
0
 def __init__(self, agent_proxy):
     """Good old constructor..."""
     super(EntitySensorMib, self).__init__(agent_proxy)
     self.entity_mib = EntityMib(self.agent_proxy)
예제 #7
0
파일: entity.py 프로젝트: wujcheng/nav
 def __init__(self, *args, **kwargs):
     super(Entity, self).__init__(*args, **kwargs)
     self.alias_mapping = {}
     self.entitymib = EntityMib(self.agent)
     self.stampcheck = TimestampChecker(self.agent, self.containers,
                                        INFO_VAR_NAME)
예제 #8
0
 def __init__(self, agent_proxy):
     super(CiscoEntityFruControlMib, self).__init__(agent_proxy)
     self.entity_mib = EntityMib(self.agent_proxy)
     self.fan_status_table = None
     self.psu_status_table = None
예제 #9
0
 def __init__(self, agent_proxy):
     super(HpIcfPowerSupplyMib, self).__init__(agent_proxy)
     self.entity_mib = EntityMib(agent_proxy)
     self.psu_status_table = None
예제 #10
0
 def __init__(self, agent_proxy):
     super(HpIcfFanMib, self).__init__(agent_proxy)
     self.entity_mib = EntityMib(agent_proxy)
     self.fan_status_table = None