lf_check.py: update to have customized email title, text and remote lf_mgr

information
lf_check.json : json example

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-06-20 15:11:35 -06:00
parent e7b1a639c8
commit 886cde2244
2 changed files with 48 additions and 8 deletions

View File

@@ -8,7 +8,10 @@
"email_list_production": "chuck.rekiere@candelatech.com",
"host_ip_production": "192.168.95.6",
"email_list_test": "chuck.rekiere@candelatech.com",
"host_ip_test": "192.168.95.6"
"host_ip_test": "192.168.95.6",
"lf_mgr": "192.168.100.116",
"email_title_txt": "Dataplane Test",
"email_txt": "Dataplane Regression testing "
},
"test_network":{
"http_test_ip": "10.40.0.10",
@@ -37,10 +40,17 @@
"suite_two":{
"test_l3_longevity":{"enabled":"TRUE","command":"test_l3_longevity.py","args":"--test_duration 15s --polling_interval 5s --upstream_port eth1 --radio 'radio==wiphy1,stations==4,ssid==ct523c-vap,ssid_pw==ct523c-vap,security==wpa2' --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000"}
},
"TEST_DICTONARY":{
"create_l3":{"enabled":"TRUE","command":"create_l4.py","args":"--radio RADIO_USED --ssid SSID_USED --passwd SSID_PW_USED --security SECURITY_USED --debug"},
"test_l3_longevity":{"enabled":"TRUE","command":"test_l3_longevity.py","args":"--test_duration 15s --polling_interval 5s --upstream_port eth1 --radio 'radio==wiphy1,stations==4,ssid==ct523c-vap,ssid_pw==ct523c-vap,security==wpa2' --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000"}
"suite_dp":{
"create_station":{"enabled":"TRUE","command":"create_station.py","args":"--radio RADIO_USED --start_id 2 --num_stations 1 --ssid SSID_USED --passwd SSID_PW_USED --security SECURITY_USED --debug"},
"data_plane_0":{"enabled":"TRUE","load_db":"skip","command":"lf_dataplane_test.py","args":"--json lf_dp.json --influx_json lf_influx_db.json"},
"data_plane_1":{"enabled":"TRUE","load_db":"skip","command":"lf_dataplane_test.py","args":"--json lf_dp.json --influx_json lf_influx_db.json"},
"data_plane_2":{"enabled":"TRUE","load_db":"skip","command":"lf_dataplane_test.py","args":"--json lf_dp.json --influx_json lf_influx_db.json"}
},
"TEST_DICTIONARY":{
"create_station":{"enabled":"TRUE","command":"create_station.py","args":"--radio RADIO_USED --start_id 2 --num_stations 1 --ssid SSID_USED --passwd SSID_PW_USED --security SECURITY_USED --debug"},
"data_plane_0":{"enabled":"TRUE","load_db":"skip","command":"lf_dataplane_test.py","args":"--json lf_dp.json --influx_json lf_influx_db.json"},
"data_plane_1":{"enabled":"TRUE","load_db":"skip","command":"lf_dataplane_test.py","args":"--json lf_dp.json --influx_json lf_influx_db.json"},
"data_plane_2":{"enabled":"TRUE","load_db":"skip","command":"lf_dataplane_test.py","args":"--json lf_dp.json --influx_json lf_influx_db.json"}
}
}
}

View File

@@ -125,6 +125,10 @@ class lf_check():
self.host_ip_production = None
self.email_list_test = ""
self.host_ip_test = None
self.email_title_txt = ""
self.email_txt = ""
self.lf_mgr = "" # lanforge tests are run against if passed in
# NOT complete : will send the email results
def send_results_email(self, report_file=None):
@@ -139,12 +143,23 @@ class lf_check():
#command = 'echo "$HOSTNAME mail system works!" | mail -s "Test: $HOSTNAME $(date)" chuck.rekiere@candelatech.com'
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
message_txt = """Results from {hostname}:
if(self.email_txt != ""):
message_txt = """{email_txt} lanforge target {lf_mgr}
Results from {hostname}:
http://{ip}/{report}
NOTE: for now to see stdout and stderr remove /home/lanforge from path.
""".format(hostname=hostname, ip=ip, report=report_url, email_txt=self.email_txt, lf_mgr=self.lf_mgr)
else:
message_txt = """Results from {hostname}:
http://{ip}/{report}
NOTE: for now to see stdout and stderr remove /home/lanforge from path.
""".format(hostname=hostname, ip=ip, report=report_url)
mail_subject = "Regression Test [{hostname}] {date}".format(hostname=hostname, date=datetime.datetime.now())
if(self.email_title_txt != ""):
mail_subject = "{} [{hostname}] {date}".format(self.email_title_txt,hostname=hostname, date=datetime.datetime.now())
else:
mail_subject = "Regression Test [{hostname}] {date}".format(hostname=hostname, date=datetime.datetime.now())
try:
if self.production_run == True:
msg = message_txt.format(ip=self.host_ip_production)
@@ -301,14 +316,28 @@ NOTE: for now to see stdout and stderr remove /home/lanforge from path.
exit(1)
if "email_list_test" in self.json_data["test_parameters"]:
self.email_list_test = self.json_data["test_parameters"]["email_list_test"]
print(self.email_list_test)
else:
self.logger.info("email_list_test not in test_parameters json")
exit(1)
if "host_ip_test" in self.json_data["test_parameters"]:
self.email_list_test = self.json_data["test_parameters"]["host_ip_test"]
self.host_ip_test = self.json_data["test_parameters"]["host_ip_test"]
else:
self.logger.info("host_ip_test not in test_parameters json")
exit(1)
if "email_title_txt" in self.json_data["test_parameters"]:
self.email_title_txt = self.json_data["test_parameters"]["email_title_txt"]
else:
self.logger.info("email_title_txt not in test_parameters json")
if "email_txt" in self.json_data["test_parameters"]:
self.email_txt = self.json_data["test_parameters"]["email_txt"]
else:
self.logger.info("email_txt not in test_parameters json")
if "lf_mgr" in self.json_data["test_parameters"]:
self.lf_mgr_port = self.json_data["test_parameters"]["lf_mgr"]
else:
self.logger.info("lf_mgr not in test_parameters json")
def read_test_network(self):
if "http_test_ip" in self.json_data["test_network"]:
@@ -392,6 +421,7 @@ NOTE: for now to see stdout and stderr remove /home/lanforge from path.
self.host_ip_production = section['HOST_IP_PRODUCTION']
self.email_list_test = section['EMAIL_LIST_TEST']
self.host_ip_test = section['HOST_IP_TEST']
self.logger.info("self.email_list_test:{}".format(self.email_list_test))
if 'TEST_NETWORK' in config_file.sections():
section = config_file['TEST_NETWORK']