mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 20:27:54 +00:00
lf_check.py config.ini : check comcast setup
Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
63
py-scripts/sandbox/config.ini
Normal file
63
py-scripts/sandbox/config.ini
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#
|
||||||
|
# NAME : config.ini
|
||||||
|
#
|
||||||
|
# PURPOSE : Configuration (config.ini) information for running lf_check.py
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
[AP_CONFIG]
|
||||||
|
SSID = "jedway-wpa2-x2048-5-3"
|
||||||
|
PASSWD ="jedway-wpa2-x2048-5-3"
|
||||||
|
SECURITY= "wpa2"
|
||||||
|
|
||||||
|
[RADIO_CFG]
|
||||||
|
RADIO_USED = "wiphy0"
|
||||||
|
|
||||||
|
[NUM_STATION]
|
||||||
|
STATIONS = "4"
|
||||||
|
|
||||||
|
[TEST_IP]
|
||||||
|
HTTP_TEST_IP = "10.40.0.1"
|
||||||
|
FTP_TEST_IP = "10.40.0.1"
|
||||||
|
|
||||||
|
[LF_GUI]
|
||||||
|
LF_MG= localhost
|
||||||
|
LF_MGR_PORT=8080
|
||||||
|
|
||||||
|
[REPORTS]
|
||||||
|
REPORT_DIR="/home/lanforge/html-reports"
|
||||||
|
REPORT_DATA="/home/lanforge/report-data"
|
||||||
|
|
||||||
|
[TESTS_LIST_COMPLETE]
|
||||||
|
test_list_complete: {
|
||||||
|
"1":["example_security_connection"],
|
||||||
|
"2":["test_ipv4_connection"],
|
||||||
|
"3":["test_generic"],
|
||||||
|
"4":["test_ipv4_l4_urls_per_ten"],
|
||||||
|
"5":["test_ipv4_l4_wifi"],
|
||||||
|
"6":["test_ipv4_l4"],
|
||||||
|
"7":["test_ipv4_variable_time"],
|
||||||
|
"8":["create_bridge"],
|
||||||
|
"9":["create_l3"],
|
||||||
|
"10":["create_l4"],
|
||||||
|
"11":["create_macvlan"],
|
||||||
|
"12":["create_station"],
|
||||||
|
"13":["create_vap"],
|
||||||
|
"14":["cpu_stats"],
|
||||||
|
"15":["test_fileio"],
|
||||||
|
"16":["testgroup"],
|
||||||
|
"17":["test_ipv6_connection"],
|
||||||
|
"18":["test_ipv6_variable_time"],
|
||||||
|
"19":["test_l3_longevity"],
|
||||||
|
"20":["test_l3_powersave_traffic"],
|
||||||
|
"21":["test_l3_scenario_throughput"],
|
||||||
|
"22":["test_status_msg"],
|
||||||
|
"23":["test_wanlink"],
|
||||||
|
"24":["wlan_theoretical_sta"],
|
||||||
|
"25":["ws_generic_monitor_test"],
|
||||||
|
"26":["sta_connect2"],
|
||||||
|
"27":["wlan_capacity_calculator"],
|
||||||
|
"28":["test_generic"],
|
||||||
|
"29":["new_script"],
|
||||||
|
"30":["sta_connect_example"]}
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ if sys.version_info[0] != 3:
|
|||||||
print("This script requires Python3")
|
print("This script requires Python3")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@@ -27,9 +28,12 @@ import serial
|
|||||||
from pexpect_serial import SerialSpawn
|
from pexpect_serial import SerialSpawn
|
||||||
import json
|
import json
|
||||||
from json import load
|
from json import load
|
||||||
|
import configparser
|
||||||
from pprint import *
|
from pprint import *
|
||||||
|
|
||||||
|
|
||||||
|
CONFIG_FILE = os.getcwd() + '/py-scripts/sandbox/config.ini'
|
||||||
|
|
||||||
# see https://stackoverflow.com/a/13306095/11014343
|
# see https://stackoverflow.com/a/13306095/11014343
|
||||||
class FileAdapter(object):
|
class FileAdapter(object):
|
||||||
def __init__(self, logger):
|
def __init__(self, logger):
|
||||||
@@ -44,17 +48,30 @@ class FileAdapter(object):
|
|||||||
|
|
||||||
|
|
||||||
class lf_check():
|
class lf_check():
|
||||||
|
def __init__(self):
|
||||||
|
self.ssid =""
|
||||||
|
self.passwd =""
|
||||||
|
self.security =""
|
||||||
|
|
||||||
# Functions in this section are/can be overridden by descendants
|
# Functions in this section are/can be overridden by descendants
|
||||||
def readConfigContents(self, config_file):
|
def readConfigContents(self):
|
||||||
|
config_file = configparser.ConfigParser()
|
||||||
success = True
|
success = True
|
||||||
|
success = config_file.read(CONFIG_FILE)
|
||||||
|
print("{}".format(success))
|
||||||
|
print("{}".format(config_file))
|
||||||
|
|
||||||
if 'TEST_CONFIG' in config_file.sections():
|
if 'AP_CONFIG' in config_file.sections():
|
||||||
section = config_file['TEST_CONFIG']
|
config_instance = config_file['AP_CONFIG']
|
||||||
try:
|
try:
|
||||||
lf_globals.test_list = json.loads(section.get(lf_testlist,lf_gloabs.test_list))
|
self.ssid = config_instance.get('SSID')
|
||||||
print("test list retrieved")
|
self.passwd = config_instance.get('PASSWD')
|
||||||
print("test list: {}".format(lf_globals.test_list))
|
self.security = config_instance.get('SECURITY')
|
||||||
|
|
||||||
|
print("AP_CONFIG retrieved")
|
||||||
|
print("ssid {}".format(self.ssid))
|
||||||
|
print("passwd {}".format(self.passwd))
|
||||||
|
print("security {}".format(self.security))
|
||||||
except:
|
except:
|
||||||
print("no test list")
|
print("no test list")
|
||||||
|
|
||||||
@@ -159,7 +176,8 @@ class lf_check():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
check = lf_check()
|
check = lf_check()
|
||||||
check.parse_ap_stats()
|
#check.parse_ap_stats()
|
||||||
|
check.readConfigContents()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user