
On 08/10/2012 03:59 PM, Dennis Jenkins wrote:
On Fri, Aug 10, 2012 at 10:21 AM, Kyle Mestery (kmestery) <kmestery@cisco.com> wrote:
Those cases both look good. I think the formatting works just fine for virtualport type=openvswitch as well, something like this:
Single VLAN (no trunk): <interface type='bridge'> <mac address='52:54:00:30:23:a6'/> <source bridge='data-br'/> <vlan tag='70'/> <virtualport type='openvswitch'> <parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2'> </virtualport> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
Single VLAN (trunk): <interface type='bridge'> <mac address='52:54:00:30:23:a6'/> <source bridge='data-br'/> <vlan tag='70'/ trunk=yes> <virtualport type='openvswitch'> <parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2'> </virtualport> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
Multiple VLANs (trunk): <interface type='bridge'> <mac address='52:54:00:30:23:a6'/> <source bridge='data-br'/> <vlan trunk='yes'> <tag id='70'> <tag id='71'> </vlan> <virtualport type='openvswitch'> <parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2'> </virtualport> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
I think that making "tag id=" an XML attribute in one case and an element in another is problematic. May I suggest just using:
<vlan [trunk='yes|no']> <!-- if unspecified, trunk defaults to 'no' --> <tag id='nn'/> [<tag id='nn'/> ...] </vlan>
Yeah, I think you're right. It's sad though that it makes the config longer even for the 99% of uses where people just want a single vlan tag (that's what blinded me). One last try before I give up: How about allowing multiple <vlan tag='n' [trunk='yes|no']/> at the toplevel? Then you could have: <vlan tag='42'/> in the simplest case, or: <vlan tag='42' trunk='yes'/> if you wanted a trunk with a single tag, or: <vlan tag='42'/> <vlan tag='43'/> <vlan tag='44'/> if you want a trunk with multiple tags (trunk='yes' would be implicit). For either of these cases, the data definition can remain the same (as long as we don't require that superfluous "trunk='yes|no'" attributes be preserved across an iteration of parse/format.) I got stuck with other stuff during the day, so I'll get back to this later tonight.