From b33b1461fe815b1a09267118644538a5b9351c60 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Fri, 24 Jun 2022 10:32:28 +0000 Subject: feat(telemetry): Rework Signed-off-by: Peter Mikus Change-Id: I0a84ce88b318c488ba2d519b20237c88b9f9f1e6 --- resources/libraries/python/Constants.py | 9 ++++++--- resources/libraries/python/ContainerUtils.py | 9 ++++++++- resources/libraries/python/TelemetryUtil.py | 4 ++-- resources/libraries/python/VPPUtil.py | 4 +++- resources/libraries/python/topology.py | 4 +++- 5 files changed, 22 insertions(+), 8 deletions(-) (limited to 'resources/libraries/python') diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index 83e0854a6b..566dec7421 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -246,6 +246,12 @@ class Constants: # Default path to VPP API socket. SOCKSVR_PATH = u"/run/vpp/api.sock" + # Default path to VPP CLI socket. + SOCKCLI_PATH = u"/run/vpp/cli.sock" + + # Default path to VPP API Stats socket. + SOCKSTAT_PATH = u"/run/vpp/stats.sock" + # Number of trials to execute in MRR test. PERF_TRIAL_MULTIPLICITY = get_int_from_env(u"PERF_TRIAL_MULTIPLICITY", 10) @@ -287,9 +293,6 @@ class Constants: # /tmp directory is inside the DUT1 docker. DUT1_UUID = get_str_from_env(u"DUT1_UUID", u"") - # Default path to VPP API Stats socket. - SOCKSTAT_PATH = u"/run/vpp/stats.sock" - # Global "kill switch" for CRC checking during runtime. FAIL_ON_CRC_MISMATCH = get_pessimistic_bool_from_env( u"FAIL_ON_CRC_MISMATCH" diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py index 633144e35f..7ec8258686 100644 --- a/resources/libraries/python/ContainerUtils.py +++ b/resources/libraries/python/ContainerUtils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -587,6 +587,12 @@ class ContainerEngine: topo_instance = BuiltIn().get_library_instance( u"resources.libraries.python.topology.Topology" ) + topo_instance.add_new_socket( + self.container.node, + SocketType.CLI, + self.container.name, + self.container.cli_socket, + ) topo_instance.add_new_socket( self.container.node, SocketType.PAPI, @@ -1277,6 +1283,7 @@ class Container: path = f"/tmp/vpp_sockets/{value}" self.__dict__[u"socket_dir"] = path self.__dict__[u"api_socket"] = f"{path}/api.sock" + self.__dict__[u"cli_socket"] = f"{path}/cli.sock" self.__dict__[u"stats_socket"] = f"{path}/stats.sock" self.__dict__[attr] = value else: diff --git a/resources/libraries/python/TelemetryUtil.py b/resources/libraries/python/TelemetryUtil.py index be2f4796b2..2d4bb096c6 100644 --- a/resources/libraries/python/TelemetryUtil.py +++ b/resources/libraries/python/TelemetryUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -133,7 +133,7 @@ class TelemetryUtil: for node in nodes.values(): if node[u"type"] == NodeType.DUT: try: - for socket in node[u"sockets"][u"PAPI"].values(): + for socket in node[u"sockets"][u"CLI"].values(): TelemetryUtil.run_telemetry( node, profile=profile, hook=socket ) diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py index 0d5dea57df..daeb568bda 100644 --- a/resources/libraries/python/VPPUtil.py +++ b/resources/libraries/python/VPPUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -72,6 +72,8 @@ class VPPUtil: PapiSocketExecutor.disconnect_all_sockets_by_node(node) DUTSetup.restart_service(node, Constants.VPP_UNIT) if node_key: + Topology.add_new_socket( + node, SocketType.CLI, node_key, Constants.SOCKCLI_PATH) Topology.add_new_socket( node, SocketType.PAPI, node_key, Constants.SOCKSVR_PATH) Topology.add_new_socket( diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py index fba2dcb189..454692807c 100644 --- a/resources/libraries/python/topology.py +++ b/resources/libraries/python/topology.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -71,6 +71,8 @@ class SocketType: PAPI = u"PAPI" # VPP PAPI Stats (legacy option until stats are migrated to Socket PAPI) STATS = u"STATS" + # VPP Socket CLI + CLI = u"CLI" DICT__nodes = load_topo_from_yaml() -- cgit 1.2.3-korg