Fixing test_wanlink so it should work now

Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
Matthew Stidham
2021-03-12 13:33:14 -08:00
parent e5a29934d4
commit 4dd66e6a49
2 changed files with 12 additions and 10 deletions

View File

@@ -23,13 +23,13 @@ j_printer = pprint.PrettyPrinter(indent=2)
# typically you're using resource 1 in stand alone realm # typically you're using resource 1 in stand alone realm
resource_id = 1 resource_id = 1
def main(): def main(base_url="http://localhost:8080"):
base_url = "http://localhost:8080"
json_post = "" json_post = ""
json_response = "" json_response = ""
num_wanlinks = -1 num_wanlinks = -1
# see if there are old wanlinks to remove # see if there are old wanlinks to remove
lf_r = LFRequest.LFRequest(base_url+"/wl/list") lf_r = LFRequest.LFRequest(base_url+"/wl/list")
print(lf_r.get_as_json())
port_a ="rd0a" port_a ="rd0a"
port_b ="rd1a" port_b ="rd1a"

View File

@@ -14,6 +14,7 @@ from LANforge.lfcli_base import LFCliBase
from LANforge.LFUtils import * from LANforge.LFUtils import *
from realm import Realm from realm import Realm
import time import time
import create_wanlink
class LANtoWAN(Realm): class LANtoWAN(Realm):
def __init__(self, host, port, ssid, security, password, def __init__(self, host, port, ssid, security, password,
@@ -59,8 +60,8 @@ class LANtoWAN(Realm):
data = { data = {
"shelf": shelf, "shelf": shelf,
"resource": resource, "resource": resource,
"port": "rdd0", "port": "rd0a",
"peer_ifname": "rdd1" "peer_ifname": "rd1a"
} }
self.json_post(url, data) self.json_post(url, data)
@@ -68,8 +69,8 @@ class LANtoWAN(Realm):
data = { data = {
"shelf": shelf, "shelf": shelf,
"resource": resource, "resource": resource,
"port": "rdd1", "port": "rd1a",
"peer_ifname": "rdd0" "peer_ifname": "rd0a"
} }
self.json_post(url, data) self.json_post(url, data)
time.sleep(.05) time.sleep(.05)
@@ -80,7 +81,7 @@ class LANtoWAN(Realm):
"alias": "wlan0", "alias": "wlan0",
"shelf": shelf, "shelf": shelf,
"resource": resource, "resource": resource,
"port": "rdd0", "port": "rd0a",
"latency": latency, "latency": latency,
"max_rate": max_rate "max_rate": max_rate
} }
@@ -91,15 +92,16 @@ class LANtoWAN(Realm):
"alias": "wlan1", "alias": "wlan1",
"shelf": shelf, "shelf": shelf,
"resource": resource, "resource": resource,
"port": "rdd1", "port": "rd1a",
"latency": latency, "latency": latency,
"max_rate": max_rate "max_rate": max_rate
} }
self.json_post(url, data) self.json_post(url, data)
create_wanlink.main(base_url='http://'+self.host+':8080')
time.sleep(.05) time.sleep(.05)
def run(self): def run(self):
self.cx_profile.use_wpa2(True, self.ssid, self.password) #self.cx_profile.use_wpa2(True, self.ssid, self.password)
self.station_profile.create(radio="wiphy0", num_stations=3, debug=False) self.station_profile.create(radio="wiphy0", num_stations=3, debug=False)
def cleanup(self): pass def cleanup(self): pass
@@ -141,7 +143,7 @@ def main():
lan_port=args.lanport, lan_port=args.lanport,
wan_port=args.wanport) wan_port=args.wanport)
ltw.create_wanlinks() ltw.create_wanlinks()
ltw.run() #ltw.run()
ltw.cleanup() ltw.cleanup()
if __name__ == "__main__": if __name__ == "__main__":