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:
parent
e2faf85e96
commit
3c6852dc18
8 changed files with 541 additions and 5 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package netif
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
|
|
@ -11,3 +13,15 @@ func DeleteLink(name string) error {
|
|||
}
|
||||
return netlink.LinkDel(link)
|
||||
}
|
||||
|
||||
func DeleteLinkIfExists(name string) error {
|
||||
link, err := netlink.LinkByName(name)
|
||||
if err != nil {
|
||||
var notFound netlink.LinkNotFoundError
|
||||
if errors.As(err, ¬Found) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return netlink.LinkDel(link)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue