mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
v1 classes are taken out of realm.py, into their own files
Signed-off-by: Dipti <dipti.dhond@candelatech.com>
This commit is contained in:
@@ -491,6 +491,32 @@ class LFCliBase:
|
||||
elif level == "error":
|
||||
logging.error(mesg)
|
||||
|
||||
@staticmethod
|
||||
def parse_time(time_string):
|
||||
if isinstance(time_string, str):
|
||||
pattern = re.compile("^(\d+)([dhms]$)")
|
||||
td = pattern.match(time_string)
|
||||
if td is not None:
|
||||
dur_time = int(td.group(1))
|
||||
dur_measure = str(td.group(2))
|
||||
if dur_measure == "d":
|
||||
duration_time = datetime.timedelta(days=dur_time)
|
||||
elif dur_measure == "h":
|
||||
duration_time = datetime.timedelta(hours=dur_time)
|
||||
elif dur_measure == "m":
|
||||
duration_time = datetime.timedelta(minutes=dur_time)
|
||||
elif dur_measure == "ms":
|
||||
duration_time = datetime.timedelta(milliseconds=dur_time)
|
||||
elif dur_measure == "w":
|
||||
duration_time = datetime.timedelta(weeks=dur_time)
|
||||
else:
|
||||
duration_time = datetime.timedelta(seconds=dur_time)
|
||||
else:
|
||||
raise ValueError("Cannot compute time string provided: %s" % time_string)
|
||||
else:
|
||||
raise ValueError("time_string must be of type str. Type %s provided" % type(time_string))
|
||||
return duration_time
|
||||
|
||||
# This style of Action subclass for argparse can't do much unless we incorporate
|
||||
# our argparse as a member of LFCliBase. Then we can do something like automatically
|
||||
# parse our proxy string without using _init_ arguments
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
#!/usr/bin/env python3
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
import port_utils
|
||||
from port_utils import PortUtils
|
||||
from pprint import pprint
|
||||
import pprint
|
||||
import time
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
import re
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from pprint import pprint
|
||||
import requests
|
||||
import pprint
|
||||
import pandas as pd
|
||||
import time
|
||||
import datetime
|
||||
import ast
|
||||
import csv
|
||||
import os
|
||||
|
||||
@@ -158,7 +161,7 @@ class L4CXProfile(LFCliBase):
|
||||
iterations=0,
|
||||
debug=False):
|
||||
try:
|
||||
duration_sec = Realm.parse_time(duration_sec).seconds
|
||||
duration_sec = LFCliBase.parse_time(duration_sec).seconds
|
||||
except:
|
||||
if (duration_sec is None) or (duration_sec <= 1):
|
||||
raise ValueError("L4CXProfile::monitor wants duration_sec > 1 second")
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
|
||||
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import time
|
||||
import pprint
|
||||
|
||||
|
||||
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
import csv
|
||||
import pandas as pd
|
||||
import os
|
||||
from pprint import pprint
|
||||
import time
|
||||
import random
|
||||
import string
|
||||
import datetime
|
||||
import pprint
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class MULTICASTProfile(LFCliBase):
|
||||
|
||||
2360
py-json/realm.py
2360
py-json/realm.py
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user