a little nicer wrt pep8
[sfa.git] / sfa / trust / top.xsd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:sig="http://www.w3.org/2000/09/xmldsig#">
3   <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="sig.xsd"/>
4   <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
5   <!--
6     
7     EMULAB-COPYRIGHT
8     Copyright (c) 2005-2007 University of Utah and the Flux Group.
9     All rights reserved.
10     
11   -->
12   <!--
13     
14     Definition of common data structures used for representing topologies -
15     shared between vtop (virtual topology) and ptop (physical topology)
16     formats.
17     
18   -->
19   <xs:element name="node_type">
20     <xs:complexType>
21       <xs:complexContent>
22         <xs:extension base="NodeTypeContents">
23           <xs:attribute name="type_name" use="required">
24             <xs:annotation>
25               <xs:documentation>Name of the type - will almost certainly not be unique</xs:documentation>
26             </xs:annotation>
27           </xs:attribute>
28           <xs:attribute name="type_slots" use="required">
29             <xs:annotation>
30               <xs:documentation>How many virtual nodes of this type this physical node can
31 handle.</xs:documentation>
32             </xs:annotation>
33             <xs:simpleType>
34               <xs:union>
35                 <xs:simpleType>
36                   <xs:restriction base="xs:integer">
37                     <xs:minInclusive value="0"/>
38                   </xs:restriction>
39                 </xs:simpleType>
40                 <xs:simpleType>
41                   <xs:restriction base="xs:token">
42                     <xs:enumeration value="unlimited"/>
43                   </xs:restriction>
44                 </xs:simpleType>
45               </xs:union>
46             </xs:simpleType>
47           </xs:attribute>
48           <xs:attribute name="static">
49             <xs:annotation>
50               <xs:documentation>element unlimited { empty }?,
51 A flag that indicates that this physical node *always*
52 has this type - a node is only allowed to have one dynamic
53 (ie. not flagged as static) type at a time, but any number
54 of static types at a time
55 element static { empty }?</xs:documentation>
56             </xs:annotation>
57             <xs:simpleType>
58               <xs:restriction base="xs:token">
59                 <xs:enumeration value="true"/>
60               </xs:restriction>
61             </xs:simpleType>
62           </xs:attribute>
63         </xs:extension>
64       </xs:complexContent>
65     </xs:complexType>
66   </xs:element>
67   <xs:complexType name="NodeTypeContents">
68     <xs:sequence>
69       <xs:element minOccurs="0" maxOccurs="unbounded" ref="field"/>
70     </xs:sequence>
71   </xs:complexType>
72   <xs:group name="LinkTypeSpec">
73     <xs:annotation>
74       <xs:documentation>Link types are currently just a siple string. They will almost certainly 
75 have to get more complicated, for two reasons:
76     First, I want to allow virtual links to specify more than one type, so
77       that we can ask for links that are, say, 'ethernet or loopback'
78     Second, I want to have a lot more control over links that get mapped to
79       multi-hop paths
80 TODO: MAYBE this should be combined with NodeTypeSpec</xs:documentation>
81     </xs:annotation>
82     <xs:sequence>
83       <xs:element name="link_type">
84         <xs:complexType>
85           <xs:attribute name="type_name" use="required"/>
86         </xs:complexType>
87       </xs:element>
88     </xs:sequence>
89   </xs:group>
90   <xs:group name="LinkEndPoints">
91     <xs:annotation>
92       <xs:documentation>A link has two endpoints. Right now, they are order
93 independent. But they might become order-dependant later.</xs:documentation>
94     </xs:annotation>
95     <xs:sequence>
96       <xs:element ref="source_interface"/>
97       <xs:element ref="destination_interface"/>
98     </xs:sequence>
99   </xs:group>
100   <xs:element name="source_interface" type="InterfaceSpec">
101     <xs:annotation>
102       <xs:documentation>First interface for this link</xs:documentation>
103     </xs:annotation>
104   </xs:element>
105   <xs:element name="destination_interface" type="InterfaceSpec">
106     <xs:annotation>
107       <xs:documentation>Second interface for this link</xs:documentation>
108     </xs:annotation>
109   </xs:element>
110   <xs:group name="LinkCharacteristics">
111     <xs:annotation>
112       <xs:documentation>Link characterstics which affect traffic.
113 TODO: In the future, the bandwidth, latency, and packet loss will be
114 moved to features and/or properties</xs:documentation>
115     </xs:annotation>
116     <xs:sequence>
117       <xs:element ref="bandwidth"/>
118       <xs:element ref="latency"/>
119       <xs:element ref="packet_loss"/>
120     </xs:sequence>
121   </xs:group>
122   <xs:element name="bandwidth">
123     <xs:annotation>
124       <xs:documentation>Bandwidth of the link in kbps</xs:documentation>
125     </xs:annotation>
126     <xs:simpleType>
127       <xs:restriction base="xs:float">
128         <xs:minExclusive value="0.0"/>
129       </xs:restriction>
130     </xs:simpleType>
131   </xs:element>
132   <xs:element name="latency">
133     <xs:annotation>
134       <xs:documentation>Latency of the link in ms</xs:documentation>
135     </xs:annotation>
136     <xs:simpleType>
137       <xs:restriction base="xs:float">
138         <xs:minInclusive value="0.0"/>
139       </xs:restriction>
140     </xs:simpleType>
141   </xs:element>
142   <xs:element name="packet_loss">
143     <xs:annotation>
144       <xs:documentation>Static packet loss probability of the link as a fraction
145 (ie. 0.01 == 1%)</xs:documentation>
146     </xs:annotation>
147     <xs:simpleType>
148       <xs:restriction base="xs:float">
149         <xs:minInclusive value="0.0"/>
150       </xs:restriction>
151     </xs:simpleType>
152   </xs:element>
153   <xs:element name="fd">
154     <xs:complexType>
155       <xs:attribute name="fd_name" use="required">
156         <xs:annotation>
157           <xs:documentation>Name of this feature or desire
158 element fd_name { text },</xs:documentation>
159         </xs:annotation>
160       </xs:attribute>
161       <xs:attribute name="fd_weight" use="required">
162         <xs:annotation>
163           <xs:documentation>Weight assocated with the feature or desire
164 element fd_weight { xsd:float },</xs:documentation>
165         </xs:annotation>
166       </xs:attribute>
167       <xs:attribute name="violatable">
168         <xs:annotation>
169           <xs:documentation>A flag indicating whether or not a failure to match the desire with a
170 a feature is a constraint violation
171 element violatable { empty }?,</xs:documentation>
172         </xs:annotation>
173         <xs:simpleType>
174           <xs:restriction base="xs:token">
175             <xs:enumeration value="true"/>
176           </xs:restriction>
177         </xs:simpleType>
178       </xs:attribute>
179       <xs:attribute name="global_operator">
180         <xs:simpleType>
181           <xs:restriction base="xs:token">
182             <xs:enumeration value="OnceOnly"/>
183             <xs:enumeration value="FirstFree"/>
184           </xs:restriction>
185         </xs:simpleType>
186       </xs:attribute>
187       <xs:attribute name="local_operator">
188         <xs:simpleType>
189           <xs:restriction base="xs:token">
190             <xs:enumeration value="+"/>
191           </xs:restriction>
192         </xs:simpleType>
193       </xs:attribute>
194     </xs:complexType>
195   </xs:element>
196   <xs:attributeGroup name="GlobalSpec">
197     <xs:annotation>
198       <xs:documentation>GlobalSpec = element global {
199         element operator { "OnceOnly" | "FirstFree" }
200 }</xs:documentation>
201     </xs:annotation>
202     <xs:attribute name="global_operator" use="required">
203       <xs:simpleType>
204         <xs:restriction base="xs:token">
205           <xs:enumeration value="OnceOnly"/>
206           <xs:enumeration value="FirstFree"/>
207         </xs:restriction>
208       </xs:simpleType>
209     </xs:attribute>
210   </xs:attributeGroup>
211   <xs:attributeGroup name="LocalSpec">
212     <xs:annotation>
213       <xs:documentation>LocalSpec = element local {
214         element operator { "+" }
215         attribute local_operator { "+" }
216 }</xs:documentation>
217     </xs:annotation>
218     <xs:attribute name="local_operator" use="required">
219       <xs:simpleType>
220         <xs:restriction base="xs:token">
221           <xs:enumeration value="+"/>
222         </xs:restriction>
223       </xs:simpleType>
224     </xs:attribute>
225   </xs:attributeGroup>
226   <xs:complexType name="InterfaceSpec">
227     <xs:annotation>
228       <xs:documentation>Interfaces
229 InterfaceSpec = element interface { InterfaceContents }</xs:documentation>
230     </xs:annotation>
231     <xs:sequence>
232       <xs:element minOccurs="0" maxOccurs="unbounded" ref="property"/>
233     </xs:sequence>
234     <xs:attribute name="node_name" use="required"/>
235     <xs:attribute name="interface_name" use="required"/>
236     <xs:attribute name="physical_node_name"/>
237     <xs:attribute name="physical_interface_name"/>
238   </xs:complexType>
239   <xs:group name="InterfaceContents">
240     <xs:sequence>
241       <xs:element ref="node_name"/>
242       <xs:element ref="interface_name"/>
243       <xs:element minOccurs="0" maxOccurs="unbounded" ref="property">
244         <xs:annotation>
245           <xs:documentation>Properties of the interface</xs:documentation>
246         </xs:annotation>
247       </xs:element>
248     </xs:sequence>
249   </xs:group>
250   <xs:element name="node_name" type="xs:string">
251     <xs:annotation>
252       <xs:documentation>Name of the node, which must match one of the nodes in this topology</xs:documentation>
253     </xs:annotation>
254   </xs:element>
255   <xs:element name="interface_name" type="xs:string">
256     <xs:annotation>
257       <xs:documentation>Name of the interface itself</xs:documentation>
258     </xs:annotation>
259   </xs:element>
260   <xs:element name="property">
261     <xs:complexType>
262       <xs:sequence>
263         <xs:element ref="property_name"/>
264         <xs:element ref="property_value"/>
265         <xs:element ref="property_penalty"/>
266         <xs:element minOccurs="0" ref="violatable"/>
267       </xs:sequence>
268       <xs:attribute name="global_operator">
269         <xs:simpleType>
270           <xs:restriction base="xs:token">
271             <xs:enumeration value="OnceOnly"/>
272             <xs:enumeration value="FirstFree"/>
273           </xs:restriction>
274         </xs:simpleType>
275       </xs:attribute>
276       <xs:attribute name="local_operator">
277         <xs:simpleType>
278           <xs:restriction base="xs:token">
279             <xs:enumeration value="+"/>
280           </xs:restriction>
281         </xs:simpleType>
282       </xs:attribute>
283     </xs:complexType>
284   </xs:element>
285   <xs:element name="property_name" type="xs:string">
286     <xs:annotation>
287       <xs:documentation>Name of this property</xs:documentation>
288     </xs:annotation>
289   </xs:element>
290   <xs:element name="property_value" type="xs:string">
291     <xs:annotation>
292       <xs:documentation>Value associated with this property
293 TODO: Add ranges and other types from rspec</xs:documentation>
294     </xs:annotation>
295   </xs:element>
296   <xs:element name="property_penalty">
297     <xs:annotation>
298       <xs:documentation>The penalty associated with this property</xs:documentation>
299     </xs:annotation>
300     <xs:simpleType>
301       <xs:restriction base="xs:float">
302         <xs:minInclusive value="0.0"/>
303       </xs:restriction>
304     </xs:simpleType>
305   </xs:element>
306   <xs:element name="violatable">
307     <xs:annotation>
308       <xs:documentation>If this flag is present, not having the property is considered a violation</xs:documentation>
309     </xs:annotation>
310     <xs:complexType/>
311   </xs:element>
312 </xs:schema>