mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
GUI: jbr_create_wanlink.py WIP
rewrote towards updated API Signed-off-by: Jed Reynolds <jed@candelatech.com>
This commit is contained in:
committed by
Jed Reynolds
parent
90232ed5ed
commit
7d9ab67572
@@ -25,8 +25,9 @@ if sys.version_info[0] != 3:
|
||||
sys.path.insert(1, "../../py-json")
|
||||
import argparse
|
||||
import pprint
|
||||
from LANforge import lf_json_autogen
|
||||
from LANforge.lf_json_autogen import LFJsonGet as LFG
|
||||
from LANforge.lf_json_autogen import LFSession
|
||||
from LANforge.lf_json_autogen import LFJsonCommand
|
||||
from LANforge.lf_json_autogen import LFJsonQuery
|
||||
|
||||
|
||||
# import LANforge.lfcli_base
|
||||
@@ -43,53 +44,65 @@ def main():
|
||||
parser.add_argument("--host", help='specify the GUI to connect to, assumes port 8080')
|
||||
parser.add_argument("--wl_name", help='name of the wanlink to create')
|
||||
parser.add_argument("--resource", help='LANforge resource')
|
||||
parser.add_argument("--debug", help='turn on debugging', action="store_true")
|
||||
|
||||
args = parser.parse_args()
|
||||
if not args.wl_name:
|
||||
print("No wanlink name provided")
|
||||
exit(1)
|
||||
post_rq = lf_json_autogen.LFJsonPost(lfclient_host=args.host,
|
||||
lfclient_port=8080,
|
||||
debug_=False,
|
||||
_exit_on_error=True)
|
||||
get_request = LFG(lfclient_host=args.host,
|
||||
lfclient_port=8080,
|
||||
debug_=False,
|
||||
_exit_on_error=True)
|
||||
|
||||
post_rq.post_add_rdd(resource=args.resource,
|
||||
session = LFSession(lfclient_url="http://%s:8080" % args.host,
|
||||
debug=args.debug,
|
||||
connection_timeout_sec=2.0,
|
||||
stream_errors=True,
|
||||
stream_warnings=True,
|
||||
exit_on_error=True)
|
||||
command: LFJsonCommand
|
||||
command = session.get_command()
|
||||
query: LFJsonQuery
|
||||
query = session.get_query()
|
||||
|
||||
|
||||
command.post_add_rdd(resource=args.resource,
|
||||
port="rd0a",
|
||||
peer_ifname="rd0b",
|
||||
report_timer=1000,
|
||||
shelf=1,
|
||||
debug_=False)
|
||||
post_rq.post_add_rdd(resource=args.resource,
|
||||
debug_=args.debug)
|
||||
|
||||
command.post_add_rdd(resource=args.resource,
|
||||
port="rd1a",
|
||||
peer_ifname="rd1b",
|
||||
report_timer=1000,
|
||||
shelf=1,
|
||||
debug_=False)
|
||||
debug_=args.debug)
|
||||
|
||||
endp_a = args.wl_name + "-A"
|
||||
endp_b = args.wl_name + "-B"
|
||||
post_rq.post_add_wl_endp(alias=endp_a,
|
||||
command.post_add_wl_endp(alias=endp_a,
|
||||
resource=args.resource,
|
||||
port="rd0a",
|
||||
shelf=1,
|
||||
debug_=False)
|
||||
post_rq.post_add_wl_endp(alias=endp_b,
|
||||
debug_=args.debug)
|
||||
command.post_add_wl_endp(alias=endp_b,
|
||||
resource=args.resource,
|
||||
port="rd1a",
|
||||
shelf=1,
|
||||
debug_=True)
|
||||
post_rq.post_add_cx(alias=args.wl_name,
|
||||
debug_=args.debug)
|
||||
command.post_add_cx(alias=args.wl_name,
|
||||
rx_endp=endp_a,
|
||||
tx_endp=endp_b,
|
||||
test_mgr="default_tm",
|
||||
debug_=True)
|
||||
|
||||
result = get_request.get_wl(eid_list=(args.wl_name))
|
||||
debug_=args.debug)
|
||||
ewarn_list = []
|
||||
result = query.get_wl(eid_list=(args.wl_name),
|
||||
wait_sec=0.2,
|
||||
timeout_sec=2.0,
|
||||
errors_warnings=ewarn_list,
|
||||
debug=args.debug)
|
||||
pprint.pprint(result)
|
||||
result = get_request.get_wl_endp(eid_list=(args.wl_name+"-A", args.wl_name+"-B"))
|
||||
result = query.get_wl_endp(eid_list=(args.wl_name+"-A", args.wl_name+"-B"),
|
||||
debug=args.debug)
|
||||
pprint.pprint(result)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user