Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for ZoneDelegated object #242

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions e2e_tests/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

func TestE2EInfobloxGoClient(t *testing.T) {
RegisterFailHandler(Fail)
_, reporterConfig := GinkgoConfiguration()
reporterConfig.SlowSpecThreshold = time.Minute * 10
RunSpecs(t, "InfobloxGoClient E2E Test Suite", reporterConfig)
suiteConfig, reporterConfig := GinkgoConfiguration()
suiteConfig.PollProgressInterval = time.Second * 10
RunSpecs(t, "InfobloxGoClient E2E Test Suite", suiteConfig, reporterConfig)
}

// ConnectorFacadeE2E is an end-to-end test facade for the ibclient.Connector.
Expand Down
181 changes: 161 additions & 20 deletions e2e_tests/wapi_framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,147 @@ var _ = Describe("Go Client", func() {
Expect(err).To(BeNil())
})

It("Should create a Zone delegation", func() {
// Create a DNS Forward Zone
zone := &ibclient.ZoneDelegated{
Fqdn: "example1.wapi.com",
DelegateTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "2.3.4.5"},
},
IsNull: false,
},
DelegatedTtl: utils.Uint32Ptr(3600),
UseDelegatedTtl: utils.BoolPtr(true),
}
ref, err := connector.CreateObject(zone)
Expect(err).To(BeNil())
Expect(ref).To(MatchRegexp("^zone_delegated.*"))
})
It("Should get the Zone delegated", func() {
zone := &ibclient.ZoneDelegated{
Fqdn: "example2.wapi.com",
DelegateTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "2.3.4.5"},
},
IsNull: false,
},
Comment: utils.StringPtr("wapi added"),
}
ref, err := connector.CreateObject(zone)
Expect(err).To(BeNil())
Expect(ref).To(MatchRegexp("^zone_delegated.*"))

var res []ibclient.ZoneDelegated
search := &ibclient.ZoneDelegated{}
errCode := connector.GetObject(search, "", nil, &res)
Expect(errCode).To(BeNil())
Expect(res[0].Ref).To(MatchRegexp("^zone_delegated.*"))
})
It("Should update the Zone delegated", func() {
// Create a Zone delegated
zoneCreate := &ibclient.ZoneDelegated{
Fqdn: "example3.wapi.com",
DelegateTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.5"},
},
IsNull: false,
},
Comment: utils.StringPtr("wapi added"),
}
ref, errCode := connector.CreateObject(zoneCreate)
Expect(errCode).To(BeNil())
Expect(ref).To(MatchRegexp("^zone_delegated.*"))

// Update a Zone-delegated
zone := &ibclient.ZoneDelegated{
DelegateTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.6"},
},
IsNull: false,
},
Comment: utils.StringPtr("wapi added"),
}

var res []ibclient.ZoneDelegated
search := &ibclient.ZoneDelegated{}
err := connector.GetObject(search, "", nil, &res)
ref, err = connector.UpdateObject(zone, res[0].Ref)
Expect(err).To(BeNil())
Expect(ref).To(MatchRegexp("^zone_delegated.*"))
})

It("Should delete the Zone-delegated", func() {
// Create a DNS Zone-delegated
zoneCreate := &ibclient.ZoneDelegated{
Fqdn: "example4.wapi.com",
DelegateTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.5"},
},
IsNull: false,
},
Comment: utils.StringPtr("wapi added"),
}
refCreate, errCode := connector.CreateObject(zoneCreate)
Expect(errCode).To(BeNil())
Expect(refCreate).To(MatchRegexp("^zone_delegated.*"))

var res []ibclient.ZoneDelegated
search := &ibclient.ZoneDelegated{}
err := connector.GetObject(search, "", nil, &res)
ref, err := connector.DeleteObject(res[0].Ref)
Expect(err).To(BeNil())
Expect(ref).To(MatchRegexp("^zone_delegated.*"))
})

It("Should fail to create a DNS Zone-delegated without mandatory parameters", func() {
zone := &ibclient.ZoneDelegated{
// Missing mandatory parameters like Fqdn and DelegatedTo oe NsGroup
Comment: utils.StringPtr("wapi added"),
DelegatedTtl: utils.Uint32Ptr(3600),
}
_, err := connector.CreateObject(zone)
Expect(err).NotTo(BeNil())
})

It("Should fail to get a non-existent DNS Zone-delegated", func() {
var res []ibclient.ZoneDelegated
search := &ibclient.ZoneDelegated{Fqdn: "nonexistent.test_fwzone.com"}
err := connector.GetObject(search, "", nil, &res)
Expect(err).NotTo(BeNil())
})

It("Should fail to update a non-existent DNS Zone-delegated", func() {
zone := &ibclient.ZoneDelegated{
Fqdn: "nonexistent.com",
DelegateTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.6"},
},
IsNull: false,
},
Comment: utils.StringPtr("wapi added"),
}

_, err := connector.UpdateObject(zone, "nonexistent_ref")
Expect(err).NotTo(BeNil())
})

It("Should fail to delete a non-existent DNS Zone-delegated", func() {
_, err := connector.DeleteObject("nonexistent_ref")
Expect(err).NotTo(BeNil())
})

It("Should add CNAME Record [cname.wapi.com]", Label("ID: 40", "RW"), func() {
r := &ibclient.RecordCNAME{
View: utils.StringPtr("default"),
Expand Down Expand Up @@ -2119,8 +2260,8 @@ var _ = Describe("DNS Forward Zone", func() {
// Create a DNS Forward Zone
zone := &ibclient.ZoneForward{
Fqdn: "example.com",
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "2.3.4.5"},
},
Expand All @@ -2136,8 +2277,8 @@ var _ = Describe("DNS Forward Zone", func() {
// Create a DNS Forward Zone
zone := &ibclient.ZoneForward{
Fqdn: "example.com",
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "2.3.4.5"},
},
Expand All @@ -2150,8 +2291,8 @@ var _ = Describe("DNS Forward Zone", func() {
{
Name: "infoblox.localdomain",
ForwardersOnly: true,
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "2.3.4.5"},
},
Expand All @@ -2170,8 +2311,8 @@ var _ = Describe("DNS Forward Zone", func() {
It("Should get the DNS Forward Zone", func() {
zone := &ibclient.ZoneForward{
Fqdn: "example.com",
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "2.3.4.5"},
},
Expand All @@ -2194,8 +2335,8 @@ var _ = Describe("DNS Forward Zone", func() {
// Create a DNS Forward Zone
zoneCreate := &ibclient.ZoneForward{
Fqdn: "example.com",
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.5"},
},
Expand All @@ -2209,8 +2350,8 @@ var _ = Describe("DNS Forward Zone", func() {

// Update a DNS Forward Zone
zone := &ibclient.ZoneForward{
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.6"},
},
Expand All @@ -2231,8 +2372,8 @@ var _ = Describe("DNS Forward Zone", func() {
// Create a DNS Forward Zone
zoneCreate := &ibclient.ZoneForward{
Fqdn: "example.com",
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.5"},
},
Expand All @@ -2255,8 +2396,8 @@ var _ = Describe("DNS Forward Zone", func() {
It("Should fail to create a DNS Forward Zone with invalid data", func() {
zone := &ibclient.ZoneForward{
Fqdn: "invalid..com", // Invalid FQDN
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.5"},
},
Expand All @@ -2279,8 +2420,8 @@ var _ = Describe("DNS Forward Zone", func() {
It("Should fail to update a non-existent DNS Forward Zone", func() {
zone := &ibclient.ZoneForward{
Fqdn: "nonexistent.com",
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.6"},
},
Expand Down Expand Up @@ -2311,8 +2452,8 @@ var _ = Describe("DNS Forward Zone", func() {
It("Should fail to create a DNS Forward Zone without fqdn parameter", func() {
zone := &ibclient.ZoneForward{
// Missing mandatory parameter Fqdn
ForwardTo: ibclient.NullForwardTo{
ForwardTo: []ibclient.NameServer{
ForwardTo: ibclient.NullableNameServers{
NameServers: []ibclient.NameServer{
{Name: "test", Address: "1.2.3.4"},
{Name: "test2", Address: "1.2.3.5"},
},
Expand Down
19 changes: 12 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ module github.com/infobloxopen/infoblox-go-client/v2
go 1.21

require (
github.com/onsi/ginkgo/v2 v2.1.4
github.com/onsi/gomega v1.19.0
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/sirupsen/logrus v1.9.3
golang.org/x/net v0.24.0
golang.org/x/net v0.28.0
)

require (
github.com/stretchr/testify v1.8.4 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
40 changes: 24 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY=
github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU=
github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k=
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo=
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand All @@ -15,19 +21,21 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading