Skip to content

Commit

Permalink
removed Telemetry collector
Browse files Browse the repository at this point in the history
Signed-off-by: Elad Gershon <egershon@nvidia.com>
  • Loading branch information
egershonNvidia authored and TalLerner committed Aug 15, 2024
1 parent 65982e2 commit dad6b6b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from constants import PDRConstants as Constants
from ufm_communication_mgr import UFMCommunicator
from telemetry_collector import TelemetryCollector
# should actually be persistent and thread safe dictionary pf PortStates

class PortData(object):
Expand Down Expand Up @@ -202,7 +201,6 @@ def __init__(self, ufm_client: UFMCommunicator, logger):

self.start_time = time.time()
self.max_time = self.start_time
self.collector = TelemetryCollector(self.test_mode)
self.ber_tele_data = pd.DataFrame(columns=[Constants.TIMESTAMP, Constants.SYMBOL_BER, Constants.PORT_NAME])
self.speed_types = {
"FDR": 14,
Expand Down Expand Up @@ -530,7 +528,7 @@ def read_next_set_of_high_ber_or_pdr_ports(self):
Read the next set of ports and check if they have high BER, PDR, temperature or link downed issues
"""
issues = {}
ports_counters = self.collector.get_telemetry()
ports_counters = self.ufm_client.get_telemetry(self.test_mode)
if ports_counters is None:
self.logger.error("Couldn't retrieve telemetry data")
return {}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ def send_request(self, uri, data, method=Constants.POST_METHOD, headers=None):
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,test_mode):
"""
get the telemetry from secondary telemetry, if it in test mode it get from the simulation
return DataFrame of the telemetry
"""
if test_mode:
url = f"http://127.0.0.1:9090/csv/xcset/simulated_telemetry"
else:
url = f"http://127.0.0.1:{Constants.SECONDARY_TELEMETRY_PORT}/csv/xcset/{Constants.SECONDARY_INSTANCE}"
try:
telemetry_data = pd.read_csv(url)
except (pd.errors.ParserError, pd.errors.EmptyDataError, urllib.error.URLError) as e:
logging.error(f"Failed to get telemetry data from UFM, fetched url={url}. Error: {e}")
telemetry_data = None
return telemetry_data


def send_event(self, message, event_id=Constants.EXTERNAL_EVENT_NOTICE, external_event_name="PDR Plugin Event", external_event_type="PDR Plugin Event"):
data = {
Expand Down

0 comments on commit dad6b6b

Please sign in to comment.