Exemple #1
0
def setup_module(module):
    "Setup topology"
    tgen = Topogen(NetworkTopo, module.__name__)
    tgen.start_topology()

    krel = platform.release()
    if topotest.version_cmp(krel, "4.10") < 0:
        tgen.errors = "Newer kernel than 4.9 needed for pbr tests"
        pytest.skip(tgen.errors)

    router_list = tgen.routers()
    for rname, router in router_list.items():
        # Install vrf into the kernel and slave eth3
        router.run("ip link add vrf-chiyoda type vrf table 1000")
        router.run("ip link set dev {}-eth3 master vrf-chiyoda".format(rname))
        router.run("ip link set vrf-chiyoda up")

        router.load_config(
            TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
        )
        router.load_config(
            TopoRouter.RD_PBRD, os.path.join(CWD, "{}/pbrd.conf".format(rname))
        )

    tgen.start_router()
Exemple #2
0
def setup_module(module):
    "Setup topology"
    tgen = Topogen(NetworkTopo, module.__name__)
    tgen.start_topology()

    krel = platform.release()
    if topotest.version_cmp(krel, "4.19") < 0:
        tgen.errors = "kernel 4.19 needed for multihoming tests"
        pytest.skip(tgen.errors)

    tors = []
    tors.append("torm11")
    tors.append("torm12")
    tors.append("torm21")
    tors.append("torm22")
    config_tors(tgen, tors)

    hosts = []
    hosts.append("hostd11")
    hosts.append("hostd12")
    hosts.append("hostd21")
    hosts.append("hostd22")
    config_hosts(tgen, hosts)

    # tgen.mininet_cli()
    # This is a sample of configuration loading.
    router_list = tgen.routers()
    for rname, router in router_list.items():
        router.load_config(TopoRouter.RD_ZEBRA,
                           os.path.join(CWD, "{}/zebra.conf".format(rname)))
        router.load_config(TopoRouter.RD_PIM,
                           os.path.join(CWD, "{}/pim.conf".format(rname)))
        router.load_config(TopoRouter.RD_BGP,
                           os.path.join(CWD, "{}/evpn.conf".format(rname)))
    tgen.start_router()
Exemple #3
0
def setup_module(mod):
    tgen = Topogen(TemplateTopo, mod.__name__)
    tgen.start_topology()

    router_list = tgen.routers()
    krel = platform.release()
    if topotest.version_cmp(krel, "4.5") < 0:
        tgen.errors = "Linux kernel version of at least 4.5 needed for bgp-gshut tests"
        pytest.skip(tgen.errors)

    # Configure vrf and its slaves in the kernel on r2
    r2 = tgen.gears["r2"]
    r2.run("ip link add vrf1 type vrf table 1000")
    r2.run("ip link set vrf1 up")
    r2.run("ip link set r2-eth2 master vrf1")
    r2.run("ip link set r2-eth3 master vrf1")

    # Load FRR config and initialize all routers
    for i, (rname, router) in enumerate(router_list.items(), 1):
        router.load_config(
            TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
        )
        router.load_config(
            TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
        )

    tgen.start_router()

    # Basic peering test to see if things are ok
    _, result = _run_cmd_and_check(r2, "show ip bgp summary json", "r2/bgp_sum_1.json")
    assertmsg = "R2: Basic sanity test after init failed -- global peerings not up"
    assert result is None, assertmsg

    _, result = _run_cmd_and_check(
        r2, "show ip bgp vrf vrf1 summary json", "r2/bgp_sum_2.json"
    )
    assertmsg = "R2: Basic sanity test after init failed -- VRF peerings not up"
    assert result is None, assertmsg