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()
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)
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
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()
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))
def __init__(self, agent_proxy): """Good old constructor...""" super(EntitySensorMib, self).__init__(agent_proxy) self.entity_mib = EntityMib(self.agent_proxy)
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)
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
def __init__(self, agent_proxy): super(HpIcfPowerSupplyMib, self).__init__(agent_proxy) self.entity_mib = EntityMib(agent_proxy) self.psu_status_table = None
def __init__(self, agent_proxy): super(HpIcfFanMib, self).__init__(agent_proxy) self.entity_mib = EntityMib(agent_proxy) self.fan_status_table = None