Create schemas for Drydock YAML docs

Start writing JSON schema documents (in YAML) for
the YAML Kinds that Drydock defines

- Wrote schema for baremetalNode, hardwareProfile,
  hostProfile, network, networkLink, rack, and region.
- Unit tests for testing validation schemas

Change-Id: Iff52d522fc61893ab07e567e4a4e842c4b4cb25e
This commit is contained in:
Jason Beard 2017-10-20 14:29:38 -05:00 committed by Scott Hussey
parent 68a6862857
commit 7af8623d91
42 changed files with 1238 additions and 22 deletions

View File

@ -77,7 +77,7 @@ class DesignsResource(StatefulResource):
resp.body = json.dumps(design.obj_to_simple())
resp.status = falcon.HTTP_201
except errors.StateError as stex:
except errors.StateError:
self.error(req.context, "Error updating persistence")
self.return_error(
resp,

View File

@ -211,7 +211,7 @@ class CreateNetworkTemplate(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -531,7 +531,7 @@ class CreateNetworkTemplate(BaseMaasAction):
elif dhcp_on and vlan.dhcp_on:
self.logger.info("DHCP already enabled for subnet %s" %
(subnet.resource_id))
except ValueError as vex:
except ValueError:
raise errors.DriverError("Inconsistent data from MaaS")
# Now that all networks should be created, we can setup routes between them
@ -591,7 +591,7 @@ class ConfigureUserCredentials(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -671,7 +671,7 @@ class IdentifyNode(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -740,7 +740,7 @@ class ConfigureHardware(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -871,7 +871,7 @@ class ApplyNodeNetworking(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -1170,7 +1170,7 @@ class ApplyNodePlatform(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -1272,7 +1272,7 @@ class ApplyNodePlatform(BaseMaasAction):
self.logger.debug("Creating static tag %s" % t)
tag = maas_tag.Tag(self.maas_client, name=t)
tag = tag_list.add(tag)
except errors.DriverError as dex:
except errors.DriverError:
tag_list.refresh()
tag = tag_list.select(t)
if tag is not None:
@ -1328,7 +1328,7 @@ class ApplyNodeStorage(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -1655,7 +1655,7 @@ class DeployNode(BaseMaasAction):
try:
site_design = self._load_site_design()
except errors.OrchestratorError as ex:
except errors.OrchestratorError:
self.task.add_status_msg(
"Error loading site design.",
error=True,
@ -1725,7 +1725,7 @@ class DeployNode(BaseMaasAction):
try:
machine.deploy()
except errors.DriverError as dex:
except errors.DriverError:
msg = "Error deploying node %s, skipping" % n.name
self.logger.warning(msg)
self.task.add_status_msg(

View File

@ -63,7 +63,7 @@ class BlockDevice(model_base.ResourceBase):
system_id=self.system_id,
device_id=self.resource_id)
self.partitions.refresh()
except Exception as ex:
except Exception:
self.logger.warning(
"Could not load partitions on node %s block device %s" %
(self.system_id, self.resource_id))

View File

@ -0,0 +1,39 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/BaremetalNode/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/baremetalNode.yaml'
type: 'object'
properties:
host_profile:
type: 'string'
interfaces:
type: 'object'
properties:
bond0:
type: 'object'
properties:
networks:
type: 'array'
items:
type: 'string'
addressing:
type: 'array'
items:
type: 'object'
properties:
network:
type: 'string'
address:
type: 'string'
metadata:
type: 'object'
properties:
rack:
type: 'string'
additionalProperties: false

View File

@ -0,0 +1,43 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/HardwareProfile/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/hardwareProfile.yaml'
type: 'object'
properties:
vendor:
type: 'string'
generation:
type: 'string'
hw_version:
type: 'string'
bios_version:
type: 'string'
boot_mode:
type: 'string'
enum:
- 'bios'
- 'uefi'
bootstrap_protocol:
type: 'string'
enum:
- 'pxe'
- 'usb'
- 'hdd'
pxe_interface:
type: 'number'
device_aliases:
type: 'object'
properties:
address:
type: 'string'
dev_type:
type: 'string'
bus_type:
type: 'string'
additionalProperties: false

View File

@ -0,0 +1,154 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/HostProfile/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/hostProfile.yaml'
type: 'object'
properties:
oob:
type: 'object'
properties:
type:
type: 'string'
network:
type: 'string'
account:
type: 'string'
credetial:
type: 'string'
storage:
type: 'object'
properties:
physical_devices:
type: 'object'
properties:
sda:
type: 'object'
properties:
labels:
type: 'object'
properties:
role:
type: 'string'
partitions:
type: 'array'
items:
type: 'object'
properties:
name:
type: 'string'
size:
type: 'string'
bootable:
type: 'boolean'
filesystem:
type: 'object'
properties:
mountpoint:
type: 'string'
fstype:
type: 'string'
mount_options:
type: 'string'
sdb:
type: 'object'
properties:
volume_group:
type: 'string'
volume_groups:
type: 'object'
properties:
log_vg:
type: 'object'
properties:
logical_volumes:
type: 'array'
items:
type: 'object'
properties:
name:
type: 'string'
size:
type: 'string'
filesystem:
type: 'object'
properties:
mountpoint:
type: 'string'
fstype:
type: 'string'
mount_options:
type: 'string'
platform:
type: 'object'
properties:
image:
type: 'string'
kernel:
type: 'string'
kernel_params:
type: 'object'
properties:
quiet:
type: 'boolean'
console:
type: 'string'
metadata:
type: 'object'
properties:
tags:
type: 'array'
items:
type: 'string'
owner_data:
type: 'object'
properties:
foo:
type: 'string'
host_profile:
type: 'string'
hardware_profile:
type: 'string'
primary_network:
type: 'string'
interfaces:
type: 'object'
properties:
pxe:
type: 'object'
properties:
device_link:
type: 'string'
labels:
type: 'object'
properties:
nonconfig:
type: 'boolean'
slaves:
type: 'array'
items:
type: 'string'
networks:
type: 'array'
items:
type: 'string'
bond0:
type: 'object'
properties:
device_link:
type: 'string'
slaves:
type: 'array'
items:
type: 'string'
networks:
type: 'array'
items:
type: 'string'
additionalProperties: false

View File

@ -0,0 +1,65 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/Network/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/network.yaml'
type: 'object'
properties:
allocation:
type: 'string'
cidr:
type: 'string'
format: 'ipv4'
ranges:
type: 'array'
items:
type: 'object'
properties:
type:
type: 'string'
start:
type: 'string'
format: 'ipv4'
end:
type: 'string'
format: 'ipv4'
dns:
type: 'object'
properties:
domain:
type: 'string'
servers:
type: 'string'
format: 'ipv4'
dhcp_relay:
type: 'object'
properties:
self_ip:
type: 'string'
format: 'ipv4'
upstream_target:
type: 'string'
format: 'ipv4'
mtu:
type: 'number'
vlan:
type: 'string'
routes:
type: 'array'
items:
type: 'object'
properties:
subnet:
type: 'string'
format: 'ipv4'
gateway:
type: 'string'
format: 'ipv4'
metric:
type: 'number'
additionalProperties: false

View File

@ -0,0 +1,37 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/NetworkLink/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/networkLink.yaml'
type: 'object'
properties:
bonding:
type: 'object'
properties:
mode:
type: 'string'
hash:
type: 'string'
peer_rate:
type: 'string'
mtu:
type: 'number'
linkspeed:
type: 'string'
trunking:
type: 'object'
properties:
mode:
type: 'string'
default_network:
type: 'string'
allowed_networks:
type: 'array'
items:
type: 'string'
additionalProperties: false

View File

@ -0,0 +1,33 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/Rack/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/rack.yaml'
type: 'object'
properties:
tor_switches:
type: 'object'
properties:
mgmt_ip:
type: 'string'
format: 'ipv4'
sdn_api_uri:
type: 'string'
format: 'uri'
location:
type: 'object'
properties:
clli:
type: 'string'
grid:
type: 'string'
local_networks:
type: 'array'
items:
type: 'string'
additionalProperties: false

View File

@ -0,0 +1,31 @@
---
schema: 'deckhand/DataSchema/v1'
metadata:
schema: metadata/Control/v1
name: drydock/Region/v1
labels:
application: drydock
data:
$schema: 'http://json-schema.org/schema#'
id: 'http://att.com/att-comdev/drydock/region.yaml'
type: 'object'
properties:
tag_definitions:
type: 'array'
items:
type: 'object'
properties:
tag:
type: 'string'
definition_type:
type: 'string'
enum:
- 'lshw_xpath'
definition:
type: 'string'
additionalProperties: false
authorized_keys:
type: 'array'
items:
type: 'string'
additionalProperties: false

View File

@ -3,7 +3,7 @@ amqp==2.2.2
Babel==2.5.1
bson==0.4.7
cachetools==2.0.1
certifi==2017.7.27.1
certifi==2017.11.5
chardet==3.0.4
click==6.7
contextlib2==0.5.5
@ -23,22 +23,22 @@ keystonemiddleware==4.9.1
kombu==4.1.0
Mako==1.0.7
MarkupSafe==1.0
monotonic==1.3
monotonic==1.4
msgpack-python==0.4.8
netaddr==0.7.19
netifaces==0.10.6
oauthlib==2.0.6
oslo.concurrency==3.23.0
oslo.config==3.16.0
oslo.context==2.19.2
oslo.context==2.19.3
oslo.i18n==3.18.0
oslo.log==3.32.0
oslo.log==3.33.0
oslo.messaging==5.33.1
oslo.middleware==3.32.1
oslo.policy==1.22.1
oslo.serialization==2.21.2
oslo.service==1.26.0
oslo.utils==3.30.0
oslo.service==1.27.0
oslo.utils==3.31.0
oslo.versionedobjects==1.23.0
Paste==2.0.3
PasteDeploy==1.5.2
@ -59,18 +59,19 @@ python-dateutil==2.6.1
python-editor==1.0.3
python-keystoneclient==3.13.0
python-mimeparse==1.6.0
pytz==2017.2
pytz==2017.3
PyYAML==3.12
repoze.lru==0.7
requests==2.18.4
rfc3986==1.1.0
Routes==2.4.1
setuptools==36.6.0
setuptools==36.7.2
six==1.11.0
SQLAlchemy==1.1.14
statsd==3.2.1
stevedore==1.27.1
tenacity==4.5.0
tenacity==4.7.0
ulid2==0.1.1
urllib3==1.22
uWSGI==2.0.15
vine==1.1.4

View File

@ -0,0 +1,139 @@
import yaml
import jsonschema
import pkg_resources
import os
import shutil
import pytest
from jsonschema.exceptions import ValidationError
class BaseSchemaValidationTest(object):
def _test_validate(self, schema, expect_failure, input_files, input):
"""validates input yaml against schema.
:param schema: schema yaml file
:param expect_failure: should the validation pass or fail.
:param input_files: pytest fixture used to access the test input files
:param input: test input yaml doc filename"""
schema_dir = pkg_resources.resource_filename('drydock_provisioner',
'schemas')
schema_filename = os.path.join(schema_dir, schema)
schema_file = open(schema_filename, 'r')
schema = yaml.safe_load(schema_file)
input_file = input_files.join(input)
instance_file = open(str(input_file), 'r')
instance = yaml.safe_load(instance_file)
if expect_failure:
with pytest.raises(ValidationError):
jsonschema.validate(instance['spec'], schema['data'])
else:
jsonschema.validate(instance['spec'], schema['data'])
class TestValidation(BaseSchemaValidationTest):
def test_validate_baremetalNode(self, input_files):
self._test_validate('baremetalNode.yaml', False, input_files, "baremetalNode.yaml")
def test_validate_baremetalNode2(self, input_files):
self._test_validate('baremetalNode.yaml', False, input_files, "baremetalNode2.yaml")
def test_invalidate_baremetalNode(self, input_files):
self._test_validate('baremetalNode.yaml', True, input_files, "invalid_baremetalNode.yaml")
def test_invalidate_baremetalNode2(self, input_files):
self._test_validate('baremetalNode.yaml', True, input_files, "invalid_baremetalNode2.yaml")
def test_validate_hardwareProfile(self, input_files):
self._test_validate('hardwareProfile.yaml', False, input_files, "hardwareProfile.yaml")
def test_invalidate_hardwareProfile(self, input_files):
self._test_validate('hardwareProfile.yaml', True, input_files, "invalid_hardwareProfile.yaml")
def test_validate_hostProfile(self, input_files):
self._test_validate('hostProfile.yaml', False, input_files, "hostProfile.yaml")
def test_validate_hostProfile2(self, input_files):
self._test_validate('hostProfile.yaml', False, input_files, "hostProfile2.yaml")
def test_invalidate_hostProfile(self, input_files):
self._test_validate('hostProfile.yaml', True, input_files, "invalid_hostProfile.yaml")
def test_invalidate_hostProfile2(self, input_files):
self._test_validate('hostProfile.yaml', True, input_files, "invalid_hostProfile2.yaml")
def test_validate_network(self, input_files):
self._test_validate('network.yaml', False, input_files, "network.yaml")
def test_validate_network2(self, input_files):
self._test_validate('network.yaml', False, input_files, "network2.yaml")
def test_validate_network3(self, input_files):
self._test_validate('network.yaml', False, input_files, "network3.yaml")
def test_validate_network4(self, input_files):
self._test_validate('network.yaml', False, input_files, "network4.yaml")
def test_validate_network5(self, input_files):
self._test_validate('network.yaml', False, input_files, "network5.yaml")
def test_invalidate_network(self, input_files):
self._test_validate('network.yaml', True, input_files, "invalid_network.yaml")
def test_invalidate_network2(self, input_files):
self._test_validate('network.yaml', True, input_files, "invalid_network2.yaml")
def test_invalidate_network3(self, input_files):
self._test_validate('network.yaml', True, input_files, "invalid_network3.yaml")
def test_invalidate_network4(self, input_files):
self._test_validate('network.yaml', True, input_files, "invalid_network4.yaml")
def test_invalidate_network5(self, input_files):
self._test_validate('network.yaml', True, input_files, "invalid_network5.yaml")
def test_validate_networkLink(self, input_files):
self._test_validate('networkLink.yaml', False, input_files, "networkLink.yaml")
def test_validate_networkLink2(self, input_files):
self._test_validate('networkLink.yaml', False, input_files, "networkLink2.yaml")
def test_validate_networkLink3(self, input_files):
self._test_validate('networkLink.yaml', False, input_files, "networkLink3.yaml")
def test_invalidate_networkLink(self, input_files):
self._test_validate('networkLink.yaml', True, input_files, "invalid_networkLink.yaml")
def test_invalidate_networkLink2(self, input_files):
self._test_validate('networkLink.yaml', True, input_files, "invalid_networkLink2.yaml")
def test_invalidate_networkLink3(self, input_files):
self._test_validate('networkLink.yaml', True, input_files, "invalid_networkLink3.yaml")
def test_validate_region(self, input_files):
self._test_validate('region.yaml', False, input_files, "region.yaml")
def test_invalidate_region(self, input_files):
self._test_validate('region.yaml', True, input_files, "invalid_region.yaml")
def test_validate_rack(self, input_files):
self._test_validate('rack.yaml', False, input_files, "rack.yaml")
def test_invalidate_rack(self, input_files):
self._test_validate('rack.yaml', True, input_files, "invalid_rack.yaml")
@pytest.fixture(scope='module')
def input_files(self, tmpdir_factory, request):
tmpdir = tmpdir_factory.mktemp('data')
samples_dir = os.path.dirname(str(
request.fspath)) + "/" + "../yaml_samples"
samples = os.listdir(samples_dir)
for f in samples:
src_file = samples_dir + "/" + f
dst_file = str(tmpdir) + "/" + f
shutil.copyfile(src_file, dst_file)
return tmpdir

View File

@ -0,0 +1,35 @@
---
apiVersion: 'drydock/v1'
kind: BaremetalNode
metadata:
name: controller01
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
host_profile: k8-node
# the hostname for a server, could be used in multiple DNS domains to
# represent different interfaces
interfaces:
bond0:
networks:
# '!' prefix for the value of the primary key indicates a record should be removed
- '!private'
# Addresses assigned to network interfaces
addressing:
# Which network the address applies to. If a network appears in addressing
# that isn't assigned to an interface, design validation will fail
- network: pxe
# The address assigned. Either a explicit IPv4 or IPv6 address
# or dhcp or slaac
address: dhcp
- network: mgmt
address: 172.16.1.20
- network: public
address: 172.16.3.20
- network: oob
address: 172.16.100.20
metadata:
rack: rack1
...

View File

@ -0,0 +1,23 @@
---
apiVersion: 'drydock/v1'
kind: BaremetalNode
metadata:
name: compute01
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
host_profile: k8-node
addressing:
- network: pxe
address: dhcp
- network: mgmt
address: 172.16.1.21
- network: private
address: 172.16.2.21
- network: oob
address: 172.16.100.21
metadata:
rack: rack2
...

View File

@ -0,0 +1,40 @@
---
apiVersion: 'drydock/v1'
kind: HardwareProfile
metadata:
name: HPGen9v3
region: sitename
date: 17-FEB-2017
author: Scott Hussey
spec:
# Vendor of the server chassis
vendor: HP
# Generation of the chassis model
generation: '8'
# Version of the chassis model within its generation - not version of the hardware definition
hw_version: '3'
# The certified version of the chassis BIOS
bios_version: '2.2.3'
# Mode of the default boot of hardware - bios, uefi
boot_mode: bios
# Protocol of boot of the hardware - pxe, usb, hdd
bootstrap_protocol: pxe
# Which interface to use for network booting within the OOB manager, not OS device
pxe_interface: 0
# Map hardware addresses to aliases/roles to allow a mix of hardware configs
# in a site to result in a consistent configuration
device_aliases:
prim_nic01:
address: '0000:00:03.0'
# type could identify expected hardware - used for hardware manifest validation
dev_type: '82540EM Gigabit Ethernet Controller'
bus_type: 'pci'
prim_nic02:
address: '0000:00:04.0'
dev_type: '82540EM Gigabit Ethernet Controller'
bus_type: 'pci'
primary_boot:
address: '2:0.0.0'
dev_type: 'VBOX HARDDISK'
bus_type: 'scsi'
...

View File

@ -0,0 +1,69 @@
---
apiVersion: 'drydock/v1'
kind: HostProfile
metadata:
name: defaults
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
# No magic to this host_profile, it just provides a way to specify
# sitewide settings. If it is absent from a node's inheritance chain
# then these values will NOT be applied
spec:
# OOB (iLO, iDRAC, etc...) settings. Should prefer open standards such
# as IPMI over vender-specific when possible.
oob:
type: ipmi
# OOB networking should be preconfigured, but we can include a network
# definition for validation or enhancement (DNS registration)
network: oob
account: admin
credential: admin
# Specify storage layout of base OS. Ceph out of scope
storage:
physical_devices:
sda:
labels:
role: rootdisk
partitions:
- name: root
size: 20g
bootable: true
filesystem:
mountpoint: '/'
fstype: 'ext4'
mount_options: 'defaults'
- name: boot
size: 1g
bootable: false
filesystem:
mountpoint: '/boot'
fstype: 'ext4'
mount_options: 'defaults'
sdb:
volume_group: 'log_vg'
volume_groups:
log_vg:
logical_volumes:
- name: 'log_lv'
size: '500m'
filesystem:
mountpoint: '/var/log'
fstype: 'xfs'
mount_options: 'defaults'
# Platform (Operating System) settings
platform:
image: ubuntu_16.04
kernel: generic
kernel_params:
quiet: true
console: ttyS2
# Additional metadata to apply to a node
metadata:
# Freeform tags to be applied to the host
tags:
- deployment=initial
owner_data:
foo: bar
...

View File

@ -0,0 +1,55 @@
---
apiVersion: 'drydock/v1'
kind: HostProfile
metadata:
name: k8-node
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
# host_profile inheritance allows for deduplication of common CIs
# Inheritance is additive for CIs that are lists of multiple items
# To remove an inherited list member, prefix the primary key value
# with '!'.
host_profile: defaults
# Hardware profile will map hardware specific details to the abstract
# names uses in the host profile as well as specify hardware specific
# configs. A viable model should be to build a host profile without a
# hardware_profile and then for each node inherit the host profile and
# specify a hardware_profile to map that node's hardware to the abstract
# settings of the host_profile
hardware_profile: HPGen9v3
# Network interfaces.
primary_network: mgmt
interfaces:
# Keyed on device_name
pxe:
# The network link attached to this
device_link: pxe
labels:
# this interface will be used only for PXE booting during deploy
noconfig: true
# Slaves will specify aliases from hwdefinition.yaml or kernel device names
slaves:
- prim_nic01
# Which networks will be configured on this interface
networks:
- pxe
bond0:
device_link: gp
# If multiple slaves are specified, but no bonding config
# is applied to the link, design validation will fail
slaves:
- prim_nic01
- prim_nic02
# If multiple networks are specified, but no trunking
# config is applied to the link, design validation will fail
networks:
- mgmt
- private
metadata:
# Explicit tag assignment
tags:
- 'test'
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: BaremetalNode
metadata:
name: controller01
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: 'bar'
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: BaremetalNode
metadata:
name: compute01
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: 'bar'
...

View File

@ -0,0 +1,11 @@
---
apiVersion: 'drydock/v1'
kind: HardwareProfile
metadata:
name: HPGen9v3
region: sitename
date: 17-FEB-2017
author: Scott Hussey
spec:
foo: 'bar'
...

View File

@ -0,0 +1,14 @@
---
apiVersion: 'drydock/v1'
kind: HostProfile
metadata:
name: defaults
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
# No magic to this host_profile, it just provides a way to specify
# sitewide settings. If it is absent from a node's inheritance chain
# then these values will NOT be applied
spec:
foo: bar

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: HostProfile
metadata:
name: k8-node
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: oob
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: pxe
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: mgmt
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: private
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: public
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: NetworkLink
metadata:
name: oob
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 1 attributes. Primary key is 'name'. These settings will generally be things the switch and server have to agree on
spec:
foo: bar
...

View File

@ -0,0 +1,15 @@
---
apiVersion: 'drydock/v1'
kind: NetworkLink
metadata:
name: gp
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 1 attributes. These CIs will generally be things the switch and server have to agree on
# pxe is a bit of 'magic' indicating the link config used when PXE booting
# a node. All other links indicate network configs applied when the node
# is deployed.
spec:
foo: bar
...

View File

@ -0,0 +1,15 @@
---
# pxe is a bit of 'magic' indicating the link config used when PXE booting
# a node. All other links indicate network configs applied when the node
# is deployed.
apiVersion: 'drydock/v1'
kind: NetworkLink
metadata:
name: pxe
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 1 attributes. Primary key is 'name'. These settings will generally be things the switch and server have to agree on
spec:
foo: bar
...

View File

@ -0,0 +1,12 @@
---
apiVersion: 'drydock/v1'
kind: Rack
metadata:
name: rack1
region: sitename
date: 24-AUG-2017
author: sh8121@att.com
description: A equipment rack
spec:
foo: 'bar'
...

View File

@ -0,0 +1,11 @@
---
apiVersion: 'drydock/v1'
kind: Region
metadata:
name: sitename
date: 17-FEB-2017
description: Sample site design
author: sh8121@att.com
spec:
foo: 'bar'
...

View File

@ -0,0 +1,20 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: oob
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
allocation: static
cidr: 172.16.100.0/24
ranges:
- type: static
start: 172.16.100.15
end: 172.16.100.254
dns:
domain: ilo.sitename.att.com
servers: 172.16.100.10
...

View File

@ -0,0 +1,32 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: pxe
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
# If this network utilizes a dhcp relay, where does it forward DHCPDISCOVER requests to?
dhcp_relay:
# Required if Drydock is configuring a switch with the relay
self_ip: 172.16.0.4
# Can refer to a unicast IP
upstream_target: 172.16.5.5
# MTU for this VLAN interface, if not specified it will be inherited from the link
mtu: 1500
# Network address
cidr: 172.16.0.0/24
# Desribe IP address ranges
ranges:
- type: dhcp
start: 172.16.0.5
end: 172.16.0.254
# DNS settings for this network
dns:
# Domain addresses on this network will be registered under
domain: admin.sitename.att.com
# DNS servers that a server using this network as its default gateway should use
servers: 172.16.0.10
...

View File

@ -0,0 +1,34 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: mgmt
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
vlan: '100'
# Allow MTU to be inherited from link the network rides on
mtu: 1500
# Network address
cidr: 172.16.1.0/24
# Desribe IP address ranges
ranges:
- type: static
start: 172.16.1.15
end: 172.16.1.254
# Static routes to be added for this network
routes:
- subnet: 0.0.0.0/0
# A blank gateway would leave to a static route specifying
# only the interface as a source
gateway: 172.16.1.1
metric: 10
# DNS settings for this network
dns:
# Domain addresses on this network will be registered under
domain: mgmt.sitename.example.com
# DNS servers that a server using this network as its default gateway should use
servers: 172.16.1.9,172.16.1.10
...

View File

@ -0,0 +1,24 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: private
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
vlan: '101'
mtu: 9000
cidr: 172.16.2.0/24
# Desribe IP address ranges
ranges:
# Type can be reserved (not used for baremetal), static (all explicit
# assignments should fall here), dhcp (will be used by a DHCP server on this network)
- type: static
start: 172.16.2.15
end: 172.16.2.254
dns:
domain: priv.sitename.example.com
servers: 172.16.2.9,172.16.2.10
...

View File

@ -0,0 +1,27 @@
---
apiVersion: 'drydock/v1'
kind: Network
metadata:
name: public
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 2/3 attributes. Primarily CIs used for configuring server interfaces
spec:
vlan: '102'
# MTU size for the VLAN interface
mtu: 1500
cidr: 172.16.3.0/24
# Desribe IP address ranges
ranges:
- type: static
start: 172.16.3.15
end: 172.16.3.254
routes:
- subnet: 0.0.0.0/0
gateway: 172.16.3.1
metric: 10
dns:
domain: sitename.example.com
servers: 8.8.8.8
...

View File

@ -0,0 +1,20 @@
---
apiVersion: 'drydock/v1'
kind: NetworkLink
metadata:
name: oob
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 1 attributes. Primary key is 'name'. These settings will generally be things the switch and server have to agree on
spec:
bonding:
mode: disabled
mtu: 1500
linkspeed: 100full
trunking:
mode: disabled
default_network: oob
allowed_networks:
- oob
...

View File

@ -0,0 +1,34 @@
---
apiVersion: 'drydock/v1'
kind: NetworkLink
metadata:
name: gp
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 1 attributes. These CIs will generally be things the switch and server have to agree on
# pxe is a bit of 'magic' indicating the link config used when PXE booting
# a node. All other links indicate network configs applied when the node
# is deployed.
spec:
# If this link is a bond of physical links, how is it configured
# 802.3ad
# active-backup
# balance-rr
# Can add support for others down the road
bonding:
mode: 802.3ad
# For LACP (802.3ad) xmit hashing policy: layer2, layer2+3, layer3+4, encap3+4
hash: layer3+4
# 802.3ad specific options
peer_rate: slow
mtu: 9000
linkspeed: auto
# Is this link supporting multiple layer 2 networks?
trunking:
mode: 802.1q
default_network: mgmt
allowed_networks:
- public
- mgmt
...

View File

@ -0,0 +1,27 @@
---
# pxe is a bit of 'magic' indicating the link config used when PXE booting
# a node. All other links indicate network configs applied when the node
# is deployed.
apiVersion: 'drydock/v1'
kind: NetworkLink
metadata:
name: pxe
region: sitename
date: 17-FEB-2017
author: sh8121@att.com
description: Describe layer 1 attributes. Primary key is 'name'. These settings will generally be things the switch and server have to agree on
spec:
bonding:
mode: disabled
mtu: 1500
linkspeed: auto
# Is this link supporting multiple layer 2 networks?
# none is a port-based VLAN identified by default_network
# tagged is is using 802.1q VLAN tagging. Untagged packets will default to default_netwokr
trunking:
mode: disabled
# use name, will translate to VLAN ID
default_network: pxe
allowed_networks:
- pxe
...

View File

@ -0,0 +1,27 @@
---
apiVersion: 'drydock/v1'
kind: Rack
metadata:
name: rack1
region: sitename
date: 24-AUG-2017
author: sh8121@att.com
description: A equipment rack
spec:
# List of TOR switches in this rack
tor_switches:
switch01name:
mgmt_ip: 1.1.1.1
sdn_api_uri: polo+https://polo-api.web.att.com/switchmgmt?switch=switch01name
switch02name:
mgmt_ip: 1.1.1.2
sdn_api_uri: polo+https://polo-api.web.att.com/switchmgmt?switch=switch02name
# GIS data for this rack
location:
clli: HSTNTXMOCG0
grid: EG12
# Networks wholly contained to this rack
# Nodes in a rack can only connect to local_networks of that rack
local_networks:
- pxe-rack1
...

View File

@ -0,0 +1,21 @@
---
apiVersion: 'drydock/v1'
kind: Region
metadata:
name: sitename
date: 17-FEB-2017
description: Sample site design
author: sh8121@att.com
spec:
tag_definitions:
- tag: test
definition_type: lshw_xpath
definition: "//node[@id=\"display\"]/'clock units=\"Hz\"' > 1000000000"
authorized_keys:
- |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDENeyO5hLPbLLQRZ0oafTYWs1ieo5Q+XgyZQs51Ju
jDGc8lKlWsg1/6yei2JewKMgcwG2Buu1eqU92Xn1SvMZLyt9GZURuBkyjcfVc/8GiU5QP1Of8B7CV0c
kfUpHWYJ17olTzT61Hgz10ioicBF6cjgQrLNcyn05xoaJHD2Vpf8Unxzi0YzA2e77yRqBo9jJVRaX2q
wUJuZrzb62x3zw8Knz6GGSZBn8xRKLaw1SKFpd1hwvL62GfqX5ZBAT1AYTZP1j8GcAoK8AFVn193SEU
vjSdUFa+RNWuJhkjBRfylJczIjTIFb5ls0jpbA3bMA9DE7lFKVQl6vVwFmiIVBI1 samplekey
...