From 2b21e343d83ef4db057f642ac26dd50fae316a22 Mon Sep 17 00:00:00 2001 From: Dipendu Ghosh Date: Wed, 14 Aug 2024 14:31:02 +0530 Subject: [PATCH] bug fixes --- snappi_cyperf/cyperfapi.py | 26 +++++++++++--------------- snappi_cyperf/l47server.py | 7 ++++++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/snappi_cyperf/cyperfapi.py b/snappi_cyperf/cyperfapi.py index abe3b97..3dd430c 100644 --- a/snappi_cyperf/cyperfapi.py +++ b/snappi_cyperf/cyperfapi.py @@ -9,10 +9,6 @@ from RESTasV3 import RESTasV3 -# mdw_address = sys.argv[1] -rest = RESTasV3(ipAddress="10.39.44.178") -# rest = RESTasV3(ipAddress="10.39.47.88") - # import sys # sys.path.insert(0, "/home/dipendu/otg/open_traffic_generator/snappi/artifacts/snappi") import snappi @@ -43,8 +39,8 @@ def __init__( self, host, version, - username=rest.username, - password=rest.password, + username, + password, gateway_port=8080, log_level="info", **kwargs, @@ -135,11 +131,11 @@ def set_config(self, config): self._connect() # self._ip_list = self.common.get_protocol_ip(config) self._l47config = config - self.interfaces.config(rest) - self.tcp.config(rest) - self.http.config(rest) - # self.objectiveandtimeline.config(rest) - self.port.config(rest) + self.interfaces.config(self.rest) + self.tcp.config(self.rest) + self.http.config(self.rest) + # self.objectiveandtimeline.config(self.rest) + self.port.config(self.rest) # self._apply_config() except Exception as err: self.logger.info(f"error:{err}") @@ -159,12 +155,12 @@ def get_config(self): def set_control_state(self, config): try: if config.app.state == "start": - self.start_test(rest) + self.start_test(self.rest) elif config.app.state == "stop": - self.stop_test(rest) + self.stop_test(self.rest) elif config.app.state == "abort": - self.abort_test(rest) + self.abort_test(self.rest) except Exception as err: self.logger.info(f"error:{err}") raise Snappil47Exception(err) @@ -284,7 +280,7 @@ def session_assistance(self): # self.configID = "appsec-appmix-and-attack" # self.configID = "appsec-empty-config" self.configID = "appsec-appmix" - response = rest.create_session(self.configID) + response = self.rest.create_session(self.configID) if response: self.session_id = response.json()[0]["id"] print("Config successfully opened, session ID: {}".format(self.session_id)) diff --git a/snappi_cyperf/l47server.py b/snappi_cyperf/l47server.py index 517c3b4..abb5b12 100644 --- a/snappi_cyperf/l47server.py +++ b/snappi_cyperf/l47server.py @@ -16,7 +16,12 @@ # sys.path.append("/home/dipendu/otg/open_traffic_generator/snappi-cyperf") from snappi_cyperf import cyperfapi -API = cyperfapi.Api(host="10.39.44.178", version="10.00.0.152") +API = cyperfapi.Api( + host="10.39.44.178", + version="10.00.0.152", + username="admin", + password="CyPerf&Keysight#1", +) # API = cyperfapi.Api(host="10.39.47.88", version="10.00.0.152")