33b4e7bfc0d7b50e66d18628a14665ad68ddd752
[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_node: &type_node
74   type: map
75   mapping: &type_node_mapping
76     type: &type_node_mapping_type
77       required: yes
78       type: str
79     host:
80       required: yes
81       type: str
82     port:
83       type: int
84     username:
85       type: str
86     password:
87       type: str
88     priv_key:
89       type: str
90     interfaces:
91       type: map
92       mapping:
93         <<: *type_interface_mapping
94
95 schema;type_tg:
96   type: map
97   mapping:
98     <<: *type_node_mapping
99     type:
100       <<: *type_node_mapping_type
101       enum: [TG]
102     subtype:
103       type: str
104     interfaces:
105       <<: *type_interface_tg
106
107 schema;type_dut:
108   type: map
109   mapping:
110     <<: *type_node_mapping
111     type:
112       <<: *type_node_mapping_type
113       enum: [DUT]
114
115 # vim: sw=2:sts=2