@@ -17,6 +17,7 @@ use RESTAPI\Responses\ConflictError;
1717use RESTAPI \Responses \ValidationError ;
1818use RESTAPI \Validators \IPAddressValidator ;
1919use RESTAPI \Validators \MACAddressValidator ;
20+ use RESTAPI \Validators \URLValidator ;
2021
2122/**
2223 * Defines a Model that interacts with the DHCP server for a given interface.
@@ -48,6 +49,15 @@ class DHCPServer extends Model {
4849 public NestedModelField $ pool ;
4950 public NestedModelField $ numberoptions ;
5051 public NestedModelField $ staticmap ;
52+ public BooleanField $ netboot ;
53+ public StringField $ nextserver ;
54+ public StringField $ filename ;
55+ public StringField $ filename32 ;
56+ public StringField $ filename64 ;
57+ public StringField $ filename32arm ;
58+ public StringField $ filename64arm ;
59+ public StringField $ uefihttpboot ;
60+ public StringField $ rootpath ;
5161
5262 public function __construct (mixed $ id = null , mixed $ parent_id = null , mixed $ data = [], mixed ...$ options ) {
5363 # Define Model attributes
@@ -78,21 +88,21 @@ class DHCPServer extends Model {
7888 default: '' ,
7989 allow_empty: true ,
8090 maximum_length: 15 ,
91+ verbose_name: 'Range From ' ,
8192 internal_name: 'from ' ,
8293 internal_namespace: 'range ' ,
8394 validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
84- verbose_name: 'Range From ' ,
8595 help_text: 'The starting IP address for the primary DHCP pool. This address must be less than or equal ' .
8696 'to the `range_to` field. ' ,
8797 );
8898 $ this ->range_to = new StringField (
8999 default: '' ,
90100 allow_empty: true ,
91101 maximum_length: 15 ,
102+ verbose_name: 'Range To ' ,
92103 internal_name: 'to ' ,
93104 internal_namespace: 'range ' ,
94105 validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
95- verbose_name: 'Range To ' ,
96106 help_text: 'The ending IP address for the primary DHCP pool. This address must be greater than or equal ' .
97107 'to the `range_to` field. ' ,
98108 );
@@ -107,8 +117,8 @@ class DHCPServer extends Model {
107117 default: '' ,
108118 allow_empty: true ,
109119 maximum_length: 255 ,
110- validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: true , allow_fqdn: true )],
111120 verbose_name: 'Failover Peer IP ' ,
121+ validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: true , allow_fqdn: true )],
112122 help_text: 'The interface IP address of the other firewall (failover peer) in this subnet. Leave ' .
113123 'empty to disable failover peering. ' ,
114124 );
@@ -117,17 +127,17 @@ class DHCPServer extends Model {
117127 allow_empty: true ,
118128 many: true ,
119129 maximum_length: 17 ,
120- validators: [new MACAddressValidator ()],
121130 verbose_name: 'MAC Allow ' ,
131+ validators: [new MACAddressValidator ()],
122132 help_text: 'MAC addresses this DHCP server is allowed to provide leases for. ' ,
123133 );
124134 $ this ->mac_deny = new StringField (
125135 default: [],
126136 allow_empty: true ,
127137 many: true ,
128138 maximum_length: 17 ,
129- validators: [new MACAddressValidator ()],
130139 verbose_name: 'MAC Deny ' ,
140+ validators: [new MACAddressValidator ()],
131141 help_text: 'MAC addresses this DHCP server is not allowed to provide leases for. ' ,
132142 );
133143 $ this ->domainsearchlist = new StringField (
@@ -136,8 +146,8 @@ class DHCPServer extends Model {
136146 many: true ,
137147 maximum_length: 255 ,
138148 delimiter: '; ' ,
139- validators: [new IPAddressValidator (allow_ipv4: false , allow_ipv6: false , allow_fqdn: true )],
140149 verbose_name: 'Domain Search List ' ,
150+ validators: [new IPAddressValidator (allow_ipv4: false , allow_ipv6: false , allow_fqdn: true )],
141151 help_text: 'The domain search list to provide via DHCP. ' ,
142152 );
143153 $ this ->defaultleasetime = new IntegerField (
@@ -159,8 +169,8 @@ class DHCPServer extends Model {
159169 default: '' ,
160170 allow_empty: true ,
161171 maximum_length: 15 ,
162- validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false , allow_keywords: ['none ' ])],
163172 verbose_name: 'Gateway ' ,
173+ validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false , allow_keywords: ['none ' ])],
164174 help_text: 'The gateway IPv4 address to provide via DHCP. This is only necessary if you are not using ' .
165175 "the interface's IP as the gateway. Specify `none` for no gateway assignment. " ,
166176 );
@@ -171,8 +181,8 @@ class DHCPServer extends Model {
171181 many_maximum: 4 ,
172182 maximum_length: 15 ,
173183 delimiter: null ,
174- validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
175184 verbose_name: 'DNS Servers ' ,
185+ validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
176186 help_text: 'The DNS servers to provide via DHCP. Leave empty to default to system nameservers. ' ,
177187 );
178188 $ this ->winsserver = new StringField (
@@ -182,8 +192,8 @@ class DHCPServer extends Model {
182192 many_maximum: 2 ,
183193 maximum_length: 15 ,
184194 delimiter: null ,
185- validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
186195 verbose_name: 'WINS Servers ' ,
196+ validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
187197 help_text: 'The WINS servers to provide via DHCP. ' ,
188198 );
189199 $ this ->ntpserver = new StringField (
@@ -193,8 +203,8 @@ class DHCPServer extends Model {
193203 many_maximum: 4 ,
194204 maximum_length: 256 ,
195205 delimiter: null ,
196- validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false , allow_fqdn: true )],
197206 verbose_name: 'NTP Servers ' ,
207+ validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false , allow_fqdn: true )],
198208 help_text: 'The NTP servers to provide via DHCP. ' ,
199209 );
200210 $ this ->staticarp = new BooleanField (
@@ -273,6 +283,69 @@ class DHCPServer extends Model {
273283 verbose_name: 'Static Mappings ' ,
274284 help_text: 'Static mappings applied to this DHCP server. ' ,
275285 );
286+ $ this ->netboot = new BooleanField (
287+ default: false ,
288+ verbose_name: 'Enable Network Booting ' ,
289+ help_text: 'Enable network booting (PXE/TFTP/UEFI HTTP boot) options for this DHCP server. ' ,
290+ );
291+ $ this ->nextserver = new StringField (
292+ default: '' ,
293+ allow_empty: true ,
294+ verbose_name: 'Next Server ' ,
295+ conditions: ['netboot ' => true ],
296+ validators: [new IPAddressValidator (allow_ipv4: true , allow_ipv6: false )],
297+ help_text: 'The IPv4 address of the network boot server (e.g. TFTP server). ' ,
298+ );
299+ $ this ->filename = new StringField (
300+ default: '' ,
301+ allow_empty: true ,
302+ verbose_name: 'Default Bootfile Name ' ,
303+ conditions: ['netboot ' => true ],
304+ help_text: 'The default bootfile name provided to BIOS/legacy PXE clients. ' ,
305+ );
306+ $ this ->filename32 = new StringField (
307+ default: '' ,
308+ allow_empty: true ,
309+ verbose_name: 'UEFI 32-bit Bootfile Name ' ,
310+ conditions: ['netboot ' => true ],
311+ help_text: 'The bootfile name provided to 32-bit UEFI PXE clients. ' ,
312+ );
313+ $ this ->filename64 = new StringField (
314+ default: '' ,
315+ allow_empty: true ,
316+ verbose_name: 'UEFI 64-bit Bootfile Name ' ,
317+ conditions: ['netboot ' => true ],
318+ help_text: 'The bootfile name provided to 64-bit UEFI PXE clients. ' ,
319+ );
320+ $ this ->filename32arm = new StringField (
321+ default: '' ,
322+ allow_empty: true ,
323+ verbose_name: 'UEFI 32-bit ARM Bootfile Name ' ,
324+ conditions: ['netboot ' => true ],
325+ help_text: 'The bootfile name provided to 32-bit ARM UEFI PXE clients. ' ,
326+ );
327+ $ this ->filename64arm = new StringField (
328+ default: '' ,
329+ allow_empty: true ,
330+ verbose_name: 'UEFI 64-bit ARM Bootfile Name ' ,
331+ conditions: ['netboot ' => true ],
332+ help_text: 'The bootfile name provided to 64-bit ARM UEFI PXE clients. ' ,
333+ );
334+ $ this ->uefihttpboot = new StringField (
335+ default: '' ,
336+ allow_empty: true ,
337+ verbose_name: 'UEFI HTTPBoot URL ' ,
338+ conditions: ['netboot ' => true ],
339+ validators: [new URLValidator ()],
340+ help_text: 'The URL provided to UEFI HTTP boot clients. ' ,
341+ );
342+ $ this ->rootpath = new StringField (
343+ default: '' ,
344+ allow_empty: true ,
345+ verbose_name: 'Root Path ' ,
346+ conditions: ['netboot ' => true ],
347+ help_text: 'The root path provided to network boot clients. ' ,
348+ );
276349
277350 parent ::__construct ($ id , $ parent_id , $ data , ...$ options );
278351 }
0 commit comments