Ingress qdisc add/del Test case

This commit is contained in:
Parav Pandit 2018-07-06 00:31:09 -05:00 committed by Alessandro Boch
parent 1006cf4f24
commit d68dce480e
1 changed files with 39 additions and 0 deletions

View File

@ -456,3 +456,42 @@ func TestFqCodelAddChangeDel(t *testing.T) {
t.Fatal("Failed to remove qdisc") t.Fatal("Failed to remove qdisc")
} }
} }
func TestIngressAddDel(t *testing.T) {
tearDown := setUpNetlinkTest(t)
defer tearDown()
if err := LinkAdd(&Ifb{LinkAttrs{Name: "foo"}}); err != nil {
t.Fatal(err)
}
link, err := LinkByName("foo")
if err != nil {
t.Fatal(err)
}
qdisc := &Ingress{
QdiscAttrs: QdiscAttrs{
LinkIndex: link.Attrs().Index,
Parent: HANDLE_INGRESS,
},
}
err = QdiscAdd(qdisc)
if err != nil {
t.Fatal("Failed to add qdisc")
}
qdiscs, err := SafeQdiscList(link)
if err != nil {
t.Fatal("Failed to list qdisc")
}
if len(qdiscs) != 1 {
t.Fatal("Failed to add qdisc")
}
if err = QdiscDel(qdisc); err != nil {
t.Fatal(err)
}
qdiscs, err = SafeQdiscList(link)
if err != nil {
t.Fatal(err)
}
if len(qdiscs) != 0 {
t.Fatal("Failed to remove qdisc")
}
}