Merge "[fuel] Get public pool parameters from idf.fuel"
[pharos.git] / config / pdf / pod1.schema.yaml
1 ##############################################################################
2 # Copyright (c) 2018 Enea AB and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 ---
9 $schema: 'http://json-schema.org/schema#'
10 $id: 'https://github.com/opnfv/pharos/blob/master/config/pdf/pod1.yaml'
11
12 definitions:
13   ############################################################################
14   # Low-level, general purpose definitions, unversioned
15   ip_address:
16     type: 'string'  # NOTE: we don't validate this is a valid addr (yet)
17   mac_address:
18     type: 'string'
19     pattern: '^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
20   ############################################################################
21   # Mid-level definitions, common schema for jumpserver & cluster nodes
22   node:
23     v1.0:
24       type: 'object'
25       properties:
26         type:
27           type: 'string'
28           enum: ['baremetal', 'virtual']
29         vendor:
30           type: 'string'
31         model:
32           type: 'string'
33         arch:
34           type: 'string'
35           enum: ['aarch64', 'x86_64']
36         cpus:
37           type: 'number'
38         cpu_cflags:
39           type: 'string'
40         cores:
41           type: 'number'
42         memory:
43           type: 'string'
44           pattern: '^[1-9]\d*[MGT]B?$'
45       required: ['type', 'vendor', 'model', 'arch', 'cpus', 'cpu_cflags', 'cores', 'memory']
46       additionalProperties: false
47   disks:
48     v1.0:
49       type: 'array'
50       items:
51         type: 'object'
52         properties:
53           name:
54             type: 'string'
55             pattern: '^disk[0-9]+$'
56           disk_capacity:
57             type: 'string'
58             pattern: '^[1-9][\d\.]*[MGT]B?$'
59           disk_type:
60             type: 'string'
61             enum: ['hdd', 'ssd', 'cdrom', 'tape']
62           disk_interface:
63             type: 'string'
64             enum: ['sata', 'sas', 'ssd', 'nvme', 'scsi', 'iscsi']
65           disk_rotation:
66             type: 'number'
67             enum: [0, 5400, 7200, 10000, 15000]
68         required: ['name', 'disk_capacity', 'disk_type', 'disk_interface', 'disk_rotation']
69         additionalProperties: false
70   remote_management:
71     v1.0:
72       type: 'object'
73       properties:
74         type:
75           type: 'string'
76           enum: ['ipmi', 'amt']
77         versions:
78           type: 'array'
79           items:
80             type: 'number'
81             enum: [1.0, 2.0]
82         user:
83           type: 'string'
84         pass:
85           type: 'string'
86         address:
87           $ref: '#/definitions/ip_address'
88         mac_address:
89           $ref: '#/definitions/mac_address'
90       required: ['type', 'versions', 'user', 'pass', 'address', 'mac_address']
91       additionalProperties: false
92   interfaces:
93     v1.0:
94       type: 'array'
95       items:
96         type: 'object'
97         properties:
98           name:
99             type: 'string'
100             pattern: '^nic[0-9]+$'
101           mac_address:
102             $ref: '#/definitions/mac_address'
103           # Optional
104           address:
105             $ref: '#/definitions/ip_address'
106           # Optional
107           vlan:
108             oneOf:
109               - type: 'string'
110                 pattern: '^(native|[1-9][0-9]{0,3})(\|(native|[1-9][0-9]{0,3}))*$'
111               - type: 'integer'
112                 mininum: 1
113                 maximum: 4095
114           # Optional
115           speed:
116             type: 'string'
117             enum: ['1gb', '10gb', '25gb', '40gb']
118             # FIXME: mandatory for nodes?
119           # Optional
120           features:
121             type: ['string', 'null']
122             pattern: '^((dpdk|sriov)\|?)*$'
123             # FIXME: mandatory for nodes?
124         required: ['name', 'mac_address']
125         additionalProperties: false
126   ############################################################################
127   # Top-level PDF blocks, versioned
128   details:
129     v1.0:
130       type: 'object'
131       properties:
132         type:
133           type: 'string'
134           enum: ['production', 'development']
135         pod_owner:
136           type: 'string'
137         contact:
138           type: 'string'
139           pattern: '^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+[,; ]*)+$'
140         lab:
141           type: 'string'
142         location:
143           type: 'string'
144         link:
145           type: 'string'
146       required: ['type', 'pod_owner', 'contact', 'lab', 'location', 'link']
147       additionalProperties: false
148   jumphost:
149     v1.0:
150       type: 'object'
151       properties:
152         name:
153           type: 'string'
154         node:
155           $ref: '#/definitions/node/v1.0'
156         disks:
157           $ref: '#/definitions/disks/v1.0'
158         os:
159           type: 'string'
160         remote_params:  # Optional YAML anchor, contents will be validated below
161           type: 'object'
162         remote_management:
163           $ref: '#/definitions/remote_management/v1.0'
164         interfaces:
165           $ref: '#/definitions/interfaces/v1.0'
166       required: ['name', 'node', 'disks', 'os', 'remote_management', 'interfaces']
167       additionalProperties: false
168   nodes:
169     v1.0:
170       type: 'array'
171       items:
172         type: 'object'
173         properties:
174           name:
175             type: 'string'
176           node:
177             $ref: '#/definitions/node/v1.0'
178           disks:
179             $ref: '#/definitions/disks/v1.0'
180           os:
181             type: 'string'
182           remote_params:  # Optional YAML anchor, contents will be validated after inject
183             type: 'object'
184           remote_management:
185             $ref: '#/definitions/remote_management/v1.0'
186           interfaces:
187             $ref: '#/definitions/interfaces/v1.0'
188         required: ['name', 'node', 'disks', 'remote_management', 'interfaces']
189         additionalProperties: false
190
191 ##############################################################################
192 # Top-level structure:
193 # - define all possible top-level keys, without enforcing a schema for them,
194 #   just so we can disallow additional properties;
195 # - require 'version' and allow dynamically generated 'version_x.y' key;
196 properties:
197   # version_x.y keys are auto-added by `validate_schema.py` based on 'version'
198   version_1.0:
199     type: 'boolean'
200   version:
201     type: 'number'
202     enum: [1.0]
203   details:
204     type: 'object'
205   jumphost:
206     type: 'object'
207   nodes:
208     type: 'array'
209 required: ['version']
210 additionalProperties: false
211
212 ##############################################################################
213 # Schema versioning
214 # - based on dynamically added 'version_x.y', require additional PDF blocks
215 #   and validate them against the proper schema version;
216 dependencies:
217   version_1.0:
218     properties:
219       details:
220         $ref: '#/definitions/details/v1.0'
221       jumphost:
222         $ref: '#/definitions/jumphost/v1.0'
223       nodes:
224         $ref: '#/definitions/nodes/v1.0'
225     required: ['details', 'jumphost', 'nodes']