Example #1
0
 def PortContext(plugin, plugin_context, port, network, binding,
                 binding_levels, original_port=None):
     expected = Context.from_dict(fake_endpoint_context)
     self.assertEqual(Context.to_dict(expected),
                      Context.to_dict(plugin_context))
     self.assertIs(self.plugin.return_value, plugin)
     self.assertDictEqual(network, {'id': 'fake'})
     self.assertDictEqual(
         port, {'id': endpoints.FAKE_PORT_ID,
                'security_groups': ['_dummy_security_group_id_']})
     self.assertIsNone(binding)
     self.assertIsNone(binding_levels)
     self.assertIsNone(original_port)
     return '_port_context_'
Example #2
0
 def update_security_group(self, ctxt, security_group_id):
     plugin_context = Context.from_dict(ctxt)
     plugin = manager.NeutronManager.get_plugin()
     fake_network = {"id": "fake"}
     fake_port = {"id": FAKE_PORT_ID, "security_groups": [security_group_id]}
     context = driver_context.PortContext(plugin, plugin_context, fake_port, fake_network, None, None)
     for dvs in self.driver.network_map.values():
         self.driver._update_security_groups(dvs, context, force=True)
Example #3
0
 def update_security_group(self, ctxt, *security_group_ids):
     plugin_context = Context.from_dict(ctxt)
     plugin = manager.NeutronManager.get_plugin()
     fake_network = {
         'id': 'fake'
     }
     fake_port = {
         'id': FAKE_PORT_ID,
         'security_groups': security_group_ids
     }
     context = driver_context.PortContext(
         plugin, plugin_context, fake_port, fake_network, None, None
     )
     for dvs in self.driver.network_map.values():
         self.driver._update_security_groups(dvs, context, force=True)