mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-15 05:59:17 +03:00
openvswitch: remove kernel, add tests (#344653)
This commit is contained in:
commit
f451c38542
3 changed files with 86 additions and 22 deletions
|
@ -741,6 +741,7 @@ in {
|
||||||
image-contents = handleTest ./image-contents.nix {};
|
image-contents = handleTest ./image-contents.nix {};
|
||||||
openvscode-server = handleTest ./openvscode-server.nix {};
|
openvscode-server = handleTest ./openvscode-server.nix {};
|
||||||
open-webui = runTest ./open-webui.nix;
|
open-webui = runTest ./open-webui.nix;
|
||||||
|
openvswitch = runTest ./openvswitch.nix;
|
||||||
orangefs = handleTest ./orangefs.nix {};
|
orangefs = handleTest ./orangefs.nix {};
|
||||||
os-prober = handleTestOn ["x86_64-linux"] ./os-prober.nix {};
|
os-prober = handleTestOn ["x86_64-linux"] ./os-prober.nix {};
|
||||||
osquery = handleTestOn ["x86_64-linux"] ./osquery.nix {};
|
osquery = handleTestOn ["x86_64-linux"] ./osquery.nix {};
|
||||||
|
|
62
nixos/tests/openvswitch.nix
Normal file
62
nixos/tests/openvswitch.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
name = "openvswitch";
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
node1 = {
|
||||||
|
virtualisation.vlans = [ 1 ];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
useNetworkd = true;
|
||||||
|
useDHCP = false;
|
||||||
|
firewall.enable = false;
|
||||||
|
|
||||||
|
vswitches.vs0 = {
|
||||||
|
interfaces = {
|
||||||
|
eth1 = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.network.networks."40-vs0" = {
|
||||||
|
name = "vs0";
|
||||||
|
networkConfig.Address = "10.0.0.1/24";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
node2 = {
|
||||||
|
virtualisation.vlans = [ 1 ];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
useNetworkd = true;
|
||||||
|
useDHCP = false;
|
||||||
|
firewall.enable = false;
|
||||||
|
|
||||||
|
vswitches.vs0 = {
|
||||||
|
interfaces = {
|
||||||
|
eth1 = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.network.networks."40-vs0" = {
|
||||||
|
name = "vs0";
|
||||||
|
networkConfig.Address = "10.0.0.2/24";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = # python
|
||||||
|
''
|
||||||
|
start_all()
|
||||||
|
node1.wait_for_unit("ovsdb.service")
|
||||||
|
node1.wait_for_unit("ovs-vswitchd.service")
|
||||||
|
node2.wait_for_unit("ovsdb.service")
|
||||||
|
node2.wait_for_unit("ovs-vswitchd.service")
|
||||||
|
|
||||||
|
node1.succeed("ping -c3 10.0.0.2")
|
||||||
|
node2.succeed("ping -c3 10.0.0.1")
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1,40 +1,37 @@
|
||||||
{
|
{
|
||||||
|
withDPDK ? false,
|
||||||
|
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
fetchFromGitHub,
|
|
||||||
autoconf,
|
autoconf,
|
||||||
automake,
|
automake,
|
||||||
|
dpdk,
|
||||||
|
fetchFromGitHub,
|
||||||
installShellFiles,
|
installShellFiles,
|
||||||
iproute2,
|
iproute2,
|
||||||
kernel ? null,
|
|
||||||
libcap_ng,
|
libcap_ng,
|
||||||
|
libpcap,
|
||||||
libtool,
|
libtool,
|
||||||
|
makeWrapper,
|
||||||
nix-update-script,
|
nix-update-script,
|
||||||
|
nixosTests,
|
||||||
|
numactl,
|
||||||
openssl,
|
openssl,
|
||||||
perl,
|
perl,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
procps,
|
procps,
|
||||||
python3,
|
python3,
|
||||||
tcpdump,
|
|
||||||
sphinxHook,
|
sphinxHook,
|
||||||
|
tcpdump,
|
||||||
util-linux,
|
util-linux,
|
||||||
which,
|
which,
|
||||||
makeWrapper,
|
|
||||||
withDPDK ? false,
|
|
||||||
dpdk,
|
|
||||||
numactl,
|
|
||||||
libpcap,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
|
||||||
_kernel = kernel;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = if withDPDK then "openvswitch-dpdk" else "openvswitch";
|
pname = if withDPDK then "openvswitch-dpdk" else "openvswitch";
|
||||||
version = "3.4.0";
|
version = "3.4.0";
|
||||||
|
|
||||||
kernel = lib.optional (_kernel != null) _kernel.dev;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "openvswitch";
|
owner = "openvswitch";
|
||||||
repo = "ovs";
|
repo = "ovs";
|
||||||
|
@ -84,14 +81,11 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
preConfigure = "./boot.sh";
|
preConfigure = "./boot.sh";
|
||||||
|
|
||||||
configureFlags =
|
configureFlags = [
|
||||||
[
|
"--localstatedir=/var"
|
||||||
"--localstatedir=/var"
|
"--sharedstatedir=/var"
|
||||||
"--sharedstatedir=/var"
|
"--sbindir=$(out)/bin"
|
||||||
"--sbindir=$(out)/bin"
|
] ++ (lib.optionals withDPDK [ "--with-dpdk=shared" ]);
|
||||||
]
|
|
||||||
++ (lib.optionals (_kernel != null) [ "--with-linux" ])
|
|
||||||
++ (lib.optionals withDPDK [ "--with-dpdk=shared" ]);
|
|
||||||
|
|
||||||
# Leave /var out of this!
|
# Leave /var out of this!
|
||||||
installFlags = [
|
installFlags = [
|
||||||
|
@ -131,7 +125,14 @@ stdenv.mkDerivation rec {
|
||||||
setuptools
|
setuptools
|
||||||
]);
|
]);
|
||||||
|
|
||||||
passthru.updateScript = nix-update-script { };
|
passthru = {
|
||||||
|
tests = {
|
||||||
|
default = nixosTests.openvswitch;
|
||||||
|
incus = nixosTests.incus-lts.openvswitch;
|
||||||
|
};
|
||||||
|
|
||||||
|
updateScript = nix-update-script { };
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";
|
changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue