mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
run autopep8 on create_vr
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -50,7 +50,8 @@ class CreateVR(Realm):
|
|||||||
self.vr_profile = self.new_vr_profile()
|
self.vr_profile = self.new_vr_profile()
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if (self.vr_name is None) or (self.vr_profile.vr_eid is None) and (self.vr_profile.vr_eid) == "":
|
if (self.vr_name is None) or (self.vr_profile.vr_eid is None) and (
|
||||||
|
self.vr_profile.vr_eid) == "":
|
||||||
print("No vr_eid to clean")
|
print("No vr_eid to clean")
|
||||||
return
|
return
|
||||||
self.rm_port("1.1.rd90a", debug_=self.debug)
|
self.rm_port("1.1.rd90a", debug_=self.debug)
|
||||||
@@ -84,9 +85,9 @@ class CreateVR(Realm):
|
|||||||
"cx_name": "all"
|
"cx_name": "all"
|
||||||
}, debug_=self.debug)
|
}, debug_=self.debug)
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.vr_profile.apply_netsmith(self.vr_name[1], delay=5, debug=self.debug)
|
self.vr_profile.apply_netsmith(
|
||||||
|
self.vr_name[1], delay=5, debug=self.debug)
|
||||||
self.json_post("/cli-json/add_rdd", {
|
self.json_post("/cli-json/add_rdd", {
|
||||||
"shelf": 1,
|
"shelf": 1,
|
||||||
"resource": self.vr_name[1],
|
"resource": self.vr_name[1],
|
||||||
@@ -101,10 +102,17 @@ class CreateVR(Realm):
|
|||||||
"peer_ifname": "rd90a",
|
"peer_ifname": "rd90a",
|
||||||
"report_timer": "3000"
|
"report_timer": "3000"
|
||||||
})
|
})
|
||||||
self.wait_until_ports_appear(sta_list=["1.1.rd90a", "1.1.rd90b"], debug_=self.debug)
|
self.wait_until_ports_appear(
|
||||||
self.vr_profile.vrcx_list(resource=self.vr_name[1], do_sync=True) # do_sync
|
sta_list=[
|
||||||
|
"1.1.rd90a",
|
||||||
|
"1.1.rd90b"],
|
||||||
|
debug_=self.debug)
|
||||||
|
self.vr_profile.vrcx_list(
|
||||||
|
resource=self.vr_name[1],
|
||||||
|
do_sync=True) # do_sync
|
||||||
self.vr_profile.create(vr_name=self.vr_name, debug=self.debug)
|
self.vr_profile.create(vr_name=self.vr_name, debug=self.debug)
|
||||||
self.vr_profile.sync_netsmith(resource=self.vr_name[1], debug=self.debug)
|
self.vr_profile.sync_netsmith(
|
||||||
|
resource=self.vr_name[1], debug=self.debug)
|
||||||
self._pass("created router")
|
self._pass("created router")
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
@@ -113,25 +121,39 @@ class CreateVR(Realm):
|
|||||||
:return: void
|
:return: void
|
||||||
"""
|
"""
|
||||||
# move rd90a into router
|
# move rd90a into router
|
||||||
self.vr_profile.refresh_netsmith(resource=self.vr_name[1], debug=self.debug)
|
self.vr_profile.refresh_netsmith(
|
||||||
|
resource=self.vr_name[1], debug=self.debug)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
pprint(("vr_eid", self.vr_name))
|
pprint(("vr_eid", self.vr_name))
|
||||||
self.vr_profile.wait_until_vrcx_appear(resource=self.vr_name[1], name_list=["rd90a", "rd90b"])
|
self.vr_profile.wait_until_vrcx_appear(
|
||||||
self.vr_profile.add_vrcx(vr_eid=self.vr_name, connection_name_list="rd90a", debug=True)
|
resource=self.vr_name[1], name_list=[
|
||||||
|
"rd90a", "rd90b"])
|
||||||
|
self.vr_profile.add_vrcx(
|
||||||
|
vr_eid=self.vr_name,
|
||||||
|
connection_name_list="rd90a",
|
||||||
|
debug=True)
|
||||||
|
|
||||||
self.vr_profile.refresh_netsmith(resource=self.vr_name[1], debug=self.debug)
|
self.vr_profile.refresh_netsmith(
|
||||||
|
resource=self.vr_name[1], debug=self.debug)
|
||||||
# test to make sure that vrcx is inside vr we expect
|
# test to make sure that vrcx is inside vr we expect
|
||||||
self.vr_profile.vrcx_list(resource=self.vr_name[1], do_sync=True)
|
self.vr_profile.vrcx_list(resource=self.vr_name[1], do_sync=True)
|
||||||
vr_list = self.vr_profile.router_list(resource=self.vr_name[1], do_refresh=True)
|
vr_list = self.vr_profile.router_list(
|
||||||
router = self.vr_profile.find_cached_router(resource=self.vr_name[1], router_name=self.vr_name[2])
|
resource=self.vr_name[1], do_refresh=True)
|
||||||
|
router = self.vr_profile.find_cached_router(
|
||||||
|
resource=self.vr_name[1], router_name=self.vr_name[2])
|
||||||
pprint(("cached router 120: ", router))
|
pprint(("cached router 120: ", router))
|
||||||
router_eid = LFUtils.name_to_eid(router["eid"])
|
router_eid = LFUtils.name_to_eid(router["eid"])
|
||||||
pprint(("router eid 122: ", router_eid))
|
pprint(("router eid 122: ", router_eid))
|
||||||
full_router = self.json_get("/vr/1/%s/%s/%s" %(router_eid[0], router_eid[1], self.vr_name[2]), debug_=True)
|
full_router = self.json_get(
|
||||||
|
"/vr/1/%s/%s/%s" %
|
||||||
|
(router_eid[0],
|
||||||
|
router_eid[1],
|
||||||
|
self.vr_name[2]),
|
||||||
|
debug_=True)
|
||||||
pprint(("full router: ", full_router))
|
pprint(("full router: ", full_router))
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
if router is None:
|
if router is None:
|
||||||
self._fail("Unable to find router after vrcx move "+self.vr_name)
|
self._fail("Unable to find router after vrcx move " + self.vr_name)
|
||||||
self.exit_fail()
|
self.exit_fail()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
@@ -156,7 +178,10 @@ Command example:
|
|||||||
|
|
||||||
optional = parser.add_argument_group('optional arguments')
|
optional = parser.add_argument_group('optional arguments')
|
||||||
|
|
||||||
optional.add_argument('--ports', default=None, required=False,
|
optional.add_argument(
|
||||||
|
'--ports',
|
||||||
|
default=None,
|
||||||
|
required=False,
|
||||||
help='Comma separated list of ports to add to virtual router')
|
help='Comma separated list of ports to add to virtual router')
|
||||||
optional.add_argument('--services', default=None, required=False,
|
optional.add_argument('--services', default=None, required=False,
|
||||||
help='Add router services to a port, "br0=nat,dhcp"')
|
help='Add router services to a port, "br0=nat,dhcp"')
|
||||||
@@ -175,10 +200,11 @@ Command example:
|
|||||||
create_vr.build()
|
create_vr.build()
|
||||||
create_vr.start()
|
create_vr.start()
|
||||||
create_vr.monitor()
|
create_vr.monitor()
|
||||||
#create_vr.stop()
|
# create_vr.stop()
|
||||||
#create_vr.clean()
|
# create_vr.clean()
|
||||||
print('Created Virtual Router')
|
print('Created Virtual Router')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user