-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christian Hopps <[email protected]>
- Loading branch information
Showing
4 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
topology: | ||
ipv6-enable: true | ||
networks-autonumber: true | ||
dns-network: "mgmt0" | ||
networks: | ||
- name: mgmt0 | ||
ip: 192.168.0.254/24 | ||
ipv6: "fd00::ff/64" | ||
nat: true | ||
- name: net0 | ||
ip: 10.0.0.0/24 | ||
ipv6: "fc00::/64" | ||
- name: net1 | ||
ip: 10.0.1.0/24 | ||
ipv6: "fc00:0:0:1::/64" | ||
- name: net2 | ||
ip: 10.0.2.0/24 | ||
ipv6: "fc00:0:0:2::/64" | ||
nodes: | ||
- name: h1 | ||
connections: | ||
- to: mgmt0 | ||
- to: net0 | ||
- name: r1 | ||
kind: linux | ||
connections: | ||
- to: mgmt0 | ||
- to: net0 | ||
- to: net1 | ||
# eth2 is router interconnect | ||
- name: r2 | ||
kind: linux | ||
connections: | ||
- to: mgmt0 | ||
name: eth0 | ||
- to: net2 | ||
name: eth1 | ||
- to: net1 | ||
# eth2 is router interconnect | ||
name: eth2 | ||
- name: h2 | ||
connections: | ||
- to: mgmt0 | ||
- to: net2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# -*- coding: utf-8 eval: (blacken-mode 1) -*- | ||
# | ||
# February 9 2022, Christian Hopps <[email protected]> | ||
# | ||
# Copyright 2022, LabN Consulting, L.L.C. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; see the file COPYING; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
# | ||
"Simple virtual interface qemu based iptfs test." | ||
import logging | ||
import os | ||
|
||
import pytest | ||
from common.config import _network_up, setup_policy_tun, setup_routed_tun | ||
from common.tests import _test_net_up | ||
|
||
# All tests are coroutines | ||
pytestmark = pytest.mark.asyncio | ||
|
||
SRCDIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
async def network_up(unet): | ||
await _network_up(unet, ipv6=True) | ||
|
||
|
||
# 192.168.0.0/24 fd00::/64 | ||
# --+-------------------+------ mgmt0 ------+-------------------+--- | ||
# | .1 | .2 | .3 | .4 | ||
# +----+ +----+ +----+ +----+ | ||
# | h1 | --- net0 --- | r1 | --- net1 --- | r2 | --- net2 --- | r1 | | ||
# +----+ .1 .2 +----+ .2 .3 +----+ .3 .4 +----+ | ||
# 10.0.0.0/24 10.0.1.0/24 10.0.2.0/24 | ||
|
||
|
||
async def test_net_up(unet, astepf): | ||
await astepf("Before test network up") | ||
await _test_net_up(unet, ipv6=True) | ||
|
||
|
||
async def do_ping(h1, astepf): | ||
count = 3000 | ||
|
||
await astepf("first IPv6 ping") | ||
logging.debug(h1.cmd_raises("ping -c1 fc00:0:0:2::4")) | ||
await astepf(f"flood {count} IPv6 ping") | ||
logging.debug(h1.cmd_raises(f"ping -f -c{count} fc00:0:0:2::4")) | ||
|
||
await astepf("first IPv4 ping") | ||
logging.debug(h1.cmd_raises("ping -c1 10.0.2.4")) | ||
await astepf(f"flood {count} IPv4 ping") | ||
logging.debug(h1.cmd_raises(f"ping -f -c{count} 10.0.2.4")) | ||
|
||
|
||
async def test_policy_tun4_up(unet, astepf, pytestconfig): | ||
h1 = unet.hosts["h1"] | ||
|
||
opts = pytestconfig.getoption("--iptfs-opts", "dont-frag") | ||
await setup_policy_tun( | ||
unet, mode="iptfs", iptfs_opts=opts, ipv6=True, tun_ipv6=False | ||
) | ||
|
||
await do_ping(h1, astepf) | ||
|
||
|
||
async def test_routed_tun4_up(unet, astepf, pytestconfig): | ||
h1 = unet.hosts["h1"] | ||
|
||
opts = pytestconfig.getoption("--iptfs-opts", "") | ||
await setup_routed_tun( | ||
unet, mode="iptfs", iptfs_opts=opts, ipv6=True, tun_ipv6=False | ||
) | ||
|
||
await do_ping(h1, astepf) | ||
|
||
|
||
async def test_policy_tun6_up(unet, astepf, pytestconfig): | ||
h1 = unet.hosts["h1"] | ||
|
||
opts = pytestconfig.getoption("--iptfs-opts", "dont-frag") | ||
await setup_policy_tun( | ||
unet, mode="iptfs", iptfs_opts=opts, ipv6=True, tun_ipv6=True | ||
) | ||
|
||
await do_ping(h1, astepf) | ||
|
||
|
||
async def test_routed_tun6_up(unet, astepf, pytestconfig): | ||
h1 = unet.hosts["h1"] | ||
|
||
opts = pytestconfig.getoption("--iptfs-opts", "") | ||
await setup_routed_tun( | ||
unet, mode="iptfs", iptfs_opts=opts, ipv6=True, tun_ipv6=True | ||
) | ||
|
||
await do_ping(h1, astepf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters