def sanity_check(topology): ops1 = topology.get("ops1") assert ops1 is not None switches = [ops1] sleep(2) get_server_crt(switches[0]) rest_sanity_check(SWITCH_IP)
def netop_login(request, topology): global COOKIE_HEADER_1, COOKIE_HEADER_2, SWITCH_IP_1, SWITCH_IP_2, proxy, \ PATH, PATH_INT PATH = "/rest/v1/system" PATH_INT = PATH + "/interfaces" hs1 = topology.get("hs1") assert hs1 is not None ops1 = topology.get("ops1") assert ops1 is not None ops2 = topology.get("ops2") assert ops2 is not None switches = [ops1, ops2] if SWITCH_IP_1 is None: SWITCH_IP_1 = get_switch_ip(switches[0]) if SWITCH_IP_2 is None: SWITCH_IP_2 = get_switch_ip(switches[1]) proxy = environ["https_proxy"] environ["https_proxy"] = "" get_server_crt(switches[0]) if COOKIE_HEADER_1 is None: COOKIE_HEADER_1 = login(SWITCH_IP_1) get_server_crt(switches[1]) if COOKIE_HEADER_2 is None: COOKIE_HEADER_2 = login(SWITCH_IP_2) def cleanup(): global COOKIE_HEADER_1, COOKIE_HEADER_2 environ["https_proxy"] = proxy COOKIE_HEADER_1 = None COOKIE_HEADER_2 = None remove_server_crt() request.addfinalizer(cleanup)
def sanity_check(topology): ops1 = topology.get("ops1") assert ops1 is not None ops2 = topology.get("ops2") assert ops2 is not None switches = [ops1, ops2] sleep(2) get_server_crt(switches[0]) rest_sanity_check(get_switch_ip(switches[0])) get_server_crt(switches[1]) rest_sanity_check(get_switch_ip(switches[1]))
def netop_login(request, topology): global cookie_header, SWITCH_IP, proxy, PATHBASE, PATHSYS PATHBASE = "/rest/v1/system/subsystems/base" PATHSYS = "/rest/v1/system" cookie_header = None ops1 = topology.get("ops1") assert ops1 is not None switches = [ops1] if SWITCH_IP is None: SWITCH_IP = get_switch_ip(switches[0]) proxy = environ["https_proxy"] environ["https_proxy"] = "" get_server_crt(switches[0]) if cookie_header is None: cookie_header = login(SWITCH_IP) def cleanup(): global cookie_header environ["https_proxy"] = proxy cookie_header = None remove_server_crt() request.addfinalizer(cleanup)
def netop_login(request, topology): global cookie_header, SWITCH_IP, proxy, PATH, PATH_PORTS, PATH_INT PATH = "/rest/v1/system" PATH_PORTS = PATH + "/ports" PATH_INT = PATH + "/interfaces" cookie_header = None ops1 = topology.get("ops1") assert ops1 is not None switches = [ops1] if SWITCH_IP is None: SWITCH_IP = get_switch_ip(switches[0]) proxy = environ["https_proxy"] environ["https_proxy"] = "" get_server_crt(switches[0]) if cookie_header is None: cookie_header = login(SWITCH_IP) def cleanup(): global cookie_header environ["https_proxy"] = proxy cookie_header = None remove_server_crt() request.addfinalizer(cleanup)