about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/incus/openvswitch.nix
blob: 5d4aef031ad0a265f52bede7c897f6e756f3a9bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import ../make-test-python.nix ({ pkgs, lib, ... } :

{
  name = "incus-openvswitch";

  meta = {
    maintainers = lib.teams.lxc.members;
  };

  nodes.machine = { lib, ... }: {
    virtualisation = {
      incus.enable = true;
      vswitch.enable = true;
      incus.preseed = {
        networks = [
          {
            name = "nixostestbr0";
            type = "bridge";
            config = {
              "bridge.driver" = "openvswitch";
              "ipv4.address" = "10.0.100.1/24";
              "ipv4.nat" = "true";
            };
          }
        ];
        profiles = [
          {
            name = "nixostest_default";
            devices = {
              eth0 = {
                name = "eth0";
                network = "nixostestbr0";
                type = "nic";
              };
              root = {
                path = "/";
                pool = "default";
                size = "35GiB";
                type = "disk";
              };
            };
          }
        ];
        storage_pools = [
          {
            name = "nixostest_pool";
            driver = "dir";
          }
        ];
      };
    };
    networking.nftables.enable = true;
  };

  testScript = ''
    machine.wait_for_unit("incus.service")
    machine.wait_for_unit("incus-preseed.service")

    with subtest("Verify openvswitch bridge"):
      machine.succeed("incus network info nixostestbr0")

    with subtest("Verify openvswitch bridge"):
      machine.succeed("ovs-vsctl br-exists nixostestbr0")
  '';
})