Commit 1d230e86 authored by Andrea Sgambelluri's avatar Andrea Sgambelluri
Browse files

base for optical automation

parent 05162809
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -177,6 +177,8 @@ cython_debug/
# Sqlite
*.db

#temp files to test telemetry
src/telemetry/backend/tempFiles/
# TeraFlowSDN-generated files
tfs_runtime_env_vars.sh
tfs_runtime_env_vars*.sh
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ metadata:
    app: telemetryservice
spec:
  type: LoadBalancer
  loadBalancerIP: 192.168.5.250
  loadBalancerIP: _LOAD_BALANCER_IP_
  externalTrafficPolicy: Local
  selector:
    app: telemetryservice
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ enum KpiSampleType {

    KPISAMPLETYPE_OPTICAL_SECURITY_STATUS       = 501;  //. can be used by both optical and L3 without any issue
    KPISAMPLETYPE_OPTICAL_POWER_TOTAL_INPUT     = 502;
    KPISAMPLETYPE_OPTICAL_TOTAL_INPUT_POWER     = 503;

    KPISAMPLETYPE_L3_UNIQUE_ATTACK_CONNS        = 601;
    KPISAMPLETYPE_L3_TOTAL_DROPPED_PACKTS       = 602;
+4 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class GNMIOpenConfigCollector(_Collector):
    =========================
    Lightweight wrapper around *pygnmi* with subscribe / get / unsubscribe helpers.
    """
    def __init__(self, address: str = '', port: int = -1, **setting) -> None:
    def __init__(self, address: str = "", port: int = -1, **setting) -> None:
        
        super().__init__('gNMI_openconfig_collector', address, port, **setting)
        self._subscriptions : Dict[str, Subscription] = {}
@@ -51,13 +51,15 @@ class GNMIOpenConfigCollector(_Collector):
        self._output_queue = queue.Queue()  # Queue for telemetry updates

        self.logger    = logging.getLogger(__name__)
        self.logger.debug("GNMICollector instantiated.")
        self.logger.info("GNMICollector instantiated.")


    def Connect(self) -> bool:
        """
        Connect to the gNMI target device.
        """
        self.logger.info("Connecting to gNMI target %s:%s with username '%s'",
                            self.address, self.port, self.username)
        if not self.connected:
            self.client = gNMIclient(
                target      = (self.address, self.port),
+3 −5
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ class Subscription:
                        LOGGER.debug("Sub %s stop requested, breaking stream loop", self.sub_id)
                        break
                    
                    LOGGER.debug("Sub %s received stream message: %s", self.sub_id, stream)
                    LOGGER.info("Sub %s received stream message: %s", self.sub_id, stream)
                    
                    # DEBUG: Check if update has actual update messages
                    if stream.HasField("update"):
@@ -269,12 +269,10 @@ class Subscription:
                    LOGGER.debug("Sub %s cancelled (channel closed) - graceful shutdown", self.sub_id)
                    break
                elif err.code() == grpc.StatusCode.INVALID_ARGUMENT:
                    LOGGER.warning("Path '%s' rejected (%s) -- trying next",
                                  path, err.details())
                    LOGGER.warning("Path '%s' rejected (%s) -- trying next", path, err.details())
                    continue
                else:
                    LOGGER.exception("Subscription %s hit gRPC error: %s",      # Change with TFS Exception
                                    self.sub_id, err)
                    LOGGER.exception("Subscription %s hit gRPC error: %s", self.sub_id, err)    # Change with TFS Exception
                    break

            except Exception as exc:  # pylint: disable=broad-except
Loading