Skip to content

Commit 9fc8e4d

Browse files
feat(network): dhcp_routes to IP network (#259)
1 parent c9603a0 commit 9fc8e4d

6 files changed

Lines changed: 178 additions & 129 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
55

66
## [Unreleased]
77

8+
### Added
9+
10+
- network: `dhcp_routes` field to IP network for additional DHCP classless static routes to be delivered if the DHCP is enabled
11+
812
## [6.6.0]
913

1014
### Added

upcloud/network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type IPNetwork struct {
9090
DHCP Boolean `json:"dhcp"`
9191
DHCPDefaultRoute Boolean `json:"dhcp_default_route"`
9292
DHCPDns []string `json:"dhcp_dns,omitempty"`
93+
DHCPRoutes []string `json:"dhcp_routes,omitempty"`
9394
Family string `json:"family,omitempty"`
9495
Gateway string `json:"gateway,omitempty"`
9596
}

upcloud/network_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ func TestUnmarshalNetwork(t *testing.T) {
187187
"172.16.0.10",
188188
"172.16.1.10"
189189
],
190+
"dhcp_routes" : [
191+
"192.168.0.0/24",
192+
"192.168.100.100/32"
193+
],
190194
"family": "IPv4",
191195
"gateway": "172.16.0.1"
192196
}
@@ -231,6 +235,10 @@ func TestUnmarshalNetwork(t *testing.T) {
231235
"172.16.0.10",
232236
"172.16.1.10",
233237
},
238+
DHCPRoutes: []string{
239+
"192.168.0.0/24",
240+
"192.168.100.100/32",
241+
},
234242
Family: IPAddressFamilyIPv4,
235243
Gateway: "172.16.0.1",
236244
},

upcloud/request/network_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ func TestMarshalCreateNetworkRequest(t *testing.T) {
7878
"172.16.0.10",
7979
"172.16.1.10",
8080
},
81+
DHCPRoutes: []string{
82+
"192.168.0.0/24",
83+
"192.168.100.100/32",
84+
},
8185
Family: upcloud.IPAddressFamilyIPv4,
8286
Gateway: "172.16.0.1",
8387
},
@@ -106,6 +110,10 @@ func TestMarshalCreateNetworkRequest(t *testing.T) {
106110
"172.16.0.10",
107111
"172.16.1.10"
108112
],
113+
"dhcp_routes" : [
114+
"192.168.0.0/24",
115+
"192.168.100.100/32"
116+
],
109117
"family" : "IPv4",
110118
"gateway" : "172.16.0.1"
111119
}

0 commit comments

Comments
 (0)