mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
Inheritance from base_profile works
Signed-off-by: Dipti <dipti.dhond@candelatech.com>
This commit is contained in:
@@ -590,31 +590,31 @@ class LFCliBase:
|
||||
}
|
||||
self.json_post("/cli-json/add_event", data, debug_=debug_)
|
||||
|
||||
def read_file(self,
|
||||
filename):
|
||||
#Convert file contents to a list
|
||||
filename = open(filename, 'r')
|
||||
return [line.split(',') for line in filename.readlines()]
|
||||
# def read_file(self,
|
||||
# filename):
|
||||
# #Convert file contents to a list
|
||||
# filename = open(filename, 'r')
|
||||
# return [line.split(',') for line in filename.readlines()]
|
||||
|
||||
def random_chars(self,
|
||||
size,
|
||||
chars=None):
|
||||
#Create random characters made of letters
|
||||
if chars is None:
|
||||
chars = string.ascii_letters
|
||||
return ''.join(random.choice(chars) for x in range(size))
|
||||
# def random_chars(self,
|
||||
# size,
|
||||
# chars=None):
|
||||
# #Create random characters made of letters
|
||||
# if chars is None:
|
||||
# chars = string.ascii_letters
|
||||
# return ''.join(random.choice(chars) for x in range(size))
|
||||
|
||||
def get_milliseconds(self,
|
||||
timestamp):
|
||||
return (timestamp - datetime.datetime(1970,1,1)).total_seconds()*1000
|
||||
def get_seconds(self,
|
||||
timestamp):
|
||||
return (timestamp - datetime.datetime(1970,1,1)).total_seconds()
|
||||
# def get_milliseconds(self,
|
||||
# timestamp):
|
||||
# return (timestamp - datetime.datetime(1970,1,1)).total_seconds()*1000
|
||||
# def get_seconds(self,
|
||||
# timestamp):
|
||||
# return (timestamp - datetime.datetime(1970,1,1)).total_seconds()
|
||||
|
||||
|
||||
def replace_special_char(self,
|
||||
str):
|
||||
return str.replace('+', ' ').replace('_', ' ').strip(' ')
|
||||
# def replace_special_char(self,
|
||||
# str):
|
||||
# return str.replace('+', ' ').replace('_', ' ').strip(' ')
|
||||
|
||||
Help_Mode = """Station WiFi modes: use the number value below:
|
||||
auto : 0,
|
||||
|
||||
@@ -4,6 +4,10 @@ import re
|
||||
import time
|
||||
import pprint
|
||||
import csv
|
||||
import datetime
|
||||
import random
|
||||
import string
|
||||
from pprint import pprint
|
||||
#from LANforge.lfcriteria import LFCriteria
|
||||
|
||||
class BaseProfile:
|
||||
@@ -54,6 +58,33 @@ class BaseProfile:
|
||||
def logg(self, message=None):
|
||||
self.parent_realm.logg(message)
|
||||
|
||||
|
||||
def replace_special_char(self,
|
||||
str):
|
||||
return str.replace('+', ' ').replace('_', ' ').strip(' ')
|
||||
|
||||
def get_milliseconds(self,
|
||||
timestamp):
|
||||
return (timestamp - datetime.datetime(1970,1,1)).total_seconds()*1000
|
||||
def get_seconds(self,
|
||||
timestamp):
|
||||
return (timestamp - datetime.datetime(1970,1,1)).total_seconds()
|
||||
def read_file(self,
|
||||
filename):
|
||||
#Convert file contents to a list
|
||||
filename = open(filename, 'r')
|
||||
return [line.split(',') for line in filename.readlines()]
|
||||
|
||||
def random_chars(self,
|
||||
size,
|
||||
chars=None):
|
||||
#Create random characters made of letters
|
||||
if chars is None:
|
||||
chars = string.ascii_letters
|
||||
return ''.join(random.choice(chars) for x in range(size))
|
||||
|
||||
|
||||
|
||||
# #Find file path to save data/csv to:
|
||||
# if args.report_file is None:
|
||||
# new_file_path = str(datetime.datetime.now().strftime("%Y-%m-%d-%H-h-%M-m-%S-s")).replace(':',
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
import re
|
||||
import time
|
||||
import pprint
|
||||
from LANforge import lfcli_base
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from base_profile import BaseProfile
|
||||
import csv
|
||||
import pandas as pd
|
||||
import os
|
||||
@@ -14,7 +13,7 @@ import random
|
||||
import string
|
||||
import datetime
|
||||
|
||||
class L3CXProfile(LFCliBase):
|
||||
class L3CXProfile(BaseProfile):
|
||||
def __init__(self,
|
||||
lfclient_host,
|
||||
lfclient_port,
|
||||
@@ -47,7 +46,7 @@ class L3CXProfile(LFCliBase):
|
||||
:param number_template_: how many zeros wide we padd, possibly a starting integer with left padding
|
||||
:param debug_:
|
||||
"""
|
||||
super().__init__(lfclient_host, lfclient_port, debug_, _halt_on_error=True)
|
||||
super().__init__(local_realm, debug = debug_)
|
||||
self.debug = debug_
|
||||
self.local_realm = local_realm
|
||||
self.side_a_min_pdu = side_a_min_pdu
|
||||
|
||||
Reference in New Issue
Block a user