def test_bgp_full_config(): try: net = IPNet(topo=BGPTopoFull()) net.start() for path in full_paths: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_bgp_policies(topology): try: net = IPNet(topo=topology()) net.start() for path in policies_paths[topology.__name__]: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_bgp_local_pref(): try: net = IPNet(topo=BGPTopoLocalPref()) net.start() for path in local_pref_paths: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_bgp_rr(): try: net = IPNet(topo=BGPTopoRR()) net.start() for path in rr_paths: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_ripng_adjust(): try: net = IPNet(topo=RIPngNetworkAdjust(lr1r5_cost=5)) net.start() assert_connectivity(net, v6=True) for path in expected_paths["RIPngNetworkAdjust-mod"]: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_ripng(): try: net = IPNet(topo=MinimalRIPngNet()) net.start() assert_connectivity(net, v6=True) for path in expected_paths: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_ripng_examples(topo): try: net = IPNet(topo=topo()) net.start() assert_connectivity(net, v6=True) for path in expected_paths[topo.__name__]: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def test_static_examples(routes, paths, through): try: topo = SRv6TestTopo(new_routes=routes) net = IPNet(topo=topo) net.start() assert_connectivity(net, v6=False) for i, p in enumerate(paths): assert_path(net, p, v6=True, traceroute_fun=sr_path, through=through[i], timeout=1, retry=30) topo.clean() net.stop() finally: cleanup()
def test_staticd_example(): try: net = IPNet(topo=StaticRoutingNet()) net.start() assert_connectivity(net, v6=False) assert_connectivity(net, v6=True) paths = [["h1", "r1", "r2", "h2"], ["h2", "r2", "r1", "h1"]] for p in paths: assert_path(net, p, v6=False) assert_path(net, p, v6=True) net.stop() finally: cleanup()
def test_static_examples(topo, connected, v4, v6): try: net = IPNet(topo=topo()) net.start() if connected and v4: assert_connectivity(net, v6=False) if connected and v6: assert_connectivity(net, v6=True) for p in static_paths[topo.__name__]: if v4: assert_path(net, p, v6=False) if v6: assert_path(net, p, v6=True) net.stop() finally: cleanup()
def test_ospf6_daemon_params(ospf6_params, link_params, expected_cfg, expected_paths): try: net = IPNet(topo=MinimalOSPFv3Net(ospf6_params, link_params)) net.start() # Check generated configuration with open("/tmp/ospf6d_r1.cfg") as fileobj: cfg = fileobj.readlines() for line in expected_cfg: assert (line + "\n") in cfg, "Cannot find the line '%s' in the generated configuration:\n%s"\ % (line, "".join(cfg)) # Check reachability assert_connectivity(net, v6=True) for path in expected_paths: assert_path(net, path, v6=True) net.stop() finally: cleanup()
def net(request): cleanup() net = IPNet(topo=StaticAddressNet()) net.start() assert_connectivity(net, v6=False) assert_connectivity(net, v6=True) paths = [ ["h1", "r1", "r2", "h3"], ["h3", "r2", "r1", "h1"], ["h3", "r2", "r1", "h2"], ["h3", "r2", "r1", "h4"], ] for p in paths: assert_path(net, p, v6=False) assert_path(net, p, v6=True) request.addfinalizer(cleanup) return net
def test_ospf_daemon_params(ospf_params, link_params, exp_cfg, exp_paths): try: net = IPNet(topo=MinimalOSPFNet(ospf_params, link_params), allocate_IPs=False) net.start() # Check generated configuration with open("/tmp/ospfd_r1.cfg") as fileobj: cfg = fileobj.readlines() for line in exp_cfg: assert line + "\n" in cfg,\ "Cannot find the line '%s' in the generated " \ "configuration:\n%s" % (line, "".join(cfg)) # Check reachability and paths assert_connectivity(net) for path in exp_paths: assert_path(net, path) net.stop() finally: cleanup()