diff options
author | 2016-04-16 02:06:52 +0300 | |
---|---|---|
committer | 2016-04-16 02:06:52 +0300 | |
commit | f91190c71d0a2550364fdce909df297405fb5e43 (patch) | |
tree | c6ccb6f26070437151866d22e7f44efce0121bbd /scripts | |
parent | 9c1dfed4edc4a4d3f51fc7f9ac9cab58657ab818 (diff) |
python3 further fixes
Diffstat (limited to 'scripts')
6 files changed, 15 insertions, 12 deletions
diff --git a/scripts/automation/regression/CPlatform.py b/scripts/automation/regression/CPlatform.py index ba1168f0..381b4790 100755 --- a/scripts/automation/regression/CPlatform.py +++ b/scripts/automation/regression/CPlatform.py @@ -709,7 +709,7 @@ class CPlatform(object): if self.running_image is None: self.get_running_image_details() - command = "copy tftp://{tftp_ip}/{img_path}/{image} harddisk:".format( + command = "copy tftp://{tftp_ip}/{img_path}/{image} bootflash:".format( tftp_ip = self.tftp_cfg['ip_address'], img_path = self.tftp_cfg['images_path'], image = img_filename) diff --git a/scripts/automation/regression/misc_methods.py b/scripts/automation/regression/misc_methods.py index 6873622e..41e8e125 100755 --- a/scripts/automation/regression/misc_methods.py +++ b/scripts/automation/regression/misc_methods.py @@ -33,6 +33,8 @@ def run_command(cmd, background = False): print('Running command: %s' % cmd) proc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() + stdout = stdout.decode() + stderr = stderr.decode() if stdout: print('Stdout:\n%s' % stdout) if proc.returncode: diff --git a/scripts/automation/regression/platform_cmd_link.py b/scripts/automation/regression/platform_cmd_link.py index 7d74a8f8..d2143a5d 100755 --- a/scripts/automation/regression/platform_cmd_link.py +++ b/scripts/automation/regression/platform_cmd_link.py @@ -382,14 +382,15 @@ class CIosTelnet(telnetlib.Telnet): res = func(self, text.encode('ascii') if type(text) is str else text, *args, **kwargs) return res.decode() if type(res) is bytes else res - def read_until(self, text, *args, **kwargs): - return self.str_to_bytes_wrapper(telnetlib.Telnet.read_until, text, *args, **kwargs) + def read_until(self, *args, **kwargs): + return self.str_to_bytes_wrapper(telnetlib.Telnet.read_until, *args, **kwargs) - def write(self, text, *args, **kwargs): - return self.str_to_bytes_wrapper(telnetlib.Telnet.write, text, *args, **kwargs) + def write(self, *args, **kwargs): + return self.str_to_bytes_wrapper(telnetlib.Telnet.write, *args, **kwargs) - def expect(self, text, *args, **kwargs): - return self.str_to_bytes_wrapper(telnetlib.Telnet.expect, text, *args, **kwargs) + def expect(self, *args, **kwargs): + res = self.str_to_bytes_wrapper(telnetlib.Telnet.expect, *args, **kwargs) + return [elem.decode() if type(elem) is bytes else elem for elem in res] def __init__ (self, host, line_pass, en_pass, port = 23, str_wait = "#"): telnetlib.Telnet.__init__(self) diff --git a/scripts/automation/regression/stateless_tests/stl_client_test.py b/scripts/automation/regression/stateless_tests/stl_client_test.py index 6308e203..e7c9bb5d 100644 --- a/scripts/automation/regression/stateless_tests/stl_client_test.py +++ b/scripts/automation/regression/stateless_tests/stl_client_test.py @@ -248,7 +248,7 @@ class STLClient_Test(CStlGeneral_Test): for profile in self.profiles: - print("now testing profile {0}...\n").format(profile) + print("now testing profile {0}...\n".format(profile)) p1 = STLProfile.load(profile, port_id = self.tx_port) p2 = STLProfile.load(profile, port_id = self.rx_port) diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py index c55ee13e..3b979744 100644 --- a/scripts/automation/regression/stateless_tests/stl_rx_test.py +++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py @@ -100,10 +100,10 @@ class STLRX_Test(CStlGeneral_Test): # one simple stream on TX --> RX def test_multiple_streams(self): num_streams = 10 - total_pkts = self.total_pkts / num_streams + total_pkts = int(self.total_pkts / num_streams) if total_pkts == 0: total_pkts = 1 - percent = self.rate_percent / num_streams + percent = int(self.rate_percent / num_streams) if percent == 0: percent = 1 diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py index e182f5ea..6b1185ef 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py @@ -881,7 +881,7 @@ class CRxStats(CTRexStats): output['ts'] = current['ts'] # we care only about the current active keys - pg_ids = filter(is_intable, current.keys()) + pg_ids = list(filter(is_intable, current.keys())) for pg_id in pg_ids: @@ -907,7 +907,7 @@ class CRxStats(CTRexStats): # cleanp old reference values - they are dead - ref_pg_ids = filter(is_intable, self.reference_stats.keys()) + ref_pg_ids = list(filter(is_intable, self.reference_stats.keys())) deleted_pg_ids = set(ref_pg_ids).difference(pg_ids) for d_pg_id in deleted_pg_ids: |