[libvirt] [PATCH go-xml] Add qemu udp unicast tunneling support

Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl> --- domain.go | 22 ++++++++++++++-------- domain_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/domain.go b/domain.go index 3ab54a1..805909f 100644 --- a/domain.go +++ b/domain.go @@ -178,16 +178,22 @@ type DomainInterfaceModel struct { } type DomainInterfaceSource struct { - Bridge string `xml:"bridge,attr,omitempty"` - Dev string `xml:"dev,attr,omitempty"` - Network string `xml:"network,attr,omitempty"` + Bridge string `xml:"bridge,attr,omitempty"` + Dev string `xml:"dev,attr,omitempty"` + Network string `xml:"network,attr,omitempty"` + Address string `xml:"address,attr,omitempty"` + Type string `xml:"type,attr,omitempty"` + Path string `xml:"path,attr,omitempty"` + Mode string `xml:"mode,attr,omitempty"` + Port uint `xml:"port,attr,omitempty"` + Service string `xml:"service,attr,omitempty"` + Host string `xml:"host,attr,omitempty"` + Local *DomainInterfaceSourceLocal `xml:"local"` +} + +type DomainInterfaceSourceLocal struct { Address string `xml:"address,attr,omitempty"` - Type string `xml:"type,attr,omitempty"` - Path string `xml:"path,attr,omitempty"` - Mode string `xml:"mode,attr,omitempty"` Port uint `xml:"port,attr,omitempty"` - Service string `xml:"service,attr,omitempty"` - Host string `xml:"host,attr,omitempty"` } type DomainInterfaceTarget struct { diff --git a/domain_test.go b/domain_test.go index 0ae9594..163661f 100644 --- a/domain_test.go +++ b/domain_test.go @@ -867,6 +867,47 @@ var domainTestData = []struct { `</domain>`, }, }, + { + Object: &Domain{ + Type: "kvm", + Name: "test", + Devices: &DomainDeviceList{ + Interfaces: []DomainInterface{ + DomainInterface{ + Type: "udp", + MAC: &DomainInterfaceMAC{ + Address: "52:54:00:39:97:ac", + }, + Model: &DomainInterfaceModel{ + Type: "virtio", + }, + Source: &DomainInterfaceSource{ + Address: "127.0.0.1", + Port: 1234, + Local: &DomainInterfaceSourceLocal{ + Address: "127.0.0.1", + Port: 1235, + }, + }, + }, + }, + }, + }, + Expected: []string{ + `<domain type="kvm">`, + ` <name>test</name>`, + ` <devices>`, + ` <interface type="udp">`, + ` <mac address="52:54:00:39:97:ac"></mac>`, + ` <model type="virtio"></model>`, + ` <source address="127.0.0.1" port="1234">`, + ` <local address="127.0.0.1" port="1235"></local>`, + ` </source>`, + ` </interface>`, + ` </devices>`, + `</domain>`, + }, + }, { Object: &Domain{ Type: "kvm", -- 2.14.1

On Tue, Sep 26, 2017 at 09:30:17PM +0200, Jeroen Simonetti wrote:
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl> --- domain.go | 22 ++++++++++++++-------- domain_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 8 deletions(-)
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Will push to git - thanks for your contribution. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrange
-
Jeroen Simonetti