代码改变世界

Openstack os-networks API create network 方法

2013-10-28 19:03  梁小白  阅读(497)  评论(1编辑  收藏

官方文档在请求方法和地址上有错误: http://api.openstack.org/api-ref.html#ext-os-networks

正确的地址为: /v2/{tenant_id}/os-networks

正确的body为:

{
    "network": 
        {
            "bridge": "br2341",
            "bridge_itnerface": "eth2",
            "cidr": "10.170.105.0/24",
            "label":"asdfa"
        }
    }

more parameters:

"""
        Create (allocate) a network. The following parameters are
        optional except for label; cidr or cidr_v6 must be specified, too.

        :param label: str
        :param bridge: str
        :param bridge_interface: str
        :param cidr: str
        :param cidr_v6: str
        :param dns1: str
        :param dns2: str
        :param fixed_cidr: str
        :param gateway: str
        :param gateway_v6: str
        :param multi_host: str
        :param priority: str
        :param project_id: str
        :param vlan_start: int
        :param vpn_start: int

        :rtype: list of :class:`Network`
        """