Browse Source

Merge "Remove LLI check if not needed"

Zuul 3 months ago
parent
commit
091af28905

+ 0
- 4
networking_ansible/ml2/mech_driver.py View File

@@ -146,10 +146,6 @@ class AnsibleMechanismDriver(ml2api.MechanismDriver):
146 146
         state. It is up to the mechanism driver to ignore state or
147 147
         state changes that it does not know or care about.
148 148
         """
149
-        # Validate current locallink info
150
-        # Raises a LocalLink error if invalid
151
-        self._link_info_from_port(context.current)
152
-
153 149
         if self._is_port_bound(context.current):
154 150
             port = context.current
155 151
             provisioning_blocks.provisioning_complete(

+ 22
- 0
networking_ansible/tests/unit/ml2/test_mech_driver.py View File

@@ -228,6 +228,14 @@ class TestUpdatePortPostCommit(base.NetworkingAnsibleTestCase):
228 228
         self.mech.update_port_postcommit(self.mock_port_context)
229 229
         mock_prov_blks.provisioning_complete.assert_called_once()
230 230
 
231
+    def test_update_port_postcommit_current_no_lli(self,
232
+                                                   mock_prov_blks,
233
+                                                   mock_delete_port,
234
+                                                   mock_port_bound):
235
+        self.mock_port_context.current[portbindings.PROFILE] = self.lli_no_info
236
+        self.mech.update_port_postcommit(self.mock_port_context)
237
+        mock_prov_blks.provisioning_complete.assert_called_once()
238
+
231 239
     def test_update_port_postcommit_original(self,
232 240
                                              mock_prov_blks,
233 241
                                              mock_delete_port,
@@ -247,6 +255,20 @@ class TestUpdatePortPostCommit(base.NetworkingAnsibleTestCase):
247 255
                           self.mock_port_context)
248 256
         mock_delete_port.assert_called_once()
249 257
 
258
+    def test_update_port_postcommit_original_no_lli(self,
259
+                                                    mock_prov_blks,
260
+                                                    mock_delete_port,
261
+                                                    mock_port_bound):
262
+        self.mock_port_context.original = {
263
+            portbindings.PROFILE: {},
264
+            'id': 'foo',
265
+        }
266
+        mock_port_bound.side_effect = [False, True]
267
+        self.assertRaises(
268
+            netans_ml2exc.LocalLinkInfoMissingException,
269
+            self.mech.update_port_postcommit,
270
+            self.mock_port_context)
271
+
250 272
     def test_update_port_postcommit_not_bound(self,
251 273
                                               mock_prov_blks,
252 274
                                               mock_delete_port,

Loading…
Cancel
Save