Пример #1
0
func (t *LxdSuite) TestNICDeviceWithoutMACAddressOrMTUGreaterThanZero(c *gc.C) {
	device, err := lxd.NICDevice("eth1", "br-eth1", "", 0)
	c.Assert(err, gc.IsNil)
	expected := lxdclient.Device{
		"name":    "eth1",
		"nictype": "bridged",
		"parent":  "br-eth1",
		"type":    "nic",
	}
	c.Assert(device, gc.DeepEquals, expected)
}
Пример #2
0
func (t *LxdSuite) TestNICDeviceWithMACAddressButNoMTU(c *gc.C) {
	device, err := lxd.NICDevice("eth1", "br-eth1", "aa:bb:cc:dd:ee:f0", 0)
	c.Assert(err, gc.IsNil)
	expected := lxdclient.Device{
		"hwaddr":  "aa:bb:cc:dd:ee:f0",
		"name":    "eth1",
		"nictype": "bridged",
		"parent":  "br-eth1",
		"type":    "nic",
	}
	c.Assert(device, gc.DeepEquals, expected)
}
Пример #3
0
func (t *LxdSuite) TestNICDeviceWithInvalidDeviceName(c *gc.C) {
	device, err := lxd.NICDevice("", "br-eth1", "", 0)
	c.Assert(device, gc.IsNil)
	c.Assert(err.Error(), gc.Equals, "invalid device name")
}
Пример #4
0
func (t *LxdSuite) TestNICDeviceWithInvalidParentDeviceName(c *gc.C) {
	device, err := lxd.NICDevice("eth0", "", "", 0)
	c.Assert(device, gc.IsNil)
	c.Assert(err.Error(), gc.Equals, "invalid parent device name")
}