f-41: lab: FRR après deploy.sh puis redémarrage de l'agent, base BGP par l'agent #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 23:41:49 +02:00
commit 6c0e05e1e7
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
3 changed files with 13 additions and 8 deletions

View file

@ -312,18 +312,20 @@ func TestRun_RenderShipsTheExampleFRRConfigs(t *testing.T) {
if code != 0 { if code != 0 {
t.Fatalf("code %d, stderr %s", code, stderr) t.Fatalf("code %d, stderr %s", code, stderr)
} }
for node, want := range map[string]string{ for node, wants := range map[string][]string{
"sw1": "router bgp 65100", "sw1": {"router bgp 65100"},
"rr1": "bgp listen range 192.168.14.0/24 peer-group fabric", "rr1": {"bgp listen range 192.168.14.0/24 peer-group fabric"},
"hv1": "bgp router-id 192.168.14.11", "hv1": {"hostname hv1", "route_reflectors: [10.255.255.1]"},
"hv2": "bgp router-id 192.168.14.12", "hv2": {"hostname hv2", "route_reflectors: [10.255.255.1]"},
} { } {
data, err := os.ReadFile(filepath.Join(out, node, "user-data")) data, err := os.ReadFile(filepath.Join(out, node, "user-data"))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !strings.Contains(string(data), want) { for _, want := range wants {
t.Errorf("%s user-data does not carry %q", node, want) if !strings.Contains(string(data), want) {
t.Errorf("%s user-data does not carry %q", node, want)
}
} }
} }
} }

View file

@ -147,7 +147,7 @@ func TestRoles_ProvisioningIsOneScriptThatStopsAtTheFirstFailure(t *testing.T) {
nodes := renderRoles(t) nodes := renderRoles(t)
for name, steps := range map[string]string{ for name, steps := range map[string]string{
"sw1": "systemctl daemon-reload\nsystemctl enable --now lab-switch.service\n/usr/local/sbin/lab-frr\n", "sw1": "systemctl daemon-reload\nsystemctl enable --now lab-switch.service\n/usr/local/sbin/lab-frr\n",
"hv1": "/usr/local/sbin/lab-deploy\n/usr/local/sbin/lab-frr\n", "hv1": "/usr/local/sbin/lab-deploy\n/usr/local/sbin/lab-frr\nsystemctl restart agent.service\n",
"hv2": "/usr/local/sbin/lab-deploy\n", "hv2": "/usr/local/sbin/lab-deploy\n",
} { } {
cfg := user(t, nodeNamed(t, nodes, name)) cfg := user(t, nodeNamed(t, nodes, name))

View file

@ -133,6 +133,9 @@ func userData(p *topology.Plan, n topology.NodePlan, o Options) ([]byte, error)
writeFile{Path: FRRScript, Permissions: "0755", Content: frrScript(n)}, writeFile{Path: FRRScript, Permissions: "0755", Content: frrScript(n)},
) )
steps = append(steps, FRRScript) steps = append(steps, FRRScript)
if n.Role == topology.RoleHypervisor {
steps = append(steps, "systemctl restart agent.service")
}
} }
if len(steps) > 0 { if len(steps) > 0 {
cfg.WriteFiles = append(cfg.WriteFiles, cfg.WriteFiles = append(cfg.WriteFiles,