Skip to content

Commit

Permalink
Fixing UTs, and adding the new components to the SCM pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
Levovar committed May 8, 2019
1 parent 30b2034 commit 5624254
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 81 deletions.
5 changes: 3 additions & 2 deletions pkg/netadmit/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func validateAllocationPool(dnet *danmtypes.DanmNet) error {
dnet.Spec.Options.Pool.Start = (ipam.Int2ip(ipam.Ip2int(ipnet.IP) + 1)).String()
}
if apEnd == "" {
dnet.Spec.Options.Pool.End = (ipam.Int2ip(ipam.Ip2int(getBroadcastAddress(ipnet)) - 1)).String()
dnet.Spec.Options.Pool.End = (ipam.Int2ip(ipam.Ip2int(GetBroadcastAddress(ipnet)) - 1)).String()
}
if !ipnet.Contains(net.ParseIP(apStart)) || !ipnet.Contains(net.ParseIP(apEnd)) {
return errors.New("Allocation pool is outside of defined CIDR")
Expand All @@ -89,8 +89,9 @@ func validateAllocationPool(dnet *danmtypes.DanmNet) error {
return nil
}

func getBroadcastAddress(subnet *net.IPNet) (net.IP) {
func GetBroadcastAddress(subnet *net.IPNet) (net.IP) {
ip := make(net.IP, len(subnet.IP.To4()))
//Don't ask
binary.BigEndian.PutUint32(ip, binary.BigEndian.Uint32(subnet.IP.To4())|^binary.BigEndian.Uint32(net.IP(subnet.Mask).To4()))
return ip
}
Expand Down
3 changes: 2 additions & 1 deletion scm/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/danm
go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/netwatcher
go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/fakeipam
go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/svcwatcher
go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/cnitest
go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/cnitest
go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/webhook
2 changes: 1 addition & 1 deletion scm/ut/run_uts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e
cd $GOPATH/src/github.com/nokia/danm
echo "" > coverage.out
for d in $(go list ./... | grep -v vendor | grep -v crd); do
go test -covermode=count -v -coverprofile=profile.out -coverpkg=github.com/nokia/danm/pkg/cnidel,github.com/nokia/danm/pkg/bitarray,github.com/nokia/danm/pkg/ipam,github.com/nokia/danm/pkg/danmep,github.com/nokia/danm/pkg/netcontrol,github.com/nokia/danm/pkg/syncher,github.com/nokia/danm/pkg/metacni,github.com/nokia/danm/pkg/svccontrol $d
go test -covermode=count -v -coverprofile=profile.out -coverpkg=github.com/nokia/danm/pkg/cnidel,github.com/nokia/danm/pkg/bitarray,github.com/nokia/danm/pkg/ipam,github.com/nokia/danm/pkg/danmep,github.com/nokia/danm/pkg/netcontrol,github.com/nokia/danm/pkg/syncher,github.com/nokia/danm/pkg/metacni,github.com/nokia/danm/pkg/svccontrol,github.com/nokia/danm/pkg/netadmit $d
if [ -f profile.out ]; then
cat profile.out >> coverage.out
rm profile.out
Expand Down
6 changes: 3 additions & 3 deletions test/stubs/netclient_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
watch "k8s.io/apimachinery/pkg/watch"
danmtypes "github.com/nokia/danm/crd/apis/danm/v1"
"github.com/nokia/danm/pkg/bitarray"
"github.com/nokia/danm/pkg/netcontrol"
"github.com/nokia/danm/pkg/ipam"
)
const (
magicVersion = "42"
Expand All @@ -33,13 +33,13 @@ func (netClient *NetClientStub) Update(obj *danmtypes.DanmNet) (*danmtypes.DanmN
if obj.Spec.NetworkID == netReservation.NetworkId {
ba := bitarray.NewBitArrayFromBase64(obj.Spec.Options.Alloc)
_, ipnet, _ := net.ParseCIDR(obj.Spec.Options.Cidr)
ipnetNum := netcontrol.Ip2int(ipnet.IP)
ipnetNum := ipam.Ip2int(ipnet.IP)
for _, reservation := range netReservation.Reservations {
ip,_,err := net.ParseCIDR(reservation.Ip)
if err != nil {
continue
}
ipInInt := netcontrol.Ip2int(ip) - ipnetNum
ipInInt := ipam.Ip2int(ip) - ipnetNum
if !ipnet.Contains(ip) {
continue
}
Expand Down
31 changes: 19 additions & 12 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,32 @@ import (
"strings"
danmtypes "github.com/nokia/danm/crd/apis/danm/v1"
"github.com/nokia/danm/pkg/bitarray"
"github.com/nokia/danm/pkg/netcontrol"
"github.com/nokia/danm/pkg/ipam"
"github.com/nokia/danm/pkg/netadmit"
)

func SetupAllocationPools(nets []danmtypes.DanmNet) error {
for index, net := range nets {
if net.Spec.Options.Cidr != "" {
bitArray, err := netcontrol.CreateAllocationArray(&net)
for index, dnet := range nets {
if dnet.Spec.Options.Cidr != "" {
bitArray, err := netadmit.CreateAllocationArray(&dnet)
if err != nil {
return err
}
net.Spec.Options.Alloc = bitArray.Encode()
err = netcontrol.ValidateAllocationPool(&net)
dnet.Spec.Options.Alloc = bitArray.Encode()
_, ipnet, err := net.ParseCIDR(dnet.Spec.Options.Cidr)
if err != nil {
return err
}
if strings.HasPrefix(net.Spec.NetworkID, "full") {
exhaustNetwork(&net)
if dnet.Spec.Options.Pool.Start == "" {
dnet.Spec.Options.Pool.Start = (ipam.Int2ip(ipam.Ip2int(ipnet.IP) + 1)).String()
}
nets[index].Spec = net.Spec
if dnet.Spec.Options.Pool.End == "" {
dnet.Spec.Options.Pool.End = (ipam.Int2ip(ipam.Ip2int(netadmit.GetBroadcastAddress(ipnet)) - 1)).String()
}
if strings.HasPrefix(dnet.Spec.NetworkID, "full") {
exhaustNetwork(&dnet)
}
nets[index].Spec = dnet.Spec
}
}
return nil
Expand All @@ -32,9 +39,9 @@ func SetupAllocationPools(nets []danmtypes.DanmNet) error {
func exhaustNetwork(netInfo *danmtypes.DanmNet) {
ba := bitarray.NewBitArrayFromBase64(netInfo.Spec.Options.Alloc)
_, ipnet, _ := net.ParseCIDR(netInfo.Spec.Options.Cidr)
ipnetNum := netcontrol.Ip2int(ipnet.IP)
begin := netcontrol.Ip2int(net.ParseIP(netInfo.Spec.Options.Pool.Start)) - ipnetNum
end := netcontrol.Ip2int(net.ParseIP(netInfo.Spec.Options.Pool.End)) - ipnetNum
ipnetNum := ipam.Ip2int(ipnet.IP)
begin := ipam.Ip2int(net.ParseIP(netInfo.Spec.Options.Pool.Start)) - ipnetNum
end := ipam.Ip2int(net.ParseIP(netInfo.Spec.Options.Pool.End)) - ipnetNum
for i:=begin;i<=end;i++ {
ba.Set(uint32(i))
}
Expand Down
18 changes: 9 additions & 9 deletions test/uts/cnidel_test/cnidel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,39 @@ var testNets = []danmtypes.DanmNet {
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "ipamNeeded"},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "cidr", Validation: true,},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "cidr",},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "flannel-test"},
Spec: danmtypes.DanmNetSpec{NetworkType: "flannel", NetworkID: "flannel_conf", Validation: true,},
Spec: danmtypes.DanmNetSpec{NetworkType: "flannel", NetworkID: "flannel_conf",},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "no-conf"},
Spec: danmtypes.DanmNetSpec{NetworkType: "flannel", NetworkID: "hulululu", Validation: true,},
Spec: danmtypes.DanmNetSpec{NetworkType: "flannel", NetworkID: "hulululu",},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "no-binary"},
Spec: danmtypes.DanmNetSpec{NetworkType: "flanel", NetworkID: "flannel_conf", Validation: true,},
Spec: danmtypes.DanmNetSpec{NetworkType: "flanel", NetworkID: "flannel_conf",},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "macvlan-v4"},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "macvlan", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Device: "ens1f0"}},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "macvlan", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Device: "ens1f0"}},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "macvlan-v6"},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "macvlan", Validation: true, Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64", Device: "ens1f1"}},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "macvlan", Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64", Device: "ens1f1"}},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "macvlan-ds"},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "macvlan", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Net6: "2a00:8a00:a000:1193::/64", Device: "ens1f1"}},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "macvlan", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Net6: "2a00:8a00:a000:1193::/64", Device: "ens1f1"}},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "sriov-test"},
Spec: danmtypes.DanmNetSpec{NetworkType: "sriov", NetworkID: "sriov-test", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Vlan: 500}},
Spec: danmtypes.DanmNetSpec{NetworkType: "sriov", NetworkID: "sriov-test", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Vlan: 500}},
},
danmtypes.DanmNet {
ObjectMeta: meta_v1.ObjectMeta {Name: "full-macvlan"},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "full", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Device: "ens1f0"}},
Spec: danmtypes.DanmNetSpec{NetworkType: "macvlan", NetworkID: "full", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26", Device: "ens1f0"}},
},
}

Expand Down
102 changes: 49 additions & 53 deletions test/uts/ipam_test/ipam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ import (
)

var testNets = []danmtypes.DanmNet {
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "emptyVal"},Spec: danmtypes.DanmNetSpec{NetworkID: "emptyVal", }},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "falseVal"},Spec: danmtypes.DanmNetSpec{NetworkID: "falseVal", Validation: false}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "trueVal"},Spec: danmtypes.DanmNetSpec{NetworkID: "trueVal", Validation: true}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "cidr"},Spec: danmtypes.DanmNetSpec{NetworkID: "cidr", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "fullIpv4"},Spec: danmtypes.DanmNetSpec{NetworkID: "fullIpv4", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.0/30"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "net6"},Spec: danmtypes.DanmNetSpec{NetworkID: "net6", Validation: true, Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64", Cidr: "192.168.1.64/26",}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "smallNet6"},Spec: danmtypes.DanmNetSpec{NetworkID: "smallNet6", Validation: true, Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/69"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflict"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflict", Validation: true, Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflicterror"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflicterror", Validation: true, Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflictFree"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflictFree", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflicterrorFree"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflicterrorFree", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "error"},Spec: danmtypes.DanmNetSpec{NetworkID: "error", Validation: true, Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "l2"},Spec: danmtypes.DanmNetSpec{NetworkID: "l2"}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "cidr"},Spec: danmtypes.DanmNetSpec{NetworkID: "cidr", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "fullIpv4"},Spec: danmtypes.DanmNetSpec{NetworkID: "fullIpv4", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.0/30"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "net6"},Spec: danmtypes.DanmNetSpec{NetworkID: "net6", Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64", Cidr: "192.168.1.64/26",}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "smallNet6"},Spec: danmtypes.DanmNetSpec{NetworkID: "smallNet6", Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/69"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflict"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflict", Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflicterror"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflicterror", Options: danmtypes.DanmNetOption{Net6: "2a00:8a00:a000:1193::/64"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflictFree"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflictFree", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "conflicterrorFree"},Spec: danmtypes.DanmNetSpec{NetworkID: "conflicterrorFree", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
danmtypes.DanmNet {ObjectMeta: meta_v1.ObjectMeta {Name: "error"},Spec: danmtypes.DanmNetSpec{NetworkID: "error", Options: danmtypes.DanmNetOption{Cidr: "192.168.1.64/26"}}},
}

var reserveTcs = []struct {
Expand All @@ -36,37 +34,35 @@ var reserveTcs = []struct {
isErrorExpected bool
isMacExpected bool
}{
{"emptyVal", 0, "", "", "", "", true, false},
{"falseVal", 1, "", "", "", "", true, false},
{"noIpsRequested", 2, "", "", "", "", false, true},
{"noneIPv4", 2, "none", "", "", "", false, true},
{"noneIPv6", 2, "", "none", "", "", false, true},
{"noneDualStack", 2, "none", "none", "", "", false, true},
{"dynamicErrorIPv4", 2, "dynamic", "", "", "", true, false},
{"dynamicErrorIPv6", 2, "", "dynamic", "", "", true, false},
{"dynamicErrorDualStack", 2, "dynamic", "dynamic", "", "", true, false},
{"dynamicIPv4Success", 3, "dynamic", "", "192.168.1.65/26", "", false, true},
{"dynamicIPv4Exhausted", 4, "dynamic", "", "", "", true, false},
{"staticInvalidIPv4", 4, "hululululu", "", "", "", true, false},
{"staticInvalidNoCidrIPv4", 4, "192.168.1.1", "", "", "", true, false},
{"staticL2IPv4", 2, "192.168.1.1/26", "", "", "", true, false},
{"staticNetmaskMismatchIPv4", 4, "192.168.1.1/32", "", "", "", true, false},
{"staticAlreadyUsedIPv4", 4, "192.168.1.2/30", "", "", "", true, false},
{"staticSuccessLastIPv4", 3, "192.168.1.126/26", "", "192.168.1.126/26", "", false, true},
{"staticSuccessFirstIPv4", 3, "192.168.1.65/26", "", "192.168.1.65/26", "", false, true},
{"staticFailAfterLastIPv4", 3, "192.168.1.127/26", "", "", "", true, false},
{"staticFailBeforeFirstIPv4", 3, "192.168.1.64/26", "", "", "", true, false},
{"dynamicIPv6Success", 5, "", "dynamic", "", "2a00:8a00:a000:1193", false, true},
{"dynamicNotSupportedCidrSizeIPv6", 6, "", "dynamic", "", "", true, false}, //basically anything smaller than /64. Restriction must be fixed some day!
{"staticL2IPv6", 4, "", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", "", "", true, false},
{"staticInvalidIPv6", 5, "", "2a00:8a00:a000:1193:hulu:lulu:lulu:lulu/64", "", "", true, false},
{"staticNetmaskMismatchIPv6", 5, "", "2a00:8a00:a000:2193:f816:3eff:fe24:e348/64", "", "", true, false},
{"staticIPv6Success", 5, "", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", "", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", false, false},
{"dynamicDualStackSuccess", 5, "dynamic", "dynamic", "192.168.1.65/26", "2a00:8a00:a000:1193", false, true},
{"staticDualStackSuccess", 5, "192.168.1.115/26", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", "192.168.1.115/26", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", false, true},
{"resolvedConflictDuringUpdate", 7, "", "dynamic", "", "2a00:8a00:a000:1193", false, true},
{"unresolvedConflictDuringUpdate", 8, "", "dynamic", "", "", true, false},
{"errorUpdate", 11, "", "dynamic", "", "", true, false},
{"noIpsRequested", 0, "", "", "", "", false, true},
{"noneIPv4", 0, "none", "", "", "", false, true},
{"noneIPv6", 0, "", "none", "", "", false, true},
{"noneDualStack", 0, "none", "none", "", "", false, true},
{"dynamicErrorIPv4", 0, "dynamic", "", "", "", true, false},
{"dynamicErrorIPv6", 0, "", "dynamic", "", "", true, false},
{"dynamicErrorDualStack", 0, "dynamic", "dynamic", "", "", true, false},
{"dynamicIPv4Success", 1, "dynamic", "", "192.168.1.65/26", "", false, true},
{"dynamicIPv4Exhausted", 2, "dynamic", "", "", "", true, false},
{"staticInvalidIPv4", 2, "hululululu", "", "", "", true, false},
{"staticInvalidNoCidrIPv4", 2, "192.168.1.1", "", "", "", true, false},
{"staticL2IPv4", 0, "192.168.1.1/26", "", "", "", true, false},
{"staticNetmaskMismatchIPv4", 2, "192.168.1.1/32", "", "", "", true, false},
{"staticAlreadyUsedIPv4", 2, "192.168.1.2/30", "", "", "", true, false},
{"staticSuccessLastIPv4", 1, "192.168.1.126/26", "", "192.168.1.126/26", "", false, true},
{"staticSuccessFirstIPv4", 1, "192.168.1.65/26", "", "192.168.1.65/26", "", false, true},
{"staticFailAfterLastIPv4", 1, "192.168.1.127/26", "", "", "", true, false},
{"staticFailBeforeFirstIPv4", 1, "192.168.1.64/26", "", "", "", true, false},
{"dynamicIPv6Success", 3, "", "dynamic", "", "2a00:8a00:a000:1193", false, true},
{"dynamicNotSupportedCidrSizeIPv6", 4, "", "dynamic", "", "", true, false}, //basically anything smaller than /64. Restriction must be fixed some day!
{"staticL2IPv6", 2, "", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", "", "", true, false},
{"staticInvalidIPv6", 3, "", "2a00:8a00:a000:1193:hulu:lulu:lulu:lulu/64", "", "", true, false},
{"staticNetmaskMismatchIPv6", 3, "", "2a00:8a00:a000:2193:f816:3eff:fe24:e348/64", "", "", true, false},
{"staticIPv6Success", 3, "", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", "", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", false, false},
{"dynamicDualStackSuccess", 3, "dynamic", "dynamic", "192.168.1.65/26", "2a00:8a00:a000:1193", false, true},
{"staticDualStackSuccess", 3, "192.168.1.115/26", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", "192.168.1.115/26", "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", false, true},
{"resolvedConflictDuringUpdate", 5, "", "dynamic", "", "2a00:8a00:a000:1193", false, true},
{"unresolvedConflictDuringUpdate", 6, "", "dynamic", "", "", true, false},
{"errorUpdate", 9, "", "dynamic", "", "", true, false},
}

var freeTcs = []struct {
Expand All @@ -75,16 +71,16 @@ var freeTcs = []struct {
allocatedIp string
isErrorExpected bool
}{
{"l2Network", 2, "192.168.1.126/26", false},
{"noAssignedIp", 3, "", false},
{"successfulFree", 4, "192.168.1.2/30", false},
{"noNetmask", 4, "192.168.1.2", false},
{"outOfRange", 4, "192.168.1.10/30", false},
{"invalidIp", 4, "192.168.hululu/30", false},
{"ipv6", 4, "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", false},
{"resolvedConflictDuringUpdate", 9, "192.168.1.69/26", false},
{"unresolvedConflictDuringUpdate", 10, "192.168.1.69/26", true},
{"errorUpdate", 11, "192.168.1.69/26", true},
{"l2Network", 0, "192.168.1.126/26", false},
{"noAssignedIp", 1, "", false},
{"successfulFree", 2, "192.168.1.2/30", false},
{"noNetmask", 2, "192.168.1.2", false},
{"outOfRange", 2, "192.168.1.10/30", false},
{"invalidIp", 2, "192.168.hululu/30", false},
{"ipv6", 2, "2a00:8a00:a000:1193:f816:3eff:fe24:e348/64", false},
{"resolvedConflictDuringUpdate", 7, "192.168.1.69/26", false},
{"unresolvedConflictDuringUpdate", 8, "192.168.1.69/26", true},
{"errorUpdate", 9, "192.168.1.69/26", true},
}

var gcTcs = []struct {
Expand Down

0 comments on commit 5624254

Please sign in to comment.