mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	realm cleaned
This commit is contained in:
		@@ -822,21 +822,13 @@ class Realm(LFCliBase):
 | 
				
			|||||||
    def new_test_group_profile(self):
 | 
					    def new_test_group_profile(self):
 | 
				
			||||||
        return TestGroupProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug)
 | 
					        return TestGroupProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class BaseProfile(LFCliBase):
 | 
					class BaseProfile(LFCliBase):
 | 
				
			||||||
    def __init__(self, local_realm):
 | 
					    def __init__(self, local_realm):
 | 
				
			||||||
        self.parent_realm = local_realm
 | 
					        self.parent_realm = local_realm
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
class BaseProfile(LFCliBase):
 | 
					 | 
				
			||||||
    def __init__(self,local_realm):
 | 
					 | 
				
			||||||
        self.parent_realm=local_realm
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
        self.halt_on_error = False
 | 
					        self.halt_on_error = False
 | 
				
			||||||
        self.exit_on_error = False
 | 
					        self.exit_on_error = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def json_get(self, target):
 | 
					    def json_get(self, target):
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
        return self.parent_realm.json_get(target)
 | 
					        return self.parent_realm.json_get(target)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def json_post(self, req_url, data, debug_=False, suppress_related_commands_=None):
 | 
					    def json_post(self, req_url, data, debug_=False, suppress_related_commands_=None):
 | 
				
			||||||
@@ -875,10 +867,6 @@ class BaseProfile(LFCliBase):
 | 
				
			|||||||
    def wait_until_cxs_appear(self, target, debug=False):
 | 
					    def wait_until_cxs_appear(self, target, debug=False):
 | 
				
			||||||
        return self.parent_realm.wait_until_cxs_appear(target, debug=False)
 | 
					        return self.parent_realm.wait_until_cxs_appear(target, debug=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
        self.debug_ = False
 | 
					 | 
				
			||||||
        return self.parent_realm.json_get(self,target)
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MULTICASTProfile(LFCliBase):
 | 
					class MULTICASTProfile(LFCliBase):
 | 
				
			||||||
    def __init__(self, lfclient_host, lfclient_port, local_realm,
 | 
					    def __init__(self, lfclient_host, lfclient_port, local_realm,
 | 
				
			||||||
@@ -1055,7 +1043,6 @@ class MULTICASTProfile(LFCliBase):
 | 
				
			|||||||
        pprint.pprint(self)
 | 
					        pprint.pprint(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
class L3CXProfile(BaseProfile):
 | 
					class L3CXProfile(BaseProfile):
 | 
				
			||||||
    def __init__(self,
 | 
					    def __init__(self,
 | 
				
			||||||
                 lfclient_host,
 | 
					                 lfclient_host,
 | 
				
			||||||
@@ -1073,16 +1060,6 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
                 name_prefix_="Unset",
 | 
					                 name_prefix_="Unset",
 | 
				
			||||||
                 number_template_="00000",
 | 
					                 number_template_="00000",
 | 
				
			||||||
                 debug_=False):
 | 
					                 debug_=False):
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class L3CXProfile(BaseProfile):
 | 
					 | 
				
			||||||
    def __init__(self, lfclient_host, lfclient_port, local_realm,
 | 
					 | 
				
			||||||
                 side_a_min_bps=None, side_b_min_bps=None,
 | 
					 | 
				
			||||||
                 side_a_max_bps=0, side_b_max_bps=0,
 | 
					 | 
				
			||||||
                 side_a_min_pdu=-1, side_b_min_pdu=-1,
 | 
					 | 
				
			||||||
                 side_a_max_pdu=0, side_b_max_pdu=0,
 | 
					 | 
				
			||||||
                 report_timer_=3000, name_prefix_="Unset", number_template_="00000", debug_=False):
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        :param lfclient_host:
 | 
					        :param lfclient_host:
 | 
				
			||||||
        :param lfclient_port:
 | 
					        :param lfclient_port:
 | 
				
			||||||
@@ -1162,21 +1139,13 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
                monitor_interval=1,
 | 
					                monitor_interval=1,
 | 
				
			||||||
                col_names=None,
 | 
					                col_names=None,
 | 
				
			||||||
                created_cx=None,
 | 
					                created_cx=None,
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
                monitor=True,
 | 
					                monitor=True,
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
                show=True,
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
                report_file=None,
 | 
					                report_file=None,
 | 
				
			||||||
                output_format=None,
 | 
					                output_format=None,
 | 
				
			||||||
                script_name=None,
 | 
					                script_name=None,
 | 
				
			||||||
                arguments=None):
 | 
					                arguments=None):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
            duration_sec = self.parse_time(duration_sec).seconds
 | 
					            duration_sec = self.parse_time(duration_sec).seconds
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
            duration_sec=self.local_realm.parse_time(duration_sec).seconds
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            if (duration_sec is None) or (duration_sec <= 1):
 | 
					            if (duration_sec is None) or (duration_sec <= 1):
 | 
				
			||||||
                raise ValueError("L3CXProfile::monitor wants duration_sec > 1 second")
 | 
					                raise ValueError("L3CXProfile::monitor wants duration_sec > 1 second")
 | 
				
			||||||
@@ -1197,7 +1166,6 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            output_format = report_file.split('.')[-1]
 | 
					            output_format = report_file.split('.')[-1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
        # Step 1, column names
 | 
					        # Step 1, column names
 | 
				
			||||||
        if fields = None:
 | 
					        if fields = None:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
@@ -1205,12 +1173,6 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
            fields = ",".join(col_names)
 | 
					            fields = ",".join(col_names)
 | 
				
			||||||
        print(fields)
 | 
					        print(fields)
 | 
				
			||||||
        # Step 2, monitor columns
 | 
					        # Step 2, monitor columns
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
        #Step 1, column names
 | 
					 | 
				
			||||||
        fields=",".join(col_names)
 | 
					 | 
				
			||||||
        print(fields)
 | 
					 | 
				
			||||||
        #Step 2, monitor columns
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
        start_time = datetime.datetime.now()
 | 
					        start_time = datetime.datetime.now()
 | 
				
			||||||
        end_time = start_time + datetime.timedelta(seconds=duration_sec)
 | 
					        end_time = start_time + datetime.timedelta(seconds=duration_sec)
 | 
				
			||||||
        print(end_time)
 | 
					        print(end_time)
 | 
				
			||||||
@@ -1219,7 +1181,6 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
        passes = 0
 | 
					        passes = 0
 | 
				
			||||||
        expected_passes = 0
 | 
					        expected_passes = 0
 | 
				
			||||||
        old_cx_rx_values = self.__get_rx_values()
 | 
					        old_cx_rx_values = self.__get_rx_values()
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
        timestamps = []
 | 
					        timestamps = []
 | 
				
			||||||
        # for x in range(0,int(round(iterations,0))):
 | 
					        # for x in range(0,int(round(iterations,0))):
 | 
				
			||||||
        if col_names = None:
 | 
					        if col_names = None:
 | 
				
			||||||
@@ -1229,12 +1190,6 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
                response = self.json_get("/endp/all")
 | 
					                response = self.json_get("/endp/all")
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                response = self.json_get("/endp/%s?fields=%s" % (created_cx, fields))
 | 
					                response = self.json_get("/endp/%s?fields=%s" % (created_cx, fields))
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
        timestamps=[]
 | 
					 | 
				
			||||||
        #for x in range(0,int(round(iterations,0))):
 | 
					 | 
				
			||||||
        while datetime.datetime.now() < end_time:
 | 
					 | 
				
			||||||
            response = self.json_get("/endp/%s?fields=%s" % (created_cx, fields))
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
            if "endpoint" not in response:
 | 
					            if "endpoint" not in response:
 | 
				
			||||||
                print(response)
 | 
					                print(response)
 | 
				
			||||||
                raise ValueError("no endpoint?")
 | 
					                raise ValueError("no endpoint?")
 | 
				
			||||||
@@ -1260,15 +1215,8 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
            time.sleep(monitor_interval)
 | 
					            time.sleep(monitor_interval)
 | 
				
			||||||
        print(value_map)
 | 
					        print(value_map)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
        # step 3 organize data
 | 
					 | 
				
			||||||
        endpoints = list()
 | 
					 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
        #if passes == expected_passes:
 | 
					 | 
				
			||||||
            #self._pass("PASS: All tests passed")
 | 
					 | 
				
			||||||
        #step 3 organize data
 | 
					        #step 3 organize data
 | 
				
			||||||
        endpoints=list()
 | 
					        endpoints=list()
 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
        for endpoint in value_map.values():
 | 
					        for endpoint in value_map.values():
 | 
				
			||||||
            endpoints.append(endpoint['endpoint'])
 | 
					            endpoints.append(endpoint['endpoint'])
 | 
				
			||||||
        endpoints2 = []
 | 
					        endpoints2 = []
 | 
				
			||||||
@@ -1280,20 +1228,11 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
            itertools.chain.from_iterable(itertools.repeat(x, len(created_cx.split(','))) for x in timestamps))
 | 
					            itertools.chain.from_iterable(itertools.repeat(x, len(created_cx.split(','))) for x in timestamps))
 | 
				
			||||||
        for point in range(0, len(endpoints2)):
 | 
					        for point in range(0, len(endpoints2)):
 | 
				
			||||||
            endpoints2[point].insert(0, timestamps2[point])
 | 
					            endpoints2[point].insert(0, timestamps2[point])
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
        # step 4 save and close
 | 
					        # step 4 save and close
 | 
				
			||||||
        header_row = col_names
 | 
					        header_row = col_names
 | 
				
			||||||
        header_row.insert(0, 'Timestamp')
 | 
					        header_row.insert(0, 'Timestamp')
 | 
				
			||||||
        print(header_row)
 | 
					        print(header_row)
 | 
				
			||||||
        if output_format.lower() in ['excel', 'xlsx'] or report_file.split('.')[-1] == 'xlsx':
 | 
					        if output_format.lower() in ['excel', 'xlsx'] or report_file.split('.')[-1] == 'xlsx':
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
        #step 4 save and close
 | 
					 | 
				
			||||||
        header_row=col_names
 | 
					 | 
				
			||||||
        print(header_row)
 | 
					 | 
				
			||||||
        header_row.insert(0,'Timestamp')
 | 
					 | 
				
			||||||
        if output_format.lower() in ['excel','xlsx'] or report_file.split('.')[-1] == 'xlsx':
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
            report_fh = open(report_file, "w+")
 | 
					 | 
				
			||||||
            workbook = xlsxwriter.Workbook(report_file)
 | 
					            workbook = xlsxwriter.Workbook(report_file)
 | 
				
			||||||
            worksheet = workbook.add_worksheet()
 | 
					            worksheet = workbook.add_worksheet()
 | 
				
			||||||
            for col_num, data in enumerate(header_row):
 | 
					            for col_num, data in enumerate(header_row):
 | 
				
			||||||
@@ -1348,15 +1287,9 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def refresh_cx(self):
 | 
					    def refresh_cx(self):
 | 
				
			||||||
        for cx_name in self.created_cx.keys():
 | 
					        for cx_name in self.created_cx.keys():
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
            self.json_post("/cli-json/show_cxe", {
 | 
					 | 
				
			||||||
                "test_mgr": "ALL",
 | 
					 | 
				
			||||||
                "cross_connect": cx_name
 | 
					 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
            self.local_realm.json_post("/cli-json/show_cxe", {
 | 
					            self.local_realm.json_post("/cli-json/show_cxe", {
 | 
				
			||||||
                 "test_mgr": "ALL",
 | 
					                 "test_mgr": "ALL",
 | 
				
			||||||
                 "cross_connect": cx_name
 | 
					                 "cross_connect": cx_name
 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
            }, debug_=self.debug)
 | 
					            }, debug_=self.debug)
 | 
				
			||||||
            print(".", end='')
 | 
					            print(".", end='')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1364,13 +1297,8 @@ class L3CXProfile(BaseProfile):
 | 
				
			|||||||
        print("Starting CXs...")
 | 
					        print("Starting CXs...")
 | 
				
			||||||
        for cx_name in self.created_cx.keys():
 | 
					        for cx_name in self.created_cx.keys():
 | 
				
			||||||
            if self.debug:
 | 
					            if self.debug:
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
                print("cx-name: %s" % (cx_name))
 | 
					                print("cx-name: %s" % (cx_name))
 | 
				
			||||||
            self.json_post("/cli-json/set_cx_state", {
 | 
					            self.json_post("/cli-json/set_cx_state", {
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
                print("cx-name: %s"%(cx_name))
 | 
					 | 
				
			||||||
            self.local_realm.json_post("/cli-json/set_cx_state", {
 | 
					 | 
				
			||||||
>>>>>>> e9a071eff8cfb397f9534ea865f8450e43078cee
 | 
					 | 
				
			||||||
                "test_mgr": "default_tm",
 | 
					                "test_mgr": "default_tm",
 | 
				
			||||||
                "cx_name": cx_name,
 | 
					                "cx_name": cx_name,
 | 
				
			||||||
                "cx_state": "RUNNING"
 | 
					                "cx_state": "RUNNING"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user