Browse Source

Stop using set_protocols() method from Neutron's ovs_lib

This method was deprecated in Ocata and will be removed in Queens
release from Neutron.
This patch switches to use add_protocols() method instead of this
deprecated one.

Change-Id: If9eb17e6e1b558b9f41acb8f696669b1f682dafb
Sławek Kapłoński 1 year ago
parent
commit
54ad53e5e9

+ 1
- 1
networking_vsphere/agent/ovsvapp_agent.py View File

@@ -403,7 +403,7 @@ class OVSvAppAgent(agent.Agent, ovs_agent.OVSNeutronAgent):
403 403
     def set_openflow_version(self, bridge):
404 404
         try:
405 405
             if bridge is not None:
406
-                bridge.set_protocols(
406
+                bridge.add_protocols(
407 407
                     ["OpenFlow%d" % i for i in range(10, 15)])
408 408
         except RuntimeError as e:
409 409
             LOG.error(_LE("Unable to set openflow version: %s"), e)

+ 13
- 13
networking_vsphere/tests/unit/agent/test_ovsvapp_agent.py View File

@@ -249,16 +249,16 @@ class TestOVSvAppAgentRestart(base.TestCase):
249 249
                 mock.patch.object(self.agent.int_br, 'get_port_name_list',
250 250
                                   return_value=int_br_ports
251 251
                                   ) as mock_br_get_ports, \
252
-                mock.patch.object(self.agent.int_br, "set_protocols"
253
-                                  ) as mock_set_protocols:
252
+                mock.patch.object(self.agent.int_br, "add_protocols"
253
+                                  ) as mock_add_protocols:
254 254
             self.assertFalse(self.agent.check_ovsvapp_agent_restart())
255 255
             self.assertTrue(mock_br_exists.called)
256 256
             self.assertTrue(mock_dump_flows.called)
257 257
             self.assertFalse(mock_br_get_ports.called)
258
-            self.assertTrue(mock_set_protocols.called)
258
+            self.assertTrue(mock_add_protocols.called)
259 259
             mock_dump_flows.return_value = 'cookie = 0x0'
260 260
             self.assertTrue(self.agent.check_ovsvapp_agent_restart())
261
-            self.assertTrue(mock_set_protocols.called)
261
+            self.assertTrue(mock_add_protocols.called)
262 262
             self.assertTrue(mock_br_exists.called)
263 263
             self.assertTrue(mock_dump_flows.called)
264 264
             self.assertTrue(mock_br_get_ports.called)
@@ -409,11 +409,11 @@ class TestOVSvAppAgent(base.TestCase):
409 409
                                   "add_patch_port",
410 410
                                   return_value=6), \
411 411
                 mock.patch.object(mock_ovs_br.return_value,
412
-                                  "set_protocols"
413
-                                  ) as mock_set_protocols:
412
+                                  "add_protocols"
413
+                                  ) as mock_add_protocols:
414 414
             self.agent.setup_security_br()
415 415
             self.assertTrue(mock_ovs_br.called)
416
-            self.assertTrue(mock_set_protocols.called)
416
+            self.assertTrue(mock_add_protocols.called)
417 417
             self.assertTrue(self.agent.sec_br.add_patch_port.called)
418 418
             self.assertTrue(mock_logger_info.called)
419 419
 
@@ -474,8 +474,8 @@ class TestOVSvAppAgent(base.TestCase):
474 474
                 mock.patch.object(p_utils, 'get_interface_name'
475 475
                                   ) as mock_int_name, \
476 476
                 mock.patch.object(mock_ovs_br.return_value,
477
-                                  "set_protocols"
478
-                                  ) as mock_set_protocol, \
477
+                                  "add_protocols"
478
+                                  ) as mock_add_protocol, \
479 479
                 mock.patch.object(self.agent.int_br,
480 480
                                   "get_port_ofport",
481 481
                                   return_value=6) as mock_get_ofport:
@@ -483,7 +483,7 @@ class TestOVSvAppAgent(base.TestCase):
483 483
             self.assertTrue(mock_logger_info.called)
484 484
             self.assertFalse(mock_logger_error.called)
485 485
             self.assertTrue(mock_ovs_br.called)
486
-            self.assertTrue(mock_set_protocol.called)
486
+            self.assertTrue(mock_add_protocol.called)
487 487
             self.assertTrue(mock_get_ofport.called)
488 488
             self.assertTrue(mock_int_name.called)
489 489
             self.assertEqual(self.agent.int_ofports['physnet1'], 6)
@@ -491,10 +491,10 @@ class TestOVSvAppAgent(base.TestCase):
491 491
     def test_set_openflow_versions(self):
492 492
         bridge = mock.Mock()
493 493
         with mock.patch.object(bridge,
494
-                               "set_protocols"
495
-                               ) as mock_set_protocol:
494
+                               "add_protocols"
495
+                               ) as mock_add_protocol:
496 496
             self.agent.set_openflow_version(bridge)
497
-            self.assertTrue(mock_set_protocol.called)
497
+            self.assertTrue(mock_add_protocol.called)
498 498
 
499 499
     def test_init_ovs_flows(self):
500 500
         cfg.CONF.set_override('bridge_mappings',

Loading…
Cancel
Save