Beispiel #1
0
    def test_ovs_virtualport_driver(self):
        d = vif.LibvirtOpenVswitchVirtualPortDriver()
        xml = self._get_instance_xml(d)

        doc = etree.fromstring(xml)
        ret = doc.findall('./devices/interface')
        self.assertEqual(len(ret), 1)
        node = ret[0]
        self.assertEqual(node.get("type"), "bridge")

        br_name = node.find("source").get("bridge")
        self.assertEqual(br_name, CONF.libvirt_ovs_bridge)
        mac = node.find("mac").get("address")
        self.assertEqual(mac, self.mapping['mac'])
        vp = node.find("virtualport")
        self.assertEqual(vp.get("type"), "openvswitch")
        iface_id_found = False
        for p_elem in vp.findall("parameters"):
            iface_id = p_elem.get("interfaceid", None)
            if iface_id:
                self.assertEqual(iface_id, self.mapping['vif_uuid'])
                iface_id_found = True

        self.assertTrue(iface_id_found)
        d.unplug(None, (self.net, self.mapping))
Beispiel #2
0
    def test_ovs_virtualport_driver(self):
        def get_connection():
            return fakelibvirt.Connection("qemu:///session", False, 9011)

        d = vif.LibvirtOpenVswitchVirtualPortDriver(get_connection)
        want_iface_id = 'vif-xxx-yyy-zzz'
        self._check_ovs_virtualport_driver(d, self.net_ovs,
                                           self.mapping_ovs_legacy,
                                           want_iface_id)
Beispiel #3
0
 def test_ovs_virtualport_driver(self):
     d = vif.LibvirtOpenVswitchVirtualPortDriver(self._get_conn(ver=9011))
     want_iface_id = 'vif-xxx-yyy-zzz'
     self._check_ovs_virtualport_driver(d, self.net_ovs,
                                        self.mapping_ovs_legacy,
                                        want_iface_id)