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 ##############################################################################
9 $schema: 'http://json-schema.org/schema#'
10 $id: 'https://github.com/opnfv/pharos/blob/master/config/pdf/pod1.yaml'
13 ############################################################################
14 # Low-level, general purpose definitions, unversioned
16 type: 'string' # NOTE: we don't validate this is a valid addr (yet)
19 pattern: '^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
20 ############################################################################
21 # Mid-level definitions, common schema for jumpserver & cluster nodes
28 enum: ['baremetal', 'virtual']
35 enum: ['aarch64', 'x86_64']
44 pattern: '^[1-9]\d*[MGT]B?$'
45 required: ['type', 'vendor', 'model', 'arch', 'cpus', 'cpu_cflags', 'cores', 'memory']
46 additionalProperties: false
55 pattern: '^disk[0-9]+$'
58 pattern: '^[1-9][\d\.]*[MGT]B?$'
61 enum: ['hdd', 'ssd', 'cdrom', 'tape']
64 enum: ['sata', 'sas', 'ssd', 'nvme', 'scsi', 'iscsi']
67 enum: [0, 5400, 7200, 10000, 15000]
68 required: ['name', 'disk_capacity', 'disk_type', 'disk_interface', 'disk_rotation']
69 additionalProperties: false
89 # These subsections are best validated separately for baremetal/virtual
102 $ref: '#/definitions/ip_address'
104 $ref: '#/definitions/mac_address'
105 required: ['type', 'versions', 'address', 'mac_address']
112 type: 'string' # Loose validation of libvirt URI for now
113 required: ['type', 'address']
114 required: ['user', 'pass']
115 additionalProperties: false
124 pattern: '^nic[0-9]+$'
126 $ref: '#/definitions/mac_address'
129 $ref: '#/definitions/ip_address'
134 pattern: '^(native|[1-9][0-9]{0,3})(\|(native|[1-9][0-9]{0,3}))*$'
141 enum: ['1gb', '10gb', '25gb', '40gb']
142 # FIXME: mandatory for nodes?
145 type: ['string', 'null']
146 pattern: '^((dpdk|sriov)\|?)*$'
147 # FIXME: mandatory for nodes?
148 required: ['name', 'mac_address']
149 additionalProperties: false
150 ############################################################################
151 # Top-level PDF blocks, versioned
158 enum: ['production', 'development']
163 pattern: '^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+[,; ]*)+$'
170 required: ['type', 'pod_owner', 'contact', 'lab', 'location', 'link']
171 additionalProperties: false
179 $ref: '#/definitions/node/v1.0'
181 $ref: '#/definitions/disks/v1.0'
184 remote_params: # Optional YAML anchor, contents will be validated below
187 $ref: '#/definitions/remote_management/v1.0'
189 $ref: '#/definitions/interfaces/v1.0'
190 required: ['name', 'node', 'disks', 'os', 'remote_management', 'interfaces']
191 additionalProperties: false
201 $ref: '#/definitions/node/v1.0'
203 $ref: '#/definitions/disks/v1.0'
206 remote_params: # Optional YAML anchor, contents will be validated after inject
209 $ref: '#/definitions/remote_management/v1.0'
211 $ref: '#/definitions/interfaces/v1.0'
212 required: ['name', 'node', 'disks', 'remote_management', 'interfaces']
213 additionalProperties: false
215 ##############################################################################
216 # Top-level structure:
217 # - define all possible top-level keys, without enforcing a schema for them,
218 # just so we can disallow additional properties;
219 # - require 'version' and allow dynamically generated 'version_x.y' key;
221 # version_x.y keys are auto-added by `validate_schema.py` based on 'version'
233 required: ['version']
234 additionalProperties: false
236 ##############################################################################
238 # - based on dynamically added 'version_x.y', require additional PDF blocks
239 # and validate them against the proper schema version;
244 $ref: '#/definitions/details/v1.0'
246 $ref: '#/definitions/jumphost/v1.0'
248 $ref: '#/definitions/nodes/v1.0'
249 required: ['details', 'jumphost', 'nodes']