From 3c5e5b1d3476ea4366bb2e22071353f571472959 Mon Sep 17 00:00:00 2001 From: drorlevy Date: Thu, 27 Apr 2023 23:26:17 +0300 Subject: [PATCH 1/6] added support for dynamic telemetry --- .../pdr_deterministic_plugin/build/Dockerfile | 5 +- .../build/config/init.sh | 2 +- .../ufm_sim_web_service/constants.py | 17 +++- .../ufm_sim_web_service/isolation_mgr.py | 97 ++++++++++++++----- .../ufm_communication_mgr.py | 61 ++++++++---- 5 files changed, 132 insertions(+), 50 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/build/Dockerfile b/plugins/pdr_deterministic_plugin/build/Dockerfile index 63f12f0ee..88b2226a3 100644 --- a/plugins/pdr_deterministic_plugin/build/Dockerfile +++ b/plugins/pdr_deterministic_plugin/build/Dockerfile @@ -21,7 +21,10 @@ COPY ufm_sim_web_service/ ${BASE_PATH}/ufm_sim_web_service/ COPY config/supervisord.conf /etc/supervisor/conf.d/ COPY config/init.sh config/deinit.sh / -COPY config/pdr_deterministic.conf config/pdr_deterministic_shared_volumes.conf ${CONF_PATH}/ +COPY config/pdr_deterministic.conf ${CONF_PATH}/ +COPY config/pdr_deterministic_shared_volumes.conf ${CONF_PATH}/ +COPY config/Field_BER_Thresholds.csv ${CONF_PATH}/ +COPY config/fec_mode_lookup.json ${CONF_PATH}/ COPY scripts/init_pdr_conf.sh ${SCRIPTS_PATH}/ COPY utils/ ${BASE_PATH}/utils/ diff --git a/plugins/pdr_deterministic_plugin/build/config/init.sh b/plugins/pdr_deterministic_plugin/build/config/init.sh index 94f0270fa..f17d435fc 100755 --- a/plugins/pdr_deterministic_plugin/build/config/init.sh +++ b/plugins/pdr_deterministic_plugin/build/config/init.sh @@ -15,6 +15,6 @@ set -eE # Updating /config folder -cp -f /opt/ufm/ufm_plugin_pdr_deterministic/conf/*.conf /config +cp -f /opt/ufm/ufm_plugin_pdr_deterministic/conf/* /config cp -f /opt/ufm/ufm_plugin_pdr_deterministic/scripts/* /scripts exit 0 diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py index dc1e0ec15..09ee94cad 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py @@ -44,21 +44,26 @@ class PDRConstants(object): GET_ACTIVE_PORTS_REST = "/resources/ports?active=true" API_HEALTHY_PORTS = "healthy_ports" API_ISOLATED_PORTS = "isolated_ports" + START_DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" + STOP_DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" + CONF_DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" + STATUS_DYNAMIC_SESSION_REST = "/app/telemetry/instances/status" POST_METHOD = "POST" PUT_METHOD = "PUT" GET_METHOD = "GET" + DELETE_METHOD = "DELETE" CONF_INTERNAL_PORT= "ufm_internal_port" UFM_HTTP_PORT = 8000 CONF_USERNAME = 'admin' CONF_PASSWORD = 'password' - TEMP_COUNTER = "cable_temperature" + TEMP_COUNTER = "CableInfo.Temperature" ERRORS_COUNTER = "errors" - RCV_PACKETS_COUNTER = "Infiniband_PckIn" - RCV_ERRORS_COUNTER = "Infiniband_RcvErrors" - RCV_REMOTE_PHY_ERROR_COUNTER = "Infiniband_RcvRemotePhysErrors" + RCV_PACKETS_COUNTER = "PortRcvPktsExtended" + RCV_ERRORS_COUNTER = "PortRcvErrorsExtended" + RCV_REMOTE_PHY_ERROR_COUNTER = "PortRcvRemotePhysicalErrorsExtended" PHY_RAW_ERROR_LANE0 = "phy_raw_errors_lane0" PHY_RAW_ERROR_LANE1 = "phy_raw_errors_lane1" @@ -94,4 +99,6 @@ class PDRConstants(object): CSV_SYMBOL_BER_ISOLATE = "Symbol BER Error" CSV_RAW_BER_DEISOLATE = "Pre-FEC BER Normal" CSV_EFF_BER_DEISOLATE = "Post-FEC BER Normal" - CSV_SYMBOL_BER_DEISOLATE = "Symbol BER Normal" \ No newline at end of file + CSV_SYMBOL_BER_DEISOLATE = "Symbol BER Normal" + + PDR_DYNAMIC_NAME = "pdr_dynamic" \ No newline at end of file diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 4d62d0259..6bdab5b2e 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -16,6 +16,7 @@ import configparser import pandas as pd import json +import http from constants import PDRConstants as Constants from ufm_communication_mgr import UFMCommunicator @@ -55,13 +56,20 @@ def __init__(self, port, cause): self.cause = cause self.port = port +def get_counter(counter_name, row, default=0): + try: + val = row.get(counter_name) if row.get(counter_name) else default + except Exception as e: + return default + return val + class IsolationMgr: def __init__(self, ufm_client: UFMCommunicator, logger): self.ufm_client = ufm_client # {port_name: PortState} self.ports_states = dict() - # {port_name: telemetry + speed} + # {port_name: telemetry_data} self.ports_data = dict() self.ufm_latest_isolation_state = [] @@ -95,6 +103,19 @@ def __init__(self, ufm_client: UFMCommunicator, logger): "HDR": 50, "NDR": 100, } + self.telemetry_counters = [ + Constants.PHY_RAW_ERROR_LANE0, + Constants.PHY_RAW_ERROR_LANE1, + Constants.PHY_RAW_ERROR_LANE2, + Constants.PHY_RAW_ERROR_LANE3, + Constants.PHY_EFF_ERROR, + Constants.PHY_SYMBOL_ERROR, + Constants.RCV_PACKETS_COUNTER, + Constants.RCV_ERRORS_COUNTER, + Constants.RCV_REMOTE_PHY_ERROR_COUNTER, + Constants.TEMP_COUNTER, + Constants.FEC_MODE + ] # DEBUG # self.iteration = 0 @@ -192,22 +213,22 @@ def get_rate_and_update(self, port_name, counter_name, new_val): self.ports_data.get(port_name)[counter_name] = new_val return counter_delta - def read_next_set_of_high_ber_or_pdr_ports(self): + def read_next_set_of_high_ber_or_pdr_ports(self, endpoint_port): issues = {} - ports_counters = self.ufm_client.get_telemetry() - if not ports_counters: + ports_counters = self.ufm_client.get_telemetry(endpoint_port, Constants.PDR_DYNAMIC_NAME) + if ports_counters is None: + # implement health check for the telemetry instance self.logger.error("Couldn't retrieve telemetry data") return issues - ports_counters = list(ports_counters.values())[0] - for port_name, statistics in ports_counters.get("Ports").items(): - # if not self.ports_states.get(port_name): - # self.ports_states[port_name] = PortState(port_name) - counters = statistics.get('statistics') - errors = counters.get(Constants.RCV_ERRORS_COUNTER, 0) + counters.get(Constants.RCV_REMOTE_PHY_ERROR_COUNTER, 0) - error_rate = self.get_rate_and_update(port_name, Constants.ERRORS_COUNTER, errors) - rcv_pkts = counters.get(Constants.RCV_PACKETS_COUNTER, 0) + for index, row in ports_counters.iterrows(): + port_name = f"{row.get('port_guid', '').split('x')[-1]}_{row.get('port_num', '')}" + rcv_error = get_counter(Constants.RCV_ERRORS_COUNTER, row) + rcv_remote_phy_error = get_counter(Constants.RCV_REMOTE_PHY_ERROR_COUNTER, row) + errors = rcv_error + rcv_remote_phy_error + error_rate = self.get_rate_and_update(port_name, Constants.ERRORS_COUNTER, row) + rcv_pkts = get_counter(Constants.RCV_PACKETS_COUNTER, row) rcv_pkt_rate = self.get_rate_and_update(port_name, Constants.RCV_PACKETS_COUNTER, rcv_pkts) - cable_temp = counters.get(Constants.TEMP_COUNTER) + cable_temp = get_counter(Constants.TEMP_COUNTER, row, default=None) # DEBUG # if port_name == "e41d2d0300062380_3": # self.iteration += 1 @@ -224,13 +245,13 @@ def read_next_set_of_high_ber_or_pdr_ports(self): issues[port_name] = Issue(port_name, Constants.ISSUE_OONOC) if self.configured_ber_check: symbol_ber_val = sum([ - counters.get(Constants.PHY_RAW_ERROR_LANE0, 0), - counters.get(Constants.PHY_RAW_ERROR_LANE1, 0), - counters.get(Constants.PHY_RAW_ERROR_LANE2, 0), - counters.get(Constants.PHY_RAW_ERROR_LANE3, 0), + get_counter(Constants.PHY_RAW_ERROR_LANE0, row), + get_counter(Constants.PHY_RAW_ERROR_LANE1, row), + get_counter(Constants.PHY_RAW_ERROR_LANE2, row), + get_counter(Constants.PHY_RAW_ERROR_LANE3, row), ]) - eff_ber_val = counters.get(Constants.PHY_EFF_ERROR) - raw_ber_val = counters.get(Constants.RAW_BER) + eff_ber_val = get_counter(Constants.PHY_EFF_ERROR, row, default=None) + raw_ber_val = get_counter(Constants.RAW_BER, row, default=None) if symbol_ber_val is not None or eff_ber_val is not None or raw_ber_val is not None: timestamp = time.time() ber_data = { @@ -239,11 +260,11 @@ def read_next_set_of_high_ber_or_pdr_ports(self): Constants.EFF_BER : eff_ber_val, Constants.SYMBOL_BER : symbol_ber_val } - self.ber_tele_data = self.ber_tele_data.concat(ber_data, ignore_index=True) + self.ber_tele_data.loc[len(self.ber_tele_data)] = ber_data self.ber_tele_data = self.ber_tele_data[self.ber_tele_data[Constants.TIMESTAMP] > self.start_time - self.ber_wait_time + self.t_isolate * 10] self.start_time = self.ber_tele_data[Constants.TIMESTAMP].min() port_data = self.ports_data.get(port_name) - fec_mode = counters.get(Constants.FEC_MODE) + fec_mode = get_counter(Constants.FEC_MODE, row, default=None) if fec_mode is None: continue port_speed = port_data.get(Constants.ACTIVE_SPEED) @@ -255,7 +276,11 @@ def read_next_set_of_high_ber_or_pdr_ports(self): port_data[Constants.ASIC] = port_asic port_data[Constants.WIDTH] = port_width if not port_asic: - logger.debug(f"Couldn't retrieve HW technology for port {port_name}, can't verify it's BER values") + self.logger.debug(f"Couldn't retrieve HW technology for port {port_name}, can't verify it's BER values") + continue + if not port_width: + self.logger.debug(f"port width for port {port_name} is None, can't verify it's BER values") + continue if timestamp - self.start_time < self.ber_wait_time: continue @@ -318,7 +343,8 @@ def get_ports_metadata(self): self.ports_data[port_name][Constants.ACTIVE_SPEED] = port.get(Constants.ACTIVE_SPEED) self.ports_data[port_name][Constants.ASIC] = port.get(Constants.HW_TECHNOLOGY) port_width = port.get(Constants.WIDTH) - port_width = int(port_width.strip('x')) + if port_width: + port_width = int(port_width.strip('x')) self.ports_data[port_name][Constants.WIDTH] = port_width def get_port_metadata(self, port_name): @@ -328,7 +354,8 @@ def get_port_metadata(self, port_name): port_speed = port_data.get(Constants.ACTIVE_SPEED) port_asic = port_data.get(Constants.HW_TECHNOLOGY) port_width = port_data.get(Constants.WIDTH) - port_width = int(port_width.strip('x')) + if port_width: + port_width = int(port_width.strip('x')) return port_speed, port_asic, port_width @@ -350,15 +377,33 @@ def get_isolation_state(self): port_state.update(Constants.STATE_ISOLATED, Constants.ISSUE_OONOC) self.ports_states[port] = port_state + def start_telemetry_session(self): + self.logger.info("Starting telemetry session") + response = self.ufm_client.start_dynamic_session(Constants.PDR_DYNAMIC_NAME, self.telemetry_counters, self.t_isolate) + if response and response.status_code == http.HTTPStatus.ACCEPTED: + port = str(response.content) + else: + self.logger.error(f"Failed to start dynamic session: {response}") + return False + return port + + def run_telemetry_get_port(self): + while not self.ufm_client.running_dynamic_session(Constants.PDR_DYNAMIC_NAME): + endpoint_port = self.start_telemetry_session() + time.sleep(20) + endpoint_port = self.ufm_client.dynamic_session_get_port(Constants.PDR_DYNAMIC_NAME) + return endpoint_port + def main_flow(self): # sync to the telemetry clock by blocking read self.logger.info("Isolation Manager initialized, starting isolation loop") - self.get_ports_metadata() + self.get_ports_metadata() + endpoint_port = self.run_telemetry_get_port() while(True): try: self.get_isolation_state() self.logger.info("Retrieving telemetry data to determine ports' states") - issues = self.read_next_set_of_high_ber_or_pdr_ports() + issues = self.read_next_set_of_high_ber_or_pdr_ports(endpoint_port) if len(issues) > self.max_num_isolate: # UFM send external event event_msg = "got too many ports detected as unhealthy: %d, skipping isolation" % len(issues) diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py index ddafa797e..83ba73fed 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py @@ -14,8 +14,8 @@ import requests import logging import copy - - +import http +import pandas as pd class UFMCommunicator: def __init__(self, host='127.0.0.1', ufm_port=8000): @@ -32,36 +32,39 @@ def get_request(self, uri, headers=None): headers = self.headers response = requests.get(request, verify=False, headers=headers) logging.info("UFM API Request Status: {}, URL: {}".format(response.status_code, request)) - if response.status_code == 200: + if response.status_code == http.client.OK: return response.json() else: return - def post_request(self, uri, data, post=True, headers=None): + def send_request(self, uri, data, method=Constants.POST_METHOD, headers=None): request = self.ufm_protocol + '://' + self._host + uri if not headers: headers = self.headers - if post: + if method == Constants.POST_METHOD: response = requests.post(url=request, json=data, verify=False, headers=headers) - else: + elif method == Constants.PUT_METHOD: response = requests.put(url=request, json=data, verify=False, headers=headers) + elif method == Constants.DELETE_METHOD: + response = requests.delete(url=request, verify=False, headers=headers) logging.info("UFM API Request Status: {}, URL: {}".format(response.status_code, request)) return response - def get_telemetry(self): - # returns dictionary port_name: telemetry data ({"counter_name": value}) - telemetry_data = self.get_request(Constants.GET_SESSION_DATA_REST) - if not telemetry_data: - return - else: - return telemetry_data + def get_telemetry(self, port, instance_name): + url = f"http://127.0.0.1:{port}/csv/xcset/{instance_name}" + try: + telemetry_data = pd.read_csv(url) + except Exception as e: + logging.error(e) + telemetry_data = None + return telemetry_data def send_event(self, message): data = {} data["event_id"] = 666 data["description"] = message data["object_name"] = "PDR Plugin Event" - ret = self.post_request(Constants.POST_EVENT_REST, data) + ret = self.send_request(Constants.POST_EVENT_REST, data) if ret: return True return False @@ -78,7 +81,7 @@ def isolate_port(self, port_name): "ports_policy": "UNHEALTHY", "action": "isolate" } - return self.post_request(Constants.ISOLATION_REST, data, post=False) + return self.send_request(Constants.ISOLATION_REST, data, method=Constants.PUT_METHOD) def deisolate_port(self, port_name): # PUT @@ -92,10 +95,34 @@ def deisolate_port(self, port_name): "ports": [port_name], "ports_policy": "HEALTHY", } - return self.post_request(Constants.ISOLATION_REST, data, post=False) + return self.send_request(Constants.ISOLATION_REST, data, method=Constants.PUT_METHOD) def get_ports_metadata(self): return self.get_request(Constants.GET_ACTIVE_PORTS_REST) def get_port_metadata(self, port_name): - return self.get_request("%s/%s" % (Constants.GET_PORTS_REST, port_name)) \ No newline at end of file + return self.get_request("%s/%s" % (Constants.GET_PORTS_REST, port_name)) + + def start_dynamic_session(self, instance_name, counters, sample_rate): + data = { + "counters": counters, + "sample_rate": sample_rate + } + return self.send_request(Constants.START_DYNAMIC_SESSION_REST % instance_name, data, method=Constants.POST_METHOD) + + def running_dynamic_session(self, instance_name): + response = self.get_request(Constants.STATUS_DYNAMIC_SESSION_REST) + if response: + instance_status = response.get(instance_name) + if instance_status and instance_status.get("status") == "running": + return True + return False + + def stop_dynamic_session(self, instance_name): + data = {} + return self.send_request(Constants.STOP_DYNAMIC_SESSION_REST % instance_name, data, method=Constants.DELETE_METHOD) + + def dynamic_session_get_port(self, instance_name): + data = self.get_request(Constants.CONF_DYNAMIC_SESSION_REST % instance_name) + if data: + return data.get("endpoint_port") From 30ce38f030e9b63bf657f3b4342dfb632e3db30c Mon Sep 17 00:00:00 2001 From: drorlevy Date: Mon, 1 May 2023 15:22:27 +0300 Subject: [PATCH 2/6] code review + update ports data --- .../pdr_deterministic_plugin/build/Dockerfile | 6 ++ .../ufm_sim_web_service/constants.py | 9 ++- .../ufm_sim_web_service/isolation_mgr.py | 67 ++++++++++++++++--- .../ufm_communication_mgr.py | 18 +++-- 4 files changed, 81 insertions(+), 19 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/build/Dockerfile b/plugins/pdr_deterministic_plugin/build/Dockerfile index 88b2226a3..2ce9baa6e 100644 --- a/plugins/pdr_deterministic_plugin/build/Dockerfile +++ b/plugins/pdr_deterministic_plugin/build/Dockerfile @@ -12,6 +12,12 @@ ARG SCRIPTS_PATH=${BASE_PATH}/scripts EXPOSE 8000 EXPOSE 8982 EXPOSE 443 +EXPOSE 9002 +EXPOSE 9003 +EXPOSE 9004 +EXPOSE 9005 +EXPOSE 9006 +EXPOSE 9007 RUN apt-get update && apt-get -y install supervisor python3 python3-pip rsyslog vim curl sudo diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py index 09ee94cad..3f1b1b059 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py @@ -44,9 +44,7 @@ class PDRConstants(object): GET_ACTIVE_PORTS_REST = "/resources/ports?active=true" API_HEALTHY_PORTS = "healthy_ports" API_ISOLATED_PORTS = "isolated_ports" - START_DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" - STOP_DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" - CONF_DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" + DYNAMIC_SESSION_REST = "/app/telemetry/instances/%s" STATUS_DYNAMIC_SESSION_REST = "/app/telemetry/instances/status" POST_METHOD = "POST" @@ -81,6 +79,11 @@ class PDRConstants(object): WIDTH = "active_width" FEC_MODE = "fec_mode_active" PORT_NAME = "name" + DESCRIPTION = "description" + EXTERNAL_NUMBER = "external_number" + GUID = "guid" + SYSTEM_ID = "systemID" + PORT_NUM = "port_num" ISSUE_PDR = "pdr" ISSUE_BER = "ber" diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 6bdab5b2e..08fe75c04 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -340,12 +340,33 @@ def get_ports_metadata(self): port_name = port.get(Constants.PORT_NAME) if not self.ports_data.get(port_name): self.ports_data[port_name] = {} - self.ports_data[port_name][Constants.ACTIVE_SPEED] = port.get(Constants.ACTIVE_SPEED) - self.ports_data[port_name][Constants.ASIC] = port.get(Constants.HW_TECHNOLOGY) - port_width = port.get(Constants.WIDTH) - if port_width: - port_width = int(port_width.strip('x')) - self.ports_data[port_name][Constants.WIDTH] = port_width + self.update_port_metadata(port_name, port) + + def update_port_metadata(self, port_name, port): + self.ports_data[port_name][Constants.ACTIVE_SPEED] = port.get(Constants.ACTIVE_SPEED) + self.ports_data[port_name][Constants.ASIC] = port.get(Constants.HW_TECHNOLOGY) + self.ports_data[port_name][Constants.GUID] = port.get(Constants.SYSTEM_ID) + if "Computer IB Port" in port.get(Constants.DESCRIPTION): + self.ports_data[port_name][Constants.PORT_NUM] = 1 + else: + self.ports_data[port_name][Constants.PORT_NUM] = port.get(Constants.EXTERNAL_NUMBER) + port_width = port.get(Constants.WIDTH) + if port_width: + port_width = int(port_width.strip('x')) + self.ports_data[port_name][Constants.WIDTH] = port_width + + + def update_ports_data(self): + meta_data = self.ufm_client.get_ports_metadata() + ports_updated = False + if meta_data and len(meta_data) > 0: + for port in meta_data: + port_name = port.get(Constants.PORT_NAME) + if not self.ports_data.get(port_name): + self.ports_data[port_name] = {} + self.update_port_metadata(port_name, port) + ports_updated = True + return ports_updated def get_port_metadata(self, port_name): meta_data = self.ufm_client.get_port_metadata(port_name) @@ -379,13 +400,31 @@ def get_isolation_state(self): def start_telemetry_session(self): self.logger.info("Starting telemetry session") - response = self.ufm_client.start_dynamic_session(Constants.PDR_DYNAMIC_NAME, self.telemetry_counters, self.t_isolate) + guids = self.get_requested_guids() + response = self.ufm_client.start_dynamic_session(Constants.PDR_DYNAMIC_NAME, self.telemetry_counters, self.t_isolate, guids) if response and response.status_code == http.HTTPStatus.ACCEPTED: - port = str(response.content) + port = str(int(response.content)) else: self.logger.error(f"Failed to start dynamic session: {response}") return False - return port + return port + + def update_telemetry_session(self): + self.logger.info("Updating telemetry session") + guids = self.get_requested_guids() + response = self.ufm_client.update_dynamic_session(Constants.PDR_DYNAMIC_NAME, self.t_isolate, guids) + return response + + def get_requested_guids(self): + guids = {} + for port in self.ports_data.values(): + sys_guid = port.get(Constants.GUID) + if sys_guid in guids: + guids[sys_guid].append(port.get(Constants.PORT_NUM)) + else: + guids[sys_guid] = [port.get(Constants.PORT_NUM)] + requested_guids = [{"guid": sys_guid, "ports": ports} for sys_guid, ports in guids.items()] + return requested_guids def run_telemetry_get_port(self): while not self.ufm_client.running_dynamic_session(Constants.PDR_DYNAMIC_NAME): @@ -397,10 +436,11 @@ def run_telemetry_get_port(self): def main_flow(self): # sync to the telemetry clock by blocking read self.logger.info("Isolation Manager initialized, starting isolation loop") - self.get_ports_metadata() + self.get_ports_metadata() endpoint_port = self.run_telemetry_get_port() while(True): try: + t_begin = time.time() self.get_isolation_state() self.logger.info("Retrieving telemetry data to determine ports' states") issues = self.read_next_set_of_high_ber_or_pdr_ports(endpoint_port) @@ -428,9 +468,14 @@ def main_flow(self): # so need to re-evaluate if to return it to service if self.automatic_deisolate or cause == Constants.ISSUE_OONOC or state == Constants.STATE_TREATED: self.eval_deisolate(port_state.name) + ports_updated = self.update_ports_data() + if ports_updated: + self.update_telemetry_session() + t_end = time.time() except Exception as e: self.logger.warning(e) - time.sleep(self.t_isolate) + t_end = time.time() + time.sleep(self.t_isolate - (t_end - t_begin)) # DEBUG #time.sleep(15) diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py index 83ba73fed..1b919e0cf 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/ufm_communication_mgr.py @@ -103,12 +103,20 @@ def get_ports_metadata(self): def get_port_metadata(self, port_name): return self.get_request("%s/%s" % (Constants.GET_PORTS_REST, port_name)) - def start_dynamic_session(self, instance_name, counters, sample_rate): + def start_dynamic_session(self, instance_name, counters, sample_rate, guids): data = { "counters": counters, - "sample_rate": sample_rate + "sample_rate": sample_rate, + "requested_guids": guids } - return self.send_request(Constants.START_DYNAMIC_SESSION_REST % instance_name, data, method=Constants.POST_METHOD) + return self.send_request(Constants.DYNAMIC_SESSION_REST % instance_name, data, method=Constants.POST_METHOD) + + def update_dynamic_session(self, instance_name, sample_rate, guids): + data = { + "sample_rate": sample_rate, + "requested_guids": guids + } + return self.send_request(Constants.DYNAMIC_SESSION_REST % instance_name, data, method=Constants.PUT_METHOD) def running_dynamic_session(self, instance_name): response = self.get_request(Constants.STATUS_DYNAMIC_SESSION_REST) @@ -120,9 +128,9 @@ def running_dynamic_session(self, instance_name): def stop_dynamic_session(self, instance_name): data = {} - return self.send_request(Constants.STOP_DYNAMIC_SESSION_REST % instance_name, data, method=Constants.DELETE_METHOD) + return self.send_request(Constants.DYNAMIC_SESSION_REST % instance_name, data, method=Constants.DELETE_METHOD) def dynamic_session_get_port(self, instance_name): - data = self.get_request(Constants.CONF_DYNAMIC_SESSION_REST % instance_name) + data = self.get_request(Constants.DYNAMIC_SESSION_REST % instance_name) if data: return data.get("endpoint_port") From 033a4199eb0475de0ff7a0f0e1a53bc9d4f87060 Mon Sep 17 00:00:00 2001 From: drorlevy Date: Tue, 2 May 2023 18:36:01 +0300 Subject: [PATCH 3/6] removed unused package and improved logging --- plugins/pdr_deterministic_plugin/build/Dockerfile | 2 +- .../ufm_sim_web_service/isolation_mgr.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/build/Dockerfile b/plugins/pdr_deterministic_plugin/build/Dockerfile index 2ce9baa6e..667dbb7b9 100644 --- a/plugins/pdr_deterministic_plugin/build/Dockerfile +++ b/plugins/pdr_deterministic_plugin/build/Dockerfile @@ -21,7 +21,7 @@ EXPOSE 9007 RUN apt-get update && apt-get -y install supervisor python3 python3-pip rsyslog vim curl sudo -RUN python3 -m pip install flask flask_restful requests urllib3 twisted jsonschema pandas +RUN python3 -m pip install flask flask_restful requests twisted jsonschema pandas COPY ufm_sim_web_service/ ${BASE_PATH}/ufm_sim_web_service/ diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 08fe75c04..752a1e0e5 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -9,7 +9,7 @@ # This software product is governed by the End User License Agreement # provided with the software product. # - +import traceback from datetime import datetime from datetime import timedelta import time @@ -225,7 +225,7 @@ def read_next_set_of_high_ber_or_pdr_ports(self, endpoint_port): rcv_error = get_counter(Constants.RCV_ERRORS_COUNTER, row) rcv_remote_phy_error = get_counter(Constants.RCV_REMOTE_PHY_ERROR_COUNTER, row) errors = rcv_error + rcv_remote_phy_error - error_rate = self.get_rate_and_update(port_name, Constants.ERRORS_COUNTER, row) + error_rate = self.get_rate_and_update(port_name, Constants.ERRORS_COUNTER, errors) rcv_pkts = get_counter(Constants.RCV_PACKETS_COUNTER, row) rcv_pkt_rate = self.get_rate_and_update(port_name, Constants.RCV_PACKETS_COUNTER, rcv_pkts) cable_temp = get_counter(Constants.TEMP_COUNTER, row, default=None) @@ -428,6 +428,7 @@ def get_requested_guids(self): def run_telemetry_get_port(self): while not self.ufm_client.running_dynamic_session(Constants.PDR_DYNAMIC_NAME): + self.logger.info("Waiting for dynamic session to start") endpoint_port = self.start_telemetry_session() time.sleep(20) endpoint_port = self.ufm_client.dynamic_session_get_port(Constants.PDR_DYNAMIC_NAME) @@ -436,8 +437,10 @@ def run_telemetry_get_port(self): def main_flow(self): # sync to the telemetry clock by blocking read self.logger.info("Isolation Manager initialized, starting isolation loop") - self.get_ports_metadata() + self.get_ports_metadata() + self.logger.info("Retrieved ports metadata") endpoint_port = self.run_telemetry_get_port() + self.logger.info("telemetry session started") while(True): try: t_begin = time.time() @@ -473,7 +476,10 @@ def main_flow(self): self.update_telemetry_session() t_end = time.time() except Exception as e: + self.logger.warning("Error in main loop") self.logger.warning(e) + traceback_err = traceback.format_exc() + self.logger.warning(traceback_err) t_end = time.time() time.sleep(self.t_isolate - (t_end - t_begin)) # DEBUG From 44782eb2e17b92554acec211d46091d9a751c71f Mon Sep 17 00:00:00 2001 From: drorlevy Date: Sun, 7 May 2023 15:10:12 +0300 Subject: [PATCH 4/6] issues with isolating and deisolating --- .../pdr_deterministic_plugin/build/Dockerfile | 2 +- .../build/config/deinit.sh | 2 +- .../build/config/pdr_deterministic.conf | 3 +- .../ufm_sim_web_service/constants.py | 1 + .../ufm_sim_web_service/isolation_mgr.py | 133 ++++++++++++------ 5 files changed, 96 insertions(+), 45 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/build/Dockerfile b/plugins/pdr_deterministic_plugin/build/Dockerfile index 667dbb7b9..dcb1b8ae9 100644 --- a/plugins/pdr_deterministic_plugin/build/Dockerfile +++ b/plugins/pdr_deterministic_plugin/build/Dockerfile @@ -21,7 +21,7 @@ EXPOSE 9007 RUN apt-get update && apt-get -y install supervisor python3 python3-pip rsyslog vim curl sudo -RUN python3 -m pip install flask flask_restful requests twisted jsonschema pandas +RUN python3 -m pip install flask flask_restful requests twisted jsonschema pandas numpy COPY ufm_sim_web_service/ ${BASE_PATH}/ufm_sim_web_service/ diff --git a/plugins/pdr_deterministic_plugin/build/config/deinit.sh b/plugins/pdr_deterministic_plugin/build/config/deinit.sh index e433ffafe..6866a705a 100755 --- a/plugins/pdr_deterministic_plugin/build/config/deinit.sh +++ b/plugins/pdr_deterministic_plugin/build/config/deinit.sh @@ -16,5 +16,5 @@ set -eE rm -f /log/pdr_deterministic*.log* -rm -f /scripts/init_pdr_conf.sh +curl -X "DELETE" http://127.0.0.1:8000/app/telemetry/instances/pdr_dynamic -H "X-Remote-User: ufmsystem" exit 0 diff --git a/plugins/pdr_deterministic_plugin/build/config/pdr_deterministic.conf b/plugins/pdr_deterministic_plugin/build/config/pdr_deterministic.conf index d9b993486..d60f5397b 100644 --- a/plugins/pdr_deterministic_plugin/build/config/pdr_deterministic.conf +++ b/plugins/pdr_deterministic_plugin/build/config/pdr_deterministic.conf @@ -21,4 +21,5 @@ DEISOLATE_CONSIDER_TIME=5 # automatically perform deisolation also if port wasn't set as "treated" AUTOMATIC_DEISOLATE=True # if set to false, the plugin will not perform deisolation -DO_DEISOLATION=True \ No newline at end of file +DO_DEISOLATION=True +DYNAMIC_WAIT_TIME=30 \ No newline at end of file diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py index 3f1b1b059..3b8c2c71b 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/constants.py @@ -97,6 +97,7 @@ class PDRConstants(object): CSV_FEC_OPCODE = "FEC OPCODE" CSV_ASIC = "ASIC" + CSV_SPEED = "Speed" CSV_RAW_BER_ISOLATE = "Pre-FEC BER Error" CSV_EFF_BER_ISOLATE = "Post-FEC BER Error" CSV_SYMBOL_BER_ISOLATE = "Symbol BER Error" diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 752a1e0e5..1dbfa6ce5 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -17,6 +17,7 @@ import pandas as pd import json import http +import numpy from constants import PDRConstants as Constants from ufm_communication_mgr import UFMCommunicator @@ -58,7 +59,7 @@ def __init__(self, port, cause): def get_counter(counter_name, row, default=0): try: - val = row.get(counter_name) if row.get(counter_name) else default + val = row.get(counter_name) if (row.get(counter_name) and not numpy.isnan(row.get(counter_name))) else default except Exception as e: return default return val @@ -87,6 +88,7 @@ def __init__(self, ufm_client: UFMCommunicator, logger): self.do_deisolate = pdr_config.getboolean(Constants.CONF_COMMON,Constants.DO_DEISOLATION) self.deisolate_consider_time = pdr_config.getint(Constants.CONF_COMMON,Constants.DEISOLATE_CONSIDER_TIME) self.automatic_deisolate = pdr_config.getboolean(Constants.CONF_COMMON,Constants.AUTOMATIC_DEISOLATE) + self.dynamic_wait_time = pdr_config.getint(Constants.CONF_COMMON,"DYNAMIC_WAIT_TIME") # Take from Conf self.logger = logger self.isolation_matrix = pd.read_csv(Constants.BER_MATRIX) @@ -96,7 +98,8 @@ def __init__(self, ufm_client: UFMCommunicator, logger): Constants.CSV_SYMBOL_BER_ISOLATE, Constants.CSV_SYMBOL_BER_DEISOLATE]].min().min() self.ber_wait_time = self.calc_max_ber_wait_time(min_threshold) self.start_time = time.time() - self.ber_tele_data = pd.DataFrame(columns=[Constants.TIMESTAMP, Constants.RAW_BER, Constants.EFF_BER, Constants.SYMBOL_BER]) + self.max_time = self.start_time + self.ber_tele_data = pd.DataFrame(columns=[Constants.TIMESTAMP, Constants.RAW_BER, Constants.EFF_BER, Constants.SYMBOL_BER, Constants.PORT_NAME]) self.speed_types = { "FDR": 14, "EDR": 25, @@ -119,7 +122,9 @@ def __init__(self, ufm_client: UFMCommunicator, logger): # DEBUG # self.iteration = 0 + # self.t_isolate = 1 # self.deisolate_consider_time = 0 + # self.dry_run = True # self.d_tmax = 9000 def calc_max_ber_wait_time(self, min_threshold): @@ -150,7 +155,7 @@ def eval_isolation(self, port_name, cause): if not self.dry_run: ret = self.ufm_client.isolate_port(port_name) - if not ret or ret.status_code != 200: + if not ret or ret.status_code != http.HTTPStatus.OK: self.logger.warning("Failed isolating port: %s with cause: %s... status_code= %s", port_name, cause, ret.status_code) return port_state = self.ports_states.get(port_name) @@ -158,7 +163,7 @@ def eval_isolation(self, port_name, cause): self.ports_states[port_name] = PortState(port_name) self.ports_states[port_name].update(Constants.STATE_ISOLATED, cause) - self.logger.warning("Isolated port: %s cause: %s", port_name, cause) + self.logger.warning(f"Isolated port: {port_name} cause: {cause}. dry_run: {self.dry_run}") def eval_deisolate(self, port_name): if not port_name in self.ufm_latest_isolation_state: @@ -174,8 +179,13 @@ def eval_deisolate(self, port_name): # we need some time after the change in state elif datetime.now() >= self.ports_states[port_name].get_change_time() + timedelta(minutes=self.deisolate_consider_time): - # TODO: handle BER - if self.check_ber_threshold(port_name, port_speed, asic, fec_mode, raw_ber_val, eff_ber_val, symbol_ber_val, isolation=False): + port_data = self.ports_data.get(port_name) + port_speed = port_data.get(Constants.ACTIVE_SPEED) + port_asic = port_data.get(Constants.ASIC) + port_width = port_data.get(Constants.WIDTH) + fec_mode = port_data.get(Constants.FEC_MODE) + raw_ber_rate, eff_ber_rate, symbol_ber_rate = self.calc_ber_rates(port_name, port_speed, port_width) + if self.check_ber_threshold(port_name, port_speed, port_asic, fec_mode, raw_ber_rate, eff_ber_rate, symbol_ber_rate, isolation=False): cause = Constants.ISSUE_BER self.ports_states[port_name].update(Constants.STATE_ISOLATED, cause) return @@ -193,18 +203,18 @@ def eval_deisolate(self, port_name): # } if not self.dry_run: ret = self.ufm_client.deisolate_port(port_name) - if not ret or ret.status_code != 200: + if not ret or ret.status_code != http.HTTPStatus.OK: self.logger.warning("Failed deisolating port: %s with cause: %s... status_code= %s", port_name, self.ports_states[port_name].cause, ret.status_code) return self.ports_states.pop(port_name) - self.logger.warning("Deisolated port: %s", port_name) + self.logger.warning(f"Deisolated port: {port_name}. dry_run: {self.dry_run}") def get_rate_and_update(self, port_name, counter_name, new_val): port_data = self.ports_data.get(port_name) if port_data: old_val = port_data.get(counter_name) if old_val and new_val > old_val: - counter_delta = (old_val - new_val) / self.t_isolate + counter_delta = (new_val - old_val) / self.t_isolate else: counter_delta = 0 else: @@ -236,7 +246,10 @@ def read_next_set_of_high_ber_or_pdr_ports(self, endpoint_port): # cable_temp = 90 # else: # cable_temp = 30 - if cable_temp is not None: + if cable_temp is not None and not numpy.isnan(cable_temp): + if cable_temp == "NA" or cable_temp == "N/A" or cable_temp == "" or cable_temp == "0C": + continue + cable_temp = int(cable_temp.split("C")[0]) if type(cable_temp) == str else cable_temp dT = abs(self.ports_data[port_name].get(Constants.TEMP_COUNTER, 0) - cable_temp) self.ports_data[port_name][Constants.TEMP_COUNTER] = cable_temp if rcv_pkt_rate and error_rate / rcv_pkt_rate > self.max_pdr: @@ -244,27 +257,47 @@ def read_next_set_of_high_ber_or_pdr_ports(self, endpoint_port): elif cable_temp and (cable_temp > self.tmax or dT > self.d_tmax): issues[port_name] = Issue(port_name, Constants.ISSUE_OONOC) if self.configured_ber_check: - symbol_ber_val = sum([ - get_counter(Constants.PHY_RAW_ERROR_LANE0, row), - get_counter(Constants.PHY_RAW_ERROR_LANE1, row), - get_counter(Constants.PHY_RAW_ERROR_LANE2, row), - get_counter(Constants.PHY_RAW_ERROR_LANE3, row), - ]) + error_lane_0 = get_counter(Constants.PHY_RAW_ERROR_LANE0, row, default=None) + error_lane_1 = get_counter(Constants.PHY_RAW_ERROR_LANE1, row, default=None) + error_lane_2 = get_counter(Constants.PHY_RAW_ERROR_LANE2, row, default=None) + error_lane_3 = get_counter(Constants.PHY_RAW_ERROR_LANE3, row, default=None) + if error_lane_0 and error_lane_1 and error_lane_2 and error_lane_3: + symbol_ber_val = sum([ + get_counter(Constants.PHY_RAW_ERROR_LANE0, row), + get_counter(Constants.PHY_RAW_ERROR_LANE1, row), + get_counter(Constants.PHY_RAW_ERROR_LANE2, row), + get_counter(Constants.PHY_RAW_ERROR_LANE3, row), + ]) + else: + symbol_ber_val = None eff_ber_val = get_counter(Constants.PHY_EFF_ERROR, row, default=None) raw_ber_val = get_counter(Constants.RAW_BER, row, default=None) + #DEBUG + # if self.iteration < 2: + # symbol_ber_val = 10 + # else: + # symbol_ber_val = 40000 + #DEBUG if symbol_ber_val is not None or eff_ber_val is not None or raw_ber_val is not None: - timestamp = time.time() + curr_timestamp = int(time.time()) ber_data = { - Constants.TIMESTAMP : timestamp, + Constants.TIMESTAMP : curr_timestamp, Constants.RAW_BER : raw_ber_val, Constants.EFF_BER : eff_ber_val, - Constants.SYMBOL_BER : symbol_ber_val + Constants.SYMBOL_BER : symbol_ber_val, + Constants.PORT_NAME: port_name } self.ber_tele_data.loc[len(self.ber_tele_data)] = ber_data - self.ber_tele_data = self.ber_tele_data[self.ber_tele_data[Constants.TIMESTAMP] > self.start_time - self.ber_wait_time + self.t_isolate * 10] - self.start_time = self.ber_tele_data[Constants.TIMESTAMP].min() + # self.ber_tele_data = self.ber_tele_data[self.ber_tele_data[Constants.TIMESTAMP] > self.start_time - self.ber_wait_time + self.t_isolate * 10] port_data = self.ports_data.get(port_name) fec_mode = get_counter(Constants.FEC_MODE, row, default=None) + #DEBUG + # fec_mode=14 + # port_data[Constants.ASIC] = "7nm" + # self.ber_wait_time = 0 + # port_data[Constants.ACTIVE_SPEED] = "NDR" + #DEBUG + port_data[Constants.FEC_MODE] = fec_mode if fec_mode is None: continue port_speed = port_data.get(Constants.ACTIVE_SPEED) @@ -282,10 +315,8 @@ def read_next_set_of_high_ber_or_pdr_ports(self, endpoint_port): self.logger.debug(f"port width for port {port_name} is None, can't verify it's BER values") continue - if timestamp - self.start_time < self.ber_wait_time: - continue - raw_ber_rate, eff_ber_rate, symbol_ber_rate = self.calc_ber_rates(port_speed, port_width, timestamp, self.start_time) - if self.check_ber_threshold(port_name, port_speed, port_asic, fec_mode, raw_ber_rate, eff_ber_rate, symbol_ber_rate, isolation=True): + raw_ber_rate, eff_ber_rate, symbol_ber_rate = self.calc_ber_rates(port_name, port_speed, port_width) + if (raw_ber_rate or eff_ber_rate or symbol_ber_rate) and self.check_ber_threshold(port_name, port_speed, port_asic, fec_mode, raw_ber_rate, eff_ber_rate, symbol_ber_rate, isolation=True): issued_port = issues.get(port_name) if issued_port: issued_port.cause = Constants.ISSUE_PDR_BER @@ -293,23 +324,34 @@ def read_next_set_of_high_ber_or_pdr_ports(self, endpoint_port): issues[port_name] = Issue(port_name, Constants.ISSUE_BER) return issues - def calc_single_rate(self, port_speed, port_width, min_timestamp, max_timestamp, col_name): - min_value = self.ber_tele_data.loc[self.ber_tele_data[Constants.TIMESTAMP] == min_timestamp, col_name].values[0] - max_value = self.ber_tele_data.loc[self.ber_tele_data[Constants.TIMESTAMP] == max_timestamp, col_name].values[0] - actual_speed = self.speed_types.get(port_speed, 100000) - return (max_value - min_value) / ((max_timestamp - min_timestamp) * actual_speed * port_width) + def calc_single_rate(self, port_name, port_speed, port_width, col_name): + try: + min_timestamp = self.ber_tele_data.loc[self.ber_tele_data[Constants.PORT_NAME] == port_name, Constants.TIMESTAMP].min() + max_timestamp = self.ber_tele_data.loc[self.ber_tele_data[Constants.PORT_NAME] == port_name, Constants.TIMESTAMP].max() + self.ber_tele_data[Constants.TIMESTAMP].min() + if max_timestamp == min_timestamp or max_timestamp - min_timestamp < self.ber_wait_time: + return 0 + min_value = self.ber_tele_data.loc[(self.ber_tele_data[Constants.TIMESTAMP] == min_timestamp) & (self.ber_tele_data[Constants.PORT_NAME] == port_name), col_name].values[0] + max_value = self.ber_tele_data.loc[(self.ber_tele_data[Constants.TIMESTAMP] == max_timestamp) & (self.ber_tele_data[Constants.PORT_NAME] == port_name), col_name].values[0] + if not min_value or not max_value: + return 0 + actual_speed = self.speed_types.get(port_speed, 100000) + return (max_value - min_value) / ((max_timestamp - min_timestamp) * actual_speed * port_width * 1000 * 1000) + except Exception as e: + self.logger.error(f"Error calculating {col_name}, error: {e}") + return 0 - def calc_ber_rates(self, port_speed, port_width, min_timestamp, max_timestamp): - raw_rate = self.calc_single_rate(min_timestamp, max_timestamp, Constants.RAW_BER) - eff_rate = self.calc_single_rate(min_timestamp, max_timestamp, Constants.EFF_BER) - symbol_rate = self.calc_single_rate(min_timestamp, max_timestamp, Constants.SYMBOL_BER) + def calc_ber_rates(self, port_name, port_speed, port_width): + raw_rate = self.calc_single_rate(port_name, port_speed, port_width, Constants.RAW_BER) + eff_rate = self.calc_single_rate(port_name, port_speed, port_width, Constants.EFF_BER) + symbol_rate = self.calc_single_rate(port_name, port_speed, port_width, Constants.SYMBOL_BER) return raw_rate, eff_rate, symbol_rate def check_ber_threshold(self, port_name, port_speed, asic, fec_mode, raw_ber_val, eff_ber_val, symbol_ber_val, isolation=True): if not asic: - logger.debug(f"{port_name} doesn't support asic retrieval. skipping BER check") + self.logger.debug(f"{port_name} doesn't support asic retrieval. skipping BER check") return False if isolation: raw_ber_string = Constants.CSV_RAW_BER_ISOLATE @@ -320,7 +362,7 @@ def check_ber_threshold(self, port_name, port_speed, asic, fec_mode, raw_ber_val eff_ber_string = Constants.CSV_EFF_BER_DEISOLATE symbol_ber_string = Constants.CSV_SYMBOL_BER_DEISOLATE - rows = self.isolation_matrix[(self.isolation_matrix[Constants.ACTIVE_SPEED] == port_speed) & + rows = self.isolation_matrix[(self.isolation_matrix[Constants.CSV_SPEED] == port_speed) & (self.isolation_matrix[Constants.CSV_FEC_OPCODE] == fec_mode) & (self.isolation_matrix[Constants.CSV_ASIC] == asic) & ((raw_ber_val > self.isolation_matrix[raw_ber_string]) | @@ -330,7 +372,7 @@ def check_ber_threshold(self, port_name, port_speed, asic, fec_mode, raw_ber_val if rows.empty: return False else: - logger.warning(f"port {port_name} BER counter crossed the threshold. fec={fec_mode}, port_speed={port_speed}, asic={asic}, raw={raw_ber_val}, eff={eff_ber_val}, symbol={symbol_ber_val}") + self.logger.warning(f"port {port_name} BER counter crossed the threshold. fec={fec_mode}, port_speed={port_speed}, asic={asic}, raw={raw_ber_val}, eff={eff_ber_val}, symbol={symbol_ber_val}") return True def get_ports_metadata(self): @@ -427,10 +469,14 @@ def get_requested_guids(self): return requested_guids def run_telemetry_get_port(self): - while not self.ufm_client.running_dynamic_session(Constants.PDR_DYNAMIC_NAME): - self.logger.info("Waiting for dynamic session to start") - endpoint_port = self.start_telemetry_session() - time.sleep(20) + try: + while not self.ufm_client.running_dynamic_session(Constants.PDR_DYNAMIC_NAME): + self.logger.info("Waiting for dynamic session to start") + endpoint_port = self.start_telemetry_session() + time.sleep(self.dynamic_wait_time) + except Exception as e: + self.ufm_client.stop_dynamic_session(Constants.PDR_DYNAMIC_NAME) + time.sleep(self.dynamic_wait_time) endpoint_port = self.ufm_client.dynamic_session_get_port(Constants.PDR_DYNAMIC_NAME) return endpoint_port @@ -481,7 +527,10 @@ def main_flow(self): traceback_err = traceback.format_exc() self.logger.warning(traceback_err) t_end = time.time() - time.sleep(self.t_isolate - (t_end - t_begin)) + #DEBUG + # self.iteration += 1 + # DEBUG + time.sleep(max(1, self.t_isolate - (t_end - t_begin))) # DEBUG #time.sleep(15) From 8fc81deb908e2d1dafa1cfaeb35b2b26c0809a06 Mon Sep 17 00:00:00 2001 From: drorlevy Date: Sun, 7 May 2023 15:31:34 +0300 Subject: [PATCH 5/6] updated Gb conversion --- .../ufm_sim_web_service/isolation_mgr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 1dbfa6ce5..220533e04 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -336,7 +336,7 @@ def calc_single_rate(self, port_name, port_speed, port_width, col_name): if not min_value or not max_value: return 0 actual_speed = self.speed_types.get(port_speed, 100000) - return (max_value - min_value) / ((max_timestamp - min_timestamp) * actual_speed * port_width * 1000 * 1000) + return (max_value - min_value) / ((max_timestamp - min_timestamp) * actual_speed * port_width * 1024 * 1024 * 1024) except Exception as e: self.logger.error(f"Error calculating {col_name}, error: {e}") return 0 From 0eea373bb97b96f913b35c0692e508fc57aa5fbf Mon Sep 17 00:00:00 2001 From: drorlevy Date: Sun, 21 May 2023 17:57:17 +0300 Subject: [PATCH 6/6] support for dynamic telemetry all fabric fetch --- .../build/config/Field_BER_Thresholds.csv | 134 +++++++++--------- .../build/docker_build.sh | 2 + .../ufm_sim_web_service/isolation_mgr.py | 6 +- 3 files changed, 69 insertions(+), 73 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/build/config/Field_BER_Thresholds.csv b/plugins/pdr_deterministic_plugin/build/config/Field_BER_Thresholds.csv index 828d1645e..df501de57 100644 --- a/plugins/pdr_deterministic_plugin/build/config/Field_BER_Thresholds.csv +++ b/plugins/pdr_deterministic_plugin/build/config/Field_BER_Thresholds.csv @@ -1,69 +1,65 @@ -ASIC,Protocol,Speed,FEC TYPE,FEC OPCODE,Media Type,Pre-FEC BER Error,Pre-FEC BER Warning,Pre-FEC BER Normal,Post-FEC BER Error,Post-FEC BER Warning,Post-FEC BER Normal,Symbol BER Error,Symbol BER Warning,Symbol BER Normal,Version -7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,DACs,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,ACC,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC_PLR (12),12,DACs,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC_PLR (12),12,ACCs,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC_PLR (12),12,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC_PLR (12),12,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC (7),7,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC (7),7,ACCs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC (7),7,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,NDR,KP4 Standard_RS-FEC (7),7,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC +PLR (13),13,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC +PLR (13),13,ACCs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC +PLR (13),13,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC +PLR (13),13,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC (7),7,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC (7),7,ACCs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC (7),7,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,KP4 Standard_RS-FEC (7),7,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,ACCs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V05 -7nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,ACCs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_LL_RS (3),3,DACs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_LL_RS (3),3,ACCs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_LL_RS (3),3,Active,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_LL_RS (3),3,Active_DiD,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_RS (2),2,DACs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_RS (2),2,ACCs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_RS (2),2,Active,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,STD_RS (2),2,Active_DiD,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,NO_FEC (0),0,DACs,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,NO_FEC (0),0,ACCs,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,NO_FEC (0),0,Active,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -7nm,IB,EDR,NO_FEC (0),0,Active_DiD,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC_PLR (12),12,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC_PLR (12),12,ACCs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC_PLR (12),12,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC_PLR (12),12,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC (7),7,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC (7),7,ACCs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC (7),7,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,KP4 Standard_RS-FEC (7),7,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,ACCs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"LL-FEC - (271,257) + PLR (13)",13,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,ACCs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,HDR,"Standard_LL_RS_FEC - RS(271,257) (3)",3,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_LL_RS (3),3,DACs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_LL_RS (3),3,ACCs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_LL_RS (3),3,Active,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_LL_RS (3),3,Active_DiD,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_RS (2),2,DACs,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_RS (2),2,ACCs,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_RS (2),2,Active,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,STD_RS (2),2,Active_DiD,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,NO_FEC (0),0,DACs,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,NO_FEC (0),0,ACCs,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,NO_FEC (0),0,Active,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 -16nm,IB,EDR,NO_FEC (0),0,Active_DiD,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V05 +ASIC,Protocol,Speed,FEC TYPE,FEC OPCODE vs MAD ,FEC OPCODE,Media Type,Pre-FEC BER Error,Pre-FEC BER Warning,Pre-FEC BER Normal,Post-FEC BER Error,Post-FEC BER Warning,Post-FEC BER Normal,Symbol BER Error,Symbol BER Warning,Symbol BER Normal,Version +7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,14,DACs,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,14,ACC,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,14,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,Ethernet_Consortium_LL_50G_RS_FEC_PLR (14),14,14,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC_PLR (12),13,12,DACs,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC_PLR (12),13,12,ACC,1.00E-06,5.00E-07,1.00E-07,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC_PLR (12),13,12,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC_PLR (12),13,12,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-11,5.00E-12,1.00E-12,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC (7),4,7,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC (7),4,7,ACC,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC (7),4,7,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,NDR,KP4_Standard_RS_FEC (7),4,7,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,ACC,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,ACC,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,HDR,LL_FEC_PLR (13),14,13,DACs,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,LL_FEC_PLR (13),14,13,ACC,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,LL_FEC_PLR (13),14,13,Active,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,HDR,LL_FEC_PLR (13),14,13,Active_DiD,1.00E-07,5.00E-08,1.00E-08,1.00E-13,5.00E-14,1.00E-14,1.00E-14,5.00E-15,1.00E-15,V06 +7nm,IB,EDR,STD_LL_RS (3),3,3,DACs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_LL_RS (3),3,3,ACC,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_LL_RS (3),3,3,Active,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_LL_RS (3),3,3,Active_DiD,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_RS (2),2,2,DACs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_RS (2),2,2,ACC,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_RS (2),2,2,Active,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,STD_RS (2),2,2,Active_DiD,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,NO_FEC (0),0,0,DACs,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,NO_FEC (0),0,0,ACC,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,NO_FEC (0),0,0,Active,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +7nm,IB,EDR,NO_FEC (0),0,0,Active_DiD,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,ACC,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC_PLR (12),13,12,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,ACC,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,KP4_Standard_RS_FEC (7),4,7,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,LL_FEC_PLR (13),14,13,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,LL_FEC_PLR (13),14,13,ACC,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,LL_FEC_PLR (13),14,13,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,LL_FEC_PLR (13),14,13,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,STD_LL_RS (3),3,3,DACs,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,STD_LL_RS (3),3,3,ACC,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,STD_LL_RS (3),3,3,Active,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,HDR,STD_LL_RS (3),3,3,Active_DiD,1.00E-05,5.00E-06,1.00E-06,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_LL_RS (3),3,3,DACs,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_LL_RS (3),3,3,ACC,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_LL_RS (3),3,3,Active,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_LL_RS (3),3,3,Active_DiD,1.00E-12,5.00E-13,1.00E-13,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_RS (2),2,2,DACs,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_RS (2),2,2,ACC,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_RS (2),2,2,Active,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,STD_RS (2),2,2,Active_DiD,1.00E-09,5.00E-10,1.00E-10,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,NO_FEC (0),0,0,DACs,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,NO_FEC (0),0,0,ACC,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,NO_FEC (0),0,0,Active,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 +16nm,IB,EDR,NO_FEC (0),0,0,Active_DiD,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,1.00E-13,5.00E-14,1.00E-14,V06 diff --git a/plugins/pdr_deterministic_plugin/build/docker_build.sh b/plugins/pdr_deterministic_plugin/build/docker_build.sh index 45bb68757..ed8138b49 100755 --- a/plugins/pdr_deterministic_plugin/build/docker_build.sh +++ b/plugins/pdr_deterministic_plugin/build/docker_build.sh @@ -100,6 +100,8 @@ pushd ${SCRIPT_DIR} BUILD_DIR=$(create_out_dir) cp Dockerfile ${BUILD_DIR} +curl -l -k 'https://l-webdev01:28443/raw/golan_fw.git/master_rc/docs!Field_BER_Thresholds.csv' -o Field_BER_Thresholds.csv +mv -f Field_BER_Thresholds.csv config cp -r config ${BUILD_DIR} cp -r scripts ${BUILD_DIR} cp -r ../ufm_sim_web_service ${BUILD_DIR} diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 220533e04..7b05aaf42 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -399,6 +399,7 @@ def update_port_metadata(self, port_name, port): def update_ports_data(self): + # update the ports metadata, meta_data = self.ufm_client.get_ports_metadata() ports_updated = False if meta_data and len(meta_data) > 0: @@ -442,8 +443,7 @@ def get_isolation_state(self): def start_telemetry_session(self): self.logger.info("Starting telemetry session") - guids = self.get_requested_guids() - response = self.ufm_client.start_dynamic_session(Constants.PDR_DYNAMIC_NAME, self.telemetry_counters, self.t_isolate, guids) + response = self.ufm_client.start_dynamic_session(Constants.PDR_DYNAMIC_NAME, self.telemetry_counters, self.t_isolate, []) if response and response.status_code == http.HTTPStatus.ACCEPTED: port = str(int(response.content)) else: @@ -518,8 +518,6 @@ def main_flow(self): if self.automatic_deisolate or cause == Constants.ISSUE_OONOC or state == Constants.STATE_TREATED: self.eval_deisolate(port_state.name) ports_updated = self.update_ports_data() - if ports_updated: - self.update_telemetry_session() t_end = time.time() except Exception as e: self.logger.warning("Error in main loop")