f-89: watchdog: subnet public_ip contrôlé comme bridge #89
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
7d15ccf56f
commit
a4700a5636
2 changed files with 24 additions and 4 deletions
|
|
@ -16,8 +16,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
modeVxlan = "vxlan"
|
||||
modeBridge = "bridge"
|
||||
modeVxlan = "vxlan"
|
||||
modeBridge = "bridge"
|
||||
modePublicIP = "public_ip"
|
||||
)
|
||||
|
||||
func subnetIfaceNames(subnetName string) (hostVeth, nsVeth, bridge string, err error) {
|
||||
|
|
@ -83,7 +84,7 @@ func checkSubnet(db *badger.DB, name string, backend dhcpbackend.Backend, u unit
|
|||
n.Notify(kindSubnet, name, p+" (host)")
|
||||
}
|
||||
checkVxlanIface(db, name, n)
|
||||
case modeBridge:
|
||||
case modeBridge, modePublicIP:
|
||||
default:
|
||||
n.Notify(kindSubnet, name, fmt.Sprintf("unknown mode %q", mode))
|
||||
}
|
||||
|
|
@ -92,7 +93,7 @@ func checkSubnet(db *badger.DB, name string, backend dhcpbackend.Backend, u unit
|
|||
switch mode {
|
||||
case modeVxlan:
|
||||
checkAnycastGateway(db, name, vpc, bridge, n)
|
||||
case modeBridge:
|
||||
case modeBridge, modePublicIP:
|
||||
checkBridgeGateway(db, name, vpc, nsVeth, n)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,25 @@ func TestCheckSubnets_ModeBridgeNeVerifiePasDeVxlan(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCheckSubnets_ModePublicIPEstConnuEtSansVxlan(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
seedSubnet(t, db, "pub-203a42", "vp-admin", modePublicIP)
|
||||
r := &recorder{}
|
||||
|
||||
if err := CheckSubnets(db, dnsmasqConfig(), newFakeUnits(), r); err != nil {
|
||||
t.Fatalf("erreur inattendue: %v", err)
|
||||
}
|
||||
|
||||
for _, c := range r.calls {
|
||||
if strings.Contains(c.problem, "unknown mode") || strings.Contains(c.problem, "vxlan") || strings.Contains(c.problem, "(host)") {
|
||||
t.Errorf("un subnet public_ip est contrôlé comme bridge : %q", c.problem)
|
||||
}
|
||||
}
|
||||
if !r.hasProblemContaining("vp-admin_br-203a42.conf") {
|
||||
t.Errorf("témoin : le contrôle DHCP du subnet public_ip doit avoir lieu, obtenu %v", r.calls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckSubnets_ModeVxlanSansVxlanID(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
seedSubnet(t, db, "br-000042", "vp-admin", modeVxlan)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue