Merge pull request #42 from ppalucki/master

macvtap support
This commit is contained in:
Vish Ishaya 2015-08-15 10:13:37 -07:00
commit cee28b0a8d
2 changed files with 30 additions and 0 deletions

View File

@ -114,6 +114,15 @@ func (macvlan *Macvlan) Type() string {
return "macvlan"
}
// Macvtap - macvtap is a virtual interfaces based on macvlan
type Macvtap struct {
Macvlan
}
func (macvtap Macvtap) Type() string {
return "macvtap"
}
// Veth devices must specify PeerName on create
type Veth struct {
LinkAttrs

View File

@ -225,6 +225,27 @@ func TestLinkAddDelMacvlan(t *testing.T) {
}
}
func TestLinkAddDelMacvtap(t *testing.T) {
tearDown := setUpNetlinkTest(t)
defer tearDown()
parent := &Dummy{LinkAttrs{Name: "foo"}}
if err := LinkAdd(parent); err != nil {
t.Fatal(err)
}
testLinkAddDel(t, &Macvtap{
Macvlan: Macvlan{
LinkAttrs: LinkAttrs{Name: "bar", ParentIndex: parent.Attrs().Index},
Mode: MACVLAN_MODE_PRIVATE,
},
})
if err := LinkDel(parent); err != nil {
t.Fatal(err)
}
}
func TestLinkAddDelVeth(t *testing.T) {
tearDown := setUpNetlinkTest(t)
defer tearDown()