f-57: netif: MAC anycast de la gateway et création d'un macvlan #57
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
5d314e45e1
commit
fe8c83b1d6
4 changed files with 103 additions and 2 deletions
25
internal/netif/macvlan_test.go
Normal file
25
internal/netif/macvlan_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package netif
|
||||
|
||||
import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
func TestMacvlanLink(t *testing.T) {
|
||||
mac, _ := AnycastMAC(2911)
|
||||
link := macvlanLink("gw-sn1", 7, mac)
|
||||
if link.Name != "gw-sn1" || link.ParentIndex != 7 {
|
||||
t.Errorf("nom ou parent inattendu : %s, %d", link.Name, link.ParentIndex)
|
||||
}
|
||||
if link.HardwareAddr.String() != "02:01:00:00:0b:5f" {
|
||||
t.Errorf("MAC %s, 02:01:00:00:0b:5f attendue", link.HardwareAddr)
|
||||
}
|
||||
if link.Mode != netlink.MACVLAN_MODE_BRIDGE {
|
||||
t.Errorf("mode %v, bridge attendu", link.Mode)
|
||||
}
|
||||
if link.Flags&net.FlagUp != 0 {
|
||||
t.Error("le macvlan doit être créé éteint")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue