-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create dummy for unconnected interface
An interface with no connection is currently omitted from the target network namespace. Instead, add a Linux "dummy" interface and assign IP addresses.
- Loading branch information
Showing
4 changed files
with
142 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
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
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,31 @@ | ||
version: 1 | ||
topology: | ||
networks-autonumber: true | ||
ipv6-enable: true | ||
networks: | ||
- name: net0 | ||
mtu: 5000 | ||
nodes: | ||
- name: r1 | ||
connections: | ||
- to: net0 | ||
name: eth0 | ||
mtu: 4500 | ||
- name: unconnected | ||
ip: 172.16.0.1/24 | ||
mtu: 9000 | ||
cmd: | | ||
ip addr show | ||
ip -6 addr show | ||
which ping | ||
tail -f /dev/null | ||
- name: r2 | ||
connections: | ||
- to: "net0" | ||
name: eth0 | ||
mtu: 4500 | ||
cmd: | | ||
ip addr show | ||
ip -6 addr show | ||
which ping | ||
tail -f /dev/null |
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,37 @@ | ||
# -*- coding: utf-8 eval: (blacken-mode 1) -*- | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
# | ||
# June 28 2023, Eric Kinzie <[email protected]> | ||
# | ||
# Copyright 2023, LabN Consulting, L.L.C. | ||
# | ||
"Testing of unconnected interface." | ||
import logging | ||
|
||
import pytest | ||
|
||
# All tests are coroutines | ||
pytestmark = pytest.mark.asyncio | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"unet_perfunc", ["munet", "noinit", "noinit-noshell"], indirect=["unet_perfunc"] | ||
) | ||
async def test_unconnected_presence(unet_perfunc): | ||
unet = unet_perfunc | ||
rc, o, e = await unet.hosts["r1"].async_cmd_status(f"ip addr show dev unconnected") | ||
assert rc == 0 | ||
assert o.find("mtu 9000") > -1 | ||
assert o.find("inet 172.16.0.1/24") > -1 | ||
|
||
|
||
async def test_basic_ping(unet_perfunc): | ||
unet = unet_perfunc | ||
r1eth0 = unet.hosts["r1"].get_intf_addr("eth0").ip | ||
logging.debug("r1eth0 is %s", r1eth0) | ||
rc, o, e = await unet.hosts["r2"].async_cmd_status( | ||
f"ip ro add 172.16.0.0/24 via {r1eth0}" | ||
) | ||
assert rc == 0 | ||
o = await unet.hosts["r2"].async_cmd_raises(f"ping -w1 -c1 172.16.0.1") | ||
logging.debug("ping r2 output: %s", o) |