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) }
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) }
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") }
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") }