Merge "OvsPorts: Rename vm type ports to compute"

This commit is contained in:
Zuul 2017-12-11 22:16:52 +00:00 committed by Gerrit Code Review
commit 267d862477
8 changed files with 23 additions and 23 deletions

View File

@ -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"

View File

@ -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",

View File

@ -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,
),

View File

@ -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

View File

@ -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

View File

@ -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',
)

View File

@ -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)

View File

@ -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',
),
),