diff --git a/dragonflow/common/constants.py b/dragonflow/common/constants.py index 70bb08d8b..99cc1dca1 100644 --- a/dragonflow/common/constants.py +++ b/dragonflow/common/constants.py @@ -12,7 +12,7 @@ # limitations under the License. from neutron_lib import constants as n_const -OVS_VM_INTERFACE = "vm" +OVS_COMPUTE_INTERFACE = "compute" OVS_BRIDGE_INTERFACE = "bridge" OVS_PATCH_INTERFACE = "patch" OVS_TUNNEL_INTERFACE = "tunnel" diff --git a/dragonflow/controller/topology.py b/dragonflow/controller/topology.py index 91fccb30e..b2d5a799b 100644 --- a/dragonflow/controller/topology.py +++ b/dragonflow/controller/topology.py @@ -30,7 +30,7 @@ LOG = log.getLogger(__name__) OvsLportMapping = collections.namedtuple('OvsLportMapping', ('lport_id', 'topic')) -_OVS_PORT_TYPES = (constants.OVS_VM_INTERFACE, +_OVS_PORT_TYPES = (constants.OVS_COMPUTE_INTERFACE, constants.OVS_TUNNEL_INTERFACE) @@ -79,8 +79,8 @@ class Topology(object): def _handle_ovs_port_added(self, ovs_port): port_type = ovs_port.type - if port_type == constants.OVS_VM_INTERFACE: - self._vm_port_added(ovs_port) + if port_type == constants.OVS_COMPUTE_INTERFACE: + self._compute_port_added(ovs_port) elif port_type == constants.OVS_TUNNEL_INTERFACE: self._tunnel_port_added(ovs_port) else: @@ -88,8 +88,8 @@ class Topology(object): def _handle_ovs_port_updated(self, ovs_port): port_type = ovs_port.type - if port_type == constants.OVS_VM_INTERFACE: - self._vm_port_updated(ovs_port) + if port_type == constants.OVS_COMPUTE_INTERFACE: + self._compute_port_updated(ovs_port) elif port_type == constants.OVS_TUNNEL_INTERFACE: self._tunnel_port_updated(ovs_port) else: @@ -116,8 +116,8 @@ class Topology(object): def _handle_ovs_port_deleted(self, ovs_port): port_type = ovs_port.type - if port_type == constants.OVS_VM_INTERFACE: - self._vm_port_deleted(ovs_port) + if port_type == constants.OVS_COMPUTE_INTERFACE: + self._compute_port_deleted(ovs_port) elif port_type == constants.OVS_TUNNEL_INTERFACE: self._tunnel_port_deleted(ovs_port) else: @@ -160,12 +160,12 @@ class Topology(object): def _tunnel_port_deleted(self, ovs_port): self._process_ovs_tunnel_port(ovs_port, "delete") - def _vm_port_added(self, ovs_port): - self._vm_port_updated(ovs_port) + def _compute_port_added(self, ovs_port): + self._compute_port_updated(ovs_port) self.controller.notify_port_status( ovs_port, n_const.PORT_STATUS_ACTIVE) - def _vm_port_updated(self, ovs_port): + def _compute_port_updated(self, ovs_port): lport = self._get_lport(ovs_port) if lport is None: LOG.warning("No logical port found for ovs port: %s", @@ -202,7 +202,7 @@ class Topology(object): LOG.exception('Failed to process logical port online ' 'event: %s', lport) - def _vm_port_deleted(self, ovs_port): + def _compute_port_deleted(self, ovs_port): ovs_port_id = ovs_port.id lport_ref = ovs_port.lport lport = lport_ref.get_object() @@ -290,7 +290,7 @@ class Topology(object): delete_ovs_to_lport_mapping = self.ovs_to_lport_mapping for ovs_port in self.db_store.get_all(ovs.OvsPort): key = ovs_port.id - if ovs_port.type == constants.OVS_VM_INTERFACE: + if ovs_port.type == constants.OVS_COMPUTE_INTERFACE: lport = self._get_lport(ovs_port) if lport is None: LOG.warning("No logical port found for ovs port: %s", diff --git a/dragonflow/db/models/ovs.py b/dragonflow/db/models/ovs.py index a73701672..99594d927 100644 --- a/dragonflow/db/models/ovs.py +++ b/dragonflow/db/models/ovs.py @@ -29,7 +29,7 @@ def _get_interface_type(row): return constants.OVS_PATCH_INTERFACE if 'iface-id' in row.external_ids: - return constants.OVS_VM_INTERFACE + return constants.OVS_COMPUTE_INTERFACE options = row.options if 'remote_ip' in options: @@ -50,7 +50,7 @@ class OvsPort(mf.ModelBase, mixins.BasicEvents, mixins.Name): ( constants.OVS_BRIDGE_INTERFACE, constants.OVS_PATCH_INTERFACE, - constants.OVS_VM_INTERFACE, + constants.OVS_COMPUTE_INTERFACE, constants.OVS_TUNNEL_INTERFACE, constants.OVS_UNKNOWN_INTERFACE, ), diff --git a/dragonflow/ovsdb/impl_idl.py b/dragonflow/ovsdb/impl_idl.py index 3bd2555d9..02ac56cc2 100644 --- a/dragonflow/ovsdb/impl_idl.py +++ b/dragonflow/ovsdb/impl_idl.py @@ -66,7 +66,7 @@ ovsdb_monitor_table_filter_default = { } _HANDLED_INTERFACE_TYPES = ( - constants.OVS_VM_INTERFACE, + constants.OVS_COMPUTE_INTERFACE, constants.OVS_TUNNEL_INTERFACE, constants.OVS_BRIDGE_INTERFACE, ) @@ -82,7 +82,7 @@ def _is_ovsport_update_valid(action, ovsport): if ovsport.name.startswith('qg'): return False - if (ovsport.type == constants.OVS_VM_INTERFACE and + if (ovsport.type == constants.OVS_COMPUTE_INTERFACE and ovsport.lport is None): return False diff --git a/dragonflow/tests/fullstack/test_ovsdb_monitor.py b/dragonflow/tests/fullstack/test_ovsdb_monitor.py index e953c0b21..41b34b78b 100644 --- a/dragonflow/tests/fullstack/test_ovsdb_monitor.py +++ b/dragonflow/tests/fullstack/test_ovsdb_monitor.py @@ -35,7 +35,7 @@ class TestOvsdbMonitor(test_base.DFTestBase): _interface = ovs.OvsPort.from_json(update.value) if str(_interface.attached_mac) != mac: return False - elif _interface.type != constants.OVS_VM_INTERFACE: + elif _interface.type != constants.OVS_COMPUTE_INTERFACE: return False elif _interface.lport is None: return False @@ -56,7 +56,7 @@ class TestOvsdbMonitor(test_base.DFTestBase): return False elif str(_interface.attached_mac) != mac: return False - elif _interface.type != constants.OVS_VM_INTERFACE: + elif _interface.type != constants.OVS_COMPUTE_INTERFACE: return False elif _interface.lport is None: return False diff --git a/dragonflow/tests/unit/test_app_base.py b/dragonflow/tests/unit/test_app_base.py index aac56dd51..db53db585 100644 --- a/dragonflow/tests/unit/test_app_base.py +++ b/dragonflow/tests/unit/test_app_base.py @@ -253,7 +253,7 @@ fake_ovs_port1 = ovs.OvsPort( ofport=2, name='tap-fake_port1', admin_state='up', - type=constants.OVS_VM_INTERFACE, + type=constants.OVS_COMPUTE_INTERFACE, lport='fake_port1', attached_mac='fa:16:3e:8c:2e:b3', ) @@ -271,7 +271,7 @@ fake_ovs_port2 = ovs.OvsPort( ofport=3, name='tap-fake_port2', admin_state='up', - type=constants.OVS_VM_INTERFACE, + type=constants.OVS_COMPUTE_INTERFACE, lport='fake_port2', attached_mac='fa:16:3e:8c:2e:b4', ) diff --git a/dragonflow/tests/unit/test_classifier_app.py b/dragonflow/tests/unit/test_classifier_app.py index 975af2412..c56426206 100644 --- a/dragonflow/tests/unit/test_classifier_app.py +++ b/dragonflow/tests/unit/test_classifier_app.py @@ -57,7 +57,7 @@ class TestClassifierAppForVlan(testscenarios.WithScenarios, ovs_port = ovs.OvsPort(id='fake_ovs_port', lport=fake_local_vlan_port.id, ofport=1, admin_state='up', - type=constants.OVS_VM_INTERFACE) + type=constants.OVS_COMPUTE_INTERFACE) self.controller.update(ovs_port) port_key = fake_local_vlan_port.unique_key match = self.app.parser.OFPMatch(reg7=port_key) diff --git a/dragonflow/tests/unit/test_ovsdb_monitor.py b/dragonflow/tests/unit/test_ovsdb_monitor.py index 5f6985bfe..2a6095982 100644 --- a/dragonflow/tests/unit/test_ovsdb_monitor.py +++ b/dragonflow/tests/unit/test_ovsdb_monitor.py @@ -69,7 +69,7 @@ class TestDFIdl(tests_base.BaseTestCase): 'set', ovs.OvsPort( ofport=1, - type=constants.OVS_VM_INTERFACE, + type=constants.OVS_COMPUTE_INTERFACE, name='tap-uuid', ), ),