mirror of
https://github.com/vishvananda/netlink
synced 2025-01-03 21:42:03 +00:00
Add a test for Vlan filtering support for bridges.
This commit is contained in:
parent
0bbc55bea9
commit
2cbcf73e3d
46
link_test.go
46
link_test.go
@ -1615,6 +1615,52 @@ func TestBridgeCreationWithHelloTime(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBridgeCreationWithVlanFiltering(t *testing.T) {
|
||||||
|
minKernelRequired(t, 3, 18)
|
||||||
|
|
||||||
|
tearDown := setUpNetlinkTest(t)
|
||||||
|
defer tearDown()
|
||||||
|
|
||||||
|
bridgeWithVlanFilteringEnabledName := "foo"
|
||||||
|
vlanFiltering := true
|
||||||
|
bridgeWithVlanFilteringEnabled := &Bridge{LinkAttrs: LinkAttrs{Name: bridgeWithVlanFilteringEnabledName}, VlanFiltering: &vlanFiltering}
|
||||||
|
if err := LinkAdd(bridgeWithVlanFilteringEnabled); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
retrievedBridge, err := LinkByName(bridgeWithVlanFilteringEnabledName)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
retrievedVlanFilteringState := *retrievedBridge.(*Bridge).VlanFiltering
|
||||||
|
if retrievedVlanFilteringState != vlanFiltering {
|
||||||
|
t.Fatalf("expected %t got %t", vlanFiltering, retrievedVlanFilteringState)
|
||||||
|
}
|
||||||
|
if err := LinkDel(bridgeWithVlanFilteringEnabled); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
bridgeWithDefaultVlanFilteringName := "bar"
|
||||||
|
bridgeWIthDefaultVlanFiltering := &Bridge{LinkAttrs: LinkAttrs{Name: bridgeWithDefaultVlanFilteringName}}
|
||||||
|
if err := LinkAdd(bridgeWIthDefaultVlanFiltering); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
retrievedBridge, err = LinkByName(bridgeWithDefaultVlanFilteringName)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
retrievedVlanFilteringState = *retrievedBridge.(*Bridge).VlanFiltering
|
||||||
|
if retrievedVlanFilteringState != false {
|
||||||
|
t.Fatalf("expected %t got %t", false, retrievedVlanFilteringState)
|
||||||
|
}
|
||||||
|
if err := LinkDel(bridgeWIthDefaultVlanFiltering); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestLinkSubscribeWithProtinfo(t *testing.T) {
|
func TestLinkSubscribeWithProtinfo(t *testing.T) {
|
||||||
tearDown := setUpNetlinkTest(t)
|
tearDown := setUpNetlinkTest(t)
|
||||||
defer tearDown()
|
defer tearDown()
|
||||||
|
Loading…
Reference in New Issue
Block a user