From aceffe7b5817e375561bd258bcd6900d746300aa Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Mon, 12 Oct 2026 15:50:54 +0200 Subject: [PATCH] =?UTF-8?q?f-55:=20lab:=20fichiers=20des=20n=C5=93uds=20su?= =?UTF-8?q?r=20un=20ISO=20d=C3=A9di=C3=A9,=20envoi=20des=20binaires=20comp?= =?UTF-8?q?il=C3=A9s=20en=20local=20#55?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: GnomeZworc --- .gitignore | 4 ++ cmd/lab/main_test.go | 28 ++++--------- docs/developpement/lab.rst | 21 +++++++++- internal/lab/provision/provision.go | 24 +++++++---- internal/lab/provision/provision_test.go | 35 ++++++++++++++-- internal/lab/render/qemu.go | 3 ++ internal/lab/render/render.go | 10 ++--- internal/lab/render/roles_test.go | 30 +++++++++++--- internal/lab/render/seed.go | 16 ++++---- internal/lab/topology/roles_test.go | 4 ++ internal/lab/topology/validate.go | 2 + test/e2e/build.sh | 45 +++++++++++++++++++++ test/e2e/topologies/bin/.gitkeep | 0 test/e2e/topologies/evpn-2hv.yml | 4 +- test/e2e/topologies/evpn-3hv.yml | 6 +-- test/e2e/topologies/provision/hypervisor.sh | 7 ++++ 16 files changed, 181 insertions(+), 58 deletions(-) create mode 100755 test/e2e/build.sh create mode 100644 test/e2e/topologies/bin/.gitkeep diff --git a/.gitignore b/.gitignore index fd7d60e..3f0d6a4 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,7 @@ data/ # Sphinx build output docs/_build/ + +# Binaires compilés en local pour le lab (test/e2e/build.sh) +test/e2e/topologies/bin/* +!test/e2e/topologies/bin/.gitkeep diff --git a/cmd/lab/main_test.go b/cmd/lab/main_test.go index 8987dcc..cb78c26 100644 --- a/cmd/lab/main_test.go +++ b/cmd/lab/main_test.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "encoding/base64" "os" "os/exec" "path/filepath" @@ -10,8 +9,6 @@ import ( "strings" "syscall" "testing" - - "go.yaml.in/yaml/v3" ) func runLab(args ...string) (int, string, string) { @@ -336,25 +333,14 @@ func TestRun_RenderShipsTheExampleFRRConfigs(t *testing.T) { if err != nil { t.Fatal(err) } - var cfg struct { - Files []struct { - Path string `yaml:"path"` - Content string `yaml:"content"` - } `yaml:"write_files"` + if !strings.Contains(string(data), "mount -o ro LABEL=LABFILES /run/lab-files") { + t.Errorf("%s user-data does not mount its files", node) } - if err := yaml.Unmarshal(data, &cfg); err != nil { - t.Fatal(err) - } - var agent []byte - for _, f := range cfg.Files { - if f.Path == "/etc/lab/files/agent.yml" { - if agent, err = base64.StdEncoding.DecodeString(f.Content); err != nil { - t.Fatal(err) - } - } - } - if !strings.Contains(string(agent), "route_reflectors: [10.255.255.1]") { - t.Errorf("%s agent.yml = %q", node, agent) + } + for _, agent := range []string{"two.yml", "bgp.yml"} { + data, err := os.ReadFile(filepath.Join("..", "..", "test", "e2e", "topologies", "agent", agent)) + if err != nil || !strings.Contains(string(data), "route_reflectors: [10.255.255.1]") { + t.Errorf("agent/%s = %q, %v", agent, data, err) } } } diff --git a/docs/developpement/lab.rst b/docs/developpement/lab.rst index d9fa252..ff4e46b 100644 --- a/docs/developpement/lab.rst +++ b/docs/developpement/lab.rst @@ -250,8 +250,11 @@ Ce que le fichier déclare : * ``provision`` — le chemin d'un script, relatif au fichier de topologie, exécuté au premier démarrage **avant** FRR ; * ``post_provision`` — un second script, exécuté **après** FRR ; - * ``files`` — des fichiers déposés dans ``/etc/lab/files/`` avant les scripts, sous la - forme ``{: }`` (``files: {agent.yml: agent/two.yml}``) ; + * ``files`` — des fichiers **ou répertoires** déposés dans ``/etc/lab/files/`` avant les + scripts, sous la forme ``{: }`` (``files: {agent.yml: agent/two.yml, bin: bin}``). + Ils voyagent dans un ``files.iso`` propre au nœud (volume ``LABFILES``), attaché comme second + lecteur et recopié au premier démarrage : la taille n'est pas limitée par cloud-init, et un + binaire de plusieurs dizaines de Mio passe ; * ``services`` — les unités systemd que ``lab up`` vérifie actives sur le nœud. Les scripts reçoivent ``LAB_NODE`` (nom du nœud), ``LAB_UPLINK`` (interface de son premier @@ -387,6 +390,20 @@ réponde, à travers le switch. Les deux fichiers ``agent/`` donnent à l'agent ``agent/two.yml`` met en plus hv1 sur le serveur DHCP intégré (``dhcp.backend: two``), ``agent/bgp.yml`` laisse les autres sur dnsmasq. +**Tester l'arbre courant plutôt que la release.** ``test/e2e/build.sh`` compile ``agent``, +``dhcp`` et ``metadata`` pour linux/amd64 dans ``test/e2e/topologies/bin/`` (ignoré par git), +que les hyperviseurs reçoivent par ``files: {bin: bin}``. Après ``deploy.sh``, +``hypervisor.sh`` installe chaque binaire présent dans ``/opt/two/local/bin/`` et y fait pointer +``/opt/two/bin/`` ; le reste (units, scripts) vient de la release. ``build.sh --clean`` vide +le répertoire : le lab suivant teste la release seule. + +.. code-block:: text + + test/e2e/build.sh # binaires de l'arbre courant + scripts/lab-host.sh push test/e2e/topologies/evpn-3hv.yml + scripts/lab-host.sh ssh './lab up topology/evpn-3hv.yml' + test/e2e/build.sh --clean # retour à la release seule + FRR est installé **après** la provision : il démarre sur le réseau final. Démarré avant la migration, zebra peut perdre la route par défaut quand elle passe de l'uplink à ``br-000000`` — constaté le 2026-10-11 sur un hyperviseur sur deux : route reflector diff --git a/internal/lab/provision/provision.go b/internal/lab/provision/provision.go index 36d0a7f..fe20c9f 100644 --- a/internal/lab/provision/provision.go +++ b/internal/lab/provision/provision.go @@ -7,6 +7,7 @@ import ( "os" "os/exec" "path/filepath" + "sort" "strings" "git.g3e.fr/syonad/two/internal/lab/render" @@ -99,17 +100,11 @@ func ReadInputs(p *topology.Plan, o *render.Options) error { if o.PostProvision, err = readNodeFiles(p, func(n topology.NodePlan) string { return n.PostProvision }); err != nil { return err } - o.Files = map[string]map[string][]byte{} for _, n := range p.Nodes { for name, src := range n.Files { - data, err := os.ReadFile(src) - if err != nil { + if _, err := os.Stat(src); err != nil { return fmt.Errorf("node %s: file %s: %w", n.Name, name, err) } - if o.Files[n.Name] == nil { - o.Files[n.Name] = map[string][]byte{} - } - o.Files[n.Name][name] = data } } return nil @@ -184,6 +179,21 @@ func Stage(ctx context.Context, r Runner, n render.Node, base string) error { for _, f := range SeedFiles { args = append(args, filepath.Join(n.Dir, f)) } + if err := r.Run(ctx, "genisoimage", args...); err != nil { + return err + } + if len(n.Files) == 0 { + return nil + } + names := make([]string, 0, len(n.Files)) + for name := range n.Files { + names = append(names, name) + } + sort.Strings(names) + args = []string{"-quiet", "-output", filepath.Join(n.Dir, render.FilesISO), "-volid", render.FilesLabel, "-joliet", "-rock", "-graft-points"} + for _, name := range names { + args = append(args, name+"="+n.Files[name]) + } return r.Run(ctx, "genisoimage", args...) } diff --git a/internal/lab/provision/provision_test.go b/internal/lab/provision/provision_test.go index d4d7a5a..a837f05 100644 --- a/internal/lab/provision/provision_test.go +++ b/internal/lab/provision/provision_test.go @@ -280,6 +280,31 @@ func TestEnsureKey_ReportsAFailedGeneration(t *testing.T) { } } +func TestStage_BurnsTheNodeFilesIntoTheirOwnISO(t *testing.T) { + runner := &fakeRunner{} + dir := t.TempDir() + n := render.Node{Name: "hv1", Dir: dir, Files: map[string]string{"bin": "/src/bin", "agent.yml": "/src/two.yml"}} + if err := Stage(context.Background(), runner, n, "/cache/deb.qcow2"); err != nil { + t.Fatalf("Stage: %v", err) + } + isos := runner.commands("genisoimage") + want := []string{"genisoimage", "-quiet", "-output", filepath.Join(dir, "files.iso"), "-volid", "LABFILES", "-joliet", "-rock", "-graft-points", + "agent.yml=/src/two.yml", "bin=/src/bin"} + if len(isos) != 2 || !reflect.DeepEqual(isos[1], want) { + t.Errorf("genisoimage calls:\n%q\nwant second:\n%q", isos, want) + } +} + +func TestStage_NoFilesNoFilesISO(t *testing.T) { + runner := &fakeRunner{} + if err := Stage(context.Background(), runner, render.Node{Name: "rr1", Dir: t.TempDir()}, "/cache/deb.qcow2"); err != nil { + t.Fatalf("Stage: %v", err) + } + if n := len(runner.commands("genisoimage")); n != 1 { + t.Errorf("genisoimage ran %d times, want only the seed", n) + } +} + func TestStage_RefusesARelativeBaseImage(t *testing.T) { runner := &fakeRunner{} err := Stage(context.Background(), runner, render.Node{Name: "hv1", Dir: t.TempDir()}, "debian.qcow2") @@ -387,7 +412,7 @@ func TestPrepare_PutsTheFRRConfigIntoTheSeed(t *testing.T) { t.Errorf("hv1 user-data has no /etc/lab/frr.conf:\n%s", data) } -func TestReadInputs_ReadsTheProvisionScriptsAndFiles(t *testing.T) { +func TestReadInputs_ReadsTheScriptsAndChecksTheFiles(t *testing.T) { dir := t.TempDir() write := func(name, content string) string { path := filepath.Join(dir, name) @@ -402,6 +427,11 @@ func TestReadInputs_ReadsTheProvisionScriptsAndFiles(t *testing.T) { p.Nodes[2].PostProvision = write("hv-post.sh", "#!/bin/sh\necho post\n") p.Nodes[2].Files = map[string]string{"agent.yml": write("two.yml", "dhcp:\n backend: two\n")} + if err := os.Mkdir(filepath.Join(dir, "bin"), 0o700); err != nil { + t.Fatal(err) + } + p.Nodes[2].Files["bin"] = filepath.Join(dir, "bin") + var o render.Options if err := ReadInputs(p, &o); err != nil { t.Fatal(err) @@ -412,9 +442,6 @@ func TestReadInputs_ReadsTheProvisionScriptsAndFiles(t *testing.T) { if !reflect.DeepEqual(o.PostProvision, map[string]string{"hv1": "#!/bin/sh\necho post\n"}) { t.Errorf("post_provision = %q", o.PostProvision) } - if !reflect.DeepEqual(o.Files, map[string]map[string][]byte{"hv1": {"agent.yml": []byte("dhcp:\n backend: two\n")}}) { - t.Errorf("files = %q", o.Files) - } p.Nodes[3].Files = map[string]string{"agent.yml": filepath.Join(dir, "absent.yml")} if err := ReadInputs(p, &render.Options{}); err == nil || !strings.Contains(err.Error(), "node hv2: file agent.yml: ") { diff --git a/internal/lab/render/qemu.go b/internal/lab/render/qemu.go index 9a870d2..4c380c8 100644 --- a/internal/lab/render/qemu.go +++ b/internal/lab/render/qemu.go @@ -26,6 +26,9 @@ func qemuArgs(p *topology.Plan, n topology.NodePlan, index int, dir string) []st "-drive", "file=" + filepath.Join(dir, DiskFile) + ",if=virtio,format=qcow2", "-drive", "file=" + filepath.Join(dir, SeedFile) + ",media=cdrom,readonly=on", } + if len(n.Files) > 0 { + args = append(args, "-drive", "file="+filepath.Join(dir, FilesISO)+",media=cdrom,readonly=on") + } restrict := "on" if n.Role == topology.RoleSwitch { diff --git a/internal/lab/render/render.go b/internal/lab/render/render.go index 723a465..7fbe3b7 100644 --- a/internal/lab/render/render.go +++ b/internal/lab/render/render.go @@ -20,6 +20,8 @@ const ( DiskFile = "disk.qcow2" SeedFile = "seed.iso" + FilesISO = "files.iso" + FilesLabel = "LABFILES" ConsoleFile = "console.log" QMPFile = "qmp.sock" PIDFile = "qemu.pid" @@ -33,12 +35,12 @@ type Options struct { FRR map[string]string Provision map[string]string PostProvision map[string]string - Files map[string]map[string][]byte } type Node struct { Name string Dir string + Files map[string]string QEMU []string MetaData []byte UserData []byte @@ -59,11 +61,6 @@ func Render(p *topology.Plan, o Options) ([]Node, error) { if _, ok := o.PostProvision[n.Name]; n.PostProvision != "" && !ok { return nil, fmt.Errorf("node %s: post_provision script %s was not read", n.Name, n.PostProvision) } - for name, src := range n.Files { - if _, ok := o.Files[n.Name][name]; !ok { - return nil, fmt.Errorf("node %s: file %s (%s) was not read", n.Name, name, src) - } - } } var nodes []Node for index, n := range p.Nodes { @@ -83,6 +80,7 @@ func Render(p *topology.Plan, o Options) ([]Node, error) { nodes = append(nodes, Node{ Name: n.Name, Dir: dir, + Files: n.Files, QEMU: qemuArgs(p, n, index, dir), MetaData: meta, UserData: user, diff --git a/internal/lab/render/roles_test.go b/internal/lab/render/roles_test.go index bf15644..686b3b5 100644 --- a/internal/lab/render/roles_test.go +++ b/internal/lab/render/roles_test.go @@ -36,7 +36,6 @@ func roleOptions() Options { FRR: frrConfigs, Provision: map[string]string{"hv1": "#!/bin/sh\necho provision\n"}, PostProvision: map[string]string{"hv1": "#!/bin/sh\necho post\n"}, - Files: map[string]map[string][]byte{"hv1": {"agent.yml": []byte("dhcp:\n backend: two\n")}}, } } @@ -155,9 +154,10 @@ func TestRoles_FRRKeyIsThePinnedRepositoryKey(t *testing.T) { func TestRoles_ProvisioningIsOneScriptThatStopsAtTheFirstFailure(t *testing.T) { nodes := renderRoles(t) env := "LAB_NODE=hv1 LAB_UPLINK=underlay LAB_FILES=/etc/lab/files " + files := "mkdir -p /etc/lab/files /run/lab-files\nmount -o ro LABEL=LABFILES /run/lab-files\ncp -R /run/lab-files/. /etc/lab/files/\numount /run/lab-files\n" for name, steps := range map[string]string{ "sw1": "systemctl daemon-reload\nsystemctl enable --now lab-switch.service\n/usr/local/sbin/lab-frr\n", - "hv1": env + "/usr/local/sbin/lab-node-provision\n/usr/local/sbin/lab-frr\n" + env + "/usr/local/sbin/lab-node-post-provision\n", + "hv1": files + env + "/usr/local/sbin/lab-node-provision\n/usr/local/sbin/lab-frr\n" + env + "/usr/local/sbin/lab-node-post-provision\n", } { cfg := user(t, nodeNamed(t, nodes, name)) if !reflect.DeepEqual(cfg.Runcmd, [][]string{{"/usr/local/sbin/lab-provision"}}) { @@ -173,7 +173,29 @@ func TestRoles_ProvisioningIsOneScriptThatStopsAtTheFirstFailure(t *testing.T) { } } -func TestRoles_HostReceivesItsScriptsAndFiles(t *testing.T) { +func TestRoles_FilesTravelOnASecondCDROM(t *testing.T) { + nodes := renderRoles(t) + hv1 := nodeNamed(t, nodes, "hv1") + if !reflect.DeepEqual(hv1.Files, map[string]string{"agent.yml": "two.yml"}) { + t.Errorf("hv1 files = %v", hv1.Files) + } + drive := "file=/srv/lab/hv1/files.iso,media=cdrom,readonly=on" + if !strings.Contains(strings.Join(hv1.QEMU, " "), "-drive "+drive) { + t.Errorf("hv1 qemu lacks %s:\n%s", drive, strings.Join(hv1.QEMU, "\n")) + } + for _, f := range user(t, hv1).WriteFiles { + if strings.HasPrefix(f.Path, "/etc/lab/files/") { + t.Errorf("hv1 user-data carries %s, files belong to the ISO", f.Path) + } + } + for _, name := range []string{"sw1", "rr1", "hv2"} { + if n := nodeNamed(t, nodes, name); strings.Contains(strings.Join(n.QEMU, " "), "files.iso") || n.Files != nil { + t.Errorf("%s gets a files ISO", name) + } + } +} + +func TestRoles_HostReceivesItsScripts(t *testing.T) { cfg := user(t, nodeNamed(t, renderRoles(t), "hv1")) for path, want := range map[string]struct { content string @@ -181,7 +203,6 @@ func TestRoles_HostReceivesItsScriptsAndFiles(t *testing.T) { }{ "/usr/local/sbin/lab-node-provision": {"#!/bin/sh\necho provision\n", "0755"}, "/usr/local/sbin/lab-node-post-provision": {"#!/bin/sh\necho post\n", "0755"}, - "/etc/lab/files/agent.yml": {"dhcp:\n backend: two\n", "0644"}, } { f := fileAt(t, cfg, path) got, err := base64.StdEncoding.DecodeString(f.Content) @@ -280,7 +301,6 @@ func TestRoles_RefusesUnreadProvisionInputs(t *testing.T) { }{ "provision": {func(o *Options) { o.Provision = nil }, "node hv1: provision script hv.sh was not read"}, "post": {func(o *Options) { o.PostProvision = nil }, "node hv1: post_provision script hv-post.sh was not read"}, - "file": {func(o *Options) { o.Files = nil }, "node hv1: file agent.yml (two.yml) was not read"}, } for name, c := range cases { o := roleOptions() diff --git a/internal/lab/render/seed.go b/internal/lab/render/seed.go index 28c130c..948fe5d 100644 --- a/internal/lab/render/seed.go +++ b/internal/lab/render/seed.go @@ -4,7 +4,6 @@ import ( _ "embed" "encoding/base64" "fmt" - "sort" "strings" "go.yaml.in/yaml/v3" @@ -31,6 +30,7 @@ const ( NodeProvision = "/usr/local/sbin/lab-node-provision" NodePostProvision = "/usr/local/sbin/lab-node-post-provision" FilesDir = "/etc/lab/files" + FilesMount = "/run/lab-files" ) //go:embed frrouting.gpg @@ -114,13 +114,13 @@ func userData(p *topology.Plan, n topology.NodePlan, o Options) ([]byte, error) } steps = append(steps, "systemctl daemon-reload", "systemctl enable --now lab-node.service") } - names := make([]string, 0, len(n.Files)) - for name := range n.Files { - names = append(names, name) - } - sort.Strings(names) - for _, name := range names { - cfg.WriteFiles = append(cfg.WriteFiles, writeFile{Path: FilesDir + "/" + name, Permissions: "0644", Encoding: "b64", Content: base64.StdEncoding.EncodeToString(o.Files[n.Name][name])}) + if len(n.Files) > 0 { + steps = append(steps, + "mkdir -p "+FilesDir+" "+FilesMount, + "mount -o ro LABEL="+FilesLabel+" "+FilesMount, + "cp -R "+FilesMount+"/. "+FilesDir+"/", + "umount "+FilesMount, + ) } if n.Provision != "" { cfg.WriteFiles = append(cfg.WriteFiles, writeFile{Path: NodeProvision, Permissions: "0755", Encoding: "b64", Content: base64.StdEncoding.EncodeToString([]byte(o.Provision[n.Name]))}) diff --git a/internal/lab/topology/roles_test.go b/internal/lab/topology/roles_test.go index 651c7ef..0be43ee 100644 --- a/internal/lab/topology/roles_test.go +++ b/internal/lab/topology/roles_test.go @@ -186,6 +186,10 @@ func TestValidate_ProvisionRejections(t *testing.T) { `hv: { role: host, image: deb, cpus: 1, memory: 512, segments: [red], files: { agent.yml: "" } }`, "node hv: file agent.yml has no source", }, + "file source with an equals sign": { + `hv: { role: host, image: deb, cpus: 1, memory: 512, segments: [red], files: { bin: "a=b" } }`, + `node hv: file bin: source "a=b" must not contain '='`, + }, "service with shell characters": { `hv: { role: host, image: deb, cpus: 1, memory: 512, segments: [red], services: ["agent.service; reboot"] }`, `node hv: service "agent.service; reboot" must match`, diff --git a/internal/lab/topology/validate.go b/internal/lab/topology/validate.go index 6d21297..7161b1f 100644 --- a/internal/lab/topology/validate.go +++ b/internal/lab/topology/validate.go @@ -214,6 +214,8 @@ func validateExtras(n Node, segments map[string]Segment, add func(string, ...any add("node %s: file name %q must match %s", n.Name, name, filePattern) case n.Files[name] == "": add("node %s: file %s has no source", n.Name, name) + case strings.Contains(n.Files[name], "="): + add("node %s: file %s: source %q must not contain '='", n.Name, name, n.Files[name]) } } seenUnits := map[string]bool{} diff --git a/test/e2e/build.sh b/test/e2e/build.sh new file mode 100755 index 0000000..3b68881 --- /dev/null +++ b/test/e2e/build.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +E2E_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_DIR="$(cd "${E2E_DIR}/../.." && pwd)" +BIN_DIR="${BIN_DIR:-${E2E_DIR}/topologies/bin}" +BINARIES="agent dhcp metadata" + +usage () { + cat >&2 <&2 + (cd "${REPO_DIR}" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "${BIN_DIR}/${binary}" "./cmd/${binary}") || return 1 + done + (cd "${BIN_DIR}" && sha256sum ${BINARIES} 2>/dev/null || shasum -a 256 ${BINARIES}) +} + +main () { + case "${1:-}" in + "") build ;; + --clean) clean ;; + *) usage ;; + esac +} + +if [[ "${BASH_SOURCE[0]}" == "${0}" || -z "${BASH_SOURCE[0]}" ]]; then + main "$@" +fi diff --git a/test/e2e/topologies/bin/.gitkeep b/test/e2e/topologies/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/topologies/evpn-2hv.yml b/test/e2e/topologies/evpn-2hv.yml index 9a6137a..89e8b47 100644 --- a/test/e2e/topologies/evpn-2hv.yml +++ b/test/e2e/topologies/evpn-2hv.yml @@ -22,10 +22,10 @@ nodes: hv1: { role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay], addresses: { underlay: 192.168.14.11 }, frr: frr/hv1.conf, provision: provision/hypervisor.sh, - post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml }, + post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin }, services: [agent.service] } hv2: { role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay], addresses: { underlay: 192.168.14.12 }, frr: frr/hv2.conf, provision: provision/hypervisor.sh, - post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml }, + post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml, bin: bin }, services: [agent.service] } diff --git a/test/e2e/topologies/evpn-3hv.yml b/test/e2e/topologies/evpn-3hv.yml index 16598c8..92b726b 100644 --- a/test/e2e/topologies/evpn-3hv.yml +++ b/test/e2e/topologies/evpn-3hv.yml @@ -22,15 +22,15 @@ nodes: hv1: { role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay], addresses: { underlay: 192.168.14.11 }, frr: frr/hv1.conf, provision: provision/hypervisor.sh, - post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml }, + post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin }, services: [agent.service] } hv2: { role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay], addresses: { underlay: 192.168.14.12 }, frr: frr/hv2.conf, provision: provision/hypervisor.sh, - post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml }, + post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml, bin: bin }, services: [agent.service] } hv3: { role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay], addresses: { underlay: 192.168.14.13 }, frr: frr/hv3.conf, provision: provision/hypervisor.sh, - post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml }, + post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml, bin: bin }, services: [agent.service] } diff --git a/test/e2e/topologies/provision/hypervisor.sh b/test/e2e/topologies/provision/hypervisor.sh index c7eb354..20b10e5 100755 --- a/test/e2e/topologies/provision/hypervisor.sh +++ b/test/e2e/topologies/provision/hypervisor.sh @@ -17,3 +17,10 @@ for script in deploy.sh bootstrap_kvm.sh; do done chmod 0755 deploy.sh bootstrap_kvm.sh bash ./deploy.sh --noup_script -i -u "${LAB_UPLINK}" -t "${RELEASE}" +for binary in "${LAB_FILES}"/bin/*; do + [ -f "${binary}" ] || continue + name=$(basename "${binary}") + install -D -m 0755 "${binary}" "/opt/two/local/bin/${name}" + ln -sfn "/opt/two/local/bin/${name}" "/opt/two/bin/${name}" + echo "lab: ${name} compilé en local remplace celui de la release ${RELEASE}" +done