def create_network(self, context, network): """Instruct HDN operators to create a network This function implements the "network create" Neutron API operation. @param context - The Neutron context reference. This parameter holds a database session (context.session), the identifier of the tenant performing the operation (context.tenant_id), and other attributes such as a flag to test whether the tenant is an administrator (context.is_admin) @param network - A dict containing data of the network to be created """ # Set the status of the network as 'PENDING CREATE' network['network']['status'] = constants.STATUS_PENDING_CREATE with db_api.autonested_transaction(context.session): new_net = super(HdnNeutronPlugin, self).create_network( context, network) self._process_l3_create(context, new_net, network['network']) # Use the HDN library to notify operators about the new network LOG.debug("Queued request to create network: %s", new_net['id']) hdnlib.notify_network_create(new_net) # Network is not present in neutron.callbacks.resources # TODO(salv-orlando): do not use literal for resource name registry.notify('NETWORK', events.AFTER_CREATE, self, tenant_id=context.tenant_id, resource_id=new_net['id']) return new_net
def create_network(self, context, network): """ Instruct HDN operators to create a network This function implements the "network create" Neutron API operation. @param context - The Neutron context reference. This parameter holds a database session (context.session), the identifier of the tenant performing the operation (context.tenant_id), and other attributes such as a flag to test whether the tenant is an administrator (context.is_admin) @param network - A dict containing data of the network to be created """ # Set the status of the network as 'PENDING CREATE' network['network']['status'] = constants.STATUS_PENDING_CREATE with db_api.autonested_transaction(): new_net = super(HdnNeutronPlugin, self).create_network( context, network) # Use the HDN library to notify operators about the new network LOG.debug("Queued request to create network: %s", new_net['id']) hdnlib.notify_network_create(new_net) return new_net