def __init__(self, device): self.pm_names = { 'tx_64_pkts', 'tx_65_127_pkts', 'tx_128_255_pkts', 'tx_256_511_pkts', 'tx_512_1023_pkts', 'tx_1024_1518_pkts', 'tx_1519_9k_pkts', 'rx_64_pkts', 'rx_65_127_pkts', 'rx_128_255_pkts', 'rx_256_511_pkts', 'rx_512_1023_pkts', 'rx_1024_1518_pkts', 'rx_1519_9k_pkts' } self.device = device self.id = device.id self.name = 'ponsim_onu' self.default_freq = 150 self.grouped = False self.freq_override = False self.pm_metrics = None self.pon_metrics_config = dict() self.uni_metrics_config = dict() self.lc = None for m in self.pm_names: self.pon_metrics_config[m] = PmConfig(name=m, type=PmConfig.COUNTER, enabled=True) self.uni_metrics_config[m] = PmConfig(name=m, type=PmConfig.COUNTER, enabled=True)
def make_proto(self, pm_config=None): if pm_config is None: pm_config = PmConfigs(id=self.device_id, default_freq=self.default_freq, grouped=self.grouped, freq_override=self.freq_override) metrics = set() if self._heartbeat is not None: if self.grouped: pm_health_stats = PmGroupConfig(group_name='Heartbeat', group_freq=OnuPmMetrics.DEFAULT_HEARTBEAT_FREQUENCY, enabled=OnuPmMetrics.DEFAULT_HEARTBEAT_ENABLED) self.pm_group_metrics[pm_health_stats.group_name] = pm_health_stats else: pm_health_stats = pm_config # Add metrics to the PM Group (or as individual metrics_ for m in sorted(self.health_metrics_config): pm = self.health_metrics_config[m] if not self.grouped: if pm.name in metrics: continue metrics.add(pm.name) pm_health_stats.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) if self.grouped: pm_config.groups.extend([pm_health_stats]) # TODO Add PON Port PM # TODO Add UNI Port PM pm_config = self.omci_pm.make_proto(pm_config) return pm_config
def make_proto(self): pm_config = PmConfigs(id=self.id, default_freq=self.default_freq, grouped=False, freq_override=False) for m in sorted(self.pon_metrics_config): pm = self.pon_metrics_config[m] # Either will do they're the same pm_config.metrics.extend( [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) return pm_config
def init_pm_metrics(self): # Setup PM configuration for this device if self.pm_metrics is None: try: self.device.reason = 'setting up Performance Monitoring configuration' kwargs = { 'nni-ports': self.northbound_ports.values(), 'pon-ports': self.southbound_ports.values() } self.pm_metrics = OltPmMetrics(self.device.core_proxy, self.device.device_id, self.device.logical_device_id, self.device.serial_number, grouped=True, freq_override=False, **kwargs) """ override the default naming structures in the OltPmMetrics class. This is being done until the protos can be modified in the BAL driver """ self.pm_metrics.nni_pm_names = ( self.get_openolt_port_pm_names())['nni_pm_names'] self.pm_metrics.nni_metrics_config = { m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.pm_metrics.nni_pm_names } self.pm_metrics.pon_pm_names = ( self.get_openolt_port_pm_names())['pon_pm_names'] self.pm_metrics.pon_metrics_config = { m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.pm_metrics.pon_pm_names } pm_config = self.pm_metrics.make_proto() self.log.info("initial-pm-config", pm_config=pm_config) self.device.core_proxy.device_pm_config_update(pm_config, init=True) # Start collecting stats from the device after a brief pause reactor.callLater(10, self.pm_metrics.start_collector) except Exception as e: self.log.exception('pm-setup', e=e)
def __init__(self, core_proxy, device_id, logical_device_id, grouped=False, freq_override=False, **kwargs): """ Initializer for shared ONU Device Adapter PM metrics :param core_proxy: (CoreProxy) Core proxy for the device :param device_id: (str) Device ID :param logical_device_id: (str) VOLTHA Logical Device ID :param grouped: (bool) Flag indicating if statistics are managed as a group :param freq_override: (bool) Flag indicating if frequency collection can be specified on a per group basis :param kwargs: (dict) Device Adapter specific values. For an ONU Device adapter, the expected key-value pairs are listed below. If not provided, the associated PMv statistics are not gathered: 'heartbeat': Reference to the a class that provides an ONU heartbeat statistics. TODO: This should be standardized across adapters """ super(OnuPmMetrics, self).__init__(core_proxy, device_id, logical_device_id, grouped=grouped, freq_override=freq_override, **kwargs) # The following HeartBeat PM is only an example. We may want to have a common heartbeat # object for OLT and ONU DAs that work the same. If so, it could also provide PM information # # TODO: In the actual 'collection' of PM data, I have the heartbeat stats disabled since # there is not yet a common 'heartbeat' object # self.health_pm_names = { ('alarm_active', PmConfig.STATE), ('heartbeat_count', PmConfig.COUNTER), ('heartbeat_miss', PmConfig.COUNTER), ('alarms_raised_count', PmConfig.COUNTER), ('heartbeat_failed_limit', PmConfig.COUNTER), ('heartbeat_interval', PmConfig.COUNTER), } # TODO Add PON Port pollable PM as a separate class and include like OMCI # TODO Add UNI Port pollable PM as a separate class and include like OMCI self._heartbeat = kwargs.pop('heartbeat', None) self.health_metrics_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.health_pm_names} self.omci_pm = OnuOmciPmMetrics(core_proxy, device_id, logical_device_id, grouped=grouped, freq_override=freq_override, **kwargs)
def make_proto(self, pm_config=None): assert pm_config is not None # OMCI only supports grouped metrics if self._omci_onu_device is None or not self.grouped: return pm_config pm_omci_cc_stats = PmGroupConfig( group_name=OnuOmciPmMetrics.OMCI_CC_GROUP_NAME, group_freq=OnuOmciPmMetrics.DEFAULT_OMCI_CC_FREQUENCY, enabled=OnuOmciPmMetrics.DEFAULT_OMCI_CC_ENABLED) self.pm_group_metrics[pm_omci_cc_stats.group_name] = pm_omci_cc_stats pm_omci_optical_stats = PmGroupConfig( group_name=OnuOmciPmMetrics.OPTICAL_GROUP_NAME, group_freq=OnuOmciPmMetrics.DEFAULT_OPTICAL_FREQUENCY, enabled=OnuOmciPmMetrics.DEFAULT_OPTICAL_ENABLED) self.pm_group_metrics[ pm_omci_optical_stats.group_name] = pm_omci_optical_stats pm_omci_uni_stats = PmGroupConfig( group_name=OnuOmciPmMetrics.UNI_STATUS_GROUP_NAME, group_freq=OnuOmciPmMetrics.DEFAULT_UNI_STATUS_FREQUENCY, enabled=OnuOmciPmMetrics.DEFAULT_UNI_STATUS_ENABLED) self.pm_group_metrics[pm_omci_uni_stats.group_name] = pm_omci_uni_stats stats_and_config = [(pm_omci_cc_stats, self.omci_cc_metrics_config), (pm_omci_optical_stats, self.omci_optical_metrics_config), (pm_omci_uni_stats, self.omci_cc_metrics_config)] for stats, config in stats_and_config: for m in sorted(config): pm = config[m] stats.metrics.extend( [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_config.groups.extend([stats]) # Also create OMCI Interval PM configs return self.openomci_interval_pm.make_proto(pm_config)
def __init__(self, event_mgr, core_proxy, device_id, logical_device_id, serial_number, grouped=False, freq_override=False, support_onu_statistics=False, support_gem_port_statistic=False, **kwargs): """ Initializer for shared ONU Device Adapter PM metrics :param core_proxy: (CoreProxy) Gateway between CORE and an adapter :param device_id: (str) Device ID :param logical_device_id: (str) VOLTHA Logical Device ID :param grouped: (bool) Flag indicating if statistics are managed as a group :param freq_override: (bool) Flag indicating if frequency collection can be specified on a per group basis :param kwargs: (dict) Device Adapter specific values. For an ONU Device adapter, the expected key-value pairs are listed below. If not provided, the associated PM statistics are not gathered: 'nni-ports': List of objects that provide NNI (northbound) port statistics 'pon-ports': List of objects that provide PON port statistics """ super().__init__(event_mgr, core_proxy, device_id, logical_device_id, serial_number, grouped=grouped, freq_override=freq_override, **kwargs) self.support_onu_stats = support_onu_statistics self.support_gem_stats = support_onu_statistics and support_gem_port_statistic # PM Config Types are COUNTER, GAUGE, and STATE self.nni_pm_names = { ('oltid', PmConfig.CONTEXT), # Physical device interface ID/Port number ('devicetype', PmConfig.CONTEXT), ('portlabel', PmConfig.CONTEXT), ('portno', PmConfig.CONTEXT), # ('admin_state', PmConfig.STATE), # ('oper_status', PmConfig.STATE), ('rx_bytes', PmConfig.COUNTER), ('rx_packets', PmConfig.COUNTER), ('rx_ucast_packets', PmConfig.COUNTER), ('rx_mcast_packets', PmConfig.COUNTER), ('rx_bcast_packets', PmConfig.COUNTER), ('rx_error_packets', PmConfig.COUNTER), ('tx_bytes', PmConfig.COUNTER), ('tx_packets', PmConfig.COUNTER), ('tx_ucast_packets', PmConfig.COUNTER), ('tx_mcast_packets', PmConfig.COUNTER), ('tx_bcast_packets', PmConfig.COUNTER), ('rx_runt_packets', PmConfig.COUNTER), ('rx_huge_packets', PmConfig.COUNTER), ('rx_crc_errors', PmConfig.COUNTER), ('rx_overflow_errors', PmConfig.COUNTER), ('rx_linecode_errors', PmConfig.COUNTER), ('tx_error_packets', PmConfig.COUNTER), ('bip_errors', PmConfig.COUNTER), # Frame buckets ('rx_packets_64', PmConfig.COUNTER), ('rx_packets_65_127', PmConfig.COUNTER), ('rx_packets_128_255', PmConfig.COUNTER), ('rx_packets_256_511', PmConfig.COUNTER), ('rx_packets_512_1023', PmConfig.COUNTER), ('rx_packets_1024_1518', PmConfig.COUNTER), ('rx_packets_1519_plus', PmConfig.COUNTER), ('tx_packets_64', PmConfig.COUNTER), ('tx_packets_65_127', PmConfig.COUNTER), ('tx_packets_128_255', PmConfig.COUNTER), ('tx_packets_256_511', PmConfig.COUNTER), ('tx_packets_512_1023', PmConfig.COUNTER), ('tx_packets_1024_1518', PmConfig.COUNTER), ('tx_packets_1519_plus', PmConfig.COUNTER), } self.pon_pm_names = { ('oltid', PmConfig.CONTEXT), # Physical device interface ID/Port number ('devicetype', PmConfig.CONTEXT), ('portlabel', PmConfig.CONTEXT), ('portno', PmConfig.CONTEXT), # ('admin_state', PmConfig.STATE), # ('oper_status', PmConfig.STATE), ('rx_packets', PmConfig.COUNTER), ('rx_bytes', PmConfig.COUNTER), ('rx_ucast_bytes', PmConfig.COUNTER), ('rx_bcast_mcast_bytes', PmConfig.COUNTER), ('rx_runt_packets', PmConfig.COUNTER), ('rx_huge_packets', PmConfig.COUNTER), ('rx_crc_errors', PmConfig.COUNTER), ('rx_overflow_errors', PmConfig.COUNTER), ('tx_packets', PmConfig.COUNTER), ('tx_bytes', PmConfig.COUNTER), ('tx_ucast_bytes', PmConfig.COUNTER), ('tx_bcast_mcast_bytes', PmConfig.COUNTER), ('tx_bip_errors', PmConfig.COUNTER), ('in_service_onus', PmConfig.GAUGE), ('closest_onu_distance', PmConfig.GAUGE), # Frame buckets ('rx_packets_64', PmConfig.COUNTER), ('rx_packets_65_127', PmConfig.COUNTER), ('rx_packets_128_255', PmConfig.COUNTER), ('rx_packets_256_511', PmConfig.COUNTER), ('rx_packets_512_1023', PmConfig.COUNTER), ('rx_packets_1024_1518', PmConfig.COUNTER), ('rx_packets_1519_plus', PmConfig.COUNTER), ('tx_packets_64', PmConfig.COUNTER), ('tx_packets_65_127', PmConfig.COUNTER), ('tx_packets_128_255', PmConfig.COUNTER), ('tx_packets_256_511', PmConfig.COUNTER), ('tx_packets_512_1023', PmConfig.COUNTER), ('tx_packets_1024_1518', PmConfig.COUNTER), ('tx_packets_1519_plus', PmConfig.COUNTER), } self.onu_pm_names = { # ('intf_id', PmConfig.CONTEXT), # Physical device port number (PON) # ('pon_id', PmConfig.CONTEXT), # ('onu_id', PmConfig.CONTEXT), ('fiber_length', PmConfig.GAUGE), ('equalization_delay', PmConfig.GAUGE), ('rssi', PmConfig.GAUGE), } self.gem_pm_names = { # ('intf_id', PmConfig.CONTEXT), # Physical device port number (PON) # ('pon_id', PmConfig.CONTEXT), # ('onu_id', PmConfig.CONTEXT), # ('gem_id', PmConfig.CONTEXT), ('alloc_id', PmConfig.GAUGE), ('rx_packets', PmConfig.COUNTER), ('rx_bytes', PmConfig.COUNTER), ('tx_packets', PmConfig.COUNTER), ('tx_bytes', PmConfig.COUNTER), } self.nni_metrics_config = { m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.nni_pm_names } self.pon_metrics_config = { m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.pon_pm_names } if self.support_onu_stats: self.onu_metrics_config = { m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.onu_pm_names } else: self.onu_metrics_config = dict() if self.support_gem_stats: self.gem_metrics_config = { m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.gem_pm_names } else: self.gem_metrics_config = dict() self._nni_ports = kwargs.pop('nni-ports', None) self._pon_ports = kwargs.pop('pon-ports', None)
def make_proto(self, pm_config=None): # pylint: disable=too-many-branches if pm_config is None: pm_config = PmConfigs(id=self.device_id, default_freq=self.default_freq, grouped=self.grouped, freq_override=self.freq_override, max_skew=self.max_skew) metrics = set() have_nni = self._nni_ports is not None and len(self._nni_ports) > 0 have_pon = self._pon_ports is not None and len(self._pon_ports) > 0 if self.grouped: if have_nni: pm_ether_stats = PmGroupConfig(group_name='ETHERNET_NNI', group_freq=self.default_freq, enabled=True) self.pm_group_metrics[ pm_ether_stats.group_name] = pm_ether_stats else: pm_ether_stats = None if have_pon: pm_pon_stats = PmGroupConfig(group_name='PON_OLT', group_freq=self.default_freq, enabled=True) self.pm_group_metrics[pm_pon_stats.group_name] = pm_pon_stats if self.support_onu_stats: pm_onu_stats = PmGroupConfig(group_name='ONU', group_freq=self.default_freq, enabled=True) self.pm_group_metrics[ pm_onu_stats.group_name] = pm_onu_stats else: pm_onu_stats = None if self.support_gem_stats: # pm_gem_stats = PmGroupConfig(group_name='GEM', # group_freq=self.default_freq, # enabled=True) pm_gem_stats = PmGroupConfig(group_name='GEM', group_freq=self.default_freq, enabled=False) self.pm_group_metrics[ pm_gem_stats.group_name] = pm_gem_stats else: pm_gem_stats = None else: pm_pon_stats = None pm_onu_stats = None pm_gem_stats = None else: pm_ether_stats = pm_config if have_nni else None pm_pon_stats = pm_config if have_pon else None pm_onu_stats = pm_config if have_pon and self.support_onu_stats else None pm_gem_stats = pm_config if have_pon and self.support_gem_stats else None if have_nni: for metric in sorted(self.nni_metrics_config): pmetric = self.nni_metrics_config[metric] if not self.grouped: if pmetric.name in metrics: continue metrics.add(pmetric.name) pm_ether_stats.metrics.extend([ PmConfig(name=pmetric.name, type=pmetric.type, enabled=pmetric.enabled) ]) if have_pon: for metric in sorted(self.pon_metrics_config): pmetric = self.pon_metrics_config[metric] if not self.grouped: if pmetric.name in metrics: continue metrics.add(pmetric.name) pm_pon_stats.metrics.extend([ PmConfig(name=pmetric.name, type=pmetric.type, enabled=pmetric.enabled) ]) if self.support_onu_stats: for metric in sorted(self.onu_metrics_config): pmetric = self.onu_metrics_config[metric] if not self.grouped: if pmetric.name in metrics: continue metrics.add(pmetric.name) pm_onu_stats.metrics.extend([ PmConfig(name=pmetric.name, type=pmetric.type, enabled=pmetric.enabled) ]) if self.support_gem_stats: for metric in sorted(self.gem_metrics_config): pmetric = self.gem_metrics_config[metric] if not self.grouped: if pmetric.name in metrics: continue metrics.add(pmetric.name) pm_gem_stats.metrics.extend([ PmConfig(name=pmetric.name, type=pmetric.type, enabled=pmetric.enabled) ]) if self.grouped: pm_config.groups.extend(self.pm_group_metrics.values()) return pm_config
def make_proto(self, pm_config=None): if pm_config is None: pm_config = PmConfigs(id=self.device_id, default_freq=self.default_freq, grouped=self.grouped, freq_override=self.freq_override) metrics = set() have_nni = self._nni_ports is not None and len(self._nni_ports) > 0 have_pon = self._pon_ports is not None and len(self._pon_ports) > 0 if self.grouped: if have_nni: pm_ether_stats = PmGroupConfig(group_name='Ethernet', group_freq=self.default_freq, enabled=True) self.pm_group_metrics[ pm_ether_stats.group_name] = pm_ether_stats else: pm_ether_stats = None if have_pon: pm_pon_stats = PmGroupConfig(group_name='PON', group_freq=self.default_freq, enabled=True) pm_onu_stats = PmGroupConfig(group_name='ONU', group_freq=self.default_freq, enabled=True) pm_gem_stats = PmGroupConfig(group_name='GEM', group_freq=self.default_freq, enabled=True) self.pm_group_metrics[pm_pon_stats.group_name] = pm_pon_stats self.pm_group_metrics[pm_onu_stats.group_name] = pm_onu_stats self.pm_group_metrics[pm_gem_stats.group_name] = pm_gem_stats else: pm_pon_stats = None pm_onu_stats = None pm_gem_stats = None else: pm_ether_stats = pm_config if have_nni else None pm_pon_stats = pm_config if have_pon else None pm_onu_stats = pm_config if have_pon else None pm_gem_stats = pm_config if have_pon else None if have_nni: for m in sorted(self.nni_metrics_config): pm = self.nni_metrics_config[m] if not self.grouped: if pm.name in metrics: continue metrics.add(pm.name) pm_ether_stats.metrics.extend( [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) if have_pon: for m in sorted(self.pon_metrics_config): pm = self.pon_metrics_config[m] if not self.grouped: if pm.name in metrics: continue metrics.add(pm.name) pm_pon_stats.metrics.extend( [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) for m in sorted(self.onu_metrics_config): pm = self.onu_metrics_config[m] if not self.grouped: if pm.name in metrics: continue metrics.add(pm.name) pm_onu_stats.metrics.extend( [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) for m in sorted(self.gem_metrics_config): pm = self.gem_metrics_config[m] if not self.grouped: if pm.name in metrics: continue metrics.add(pm.name) pm_gem_stats.metrics.extend( [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) if self.grouped: pm_config.groups.extend( [stats for stats in six.itervalues(self.pm_group_metrics)]) return pm_config
def __init__(self, event_mgr, core_proxy, device_id, logical_device_id, serial_number, **kwargs): super(OnuPmIntervalMetrics, self).__init__(event_mgr, core_proxy, device_id, logical_device_id, serial_number, grouped=True, freq_override=False, **kwargs) ethernet_bridge_history = { ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ('parent_class_id', PmConfig.CONTEXT), ('parent_entity_id', PmConfig.CONTEXT), ('upstream', PmConfig.CONTEXT), ("drop_events", PmConfig.COUNTER), ("octets", PmConfig.COUNTER), ("packets", PmConfig.COUNTER), ("broadcast_packets", PmConfig.COUNTER), ("multicast_packets", PmConfig.COUNTER), ("crc_errored_packets", PmConfig.COUNTER), ("undersize_packets", PmConfig.COUNTER), ("oversize_packets", PmConfig.COUNTER), ("64_octets", PmConfig.COUNTER), ("65_to_127_octets", PmConfig.COUNTER), ("128_to_255_octets", PmConfig.COUNTER), ("256_to_511_octets", PmConfig.COUNTER), ("512_to_1023_octets", PmConfig.COUNTER), ("1024_to_1518_octets", PmConfig.COUNTER) } self._ethernet_bridge_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in ethernet_bridge_history} ethernet_uni_history = { # Ethernet History Data (Class ID 24) ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ("fcs_errors", PmConfig.COUNTER), ("excessive_collision_counter", PmConfig.COUNTER), ("late_collision_counter", PmConfig.COUNTER), ("frames_too_long", PmConfig.COUNTER), ("buffer_overflows_on_rx", PmConfig.COUNTER), ("buffer_overflows_on_tx", PmConfig.COUNTER), ("single_collision_frame_counter", PmConfig.COUNTER), ("multiple_collisions_frame_counter", PmConfig.COUNTER), ("sqe_counter", PmConfig.COUNTER), ("deferred_tx_counter", PmConfig.COUNTER), ("internal_mac_tx_error_counter", PmConfig.COUNTER), ("carrier_sense_error_counter", PmConfig.COUNTER), ("alignment_error_counter", PmConfig.COUNTER), ("internal_mac_rx_error_counter", PmConfig.COUNTER), } self._ethernet_uni_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in ethernet_uni_history} fec_history = { # FEC History Data (Class ID 312) ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ("corrected_bytes", PmConfig.COUNTER), ("corrected_code_words", PmConfig.COUNTER), ("uncorrectable_code_words", PmConfig.COUNTER), ("total_code_words", PmConfig.COUNTER), ("fec_seconds", PmConfig.COUNTER), } self._fec_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in fec_history} gem_port_history = { # GEM Port Network CTP History Data (Class ID 341) ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ("transmitted_gem_frames", PmConfig.COUNTER), ("received_gem_frames", PmConfig.COUNTER), ("received_payload_bytes", PmConfig.COUNTER), ("transmitted_payload_bytes", PmConfig.COUNTER), ("encryption_key_errors", PmConfig.COUNTER), } self._gem_port_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in gem_port_history} xgpon_tc_history = { # XgPon TC History Data (Class ID 344) ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ("psbd_hec_error_count", PmConfig.COUNTER), ("xgtc_hec_error_count", PmConfig.COUNTER), ("unknown_profile_count", PmConfig.COUNTER), ("transmitted_xgem_frames", PmConfig.COUNTER), ("fragment_xgem_frames", PmConfig.COUNTER), ("xgem_hec_lost_words_count", PmConfig.COUNTER), ("xgem_key_errors", PmConfig.COUNTER), ("xgem_hec_error_count", PmConfig.COUNTER), } self._xgpon_tc_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in xgpon_tc_history} xgpon_downstream_history = { # XgPon Downstream History Data (Class ID 345) ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ("ploam_mic_error_count", PmConfig.COUNTER), ("downstream_ploam_messages_count", PmConfig.COUNTER), ("profile_messages_received", PmConfig.COUNTER), ("ranging_time_messages_received", PmConfig.COUNTER), ("deactivate_onu_id_messages_received", PmConfig.COUNTER), ("disable_serial_number_messages_received", PmConfig.COUNTER), ("request_registration_messages_received", PmConfig.COUNTER), ("assign_alloc_id_messages_received", PmConfig.COUNTER), ("key_control_messages_received", PmConfig.COUNTER), ("sleep_allow_messages_received", PmConfig.COUNTER), ("baseline_omci_messages_received_count", PmConfig.COUNTER), ("extended_omci_messages_received_count", PmConfig.COUNTER), ("assign_onu_id_messages_received", PmConfig.COUNTER), ("omci_mic_error_count", PmConfig.COUNTER), } self._xgpon_downstream_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in xgpon_downstream_history} xgpon_upstream_history = { # XgPon Upstream History Data (Class ID 346) ('class_id', PmConfig.CONTEXT), ('entity_id', PmConfig.CONTEXT), ("interval_end_time", PmConfig.CONTEXT), ("upstream_ploam_message_count", PmConfig.COUNTER), ("serial_number_onu_message_count", PmConfig.COUNTER), ("registration_message_count", PmConfig.COUNTER), ("key_report_message_count", PmConfig.COUNTER), ("acknowledge_message_count", PmConfig.COUNTER), ("sleep_request_message_count", PmConfig.COUNTER), } self._xgpon_upstream_history_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in xgpon_upstream_history} self._configs = { EthernetFrameUpstreamPerformanceMonitoringHistoryData.class_id: self._ethernet_bridge_history_config, EthernetFrameDownstreamPerformanceMonitoringHistoryData.class_id: self._ethernet_bridge_history_config, EthernetFrameExtendedPerformanceMonitoring.class_id: self._ethernet_bridge_history_config, EthernetFrameExtendedPerformanceMonitoring64Bit.class_id: self._ethernet_bridge_history_config, EthernetPMMonitoringHistoryData.class_id: self._ethernet_uni_history_config, FecPerformanceMonitoringHistoryData.class_id: self._fec_history_config, GemPortNetworkCtpMonitoringHistoryData.class_id: self._gem_port_history_config, XgPonTcPerformanceMonitoringHistoryData.class_id: self._xgpon_tc_history_config, XgPonDownstreamPerformanceMonitoringHistoryData.class_id: self._xgpon_downstream_history_config, XgPonUpstreamPerformanceMonitoringHistoryData.class_id: self._xgpon_upstream_history_config }
def make_proto(self, pm_config=None): """ From the PM Configurations defined in this class's initializer, create the PMConfigs protobuf message that defines our PM configuration and data. All ONU PM Interval metrics are grouped metrics that are generated autonmouslly from the OpenOMCI Performance Intervals state machine. :param pm_config (PMConfigs) PM Configuration message to add OpenOMCI config items too :return: (PmConfigs) PM Configuration Protobuf message """ assert pm_config is not None pm_ethernet_bridge_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[EthernetFrameUpstreamPerformanceMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.ETHERNET_BRIDGE_HISTORY_ENABLED) self.pm_group_metrics[pm_ethernet_bridge_history.group_name] = pm_ethernet_bridge_history for m in sorted(self._ethernet_bridge_history_config): pm = self._ethernet_bridge_history_config[m] pm_ethernet_bridge_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_ethernet_uni_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[EthernetPMMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.ETHERNET_UNI_HISTORY_ENABLED) self.pm_group_metrics[pm_ethernet_uni_history.group_name] = pm_ethernet_uni_history for m in sorted(self._ethernet_uni_history_config): pm = self._ethernet_uni_history_config[m] pm_ethernet_uni_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_fec_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[FecPerformanceMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.FEC_HISTORY_ENABLED) self.pm_group_metrics[pm_fec_history.group_name] = pm_fec_history for m in sorted(self._fec_history_config): pm = self._fec_history_config[m] pm_fec_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_gem_port_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[GemPortNetworkCtpMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.GEM_PORT_HISTORY_ENABLED) self.pm_group_metrics[pm_gem_port_history.group_name] = pm_gem_port_history for m in sorted(self._gem_port_history_config): pm = self._gem_port_history_config[m] pm_gem_port_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_xgpon_tc_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[XgPonTcPerformanceMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.TRANS_CONV_HISTORY_ENABLED) self.pm_group_metrics[pm_xgpon_tc_history.group_name] = pm_xgpon_tc_history for m in sorted(self._xgpon_tc_history_config): pm = self._xgpon_tc_history_config[m] pm_xgpon_tc_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_xgpon_downstream_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[XgPonDownstreamPerformanceMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.XGPON_DOWNSTREAM_HISTORY) self.pm_group_metrics[pm_xgpon_downstream_history.group_name] = pm_xgpon_downstream_history for m in sorted(self._xgpon_downstream_history_config): pm = self._xgpon_downstream_history_config[m] pm_xgpon_downstream_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_xgpon_upstream_history = PmGroupConfig(group_name=OnuPmIntervalMetrics.ME_ID_INFO[XgPonUpstreamPerformanceMonitoringHistoryData.class_id], group_freq=0, enabled=OnuPmIntervalMetrics.XGPON_UPSTREAM_HISTORY) self.pm_group_metrics[pm_xgpon_upstream_history.group_name] = pm_xgpon_upstream_history for m in sorted(self._xgpon_upstream_history_config): pm = self._xgpon_upstream_history_config[m] pm_xgpon_upstream_history.metrics.extend([PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)]) pm_config.groups.extend([stats for stats in six.itervalues(self.pm_group_metrics)]) return pm_config
def __init__(self, event_mgr, core_proxy, device_id, logical_device_id, serial_number, grouped=False, freq_override=False, **kwargs): """ Initializer for shared ONU Device Adapter OMCI CC PM metrics :param core_proxy: (CoreProxy) Core proxy for the device :param device_id: (str) Device ID :param logical_device_id: (str) VOLTHA Logical Device ID :param grouped: (bool) Flag indicating if statistics are managed as a group :param freq_override: (bool) Flag indicating if frequency collection can be specified on a per group basis :param kwargs: (dict) Device Adapter specific values. For an ONU Device adapter, the expected key-value pairs are listed below. If not provided, the associated PM statistics are not gathered: 'omci-onu-dev': Reference to the OMCI OnuDeviceEtnry object for retrieval of OpenOMCI Communications channel statistics and retrieval of polled statistics. """ super(OnuOmciPmMetrics, self).__init__(event_mgr, core_proxy, device_id, logical_device_id, serial_number, grouped=grouped, freq_override=freq_override, **kwargs) self._omci_onu_device = kwargs.pop(OnuOmciPmMetrics.OMCI_DEV_KEY, None) self._omci_cc = self._omci_onu_device.omci_cc if self._omci_onu_device is not None else None self.omci_cc_pm_names = { ('tx_frames', PmConfig.COUNTER), ('tx_errors', PmConfig.COUNTER), ('rx_frames', PmConfig.COUNTER), ('rx_unknown_tid', PmConfig.COUNTER), ('rx_onu_frames', PmConfig.COUNTER), # Rx ONU autonomous messages ('rx_unknown_me', PmConfig.COUNTER), # Managed Entities without a decode definition ('rx_timeouts', PmConfig.COUNTER), ('rx_late', PmConfig.COUNTER), ('consecutive_errors', PmConfig.COUNTER), ('reply_min', PmConfig.GAUGE), # Milliseconds ('reply_max', PmConfig.GAUGE), # Milliseconds ('reply_average', PmConfig.GAUGE), # Milliseconds ('hp_tx_queue_len', PmConfig.GAUGE), ('lp_tx_queue_len', PmConfig.GAUGE), ('max_hp_tx_queue', PmConfig.GAUGE), ('max_lp_tx_queue', PmConfig.GAUGE), } self.omci_cc_metrics_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.omci_cc_pm_names} self.omci_optical_pm_names = { ('intf_id', PmConfig.CONTEXT), ('transmit_power', PmConfig.GAUGE), ('receive_power', PmConfig.GAUGE), } self.omci_optical_metrics_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.omci_optical_pm_names} self.omci_uni_pm_names = { ('intf_id', PmConfig.CONTEXT), ('ethernet_type', PmConfig.GAUGE), # PPTP Ethernet ME ('oper_status', PmConfig.GAUGE), # PPTP Ethernet ME ('pptp_admin_state', PmConfig.GAUGE), # PPTP Ethernet ME ('uni_admin_state', PmConfig.GAUGE), # UNI-G ME } self.omci_uni_metrics_config = {m: PmConfig(name=m, type=t, enabled=True) for (m, t) in self.omci_uni_pm_names} self.openomci_interval_pm = OnuPmIntervalMetrics(event_mgr, core_proxy, device_id, logical_device_id, serial_number) self.last_collect_optical_metrics = None