f-28: add vpc cidr field
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
2504b435a3
commit
76a840b80a
8 changed files with 98 additions and 17 deletions
|
|
@ -11,14 +11,15 @@ import (
|
|||
)
|
||||
|
||||
type subnetData struct {
|
||||
vpc string
|
||||
subnetID string
|
||||
bridge string
|
||||
mode string
|
||||
vxlanID int
|
||||
localIface string
|
||||
vpc string
|
||||
subnetID string
|
||||
bridge string
|
||||
mode string
|
||||
vxlanID int
|
||||
localIface string
|
||||
interfaceIP net.IP
|
||||
cidr *net.IPNet
|
||||
cidr *net.IPNet
|
||||
vpcCIDR *net.IPNet
|
||||
}
|
||||
|
||||
func loadSubnet(db *badger.DB, name string) (subnetData, error) {
|
||||
|
|
@ -77,5 +78,15 @@ func loadSubnet(db *badger.DB, name string) (subnetData, error) {
|
|||
}
|
||||
d.cidr = ipNet
|
||||
|
||||
vpcCIDRStr, err := kv.GetFromDB(db, "vpc/"+d.vpc+"/cidr")
|
||||
if err != nil {
|
||||
return d, fmt.Errorf("get vpc cidr: %w", err)
|
||||
}
|
||||
_, vpcIPNet, err := net.ParseCIDR(vpcCIDRStr)
|
||||
if err != nil {
|
||||
return d, fmt.Errorf("parse vpc cidr: %w", err)
|
||||
}
|
||||
d.vpcCIDR = vpcIPNet
|
||||
|
||||
return d, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue