Exemplo n.º 1
0
    def make_proto(self, pm_config=None):
        assert pm_config is not None

        if self._omci_cc is not None:
            if self.grouped:
                pm_omci_stats = PmGroupConfig(group_name='OMCI',
                                              group_freq=self.default_freq,
                                              enabled=True)
            else:
                pm_omci_stats = pm_config

            metrics = set()
            for m in sorted(self.omci_metrics_config):
                pm = self.omci_metrics_config[m]
                if not self.grouped:
                    if pm.name in metrics:
                        continue
                    metrics.add(pm.name)

                pm_omci_stats.metrics.extend(
                    [PmConfig(name=pm.name, type=pm.type, enabled=pm.enabled)])
            if self.grouped:
                pm_config.groups.extend([pm_omci_stats])

        return self.openomci_interval_pm.make_proto(pm_config)
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    def make_proto(self, pm_config=None):
        assert pm_config is not None

        if self._omci_cc is not None:
            if self.grouped:
                pm_omci_stats = PmGroupConfig(group_name='OMCI-CC',
                                              group_freq=OnuOmciPmMetrics.DEFAULT_OMCI_CC_FREQUENCY,
                                              enabled=OnuOmciPmMetrics.DEFAULT_OMCI_CC_ENABLED)
                self.pm_group_metrics[pm_omci_stats.group_name] = pm_omci_stats
            else:
                pm_omci_stats = pm_config

            metrics = set()
            for m in sorted(self.omci_metrics_config):
                pm = self.omci_metrics_config[m]
                if not self.grouped:
                    if pm.name in metrics:
                        continue
                    metrics.add(pm.name)

                pm_omci_stats.metrics.extend([PmConfig(name=pm.name,
                                                       type=pm.type,
                                                       enabled=pm.enabled)])
            if self.grouped:
                pm_config.groups.extend([pm_omci_stats])

        return self.openomci_interval_pm.make_proto(pm_config)
Exemplo n.º 4
0
    def make_proto(self):
        pm_config = PmConfigs(id=self.id, default_freq=self.default_freq,
                              grouped=self.grouped,
                              freq_override=self.freq_override)
        metrics = set()

        if self.grouped:
            pm_omci_stats = PmGroupConfig(group_name='OMCI',
                                          group_freq=self.default_freq,
                                          enabled=True)

            pm_health_stats = PmGroupConfig(group_name='Heartbeat',
                                            group_freq=self.default_freq,
                                            enabled=True)
            # TODO Add PON Port PM
            # TODO Add UNI Port PM
        else:
            pm_omci_stats = pm_config
            pm_health_stats = pm_config
            # TODO Add PON Port PM
            # TODO Add UNI Port PM

        for m in sorted(self.omci_metrics_config):
            pm = self.omci_metrics_config[m]
            if not self.grouped:
                if pm.name in metrics:
                    continue
                metrics.add(pm.name)

            pm_omci_stats.metrics.extend([PmConfig(name=pm.name,
                                                   type=pm.type,
                                                   enabled=pm.enabled)])

        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)])

        return pm_config
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
 def __init__(self, device):
     self.pm_names = {
         'tx_64', 'tx_65_127', 'tx_128_255', 'tx_256_511', 'tx_512_1023',
         'tx_1024_1518', 'tx_1519_9k', 'rx_64', 'rx_65_127', 'rx_128_255',
         'rx_256_511', 'rx_512_1023', 'rx_1024_1518', 'rx_1519_9k',
         'tx_pkts', 'rx_pkts', 'tx_bytes', 'rx_bytes'
     }
     self.pm_group_names = {'nni'}
     self.device = device
     self.id = device.id
     self.default_freq = 150
     self.pon_metrics = dict()
     self.nni_metrics = dict()
     for m in self.pm_names:
         self.pon_metrics[m] = \
                 self.Metrics(config = PmConfig(name=m,
                                                type=PmConfig.COUNTER,
                                                enabled=True), value = 0)
         self.nni_metrics[m] = \
                 self.Metrics(config = PmConfig(name=m,
                                                type=PmConfig.COUNTER,
                                                enabled=True), value = 0)
     self.pm_group_metrics = dict()
     for m in self.pm_group_names:
         self.pm_group_metrics[m] = \
                 self.Metrics(config = PmGroupConfig(group_name=m,
                                                     group_freq=self.default_freq,
                                                     enabled=True),
                                                     is_group = True)
     for m in sorted(self.nni_metrics):
         pm = self.nni_metrics[m]
         self.pm_group_metrics['nni'].config.metrics.extend([
             PmConfig(name=pm.config.name,
                      type=pm.config.type,
                      enabled=pm.config.enabled)
         ])
Exemplo n.º 7
0
    def make_proto(self):
        pm_config = PmConfigs(id=self.id, default_freq=self.default_freq,
                              grouped=self.grouped,
                              freq_override=self.freq_override)
        metrics = set()

        if self.grouped:
            pm_ether_stats = PmGroupConfig(group_name='Ethernet',
                                           group_freq=self.default_freq,
                                           enabled=True)

            pm_pon_stats = PmGroupConfig(group_name='PON',
                                         group_freq=self.default_freq,
                                         enabled=True)

            pm_ont_stats = PmGroupConfig(group_name='ONT',
                                         group_freq=self.default_freq,
                                         enabled=True)

            pm_gem_stats = PmGroupConfig(group_name='GEM',
                                         group_freq=self.default_freq,
                                         enabled=True)
        else:
            pm_ether_stats = pm_config
            pm_pon_stats = pm_config
            pm_ont_stats = pm_config
            pm_gem_stats = pm_config

        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)])

        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_ont_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([pm_ether_stats,
                                     pm_pon_stats,
                                     pm_ont_stats,
                                     pm_gem_stats])
        return pm_config
Exemplo n.º 8
0
    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 self.pm_group_metrics.itervalues()])

        return pm_config
Exemplo n.º 9
0
    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)
            else:
                pm_ether_stats = None

            if have_pon:
                pm_pon_stats = PmGroupConfig(group_name='PON',
                                             group_freq=self.default_freq,
                                             enabled=True)

                pm_ont_stats = PmGroupConfig(group_name='ONT',
                                             group_freq=self.default_freq,
                                             enabled=True)

                pm_gem_stats = PmGroupConfig(group_name='GEM',
                                             group_freq=self.default_freq,
                                             enabled=True)
            else:
                pm_pon_stats = None
                pm_ont_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_ont_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_ont_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_groups = [
                stats for stats in (pm_ether_stats, pm_pon_stats, pm_ont_stats,
                                    pm_gem_stats) if stats is not None
            ]
            pm_config.groups.extend(pm_groups)

        return pm_config
Exemplo n.º 10
0
    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 configuation and
        data.

        All ONU PM Interval metrics are grouped metrics that are generated autonmouslly
        from the OpenOMCI Performace 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='Ethernet Bridge Port History',
                                                   group_freq=0,
                                                   enabled=True)

        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='Ethernet UNI History',
                                                group_freq=0,
                                                enabled=True)

        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='Upstream Ethernet History',
                                       group_freq=0,
                                       enabled=True)

        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='GEM Port History',
                                            group_freq=0,
                                            enabled=True)

        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='xgPON TC History',
                                            group_freq=0,
                                            enabled=True)

        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='xgPON Downstream History',
                                                    group_freq=0,
                                                    enabled=True)

        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='xgPON Upstream History',
                                                  group_freq=0,
                                                  enabled=True)

        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([pm_ethernet_bridge_history,
                                 pm_ethernet_uni_history,
                                 pm_fec_history,
                                 pm_gem_port_history,
                                 pm_xgpon_tc_history,
                                 pm_xgpon_downstream_history,
                                 pm_xgpon_upstream_history
                                 ])
        return pm_config