Example #1
0
 def convert_with_links(rpc_network,
                        limit,
                        url=None,
                        expand=False,
                        **kwargs):
     collection = NetworkCollection()
     collection.network = [view.format_network(url, p) for p in rpc_network]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
Example #2
0
    def post(self, **network_dict):
        """Create a new network.

        :param network_dict: a network within the request body.
        """
        context = pecan.request.context
        policy.enforce(context, "network:create", action="network:create")
        new_network = pecan.request.compute_api.network_create(
            context, network_dict['neutron_net_id'])
        return view.format_network(pecan.request.host_url, new_network)
Example #3
0
    def post(self, **network_dict):
        """Create a new network.

        :param network_dict: a network within the request body.
        """
        context = pecan.request.context
        policy.enforce(context, "network:create", action="network:create")
        new_network = pecan.request.compute_api.network_create(
            context, network_dict['neutron_net_id'])
        return view.format_network(pecan.request.host_url, new_network)
Example #4
0
    def post(self, **network_dict):
        """Create a new network.

        :param network_dict: a network within the request body.
        """
        context = pecan.request.context
        policy.enforce(context, "network:create", action="network:create")
        network_dict['project_id'] = context.project_id
        network_dict['user_id'] = context.user_id
        new_network = objects.Network(context, **network_dict)
        new_network.create(context)
        pecan.request.compute_api.network_create(context, new_network)
        return view.format_network(pecan.request.host_url, new_network)
Example #5
0
 def convert_with_links(rpc_network, limit, url=None,
                        expand=False, **kwargs):
     collection = NetworkCollection()
     collection.network = [view.format_network(url, p) for p in rpc_network]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection