Exemple #1
0
    def _update_transceiver_sensor_cache(self, interface, sub_id):
        """
        Update sensor data for single transceiver
        :param: interface: Interface name associated with transceiver
        :param: sub_id: OID of transceiver
        """

        ifalias = self.if_alias_map.get(interface, "")
        ifindex = port_util.get_index_from_str(interface)

        # get transceiver sensors from transceiver dom entry in STATE DB
        transceiver_dom_entry = Namespace.dbs_get_all(
            self.mib_updater.statedb, mibs.STATE_DB,
            mibs.transceiver_dom_table(interface))

        if not transceiver_dom_entry:
            return

        sensor_data_list = TransceiverSensorData.create_sensor_data(
            transceiver_dom_entry)
        sensor_data_list = TransceiverSensorData.sort_sensor_data(
            sensor_data_list)
        for index, sensor_data in enumerate(sensor_data_list):
            sensor_sub_id = get_transceiver_sensor_sub_id(
                ifindex, sensor_data.get_oid_offset())
            self._add_entity_related_oid(interface, sensor_sub_id)
            self.mib_updater.set_phy_class(sensor_sub_id, PhysicalClass.SENSOR)
            sensor_description = get_transceiver_sensor_description(
                sensor_data.get_name(), sensor_data.get_lane_number(), ifalias)
            self.mib_updater.set_phy_descr(sensor_sub_id, sensor_description)
            self.mib_updater.set_phy_name(sensor_sub_id, sensor_description)
            self.mib_updater.set_phy_contained_in(sensor_sub_id, sub_id)
            self.mib_updater.set_phy_parent_relative_pos(
                sensor_sub_id, index + 1)
            self.mib_updater.set_phy_fru(sensor_sub_id, False)
            # add to available OIDs list
            self.mib_updater.add_sub_id(sensor_sub_id)
Exemple #2
0
    def _update_transceiver_sensor_cache(self, interface, sub_id):
        """
        Update sensor data for single transceiver
        :param: interface: Interface name associated with transceiver
        :param: sub_id: OID of transceiver
        """

        ifalias = self.if_alias_map.get(interface, "")
        ifindex = port_util.get_index_from_str(interface)

        # get transceiver sensors from transceiver dom entry in STATE DB
        transceiver_dom_entry = Namespace.dbs_get_all(
            self.mib_updater.statedb, mibs.STATE_DB,
            mibs.transceiver_dom_table(interface))

        if not transceiver_dom_entry:
            return

        # go over transceiver sensors
        for sensor in transceiver_dom_entry:
            if sensor not in XCVR_SENSOR_NAME_MAP:
                continue
            sensor_sub_id = get_transceiver_sensor_sub_id(ifindex, sensor)
            self._add_entity_related_oid(interface, sensor_sub_id)
            sensor_description = get_transceiver_sensor_description(
                sensor, ifalias)

            self.mib_updater.set_phy_class(sensor_sub_id, PhysicalClass.SENSOR)
            self.mib_updater.set_phy_descr(sensor_sub_id, sensor_description)
            self.mib_updater.set_phy_name(sensor_sub_id, sensor_description)
            self.mib_updater.set_phy_contained_in(sensor_sub_id, sub_id)
            self.mib_updater.set_phy_parent_relative_pos(
                sensor_sub_id, XCVR_SENSOR_INDEX_MAP[sensor])
            self.mib_updater.set_phy_fru(sensor_sub_id, False)
            # add to available OIDs list
            self.mib_updater.add_sub_id(sensor_sub_id)
Exemple #3
0
    def _get_if_entry(self, sub_id):
        """
        :param oid: The 1-based sub-identifier query.
        :return: the DB entry for the respective sub_id.
        """
        oid = self.get_oid(sub_id)
        if not oid:
            return

        if_table = ""
        # Once PORT_TABLE will be moved to CONFIG DB
        # we will get entry from CONFIG_DB for all cases
        db = mibs.APPL_DB
        if oid in self.oid_lag_name_map:
            if_table = mibs.lag_entry_table(self.oid_lag_name_map[oid])
        elif oid in self.mgmt_oid_name_map:
            if_table = mibs.mgmt_if_entry_table(self.mgmt_oid_name_map[oid])
            db = mibs.CONFIG_DB
        elif oid in self.oid_name_map:
            if_table = mibs.if_entry_table(self.oid_name_map[oid])
        else:
            return None

        return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=True)
Exemple #4
0
 def get_physical_relation_info(self, name):
     return Namespace.dbs_get_all(self.mib_updater.statedb, mibs.STATE_DB,
                                  mibs.physical_entity_info_table(name))