Add devlink command to query devlink port list

Add devlink command to get list of devlink ports and their common
attributes.

Signed-off-by: Parav Pandit <parav@mellanox.com>
This commit is contained in:
Parav Pandit
2020-06-15 12:05:23 +03:00
committed by Alessandro Boch
parent ffba2c833f
commit ff8f17bc19
3 changed files with 118 additions and 0 deletions

View File

@@ -40,3 +40,15 @@ func TestDevLinkSetEswitchMode(t *testing.T) {
t.Fatal(err)
}
}
func TestDevLinkGetAllPortList(t *testing.T) {
minKernelRequired(t, 5, 4)
ports, err := DevLinkGetAllPortList()
if err != nil {
t.Fatal(err)
}
t.Log("devlink port count = ", len(ports))
for _, port := range ports {
t.Log(*port)
}
}