Beispiel #1
0
func (t *LxdSuite) TestNICPropertiesWithoutMACAddressOrMTUGreaterThanZero(c *gc.C) {
	props, err := lxd.NICProperties("testbr1", "eth1", "", 0)
	c.Assert(err, gc.IsNil)
	c.Assert(props, gc.HasLen, 3)
	c.Assert(props[0], gc.Equals, "nictype=bridged")
	c.Assert(props[1], gc.Equals, "parent=testbr1")
	c.Assert(props[2], gc.Equals, "name=eth1")
}
Beispiel #2
0
func (t *LxdSuite) TestNICPropertiesWithMACAddressButNoMTU(c *gc.C) {
	props, err := lxd.NICProperties("testbr1", "eth1", "aa:bb:cc:dd:ee:f0", 0)
	c.Assert(err, gc.IsNil)
	c.Assert(props, gc.HasLen, 4)
	c.Assert(props[0], gc.Equals, "nictype=bridged")
	c.Assert(props[1], gc.Equals, "parent=testbr1")
	c.Assert(props[2], gc.Equals, "name=eth1")
	c.Assert(props[3], gc.Equals, "hwaddr=aa:bb:cc:dd:ee:f0")
}
Beispiel #3
0
func (t *LxdSuite) TestNICPropertiesWithMACAddressAndMTUGreaterThanZero(c *gc.C) {
	props, err := lxd.NICProperties("testbr1", "eth1", "aa:bb:cc:dd:ee:f0", 1066)
	c.Assert(err, gc.IsNil)
	c.Assert(props, gc.HasLen, 5)
	c.Assert(props[0], gc.Equals, "nictype=bridged")
	c.Assert(props[1], gc.Equals, "parent=testbr1")
	c.Assert(props[2], gc.Equals, "name=eth1")
	c.Assert(props[3], gc.Equals, "hwaddr=aa:bb:cc:dd:ee:f0")
	c.Assert(props[4], gc.Equals, "mtu=1066")
}
Beispiel #4
0
func (t *LxdSuite) TestNICPropertiesWithInvalidParentDevice(c *gc.C) {
	props, err := lxd.NICProperties("", "eth1", "", 0)
	c.Assert(props, gc.IsNil)
	c.Assert(err.Error(), gc.Equals, "invalid parent device")
}
Beispiel #5
0
func (t *LxdSuite) TestNICPropertiesWithInvalidDeviceName(c *gc.C) {
	props, err := lxd.NICProperties("testbr1", "", "", 0)
	c.Assert(props, gc.IsNil)
	c.Assert(err.Error(), gc.Equals, "invalid device name")
}