f-41: vpc: VRF, L3VNI et transit à la création des VPC routées #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 20:21:19 +02:00
commit 3c6852dc18
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
8 changed files with 541 additions and 5 deletions

View file

@ -3,6 +3,7 @@ package vpc
import (
"strings"
configuration "git.g3e.fr/syonad/two/internal/config/agent"
"git.g3e.fr/syonad/two/internal/netif"
"git.g3e.fr/syonad/two/internal/netns"
"git.g3e.fr/syonad/two/internal/state"
@ -10,12 +11,22 @@ import (
"github.com/dgraph-io/badger/v4"
)
func DeleteVPC(db *badger.DB, name string) error {
func DeleteVPC(db *badger.DB, name string, cfg *configuration.Config) error {
if current, err := state.Get(db, "vpc/"+name); err != nil {
return err
} else if current == state.Deleting {
vpcID := strings.SplitN(name, "-", 2)[1]
l3, ok, err := loadL3(db, name, vpcID)
if err != nil {
return err
}
if ok {
if err := deleteL3(newSystem(), cfg, l3); err != nil {
return err
}
}
if err := netif.DeleteLink("vp-" + vpcID + "-e"); err != nil {
return err
}