labctl: segments sur des bridges de l'hôte, routeurs et passerelle VRRP #2
All checks were successful
Tests / test (push) Successful in 3m46s
All checks were successful
Tests / test (push) Successful in 3m46s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
e0de56a64f
commit
e9a0c19b72
24 changed files with 1766 additions and 578 deletions
|
|
@ -31,7 +31,7 @@ func qemuArgs(p *topology.Plan, n topology.NodePlan, index int, dir string) []st
|
|||
}
|
||||
|
||||
restrict := "on"
|
||||
if n.Role == topology.RoleSwitch {
|
||||
if n.Role == topology.RoleRouter {
|
||||
restrict = "off"
|
||||
}
|
||||
args = append(args,
|
||||
|
|
@ -39,19 +39,11 @@ func qemuArgs(p *topology.Plan, n topology.NodePlan, index int, dir string) []st
|
|||
"-device", fmt.Sprintf("virtio-net-pci,netdev=%s,mac=%s,romfile=", AdminInterface, adminMAC(index)),
|
||||
)
|
||||
|
||||
for _, c := range nodeCables(p, n.Name) {
|
||||
args = append(args, cable(c.NodeInterface, c.NodePort, c.SwitchPort, c.NodeMAC.String(), c.MTU)...)
|
||||
}
|
||||
for _, c := range switchCables(p, n.Name) {
|
||||
args = append(args, cable(c.SwitchInterface, c.SwitchPort, c.NodePort, c.SwitchMAC.String(), c.MTU)...)
|
||||
for _, port := range nodePorts(p, n.Name) {
|
||||
args = append(args,
|
||||
"-netdev", fmt.Sprintf("tap,id=%s,ifname=%s,script=no,downscript=no", port.Interface, port.Tap),
|
||||
"-device", fmt.Sprintf("virtio-net-pci,netdev=%s,mac=%s,host_mtu=%d,romfile=", port.Interface, port.MAC, port.MTU),
|
||||
)
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
func cable(id string, local, remote int, mac string, mtu int) []string {
|
||||
return []string{
|
||||
"-netdev", fmt.Sprintf("dgram,id=%s,local.type=inet,local.host=%s,local.port=%d,remote.type=inet,remote.host=%s,remote.port=%d",
|
||||
id, loopback, local, loopback, remote),
|
||||
"-device", fmt.Sprintf("virtio-net-pci,netdev=%s,mac=%s,host_mtu=%d,romfile=", id, mac, mtu),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue