Skip to content

Commit d033852

Browse files
committed
net: schema: Configuration schema using jsonschema yaml format
Convert network configuration schema in pykwalify format to jsonschema format because pykwalify is being deprecated in zephyr and jsonschema is used in the future. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 1d465ab commit d033852

File tree

1 file changed

+197
-156
lines changed

1 file changed

+197
-156
lines changed
Lines changed: 197 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,201 @@
11
# SPDX-License-Identifier: Apache-2.0
22
#
3-
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
# Copyright (c) 2025 Nordic Semiconductor ASA
44
#
5-
# A pykwalify schema for basic validation of the network configuration yaml file.
5+
# A JSON schema for basic validation of the network configuration yaml file.
66

7-
type: map
8-
mapping:
9-
"net_init_config":
10-
type: map
11-
mapping:
12-
"config_format_hash":
13-
type: str
14-
"network_interfaces":
15-
type: seq
16-
sequence:
17-
- type: map
18-
required: true
19-
mapping:
20-
"bind_to":
21-
type: any
22-
"name":
23-
type: str
24-
"device_name":
25-
type: str
26-
"set_name":
27-
type: str
28-
"set_default":
29-
type: bool
30-
"flags":
31-
type: seq
32-
sequence:
33-
- type: str
34-
required: true
35-
"ipv6":
36-
type: map
37-
mapping:
38-
"status":
39-
type: bool
40-
"ipv6_addresses":
41-
type: seq
42-
sequence:
43-
- type: str
44-
required: true
45-
"ipv6_multicast_addresses":
46-
type: seq
47-
sequence:
48-
- type: str
49-
required: true
50-
"prefixes":
51-
type: seq
52-
sequence:
53-
- type: map
54-
required: true
55-
mapping:
56-
"address":
57-
type: str
58-
required: true
59-
"len":
60-
type: int
61-
required: true
62-
"lifetime":
63-
type: int
64-
required: true
65-
"hop_limit":
66-
type: int
67-
"multicast_hop_limit":
68-
type: int
69-
"dhcpv6":
70-
type: map
71-
mapping:
72-
"status":
73-
type: bool
74-
"do_request_address":
75-
type: bool
76-
"do_request_prefix":
77-
type: bool
78-
"ipv4":
79-
type: map
80-
mapping:
81-
"status":
82-
type: bool
83-
"ipv4_addresses":
84-
type: seq
85-
sequence:
86-
- type: str
87-
required: true
88-
"ipv4_multicast_addresses":
89-
type: seq
90-
sequence:
91-
- type: str
92-
required: true
93-
"gateway":
94-
type: str
95-
"time_to_live":
96-
type: int
97-
"multicast_time_to_live":
98-
type: int
99-
"dhcpv4":
100-
type: map
101-
mapping:
102-
"status":
103-
type: bool
104-
"dhcpv4_server":
105-
type: map
106-
mapping:
107-
"status":
108-
type: bool
109-
"base_address":
110-
type: str
111-
"ipv4_autoconf":
112-
type: map
113-
mapping:
114-
"status":
115-
type: bool
116-
"vlan":
117-
type: map
118-
mapping:
119-
"status":
120-
type: bool
121-
"tag":
122-
type: int
123-
required: true
124-
"ieee_802_15_4":
125-
type: map
126-
mapping:
127-
"status":
128-
type: bool
129-
"bind_to":
130-
type: any
131-
"pan_id":
132-
type: int
133-
required: true
134-
"channel":
135-
type: int
136-
required: true
137-
"tx_power":
138-
type: int
139-
"security_key":
140-
type: seq
141-
sequence:
142-
- type: int
143-
"security_key_mode":
144-
type: int
145-
"security_level":
146-
type: int
147-
"ack_required":
148-
type: bool
149-
"sntp":
150-
type: map
151-
mapping:
152-
"status":
153-
type: bool
154-
"server":
155-
type: str
156-
required: true
157-
"timeout":
158-
type: int
159-
"bind_to":
160-
type: any
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+
net_init_config:
15+
type: object
16+
properties:
17+
config_format_hash:
18+
type: string
19+
description: Hash for the configuration data (internal)
20+
network_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+
device_name:
31+
description: Device name to bind to
32+
type: string
33+
set_name:
34+
description: New name of the network interface
35+
type: string
36+
set_default:
37+
description: Set this interface as a default one
38+
type: boolean
39+
flags:
40+
description: Network interface flags to set
41+
type: array
42+
items:
43+
type: string
44+
ipv6:
45+
description: IPv6 configuration
46+
type: object
47+
properties:
48+
status:
49+
description: Is IPv6 enabled for this interface
50+
type: boolean
51+
ipv6_addresses:
52+
description: Static IPv6 addresses for this interface
53+
type: array
54+
items:
55+
type: string
56+
ipv6_multicast_addresses:
57+
description: Multicast IPv6 addresses for this interface
58+
type: array
59+
items:
60+
type: string
61+
prefixes:
62+
description: IPv6 prefixes for this interface
63+
type: array
64+
items:
65+
type: object
66+
properties:
67+
address:
68+
description: IPv6 prefix
69+
type: string
70+
len:
71+
description: IPv6 prefix length
72+
type: integer
73+
lifetime:
74+
description: IPv6 prefix lifetime (in sec)
75+
type: integer
76+
required:
77+
- address
78+
- len
79+
- lifetime
80+
hop_limit:
81+
description: IPv6 hop limit
82+
type: integer
83+
multicast_hop_limit:
84+
description: IPv6 multicast hop limit
85+
type: integer
86+
dhcpv6:
87+
description: DHCPv6 configuration
88+
type: object
89+
properties:
90+
status:
91+
description: Is DHCPv6 enabled for this interface
92+
type: boolean
93+
do_request_address:
94+
description: Set request address flag
95+
type: boolean
96+
do_request_prefix:
97+
description: Set request prefix flag
98+
type: boolean
99+
ipv4:
100+
description: IPv4 configuration
101+
type: object
102+
properties:
103+
status:
104+
description: Is IPv4 enabled for this interface
105+
type: boolean
106+
ipv4_addresses:
107+
description: Static IPv4 addresses for this interface
108+
type: array
109+
items:
110+
type: string
111+
ipv4_multicast_addresses:
112+
description: Multicast IPv4 addresses for this interface
113+
type: array
114+
items:
115+
type: string
116+
gateway:
117+
description: IPv4 gateway to use
118+
type: string
119+
time_to_live:
120+
description: IPv4 time-to-live
121+
type: integer
122+
multicast_time_to_live:
123+
description: IPv4 multicast time-to-live
124+
type: integer
125+
dhcpv4:
126+
description: DHCPv4 configuration
127+
type: object
128+
properties:
129+
status:
130+
description: Is DHCPv4 enabled for this interface
131+
type: boolean
132+
dhcpv4_server:
133+
type: object
134+
properties:
135+
status:
136+
description: Is DHCPv4 server enabled for this interface
137+
type: boolean
138+
base_address:
139+
description: Set base address for the DHCPv4 server
140+
type: string
141+
ipv4_autoconf:
142+
description: IPv4 autoconfiguration
143+
type: object
144+
properties:
145+
status:
146+
description: Is IPv4 auto configuration enabled for this interface
147+
type: boolean
148+
vlan:
149+
description: Virtual LAN configuration
150+
type: object
151+
properties:
152+
status:
153+
description: Is VLAN enabled for this interface
154+
type: boolean
155+
tag:
156+
description: VLAN tag for this interface
157+
type: integer
158+
required:
159+
- tag
160+
ieee_802_15_4:
161+
type: object
162+
properties:
163+
status:
164+
description: Is IEEE 802.15.4 enabled
165+
type: boolean
166+
bind_to: {}
167+
pan_id:
168+
type: integer
169+
channel:
170+
type: integer
171+
tx_power:
172+
type: integer
173+
security_key_mode:
174+
type: integer
175+
security_level:
176+
type: integer
177+
ack_required:
178+
type: boolean
179+
security_key:
180+
type: array
181+
items:
182+
type: integer
183+
required:
184+
- pan_id
185+
- channel
186+
sntp:
187+
type: object
188+
properties:
189+
status:
190+
description: Is SNTP enabled
191+
type: boolean
192+
server:
193+
description: SNTP server address
194+
type: string
195+
timeout:
196+
description: Request timeout in sec
197+
type: integer
198+
bind_to: {}
199+
required:
200+
- server
201+
additionalProperties: false

0 commit comments

Comments
 (0)