예제 #1
0
    def create_network(self, context, network):
        """Create network.

        Perform this operation in the context of the configured device
        plugins.
        """
        LOG.debug(_("create_network() called"))
        provider_vlan_id = self._get_provider_vlan_id(network[const.NETWORK])
        args = [context, network]
        switch_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
                                                       self._func_name(),
                                                       args)
        # The vswitch plugin did all the verification. If it's a provider
        # vlan network, save it for the sub-plugin to use later.
        if provider_vlan_id:
            network_id = switch_output[const.NET_ID]
            cdb.add_provider_network(network_id,
                                     const.NETWORK_TYPE_VLAN,
                                     provider_vlan_id)
            LOG.debug(_("Provider network added to DB: %(network_id)s, "
                        "%(vlan_id)s"),
                      {'network_id': network_id, 'vlan_id': provider_vlan_id})
        return switch_output
예제 #2
0
    def create_network(self, context, network):
        """Create network.

        Perform this operation in the context of the configured device
        plugins.
        """
        LOG.debug(_("create_network() called"))
        provider_vlan_id = self._get_provider_vlan_id(network[const.NETWORK])
        args = [context, network]
        ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
                                                    self._func_name(),
                                                    args)
        # The vswitch plugin did all the verification. If it's a provider
        # vlan network, save it for the nexus plugin to use later.
        if provider_vlan_id:
            network_id = ovs_output[0][const.NET_ID]
            cdb.add_provider_network(network_id,
                                     const.NETWORK_TYPE_VLAN,
                                     provider_vlan_id)
            LOG.debug(_("provider network added to DB: %(network_id)s, "
                        "%(vlan_id)s"), {'network_id': network_id,
                                         'vlan_id': provider_vlan_id})
        return ovs_output[0]