summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-11 01:42:04 +0000
committerGerrit Code Review <review@openstack.org>2018-08-11 01:42:04 +0000
commit343470c0cf9d3abc306aaacbf35c1635748f3d9f (patch)
treea8bc248524ec60861162284423ca1d09b4c8b6c2
parentb6f8fcafacc4d6eae03f65e812e0d9ab9ac06d17 (diff)
parentda5b13df2b2a8171f60311414250671820390738 (diff)
Merge "Trivial: avoid KeyError while processing ports"
-rw-r--r--neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py4
-rw-r--r--neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py11
2 files changed, 11 insertions, 4 deletions
diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
index 560238d..69baa17 100644
--- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
+++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
@@ -1263,7 +1263,9 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
1263 1263
1264 def _get_port_info(self, registered_ports, cur_ports, 1264 def _get_port_info(self, registered_ports, cur_ports,
1265 readd_registered_ports): 1265 readd_registered_ports):
1266 port_info = {'current': cur_ports} 1266 port_info = {'current': cur_ports,
1267 'added': set(),
1268 'removed': set()}
1267 # FIXME(salv-orlando): It's not really necessary to return early 1269 # FIXME(salv-orlando): It's not really necessary to return early
1268 # if nothing has changed. 1270 # if nothing has changed.
1269 if not readd_registered_ports and cur_ports == registered_ports: 1271 if not readd_registered_ports and cur_ports == registered_ports:
diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py
index 1ed0083..48a5f02 100644
--- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py
+++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py
@@ -387,7 +387,9 @@ class TestOvsNeutronAgent(object):
387 def test_scan_ports_returns_current_only_for_unchanged_ports(self): 387 def test_scan_ports_returns_current_only_for_unchanged_ports(self):
388 vif_port_set = set([1, 3]) 388 vif_port_set = set([1, 3])
389 registered_ports = set([1, 3]) 389 registered_ports = set([1, 3])
390 expected = {'current': vif_port_set} 390 expected = {'current': vif_port_set,
391 'added': set(),
392 'removed': set()}
391 actual = self.mock_scan_ports(vif_port_set, registered_ports) 393 actual = self.mock_scan_ports(vif_port_set, registered_ports)
392 self.assertEqual(expected, actual) 394 self.assertEqual(expected, actual)
393 395
@@ -438,7 +440,8 @@ class TestOvsNeutronAgent(object):
438 vif_port_set = set([1, 2, 3]) 440 vif_port_set = set([1, 2, 3])
439 registered_ports = set([1, 2, 3]) 441 registered_ports = set([1, 2, 3])
440 updated_ports = set([2]) 442 updated_ports = set([2])
441 expected = dict(current=vif_port_set, updated=set([2])) 443 expected = dict(current=vif_port_set, updated=set([2]),
444 added=set(), removed=set())
442 actual = self.mock_scan_ports(vif_port_set, registered_ports, 445 actual = self.mock_scan_ports(vif_port_set, registered_ports,
443 updated_ports) 446 updated_ports)
444 self.assertEqual(expected, actual) 447 self.assertEqual(expected, actual)
@@ -2452,7 +2455,9 @@ class AncillaryBridgesTest(object):
2452 def test_scan_ancillary_ports_returns_cur_only_for_unchanged_ports(self): 2455 def test_scan_ancillary_ports_returns_cur_only_for_unchanged_ports(self):
2453 vif_port_set = set([1, 2]) 2456 vif_port_set = set([1, 2])
2454 registered_ports = set([1, 2]) 2457 registered_ports = set([1, 2])
2455 expected = dict(current=vif_port_set) 2458 expected = dict(current=vif_port_set,
2459 added=set(),
2460 removed=set())
2456 actual = self.mock_scan_ancillary_ports(vif_port_set, registered_ports) 2461 actual = self.mock_scan_ancillary_ports(vif_port_set, registered_ports)
2457 self.assertEqual(expected, actual) 2462 self.assertEqual(expected, actual)
2458 2463