Ejemplo n.º 1
0
func TestIPv6InterfaceAllocationRequest(t *testing.T) {

	input := engine.Env{}

	_, subnet, _ := net.ParseCIDR("2001:db8:1234:1234:1234::/80")
	expected_ip := net.ParseIP("2001:db8:1234:1234:1234::1328")

	// set global ipv6
	input.Set("globalIPv6Network", subnet.String())
	input.Set("RequestedIPv6", expected_ip.String())

	output := newInterfaceAllocation(t, input)

	// ensure global ip with mac
	ip := net.ParseIP(output.Get("GlobalIPv6"))
	if ip.String() != expected_ip.String() {
		t.Fatalf("Error ip %s should be %s", ip.String(), expected_ip.String())
	}

	// retry -> fails for duplicated address
	input.SetBool("expectFail", true)
	output = newInterfaceAllocation(t, input)
}