提交 a341fc73 编写于 作者: L Laine Stump 提交者: Eric Blake

interface: allow reordering of elements in xml

The interface xml schema was written with strict rules about the
ordering of the elements. This was never intentional, but just due to
omission of <interleave> in the appropriate places. This patch just
adds in <interleave> wherever there is more than one element, and
re-indents everything else appropriately.
上级 d98a60c2
...@@ -29,35 +29,41 @@ ...@@ -29,35 +29,41 @@
Ethernet adapter Ethernet adapter
--> -->
<define name="basic-ethernet-content"> <define name="basic-ethernet-content">
<attribute name="type"> <interleave>
<value>ethernet</value> <attribute name="type">
</attribute> <value>ethernet</value>
<ref name="name-attr"/> </attribute>
<!-- If no MAC is given when the interface is defined, it is determined <ref name="name-attr"/>
by using the device name. <!-- If no MAC is given when the interface is defined, it is determined
FIXME: What if device name and MAC don't specify the same NIC ? --> by using the device name.
<optional> FIXME: What if device name and MAC don't specify the same NIC ? -->
<element name="mac"> <optional>
<attribute name="address"><ref name="macAddr"/></attribute> <element name="mac">
</element> <attribute name="address"><ref name="macAddr"/></attribute>
</optional> </element>
<ref name="link-speed-state"/> </optional>
<!-- FIXME: Allow (some) ethtool options --> <ref name="link-speed-state"/>
<!-- FIXME: Allow (some) ethtool options -->
</interleave>
</define> </define>
<!-- Ethernet adapter without IP addressing, e.g. for a bridge --> <!-- Ethernet adapter without IP addressing, e.g. for a bridge -->
<define name="bare-ethernet-interface"> <define name="bare-ethernet-interface">
<element name="interface"> <element name="interface">
<ref name="basic-ethernet-content"/> <interleave>
<ref name="basic-ethernet-content"/>
</interleave>
</element> </element>
</define> </define>
<define name="ethernet-interface"> <define name="ethernet-interface">
<element name="interface"> <element name="interface">
<ref name="startmode"/> <interleave>
<ref name="basic-ethernet-content"/> <ref name="startmode"/>
<ref name="mtu"/> <ref name="basic-ethernet-content"/>
<ref name="interface-addressing"/> <ref name="mtu"/>
<ref name="interface-addressing"/>
</interleave>
</element> </element>
</define> </define>
...@@ -85,18 +91,22 @@ ...@@ -85,18 +91,22 @@
<define name="bare-vlan-interface"> <define name="bare-vlan-interface">
<element name="interface"> <element name="interface">
<ref name="vlan-interface-common"/> <interleave>
<ref name="vlan-device"/> <ref name="vlan-interface-common"/>
<ref name="vlan-device"/>
</interleave>
</element> </element>
</define> </define>
<define name="vlan-interface"> <define name="vlan-interface">
<element name="interface"> <element name="interface">
<ref name="vlan-interface-common"/> <interleave>
<ref name="startmode"/> <ref name="vlan-interface-common"/>
<ref name="mtu"/> <ref name="startmode"/>
<ref name="interface-addressing"/> <ref name="mtu"/>
<ref name="vlan-device"/> <ref name="interface-addressing"/>
<ref name="vlan-device"/>
</interleave>
</element> </element>
</define> </define>
...@@ -105,31 +115,33 @@ ...@@ -105,31 +115,33 @@
--> -->
<define name="bridge-interface"> <define name="bridge-interface">
<element name="interface"> <element name="interface">
<attribute name="type"> <interleave>
<value>bridge</value> <attribute name="type">
</attribute> <value>bridge</value>
<ref name="name-attr"/> </attribute>
<ref name="startmode"/> <ref name="name-attr"/>
<ref name="mtu"/> <ref name="startmode"/>
<ref name="interface-addressing"/> <ref name="mtu"/>
<element name="bridge"> <ref name="interface-addressing"/>
<optional> <element name="bridge">
<attribute name="stp"> <optional>
<ref name="on-or-off"/> <attribute name="stp">
</attribute> <ref name="on-or-off"/>
</optional> </attribute>
<!-- Bridge forward delay (see 'brctl setfd') --> </optional>
<optional v:since="2"> <!-- Bridge forward delay (see 'brctl setfd') -->
<attribute name="delay"><ref name="timeval"/></attribute> <optional v:since="2">
</optional> <attribute name="delay"><ref name="timeval"/></attribute>
<zeroOrMore> </optional>
<choice> <zeroOrMore>
<ref name="bare-ethernet-interface"/> <choice>
<ref name="bare-vlan-interface"/> <ref name="bare-ethernet-interface"/>
<ref v:since="2" name="bare-bond-interface"/> <ref name="bare-vlan-interface"/>
</choice> <ref v:since="2" name="bare-bond-interface"/>
</zeroOrMore> </choice>
</element> </zeroOrMore>
</element>
</interleave>
</element> </element>
</define> </define>
<!-- Jim Fehlig would like support for other bridge attributes, in <!-- Jim Fehlig would like support for other bridge attributes, in
...@@ -180,67 +192,73 @@ ...@@ -180,67 +192,73 @@
xmit_hash_policy (since 2.6.3/3.2.2) xmit_hash_policy (since 2.6.3/3.2.2)
--> -->
<optional> <interleave>
<choice> <optional>
<element name="miimon"> <choice>
<!-- miimon frequency in ms --> <element name="miimon">
<attribute name="freq"><ref name="unsignedInt"/></attribute> <!-- miimon frequency in ms -->
<optional> <attribute name="freq"><ref name="unsignedInt"/></attribute>
<attribute name="downdelay"><ref name="unsignedInt"/></attribute> <optional>
</optional> <attribute name="downdelay"><ref name="unsignedInt"/></attribute>
<optional> </optional>
<attribute name="updelay"><ref name="unsignedInt"/></attribute> <optional>
</optional> <attribute name="updelay"><ref name="unsignedInt"/></attribute>
<optional> </optional>
<!-- use_carrier --> <optional>
<attribute name="carrier"> <!-- use_carrier -->
<choice> <attribute name="carrier">
<!-- use MII/ETHTOOL ioctl --> <choice>
<value>ioctl</value> <!-- use MII/ETHTOOL ioctl -->
<!-- use netif_carrier_ok() --> <value>ioctl</value>
<value>netif</value> <!-- use netif_carrier_ok() -->
</choice> <value>netif</value>
</attribute> </choice>
</optional> </attribute>
</element> </optional>
<element name="arpmon"> </element>
<attribute name="interval"><ref name="unsignedInt"/></attribute> <element name="arpmon">
<attribute name="target"><ref name="ipv4Addr"/></attribute> <attribute name="interval"><ref name="unsignedInt"/></attribute>
<optional> <attribute name="target"><ref name="ipv4Addr"/></attribute>
<attribute name="validate"> <optional>
<choice> <attribute name="validate">
<value>none</value> <choice>
<value>active</value> <value>none</value>
<value>backup</value> <value>active</value>
<value>all</value> <value>backup</value>
</choice> <value>all</value>
</attribute> </choice>
</optional> </attribute>
</element> </optional>
</choice> </element>
</optional> </choice>
</optional>
<oneOrMore> <oneOrMore>
<!-- The slave interfaces --> <!-- The slave interfaces -->
<ref name="bare-ethernet-interface"/> <ref name="bare-ethernet-interface"/>
</oneOrMore> </oneOrMore>
</interleave>
</element> </element>
</define> </define>
<define name="bare-bond-interface"> <define name="bare-bond-interface">
<element name="interface"> <element name="interface">
<ref name="bond-interface-common"/> <interleave>
<ref name="bond-element"/> <ref name="bond-interface-common"/>
<ref name="bond-element"/>
</interleave>
</element> </element>
</define> </define>
<define name="bond-interface"> <define name="bond-interface">
<element name="interface"> <element name="interface">
<ref name="bond-interface-common"/> <interleave>
<ref name="startmode"/> <ref name="bond-interface-common"/>
<ref name="mtu"/> <ref name="startmode"/>
<ref name="interface-addressing"/> <ref name="mtu"/>
<ref name="bond-element"/> <ref name="interface-addressing"/>
<ref name="bond-element"/>
</interleave>
</element> </element>
</define> </define>
...@@ -302,22 +320,24 @@ ...@@ -302,22 +320,24 @@
<attribute name="family"> <attribute name="family">
<value>ipv4</value> <value>ipv4</value>
</attribute> </attribute>
<choice> <interleave>
<ref name="dhcp-element"/> <choice>
<group> <ref name="dhcp-element"/>
<element name="ip"> <group>
<attribute name="address"><ref name="ipv4Addr"/></attribute> <element name="ip">
<attribute name="address"><ref name="ipv4Addr"/></attribute>
<optional>
<attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
</optional>
</element>
<optional> <optional>
<attribute name="prefix"><ref name="ipv4Prefix"/></attribute> <element name="route">
<attribute name="gateway"><ref name="ipv4Addr"/></attribute>
</element>
</optional> </optional>
</element> </group>
<optional> </choice>
<element name="route"> </interleave>
<attribute name="gateway"><ref name="ipv4Addr"/></attribute>
</element>
</optional>
</group>
</choice>
</element> </element>
</define> </define>
...@@ -326,25 +346,27 @@ ...@@ -326,25 +346,27 @@
<attribute name="family"> <attribute name="family">
<value>ipv6</value> <value>ipv6</value>
</attribute> </attribute>
<optional> <interleave>
<element name="autoconf"><empty/></element> <optional>
</optional> <element name="autoconf"><empty/></element>
<optional> </optional>
<ref name="dhcp-element"/> <optional>
</optional> <ref name="dhcp-element"/>
<zeroOrMore> </optional>
<element name="ip"> <zeroOrMore>
<attribute name="address"><ref name="ipv6Addr"/></attribute> <element name="ip">
<optional> <attribute name="address"><ref name="ipv6Addr"/></attribute>
<attribute name="prefix"><ref name="ipv6Prefix"/></attribute> <optional>
</optional> <attribute name="prefix"><ref name="ipv6Prefix"/></attribute>
</element> </optional>
</zeroOrMore> </element>
<optional> </zeroOrMore>
<element name="route"> <optional>
<attribute name="gateway"><ref name="ipv6Addr"/></attribute> <element name="route">
</element> <attribute name="gateway"><ref name="ipv6Addr"/></attribute>
</optional> </element>
</optional>
</interleave>
</element> </element>
</define> </define>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册