From 111bd3664b91279883d9f8e2483e436cbdcf3d38 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Fri, 28 Oct 2016 14:32:05 +0200 Subject: move port_attr from driver class to physical port class + small fixes according to code review Signed-off-by: Yaroslav Brustinov --- .../trex_control_plane/stl/trex_stl_lib/utils/common.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py index 0214d7d7..72ee8972 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py @@ -27,9 +27,9 @@ def user_input(): return raw_input() -def random_id_gen_unsafe(length=8): +class random_id_gen: """ - A generator for creating a random chars id of specific length + Emulated generator for creating a random chars id of specific length :parameters: length : int @@ -40,16 +40,6 @@ def random_id_gen_unsafe(length=8): :return: a random id with each next() request. """ - id_chars = string.ascii_lowercase + string.digits - while True: - return_id = '' - for i in range(length): - return_id += random.choice(id_chars) - yield return_id - - -class random_id_gen: - """ Thread safe version of random_id_gen_unsafe """ def __init__(self, length=8): self.id_chars = string.ascii_lowercase + string.digits self.length = length -- cgit 1.2.3-korg