OS API should implement network creation

Registered by Alexej Ababilov

nova/api/openstack/compute/contrib/networks.py contains NetworkController class. It supports list, get, and delete operations for networks but `create` is not implemented:

    def create(self, req, id, body=None):
        raise exc.HTTPNotImplemented()

This call could be implemented in the same way as in nova-manage CLI utility (get default arguments from configuration etc.). It should return a list of new networks.

Supported arguments for the call should be passed in a dictionary:
- string: "bridge", "bridge_interface",
                    "cidr", "cidr_v6", "dns1", "dns2",
                    "fixed_cidr", "gateway", "gateway_v6",
                    "label", "multi_host", "priority",
                    "project_id";
- integer: "network_size", "num_networks",
                    "vlan_start", "vpn_start".

Sample request:
curl -X 'POST' 'http://main-node:8774/v1.1/45d2e66674b647c2bee1d1f18ae64e93/os-networks' -H 'User-Agent: python-openstackclient-base' -H 'Content-Type: application/json' -H 'X-Auth-Token: b4be16290db84726bc71d10f0947aa13' -d '{"network": {"vlan_start": 234, "cidr": "10.70.105.0/24", "label": "net234"}}'

Response:
{"networks": [{"bridge": "br234", "vpn_public_port": 1000, "dhcp_start": "10.70.105.3", "bridge_interface": "eth0", "updated_at": null, "id": 66085e78-8f6-4a26-b16c-4b1f55901fbd", "cidr_v6": null, "deleted_at": null, "gateway": "10.70.105.1", "label": "net234", "project_id": null, "vpn_private_address": "10.70.105.2", "deleted": false, "vlan": 234, "broadcast": "10.70.105.255", "netmask": "255.255.255.0", "injected": false, "cidr": "10.70.105.0/24", "vpn_public_address": null, "multi_host": false, "dns1": null, "host": null, "gateway_v6": null, "netmask_v6": null, "created_at": "2012-07-11 07:42:06.155778"}]}

Blueprint information

Status:
Complete
Approver:
None
Priority:
Low
Drafter:
None
Direction:
Needs approval
Assignee:
Alexej Ababilov
Definition:
Approved
Series goal:
Accepted for folsom
Implementation:
Implemented
Milestone target:
milestone icon 2012.2
Started by
Thierry Carrez
Completed by
Vish Ishaya

Related branches

Sprints

Whiteboard

Addressed by: https://review.openstack.org/9847
    implement network creation in compute API

Patch is looking good but one issue remains - making the API only create a single network at a time.

Gerrit topic: https://review.openstack.org/#q,topic:bp/os-api-network-create,n,z

Addressed by: https://review.openstack.org/11697
    Only allow a single network to be created

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.