mirror of
https://github.com/vishvananda/netlink
synced 2025-01-01 04:22:06 +00:00
fd97bf4e47
Devlink device currently has legacy and switchdev mode. Add an API to set devlink device mode for discovered devlink device. Signed-off-by: Parav Pandit <parav@mellanox.com>
43 lines
820 B
Go
43 lines
820 B
Go
// +build linux
|
|
|
|
package netlink
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestDevLinkGetDeviceList(t *testing.T) {
|
|
minKernelRequired(t, 4, 12)
|
|
setUpNetlinkTestWithKModule(t, "devlink")
|
|
_, err := DevLinkGetDeviceList()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestDevLinkGetDeviceByName(t *testing.T) {
|
|
minKernelRequired(t, 4, 12)
|
|
setUpNetlinkTestWithKModule(t, "devlink")
|
|
_, err := DevLinkGetDeviceByName("foo", "bar")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestDevLinkSetEswitchMode(t *testing.T) {
|
|
minKernelRequired(t, 4, 12)
|
|
setUpNetlinkTestWithKModule(t, "devlink")
|
|
dev, err := DevLinkGetDeviceByName("foo", "bar")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
err = DevLinkSetEswitchMode(dev, "switchdev")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
err = DevLinkSetEswitchMode(dev, "legacy")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|