def stop_wipe_and_remove_all_labs(client_library: ClientLibrary): lab_list = client_library.get_lab_list() for lab_id in lab_list: lab = client_library.join_existing_lab(lab_id) lab.stop() lab.wipe() client_library.remove_lab(lab_id)
# setup the connection and clean everything cl = ClientLibrary("http://localhost:8001", "cml2", "cml2cml2", allow_http=True) cl.is_system_ready(wait=True) # set transport if needed - also proxy can be set if needed # cl.licensing.licensing.set_transport(ssms=ssms, proxy_server="172.16.1.100", proxy_port=8888) cl.licensing.set_transport(ssms=SSMS) cl.licensing.install_certificate(cert=CERT) # 'register_wait' method waits max 45s for registration status to become COMPLETED # and another 45s for authorization status to become IN_COMPLIANCE cl.licensing.register_wait(token=TOKEN) lab_list = cl.get_lab_list() for lab_id in lab_list: lab = cl.join_existing_lab(lab_id) lab.stop() lab.wipe() cl.remove_lab(lab_id) lab = cl.create_lab() lab = cl.join_existing_lab(lab_id="lab_1") s1 = lab.create_node("s1", "server", 50, 100) s2 = lab.create_node("s2", "server", 50, 200) print(s1, s2) # create a link between s1 and s2, equivalent to # s1_i1 = s1.create_interface()