diff options
author | goldammx <martinx.goldammer@intel.com> | 2017-02-09 08:03:00 -0500 |
---|---|---|
committer | goldammx <martinx.goldammer@intel.com> | 2017-02-13 06:21:28 -0500 |
commit | ca9c9275ed6d5d852987c69a378e88a3502cb2ab (patch) | |
tree | 23a28663a4db92cd1c409b887691650642f18023 /tools/pkt_gen/xena | |
parent | ea4376cb3c89f4e3605d7f48036fd61325a52fcf (diff) |
pylint: Fixing pylint errors and warnings
All python files must reach pylint score 10/10. This will be
regularly verified by Jenkins jobs to keep constant code quality.
VSPERF specific pylintrc file was updated according to the vsperf
coding standards. Distro version included in reports will be
slightly different, due to migration to new python package distro.
Previously used platform.distro() will be deprecated since python 3.7.
JIRA: VSPERF-487
Change-Id: I934120208b9624787a3567ccaa49e14d77d7a5bf
Signed-off-by: Martin Goldammer <martinx.goldammer@intel.com>
Reviewed-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Bill Michalowski <bmichalo@redhat.com>
Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Diffstat (limited to 'tools/pkt_gen/xena')
-rw-r--r-- | tools/pkt_gen/xena/XenaDriver.py | 21 | ||||
-rw-r--r-- | tools/pkt_gen/xena/xena_json.py | 8 |
2 files changed, 16 insertions, 13 deletions
diff --git a/tools/pkt_gen/xena/XenaDriver.py b/tools/pkt_gen/xena/XenaDriver.py index e144514f..6e39e47a 100644 --- a/tools/pkt_gen/xena/XenaDriver.py +++ b/tools/pkt_gen/xena/XenaDriver.py @@ -1,4 +1,4 @@ -# Copyright 2016 Red Hat Inc & Xena Networks. +# Copyright 2016-2017 Red Hat Inc & Xena Networks. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import struct import sys import threading import time - +# pylint: disable=too-many-lines # Xena Socket Commands CMD_CLEAR_RX_STATS = 'pr_clear' CMD_CLEAR_TX_STATS = 'pt_clear' @@ -371,7 +371,7 @@ class XenaManager(object): """ return self.driver.ask_verify(make_manager_command(CMD_OWNER, username)) - +# pylint: disable=too-many-public-methods class XenaPort(object): """ Xena Port emulator class @@ -537,7 +537,7 @@ class XenaPort(object): command = make_port_command(CMD_RESET, self) return self._manager.driver.ask_verify(command) - def set_port_arp_reply(self, on=True, v6=False): + def set_port_arp_reply(self, is_on=True, ipv6=False): """ Set the port arpreply value :param on: Enable or disable the arp reply on the port @@ -545,11 +545,11 @@ class XenaPort(object): :return: Boolean True if response OK, False if error """ command = make_port_command('{} {}'.format( - CMD_SET_PORT_ARP_V6_REPLY if v6 else CMD_SET_PORT_ARP_REPLY, - "on" if on else "off"), self) + CMD_SET_PORT_ARP_V6_REPLY if ipv6 else CMD_SET_PORT_ARP_REPLY, + "on" if is_on else "off"), self) return self._manager.driver.ask_verify(command) - def set_port_ping_reply(self, on=True, v6=False): + def set_port_ping_reply(self, is_on=True, ipv6=False): """ Set the port ping reply value :param on: Enable or disable the ping reply on the port @@ -557,8 +557,8 @@ class XenaPort(object): :return: Boolean True if response OK, False if error """ command = make_port_command('{} {}'.format( - CMD_SET_PORT_PING_V6_REPLY if v6 else CMD_SET_PORT_PING_REPLY, - "on" if on else "off"), self) + CMD_SET_PORT_PING_V6_REPLY if ipv6 else CMD_SET_PORT_PING_REPLY, + "on" if is_on else "off"), self) return self._manager.driver.ask_verify(command) def set_port_learning(self, interval): @@ -885,6 +885,7 @@ class XenaRXStats(object): """ return self._time + # pylint: disable=too-many-branches def parse_stats(self): """ Parse the stats from pr all command :return: Dictionary of all stats @@ -1040,7 +1041,7 @@ class XenaTXStats(object): def aggregate_stats(stat1, stat2): """ - Judge whether stat1 and stat2 both have same key, if both have same key, + Judge whether stat1 and stat2 both have same key, if both have same key, call the aggregate fuction, else use the stat1's value """ newstat = dict() diff --git a/tools/pkt_gen/xena/xena_json.py b/tools/pkt_gen/xena/xena_json.py index 1ce7b46f..50d0e2fe 100644 --- a/tools/pkt_gen/xena/xena_json.py +++ b/tools/pkt_gen/xena/xena_json.py @@ -1,4 +1,4 @@ -# Copyright 2016 Red Hat Inc & Xena Networks. +# Copyright 2016-2017 Red Hat Inc & Xena Networks. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -232,10 +232,13 @@ class XenaJSON(object): """ self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][ 'Enabled'] = 'true' - + # pylint: disable=too-many-arguments def modify_2544_tput_options(self, initial_value, minimum_value, maximum_value, value_resolution, use_pass_threshhold, pass_threshhold): + """ + modify_2544_tput_options + """ self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][ 'RateIterationOptions']['InitialValue'] = initial_value self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][ @@ -638,4 +641,3 @@ if __name__ == "__main__": write_json_file(JSON.json_data, './testthis.x2544') JSON = XenaJSON('./testthis.x2544') print_json_report(JSON.json_data) - |