Skip to content

Commit 212a338

Browse files
committed
fix typo
1 parent d819855 commit 212a338

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

internal/controller/netbox_testdata_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/netbox-community/go-netbox/v3/netbox/client/tenancy"
2525
netboxModels "github.com/netbox-community/go-netbox/v3/netbox/models"
2626
netboxv1 "github.com/netbox-community/netbox-operator/api/v1"
27+
"github.com/netbox-community/netbox-operator/pkg/netbox/api"
2728
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2829
)
2930

@@ -40,7 +41,7 @@ var comments = "integration test comment"
4041
var siteSlug = "mars-ip-claim"
4142

4243
var ipAddress = "1.0.0.1/32"
43-
var ipAddressFamily = int64(4)
44+
var ipAddressFamily = int64(api.IPv4Family)
4445
var parentPrefix = "1.0.0.0/28"
4546

4647
var siteId = int64(2)

pkg/netbox/api/ip_address_claim.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import (
2929
type IPFamily int64
3030

3131
const (
32-
IPv4Familiy IPFamily = iota + 4
33-
_ // Skip 5
34-
IPv6Familiy
32+
IPv4Family IPFamily = iota + 4
33+
_ // Skip 5
34+
IPv6Family
3535
)
3636

3737
const (
@@ -90,9 +90,9 @@ func (r *NetboxClient) GetAvailableIpAddressByClaim(ipAddressClaim *models.IPAdd
9090
}
9191

9292
var ipMask string
93-
if responseAvailableIPs.Payload[0].Family == int64(IPv4Familiy) {
93+
if responseAvailableIPs.Payload[0].Family == int64(IPv4Family) {
9494
ipMask = ipMaskIPv4
95-
} else if responseAvailableIPs.Payload[0].Family == int64(IPv6Familiy) {
95+
} else if responseAvailableIPs.Payload[0].Family == int64(IPv6Family) {
9696
ipMask = ipMaskIPv6
9797
} else {
9898
return nil, errors.New("available ip has unknown IP family")

pkg/netbox/api/ip_address_claim_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ func TestIPAddressClaim(t *testing.T) {
4848
return []*netboxModels.AvailableIP{
4949
{
5050
Address: ipAddressV4_1,
51-
Family: int64(IPv4Familiy),
51+
Family: int64(IPv4Family),
5252
},
5353
{
5454
Address: ipAddressV4_2,
55-
Family: int64(IPv4Familiy),
55+
Family: int64(IPv4Family),
5656
},
5757
}
5858
}
@@ -177,7 +177,7 @@ func TestIPAddressClaim(t *testing.T) {
177177
Payload: []*netboxModels.AvailableIP{
178178
{
179179
Address: ipAddressV6,
180-
Family: int64(IPv6Familiy),
180+
Family: int64(IPv6Family),
181181
},
182182
}}
183183

pkg/netbox/api/prefix_claim.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func validatePrefixLengthOrError(prefixClaim *models.PrefixClaim, prefixFamily i
7373
return errors.New("requesting the entire parent prefix range is disallowed")
7474
} else if parentPrefixLength > requestedPrefixLength {
7575
return errors.New("requested prefix size must be smaller than the parent prefix size")
76-
} else if prefixFamily == int64(IPv4Familiy) && requestedPrefixLength > 32 {
76+
} else if prefixFamily == int64(IPv4Family) && requestedPrefixLength > 32 {
7777
return errors.New("requested prefix length must be smaller than 32 for IPv4")
7878
}
7979

pkg/netbox/api/prefix_claim_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ func TestPrefixClaim_GetAvailablePrefixesByParentPrefix(t *testing.T) {
4646
Payload: []*netboxModels.AvailablePrefix{
4747
{
4848
Prefix: childPrefix1,
49-
Family: int64(IPv4Familiy),
49+
Family: int64(IPv4Family),
5050
},
5151
{
5252
Prefix: childPrefix2,
53-
Family: int64(IPv4Familiy),
53+
Family: int64(IPv4Family),
5454
},
5555
},
5656
}
@@ -174,7 +174,7 @@ func TestPrefixClaim_GetBestFitPrefixByClaim(t *testing.T) {
174174
NewIpamPrefixesListParams().
175175
WithPrefix(&parentPrefix)
176176

177-
prefixFamily := int64(IPv4Familiy)
177+
prefixFamily := int64(IPv4Family)
178178
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
179179
prefixListOutput := &ipam.IpamPrefixesListOK{
180180
Payload: &ipam.IpamPrefixesListOKBody{
@@ -232,7 +232,7 @@ func TestPrefixClaim_InvalidIPv4PrefixLength(t *testing.T) {
232232
NewIpamPrefixesListParams().
233233
WithPrefix(&parentPrefix)
234234

235-
prefixFamily := int64(IPv4Familiy)
235+
prefixFamily := int64(IPv4Family)
236236
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
237237
prefixListOutput := &ipam.IpamPrefixesListOK{
238238
Payload: &ipam.IpamPrefixesListOKBody{
@@ -276,7 +276,7 @@ func TestPrefixClaim_FailWhenRequestingEntirePrefix(t *testing.T) {
276276
NewIpamPrefixesListParams().
277277
WithPrefix(&parentPrefix)
278278

279-
prefixFamily := int64(IPv4Familiy)
279+
prefixFamily := int64(IPv4Family)
280280
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
281281
prefixListOutput := &ipam.IpamPrefixesListOK{
282282
Payload: &ipam.IpamPrefixesListOKBody{
@@ -320,7 +320,7 @@ func TestPrefixClaim_FailWhenPrefixLargerThanParent(t *testing.T) {
320320
NewIpamPrefixesListParams().
321321
WithPrefix(&parentPrefix)
322322

323-
prefixFamily := int64(IPv4Familiy)
323+
prefixFamily := int64(IPv4Family)
324324
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
325325
prefixListOutput := &ipam.IpamPrefixesListOK{
326326
Payload: &ipam.IpamPrefixesListOKBody{
@@ -381,7 +381,7 @@ func TestPrefixClaim_ValidIPv6PrefixLength(t *testing.T) {
381381
NewIpamPrefixesListParams().
382382
WithPrefix(&parentPrefix)
383383

384-
prefixFamily := int64(IPv6Familiy)
384+
prefixFamily := int64(IPv6Family)
385385
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV6
386386
prefixListOutput := &ipam.IpamPrefixesListOK{
387387
Payload: &ipam.IpamPrefixesListOKBody{
@@ -455,7 +455,7 @@ func TestPrefixClaim_GetBestFitPrefixByClaimNoAvailablePrefixMatchesSize(t *test
455455
NewIpamPrefixesListParams().
456456
WithPrefix(&parentPrefix)
457457

458-
prefixFamily := int64(IPv4Familiy)
458+
prefixFamily := int64(IPv4Family)
459459
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
460460
prefixListOutput := &ipam.IpamPrefixesListOK{
461461
Payload: &ipam.IpamPrefixesListOKBody{
@@ -536,7 +536,7 @@ func TestPrefixClaim_GetBestFitPrefixByClaimNoAvailablePrefixMatchesSizeCriteria
536536
NewIpamPrefixesListParams().
537537
WithPrefix(&parentPrefix)
538538

539-
prefixFamily := int64(IPv4Familiy)
539+
prefixFamily := int64(IPv4Family)
540540
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
541541
prefixListOutput := &ipam.IpamPrefixesListOK{
542542
Payload: &ipam.IpamPrefixesListOKBody{
@@ -612,7 +612,7 @@ func TestPrefixClaim_GetBestFitPrefixByClaimInvalidFormatFromNetbox(t *testing.T
612612
NewIpamPrefixesListParams().
613613
WithPrefix(&parentPrefix)
614614

615-
prefixFamily := int64(IPv4Familiy)
615+
prefixFamily := int64(IPv4Family)
616616
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
617617
prefixListOutput := &ipam.IpamPrefixesListOK{
618618
Payload: &ipam.IpamPrefixesListOKBody{
@@ -693,7 +693,7 @@ func TestPrefixClaim_GetBestFitPrefixByClaimInvalidPrefixClaim(t *testing.T) {
693693
NewIpamPrefixesListParams().
694694
WithPrefix(&parentPrefix)
695695

696-
prefixFamily := int64(IPv4Familiy)
696+
prefixFamily := int64(IPv4Family)
697697
prefixFamilyLabel := netboxModels.PrefixFamilyLabelIPV4
698698
prefixListOutput := &ipam.IpamPrefixesListOK{
699699
Payload: &ipam.IpamPrefixesListOKBody{

0 commit comments

Comments
 (0)