Topology schema
[csit.git] / resources / topology_schemas / topology.sch.yaml
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 # This file defines yaml schema for topolgy yaml.
15
16 schema;topology_metadata_map:
17   type: map
18   mapping:
19     version:
20       type: any
21     schema:
22       required: yes
23       type: seq
24       sequence:
25         - type: str
26           unique: True
27     tags:
28       include: list_tags
29     check_script:
30       type: str
31     start_script:
32       type: str
33
34
35 schema;list_tags:
36   type: seq
37   sequence:
38     - type: str
39       unique: True
40
41 schema;type_interfaces:
42   type: map
43   mapping: &type_interface_mapping
44     regex;(port\d+): &type_interface_mapping_port
45       type: map
46       mapping: &type_interface_mapping_port_mapping
47         name:
48           type: str
49         pci_address:
50           type: str
51           pattern: "[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\\.\\d{1}"
52         mac_address:
53           type: str
54           pattern: "[0-9a-f]{2}(:[0-9a-f]{2}){5}"
55         link:
56           type: str
57           required: yes
58         driver: &type_interface_mapping_driver
59           type: str
60
61 schema;type_interface_tg: &type_interface_tg
62   type: map
63   mapping:
64     <<: *type_interface_mapping
65     regex;(port\d+):
66       <<: *type_interface_mapping_port
67       mapping:
68         <<: *type_interface_mapping_port_mapping
69         driver:
70           <<: *type_interface_mapping_driver
71           required: yes
72
73 schema;type_honeycomb: &type_honeycomb
74   type: map
75   mapping: &type_honeycomb_mapping
76     user:
77       type: str
78       required: yes
79     passwd:
80       type: str
81       required: yes
82     port:
83       type: int
84       required: yes
85     netconf_port:
86       type: int
87       required: yes
88
89 schema;type_node: &type_node
90   type: map
91   mapping: &type_node_mapping
92     type: &type_node_mapping_type
93       required: yes
94       type: str
95     host:
96       required: yes
97       type: str
98     port:
99       type: int
100     username:
101       type: str
102     password:
103       type: str
104     priv_key:
105       type: str
106     interfaces:
107       type: map
108       mapping:
109         <<: *type_interface_mapping
110
111 schema;type_tg:
112   type: map
113   mapping:
114     <<: *type_node_mapping
115     type:
116       <<: *type_node_mapping_type
117       enum: [TG]
118     subtype:
119       type: str
120     interfaces:
121       <<: *type_interface_tg
122
123 schema;type_dut:
124   type: map
125   mapping:
126     <<: *type_node_mapping
127     type:
128       <<: *type_node_mapping_type
129       enum: [DUT]
130     honeycomb:
131       type: map
132       mapping:
133         <<: *type_honeycomb_mapping
134
135 # vim: sw=2:sts=2