supported_extension_aliases = []
_plugins = {}
_inventory = {}
- _methods_to_delegate = ['get_network', 'get_networks',
+ _methods_to_delegate = ['create_network_bulk',
+ 'get_network', 'get_networks',
'create_port_bulk',
'get_port', 'get_ports',
'create_subnet', 'create_subnet_bulk',
def __getattribute__(self, name):
"""
This delegates the calls to the methods implemented only by the OVS
- sub-plugin.
+ sub-plugin. Note: Currently, bulking is handled by the caller
+ (PluginV2), and this model class expects to receive only non-bulking
+ calls. If, however, a bulking call is made, this will method will
+ delegate the call to the OVS plugin.
"""
- super_getattr = super(VirtualPhysicalSwitchModelV2,
- self).__getattribute__
- methods = super_getattr('_methods_to_delegate')
+ super_getattribute = super(VirtualPhysicalSwitchModelV2,
+ self).__getattribute__
+ methods = super_getattribute('_methods_to_delegate')
if name in methods:
- plugin = super_getattr('_plugins')[const.VSWITCH_PLUGIN]
+ plugin = super_getattribute('_plugins')[const.VSWITCH_PLUGIN]
return getattr(plugin, name)
try:
- return super_getattr(name)
+ return super_getattribute(name)
except AttributeError:
- plugin = super_getattr('_plugins')[const.VSWITCH_PLUGIN]
+ plugin = super_getattribute('_plugins')[const.VSWITCH_PLUGIN]
return getattr(plugin, name)
def _func_name(self, offset=0):
# TODO (Sumit): Check if we need to perform any rollback here
raise
- def create_network_bulk(self, context, networks):
- """
- Perform this operation in the context of the configured device
- plugins.
- """
- LOG.debug(_("create_network_bulk() called"))
- try:
- args = [context, networks]
- ovs_output = self._plugins[
- const.VSWITCH_PLUGIN].create_network_bulk(context, networks)
- LOG.debug(_("ovs_output: %s"), ovs_output)
- vlanids = self._get_all_segmentation_ids()
- ovs_networks = ovs_output
- return ovs_output
- except:
- # TODO (Sumit): Check if we need to perform any rollback here
- raise
-
def update_network(self, context, id, network):
"""
Perform this operation in the context of the configured device
Meta-Plugin with v2 API support for multiple sub-plugins.
"""
supported_extension_aliases = ["Cisco Credential", "Cisco qos"]
- _methods_to_delegate = ['create_network', 'create_network_bulk',
+ _methods_to_delegate = ['create_network',
'delete_network', 'update_network', 'get_network',
'get_networks',
- 'create_port', 'create_port_bulk', 'delete_port',
+ 'create_port', 'delete_port',
'update_port', 'get_port', 'get_ports',
- 'create_subnet', 'create_subnet_bulk',
+ 'create_subnet',
'delete_subnet', 'update_subnet',
'get_subnet', 'get_subnets', ]
_master = True
"""
When the configured model class offers to manage the state of the
logical resources, we delegate the core API calls directly to it.
+ Note: Bulking calls will be handled by this class, and turned into
+ non-bulking calls to be considered for delegation.
"""
master = object.__getattribute__(self, "_master")
methods = object.__getattribute__(self, "_methods_to_delegate")