From 12bb903815e11d23562cac925ce95f18230e9053 Mon Sep 17 00:00:00 2001 From: Dan Wendlandt Date: Fri, 26 Aug 2011 01:02:41 -0700 Subject: [PATCH] lp834491: change plugin to work with API code after the API alignment merge --- .../plugins/openvswitch/ovs_quantum_plugin.py | 25 ++++++++++--------- quantum/plugins/openvswitch/run_tests.py | 3 +++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/quantum/plugins/openvswitch/ovs_quantum_plugin.py b/quantum/plugins/openvswitch/ovs_quantum_plugin.py index d58b39de8..928e16464 100644 --- a/quantum/plugins/openvswitch/ovs_quantum_plugin.py +++ b/quantum/plugins/openvswitch/ovs_quantum_plugin.py @@ -133,7 +133,7 @@ class OVSQuantumPlugin(QuantumPluginBase): # Verify that no attachments are plugged into the network for port in db.port_list(net_id): - if port['interface_id']: + if port.interface_id: raise q_exc.NetworkInUse(net_id=net_id) net = db.network_destroy(net_id) ovs_db.remove_vlan_binding(net_id) @@ -150,31 +150,31 @@ class OVSQuantumPlugin(QuantumPluginBase): return self._make_net_dict(str(net.uuid), net.name, None) def _make_port_dict(self, port_id, port_state, net_id, attachment): - res = {'port-id': port_id, - 'port-state': port_state} - if net_id: - res['net-id'] = net_id - if attachment: - res['attachment-id'] = attachment - return res + return {'port-id': port_id, + 'port-state': port_state, + 'net-id': net_id, + 'attachment': attachment} def get_all_ports(self, tenant_id, net_id): ids = [] ports = db.port_list(net_id) for p in ports: LOG.debug("Appending port: %s" % p.uuid) - d = self._make_port_dict(str(p.uuid), p.state, None, None) + d = self._make_port_dict(str(p.uuid), p.state, p.network_id, + p.interface_id) ids.append(d) return ids def create_port(self, tenant_id, net_id, port_state=None): LOG.debug("Creating port with network_id: %s" % net_id) port = db.port_create(net_id, port_state) - return self._make_port_dict(str(port.uuid), port.state, None, None) + return self._make_port_dict(str(port.uuid), port.state, + port.network_id, port.interface_id) def delete_port(self, tenant_id, net_id, port_id): port = db.port_destroy(port_id, net_id) - return self._make_port_dict(str(port.uuid), port.state, None, None) + return self._make_port_dict(str(port.uuid), port.state, + port.network_id, port.interface_id) def update_port(self, tenant_id, net_id, port_id, port_state): """ @@ -183,7 +183,8 @@ class OVSQuantumPlugin(QuantumPluginBase): LOG.debug("update_port() called\n") port = db.port_get(port_id, net_id) db.port_set_state(port_id, net_id, port_state) - return self._make_port_dict(str(port.uuid), port.state, None, None) + return self._make_port_dict(str(port.uuid), port.state, + port.network_id, port.interface_id) def get_port_details(self, tenant_id, net_id, port_id): port = db.port_get(port_id, net_id) diff --git a/quantum/plugins/openvswitch/run_tests.py b/quantum/plugins/openvswitch/run_tests.py index 15a7583b4..38e361392 100644 --- a/quantum/plugins/openvswitch/run_tests.py +++ b/quantum/plugins/openvswitch/run_tests.py @@ -65,6 +65,9 @@ if __name__ == '__main__': # we should only invoked the tests once invoke_once = len(sys.argv) > 1 + test_config['plugin_name'] = "quantum.plugins.openvswitch." + \ + "ovs_quantum_plugin.OVSQuantumPlugin" + cwd = os.getcwd() working_dir = os.path.abspath("tests") -- 2.45.2