From bf5dbb841af56192a9cbcf50c996787ec0582bae Mon Sep 17 00:00:00 2001 From: Dipti Date: Wed, 3 Mar 2021 00:32:26 -0800 Subject: [PATCH] pushing lfdata from dipti-branch, adding version number for all new_x_profile in realm.py, version number in test_vt_2 Signed-off-by: Dipti --- py-json/l3_cxprofile2.py | 2 +- py-json/realm.py | 155 ++++++++++++++++++------- py-json/test_base.py | 4 +- py-scripts/test_ipv4_variable_time2.py | 8 +- 4 files changed, 121 insertions(+), 48 deletions(-) mode change 100644 => 100755 py-scripts/test_ipv4_variable_time2.py diff --git a/py-json/l3_cxprofile2.py b/py-json/l3_cxprofile2.py index fb3271d1..03a5f02a 100644 --- a/py-json/l3_cxprofile2.py +++ b/py-json/l3_cxprofile2.py @@ -3,7 +3,7 @@ import re import time import pprint from pprint import pprint -#from lfdata import LFDataCollection +from lfdata import LFDataCollection from base_profile import BaseProfile import os import datetime diff --git a/py-json/realm.py b/py-json/realm.py index 459fd84c..f4d3cdb4 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -22,11 +22,6 @@ import pandas as pd import requests import ast import csv -#Profile Imports -from l3_cxprofile import L3CXProfile -from l3_cxprofile2 import L3CXProfile2 - - def wpa_ent_list(): @@ -765,21 +760,41 @@ class Realm(LFCliBase): link = self.lfclient_url + link info = () - def new_station_profile(self): - station_prof = StationProfile(self.lfclient_url, local_realm=self, debug_=self.debug, up=False) + def new_station_profile(self, ver = 1): + if ver == 1: + #import station_profile + station_prof = StationProfile(self.lfclient_url, local_realm=self, debug_=self.debug, up=False) + #elif ver == 2: + # import station_profile2 + # station_prof = station_profile2.StationProfile2(self.lfclient_url, local_realm=self, debug_=self.debug, up=False) return station_prof - def new_multicast_profile(self): - multi_prof = MULTICASTProfile(self.lfclient_host, self.lfclient_port, + def new_multicast_profile(self, ver = 1): + if ver == 1: + #import multicast_profile + multi_prof = MULTICASTProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug, report_timer_=3000) + #elif ver == 2: + # import multicast_profile2 + # multi_prof = multicast_profile2.MULTICASTProfile2(self.lfclient_host, self.lfclient_port, + # local_realm=self, debug_=self.debug, report_timer_=3000) return multi_prof - def new_wifi_monitor_profile(self, resource_=1, debug_=False, up_=False): - wifi_mon_prof = WifiMonitor(self.lfclient_url, + def new_wifi_monitor_profile(self, resource_=1, debug_=False, up_=False, ver = 1): + if ver == 1: + #import wifi_monitor_profile + wifi_mon_prof = WifiMonitor(self.lfclient_url, local_realm=self, resource_=resource_, up=up_, debug_=(self.debug or debug_)) + #elif ver == 2: + # import wifi_monitor_profile2 + # wifi_mon_prof = wifi_monitor_profile2.WifiMonitor2(self.lfclient_url, + # local_realm=self, + # resource_=resource_, + # up=up_, + # debug_=(self.debug or debug_)) return wifi_mon_prof def new_l3_cx_profile(self, ver = 1): @@ -799,57 +814,117 @@ class Realm(LFCliBase): report_timer_=3000) return cx_prof - def new_l4_cx_profile(self): - cx_prof = L4CXProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + def new_l4_cx_profile(self, ver = 1): + if ver == 1 : + #import l4_cxprofile + cx_prof = L4CXProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + #elif ver == 2: + # import l4_cxprofile2 + # cx_prof = l4_cxprofile2.L4CXProfile2(self.lfclient_host, + # self.lfclient_port, + # local_realm=self, + # debug_=self.debug, + # report_timer_=3000) return cx_prof - def new_generic_endp_profile(self): - endp_prof = GenCXProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + def new_generic_endp_profile(self, ver = 1): + if ver == 1 : + #import gen_cxprofile + endp_prof = GenCXProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + #elif ver == 2: + # import gen_cxprofile2 + # endp_prof = gen_cxprofile2.GenCXProfile(self.lfclient_host, + # self.lfclient_port, + # local_realm=self, + # debug_=self.debug, + # report_timer_=3000) return endp_prof - def new_generic_cx_profile(self): + def new_generic_cx_profile(self, ver = 1): """ @deprecated :return: new GenCXProfile """ - cx_prof = GenCXProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + if ver == 1: + #import gen_cxprofile + cx_prof = GenCXProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + #elif ver == 2: + # import gen_cxprofile2 + # cx_prof = gen_cxprofile2.GenCXProfile(self.lfclient_host, + # self.lfclient_port, + # local_realm=self, + # debug_=self.debug, + # report_timer_=3000) return cx_prof - def new_vap_profile(self): - vap_prof = VAPProfile(lfclient_host=self.lfclient_host, lfclient_port=self.lfclient_port, local_realm=self, + def new_vap_profile(self, ver = 1): + if ver == 1: + #import vap_profile + vap_prof = VAPProfile(lfclient_host=self.lfclient_host, lfclient_port=self.lfclient_port, local_realm=self, debug_=self.debug) + # elif ver == 2: + # import vap_profile2 + # vap_prof = vap_profile2.VAPProfile2(lfclient_host=self.lfclient_host, lfclient_port=self.lfclient_port, local_realm=self, + # debug_=self.debug) return vap_prof - def new_vr_profile(self): - import vr_profile - from vr_profile import VRProfile - vap_prof = VRProfile(local_realm=self, + def new_vr_profile(self, ver = 1): + if ver == 1: + import vr_profile + from vr_profile import VRProfile + vap_prof = vr_profile.VRProfile(local_realm=self, debug=self.debug) + # elif ver == 2: + # import vr_profile2 + # from vr_profile2 import VRProfile2 + # vap_prof = vr_profile2.VRProfile2(local_realm=self, + # debug=self.debug) return vap_prof - def new_http_profile(self): - http_prof = HTTPProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + def new_http_profile(self, ver = 1): + if ver == 1: + #import http_profile + http_prof = HTTPProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + # elif ver == 2: + # import http_profile2 + # http_prof = http_profile2.HTTPProfile2(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) return http_prof - def new_fio_endp_profile(self): - cx_prof = FIOEndpProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + def new_fio_endp_profile(self, ver = 1): + if ver == 1: + #import fio_endp_profile + cx_prof = FIOEndpProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + # elif ver == 2: + # import fio_endp_profile2 + # cx_prof = fio_endp_profile2.FIOEndpProfile2(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) return cx_prof - def new_dut_profile(self): - return DUTProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + def new_dut_profile(self, ver = 1): + if ver == 1: + #import dut_profile + dut_profile = dut_profile.DUTProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + # elif ver == 2: + # import dut_profile2 + # dut_profile = dut_profile2.DUTProfile2(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + return dut_profile - def new_mvlan_profile(self): - return MACVLANProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + def new_mvlan_profile(self, ver = 1): + if ver == 1: + #import mac_vlan_profile + mac_vlan_profile = MACVLANProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + # elif ver == 2: + # import mac_vlan_profile2 + # mac_vlan_profile = mac_vlan_profile2.MACVLANProfile2(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + return mac_vlan_profile - def new_test_group_profile(self): - return TestGroupProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) - - def new_vr_profile(self): - import vr_profile - from vr_profile import VRProfile - profile = VRProfile(local_realm=self, - debug=self.debug) - return profile + def new_test_group_profile(self, ver = 1): + if ver == 1: + #import test_group_profile + test_group_profile = TestGroupProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + # elif ver == 2: + # import test_group_profile2 + # test_group_profile = test_group_profile2.TestGroupProfile2(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug) + return test_group_profile class BaseProfile: def __init__(self, local_realm, debug=False): diff --git a/py-json/test_base.py b/py-json/test_base.py index e2d197a1..5187a94b 100644 --- a/py-json/test_base.py +++ b/py-json/test_base.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import lfdata -import lfreporting +from lfdata import LFDataCollection +#import lfreporting class TestBase: def __init__(self): diff --git a/py-scripts/test_ipv4_variable_time2.py b/py-scripts/test_ipv4_variable_time2.py old mode 100644 new mode 100755 index 9e20af79..019954c9 --- a/py-scripts/test_ipv4_variable_time2.py +++ b/py-scripts/test_ipv4_variable_time2.py @@ -22,10 +22,9 @@ if 'py-json' not in sys.path: sys.path.append(os.path.join(os.path.abspath('..'), 'py-json')) import argparse -#from LANforge.lfcli_base import LFCliBase from LANforge import LFUtils from realm import Realm -from LANforge.test_base import TestBase +from test_base import TestBase import time import datetime @@ -53,7 +52,6 @@ class IPV4VariableTime(Realm, TestBase): super().__init__(lfclient_host=host, lfclient_port=port) - self.add_to self.upstream = upstream self.host = host self.port = port @@ -75,8 +73,8 @@ class IPV4VariableTime(Realm, TestBase): # }) self.name_prefix = name_prefix self.test_duration = test_duration - self.station_profile = self.new_station_profile(station_list=sta_list) - self.cx_profile = self.new_l3_cx_profile(ver=2) + self.station_profile = self.new_station_profile(ver = 2, station_list = sta_list) + self.cx_profile = self.new_l3_cx_profile(ver = 2) #station profile settings self.station_profile.lfclient_url = self.lfclient_url