Skip to content

Commit 0e6d93f

Browse files
0.2.1 development
1 parent dabc7eb commit 0e6d93f

File tree

11 files changed

+574
-269
lines changed

11 files changed

+574
-269
lines changed

.coverage

0 Bytes
Binary file not shown.

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
tox:
77
strategy:
88
matrix:
9-
python-version: [ '3.10', '3.11', '3.12' ]
9+
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
1010
platform: [ubuntu-latest]
1111
runs-on: ${{ matrix.platform }}
1212
steps:

data/example-jsnac.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"chassis": {
1818
"title": "Chassis",
1919
"description": "Object containing Chassis information. Has the below properties: \nhostname [required]: hostname\nmodel [required]: string\ndevice_type [required]: choice (router, switch, firewall, load-balancer)\n",
20-
"type": "object",
2120
"properties": {
2221
"hostname": {
2322
"js_kind": {
2423
"name": "hostname"
2524
}
2625
},
2726
"model": {
27+
"description": "Model of the device",
2828
"js_kind": {
2929
"name": "string"
3030
}
@@ -52,7 +52,6 @@
5252
"system": {
5353
"title": "System",
5454
"description": "Object containing System information. Has the below properties:\ndomain_name [required]: string\nntp_servers [required]: list of ipv4 addresses\n",
55-
"type": "object",
5655
"properties": {
5756
"domain_name": {
5857
"js_kind": {
@@ -62,7 +61,6 @@
6261
"ntp_servers": {
6362
"title": "NTP Servers",
6463
"description": "List of NTP servers",
65-
"type": "array",
6664
"items": {
6765
"js_kind": {
6866
"name": "ipv4"
@@ -78,9 +76,7 @@
7876
"interfaces": {
7977
"title": "Device Interfaces",
8078
"description": "List of device interfaces. Each interface has the below properties:\nif [required]: string\ndesc: string\nipv4: ipv4_cidr\nipv6: ipv6_cidr\n",
81-
"type": "array",
8279
"items": {
83-
"type": "object",
8480
"properties": {
8581
"if": {
8682
"js_kind": {

data/example-jsnac.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ schema:
2424
hostname [required]: hostname
2525
model [required]: string
2626
device_type [required]: choice (router, switch, firewall, load-balancer)
27-
type: "object"
2827
properties:
2928
hostname:
3029
js_kind: { name: "hostname" }
3130
model:
31+
description: "Model of the device"
3232
js_kind: { name: "string" }
3333
device_type:
3434
title: "Device Type"
@@ -43,16 +43,14 @@ schema:
4343
Object containing System information. Has the below properties:
4444
domain_name [required]: string
4545
ntp_servers [required]: list of ipv4 addresses
46-
type: "object"
4746
properties:
4847
domain_name:
4948
js_kind: { name: "string" }
5049
ntp_servers:
5150
title: "NTP Servers"
5251
description: "List of NTP servers"
53-
type: "array"
5452
items:
55-
js_kind: { name: "ipv4" }
53+
js_kind: { name: "ipv4" }
5654
required: [ "domain_name", "ntp_servers" ]
5755
interfaces:
5856
title: "Device Interfaces"
@@ -62,9 +60,7 @@ schema:
6260
desc: string
6361
ipv4: ipv4_cidr
6462
ipv6: ipv6_cidr
65-
type: "array"
6663
items:
67-
type: "object"
6864
properties:
6965
if:
7066
js_kind: { name: "string" }

data/example.schema.json

+78-21
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,88 @@
1414
"type": "string",
1515
"pattern": "^(([a-fA-F0-9]{1,4}|):){1,7}([a-fA-F0-9]{1,4}|:)$",
1616
"title": "IPv6 Address",
17-
"description": "Short IPv6 address (String) \n Accepts both full and short form addresses, link-local addresses, and IPv4-mapped addresses"
17+
"description": "Short IPv6 address (String) \nAccepts both full and short form addresses, link-local addresses, and IPv4-mapped addresses"
1818
},
1919
"ipv4_cidr": {
2020
"type": "string",
2121
"pattern": "^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])/(1[0-9]|[0-9]|2[0-9]|3[0-2])$",
2222
"title": "IPv4 CIDR",
23-
"description": "IPv4 CIDR (String) \n Format: xxx.xxx.xxx.xxx/xx"
23+
"description": "IPv4 CIDR (String) \nFormat: xxx.xxx.xxx.xxx/xx"
2424
},
2525
"ipv6_cidr": {
2626
"type": "string",
27-
"pattern": "(([a-fA-F0-9]{1,4}|):){1,7}([a-fA-F0-9]{1,4}|:)/(32|36|40|44|48|52|56|60|64|128)$",
28-
"title": "IPv6 CIDR",
29-
"description": "Full IPv6 CIDR (String) \n Format: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/xxx"
27+
"pattern": "^(([a-fA-F0-9]{1,4}|):){1,7}([a-fA-F0-9]{1,4}|:)/(32|36|40|44|48|52|56|60|64|128)$",
28+
"description": "Full IPv6 CIDR (String) \nFormat: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/xxx"
3029
},
3130
"ipv4_prefix": {
3231
"type": "string",
33-
"title": "IPv4 Prefix",
3432
"pattern": "^/(1[0-9]|[0-9]|2[0-9]|3[0-2])$",
35-
"description": "IPv4 Prefix (String) \n Format: /xx between 0 and 32"
33+
"description": "IPv4 Prefix (String) \nFormat: /xx between 0 and 32"
3634
},
3735
"ipv6_prefix": {
3836
"type": "string",
39-
"title": "IPv6 Prefix",
4037
"pattern": "^/(32|36|40|44|48|52|56|60|64|128)$",
41-
"description": "IPv6 prefix (String) \n Format: /xx between 32 and 64 in increments of 4. also /128"
38+
"description": "IPv6 prefix (String) \nFormat: /xx between 32 and 64 in increments of 4. also /128"
4239
},
4340
"domain": {
4441
"type": "string",
4542
"pattern": "^([a-zA-Z0-9-]{1,63}\\.)+[a-zA-Z]{2,63}$",
46-
"title": "Domain Name",
47-
"description": "Domain name (String) \n Format: example.com"
43+
"description": "Domain name (String) \nFormat: example.com"
44+
},
45+
"email": {
46+
"type": "string",
47+
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
48+
"description": "Email address (String) \nFormat: [email protected]"
49+
},
50+
"http_url": {
51+
"type": "string",
52+
"pattern": "^(https?://)?([\\da-z.-]+)\\.([a-z.]{2,6})([/\\w .-]*)*\\??([^#\\s]*)?(#.*)?$",
53+
"description": "HTTP(s) URL (String) \nFormat: http://example.com"
54+
},
55+
"uint16": {
56+
"type": "integer",
57+
"minimum": 0,
58+
"maximum": 65535,
59+
"description": "16-bit Unsigned Integer \nRange: 0 to 65535"
60+
},
61+
"uint32": {
62+
"type": "integer",
63+
"minimum": 0,
64+
"maximum": 4294967295,
65+
"description": "32-bit Unsigned Integer \nRange: 0 to 4294967295"
66+
},
67+
"uint64": {
68+
"type": "integer",
69+
"minimum": 0,
70+
"maximum": 18446744073709551615,
71+
"description": "64-bit Unsigned Integer \nRange: 0 to 18446744073709551615"
72+
},
73+
"mtu": {
74+
"type": "integer",
75+
"minimum": 68,
76+
"maximum": 9192,
77+
"description": "Maximum Transmission Unit (MTU) \nRange: 68 to 9192"
78+
},
79+
"mac": {
80+
"type": "string",
81+
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
82+
"description": "MAC Address (String) \nFormat: xx:xx:xx:xx:xx:xx"
83+
},
84+
"mac_dot": {
85+
"type": "string",
86+
"pattern": "^([0-9A-Fa-f]{4}[.]){2}([0-9A-Fa-f]{4})$",
87+
"description": "MAC Address with dots (String) \nFormat: xxxx.xxxx.xxxx"
88+
},
89+
"vlan": {
90+
"type": "integer",
91+
"minimum": 1,
92+
"maximum": 4094,
93+
"description": "VLAN ID (Integer) \nRange: 1 to 4094"
94+
},
95+
"docker_image": {
96+
"type": "string",
97+
"pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$",
98+
"description": "Docker Image Name (String) \nFormat: alpine:latest"
4899
},
49100
"hostname": {
50101
"title": "Hostname",
@@ -57,21 +108,22 @@
57108
"additionalProperties": false,
58109
"properties": {
59110
"chassis": {
111+
"type": "object",
112+
"additionalProperties": false,
60113
"title": "Chassis",
61114
"description": "Object containing Chassis information. Has the below properties: \nhostname [required]: hostname\nmodel [required]: string\ndevice_type [required]: choice (router, switch, firewall, load-balancer)\n",
62-
"type": "object",
63115
"properties": {
64116
"hostname": {
117+
"title": "hostname",
65118
"$ref": "#/$defs/hostname"
66119
},
67120
"model": {
68-
"type": "string",
69121
"title": "model",
122+
"type": "string",
70123
"description": "String"
71124
},
72125
"device_type": {
73-
"title": "Device Type",
74-
"description": "Device Type options are:\nrouter, switch, firewall, load-balancer\n",
126+
"title": "device_type",
75127
"enum": [
76128
"router",
77129
"switch",
@@ -87,20 +139,22 @@
87139
]
88140
},
89141
"system": {
142+
"type": "object",
143+
"additionalProperties": false,
90144
"title": "System",
91145
"description": "Object containing System information. Has the below properties:\ndomain_name [required]: string\nntp_servers [required]: list of ipv4 addresses\n",
92-
"type": "object",
93146
"properties": {
94147
"domain_name": {
95-
"type": "string",
96148
"title": "domain_name",
149+
"type": "string",
97150
"description": "String"
98151
},
99152
"ntp_servers": {
153+
"type": "array",
100154
"title": "NTP Servers",
101155
"description": "List of NTP servers",
102-
"type": "array",
103156
"items": {
157+
"title": "items",
104158
"$ref": "#/$defs/ipv4"
105159
}
106160
}
@@ -111,26 +165,29 @@
111165
]
112166
},
113167
"interfaces": {
168+
"type": "array",
114169
"title": "Device Interfaces",
115170
"description": "List of device interfaces. Each interface has the below properties:\nif [required]: string\ndesc: string\nipv4: ipv4_cidr\nipv6: ipv6_cidr\n",
116-
"type": "array",
117171
"items": {
118172
"type": "object",
173+
"additionalProperties": false,
119174
"properties": {
120175
"if": {
121-
"type": "string",
122176
"title": "if",
177+
"type": "string",
123178
"description": "String"
124179
},
125180
"desc": {
126-
"type": "string",
127181
"title": "desc",
182+
"type": "string",
128183
"description": "String"
129184
},
130185
"ipv4": {
186+
"title": "ipv4",
131187
"$ref": "#/$defs/ipv4_cidr"
132188
},
133189
"ipv6": {
190+
"title": "ipv6",
134191
"$ref": "#/$defs/ipv6_cidr"
135192
}
136193
},

0 commit comments

Comments
 (0)