Skip to content

Commit 6f44de2

Browse files
committed
schemas: Add network configuration schema yaml file
This contains rules to validate network configuration in yaml format. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 20966d5 commit 6f44de2

File tree

1 file changed

+224
-0
lines changed

1 file changed

+224
-0
lines changed
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025 Nordic Semiconductor ASA
4+
#
5+
# A JSON schema for basic validation of the network configuration yaml file.
6+
7+
$id: "https://zephyrproject.org/schemas/zephyr/network"
8+
$schema: "https://json-schema.org/draft/2020-12/schema"
9+
10+
title: "Zephyr Network Configuration Schema"
11+
description: Schema for validating Zephyr network configuration metadata files
12+
type: object
13+
properties:
14+
networking:
15+
type: object
16+
properties:
17+
config_format_hash:
18+
type: string
19+
description: Hash for the configuration data (internal)
20+
interfaces:
21+
description: List of network interfaces
22+
type: array
23+
items:
24+
type: object
25+
properties:
26+
bind_to: {}
27+
name:
28+
description: Network interface name to bind to
29+
type: string
30+
# CONFIG_NET_INTERFACE_NAME_LEN
31+
maxLength: 15
32+
minLength: 2
33+
device_name:
34+
description: Device name to bind to
35+
type: string
36+
set_name:
37+
description: New name of the network interface
38+
type: string
39+
# CONFIG_NET_INTERFACE_NAME_LEN
40+
maxLength: 15
41+
minLength: 2
42+
set_default:
43+
description: Set this interface as a default one
44+
type: boolean
45+
flags:
46+
description: Network interface flags to set
47+
type: array
48+
items:
49+
type: string
50+
maxLength: 32
51+
ipv6:
52+
description: IPv6 configuration
53+
type: object
54+
properties:
55+
status:
56+
description: Is IPv6 enabled for this interface
57+
type: boolean
58+
ipv6_addresses:
59+
description: Static IPv6 addresses for this interface
60+
type: array
61+
items:
62+
type: string
63+
# INET6_ADDRSTRLEN + prefix len (like "/128")
64+
maxLength: 50
65+
ipv6_multicast_addresses:
66+
description: Multicast IPv6 addresses for this interface
67+
type: array
68+
items:
69+
type: string
70+
# NET_IPV6_ADDR_STR_LEN
71+
maxLength: 40
72+
prefixes:
73+
description: IPv6 prefixes for this interface
74+
type: array
75+
items:
76+
type: object
77+
properties:
78+
address:
79+
description: IPv6 prefix
80+
type: string
81+
# NET_IPV6_ADDR_STR_LEN
82+
maxLength: 40
83+
len:
84+
description: IPv6 prefix length
85+
type: integer
86+
lifetime:
87+
description: IPv6 prefix lifetime (in sec)
88+
type: integer
89+
required:
90+
- address
91+
- len
92+
- lifetime
93+
hop_limit:
94+
description: IPv6 hop limit
95+
type: integer
96+
multicast_hop_limit:
97+
description: IPv6 multicast hop limit
98+
type: integer
99+
dhcpv6:
100+
description: DHCPv6 configuration
101+
type: object
102+
properties:
103+
status:
104+
description: Is DHCPv6 enabled for this interface
105+
type: boolean
106+
do_request_address:
107+
description: Set request address flag
108+
type: boolean
109+
do_request_prefix:
110+
description: Set request prefix flag
111+
type: boolean
112+
ipv4:
113+
description: IPv4 configuration
114+
type: object
115+
properties:
116+
status:
117+
description: Is IPv4 enabled for this interface
118+
type: boolean
119+
ipv4_addresses:
120+
description: Static IPv4 addresses for this interface
121+
type: array
122+
items:
123+
type: string
124+
# INET_ADDRSTRLEN + netmask len (like "/24")
125+
maxLength: 19
126+
ipv4_multicast_addresses:
127+
description: Multicast IPv4 addresses for this interface
128+
type: array
129+
items:
130+
type: string
131+
# INET_ADDRSTRLEN
132+
maxLength: 16
133+
gateway:
134+
description: IPv4 gateway to use
135+
type: string
136+
# INET_ADDRSTRLEN
137+
maxLength: 16
138+
time_to_live:
139+
description: IPv4 time-to-live
140+
type: integer
141+
multicast_time_to_live:
142+
description: IPv4 multicast time-to-live
143+
type: integer
144+
dhcpv4:
145+
description: DHCPv4 configuration
146+
type: object
147+
properties:
148+
status:
149+
description: Is DHCPv4 enabled for this interface
150+
type: boolean
151+
dhcpv4_server:
152+
type: object
153+
properties:
154+
status:
155+
description: Is DHCPv4 server enabled for this interface
156+
type: boolean
157+
base_address:
158+
description: Set base address for the DHCPv4 server
159+
type: string
160+
# INET_ADDRSTRLEN
161+
maxLength: 16
162+
ipv4_autoconf:
163+
description: IPv4 autoconfiguration
164+
type: object
165+
properties:
166+
status:
167+
description: Is IPv4 auto configuration enabled for this interface
168+
type: boolean
169+
vlan:
170+
description: Virtual LAN configuration
171+
type: object
172+
properties:
173+
status:
174+
description: Is VLAN enabled for this interface
175+
type: boolean
176+
tag:
177+
description: VLAN tag for this interface
178+
type: integer
179+
required:
180+
- tag
181+
ieee_802_15_4:
182+
type: object
183+
properties:
184+
status:
185+
description: Is IEEE 802.15.4 enabled
186+
type: boolean
187+
bind_to: {}
188+
pan_id:
189+
type: integer
190+
channel:
191+
type: integer
192+
tx_power:
193+
type: integer
194+
security_key_mode:
195+
type: integer
196+
security_level:
197+
type: integer
198+
ack_required:
199+
type: boolean
200+
security_key:
201+
type: array
202+
items:
203+
type: integer
204+
required:
205+
- pan_id
206+
- channel
207+
sntp:
208+
type: object
209+
properties:
210+
status:
211+
description: Is SNTP enabled
212+
type: boolean
213+
server:
214+
description: SNTP server address
215+
type: string
216+
# INET6_ADDRSTRLEN
217+
maxLength: 46
218+
timeout:
219+
description: Request timeout in sec
220+
type: integer
221+
bind_to: {}
222+
required:
223+
- server
224+
additionalProperties: false

0 commit comments

Comments
 (0)