+ do_notify(RES_NETWORK, progress, ret)
+
+def create_subnet(subnet, do_notify, progress):
+ param = {
+ "tenant": subnet["properties"]["location_info"]["tenant"],
+ "networkName": subnet["properties"]["network_name"],
+ "subnetName": subnet["properties"]["name"],
+ "cidr": ignore_case_get(subnet["properties"], "cidr"),
+ "ipVersion": ignore_case_get(subnet["properties"], "ip_version", IP_V4)
+ }
+ set_opt_val(param, "enableDhcp",
+ ignore_case_get(subnet["properties"], "dhcp_enabled"), DHCP_ENABLED)
+ set_opt_val(param, "gatewayIp", ignore_case_get(subnet["properties"], "gateway_ip"))
+ set_opt_val(param, "dnsNameservers", ignore_case_get(subnet["properties"], "dns_nameservers"))
+ allocation_pool = {}
+ set_opt_val(allocation_pool, "start", ignore_case_get(subnet["properties"], "start_ip"))
+ set_opt_val(allocation_pool, "end", ignore_case_get(subnet["properties"], "end_ip"))
+ if allocation_pool:
+ param["allocationPools"] = [allocation_pool]
+ set_opt_val(param, "hostRoutes", ignore_case_get(subnet["properties"], "host_routes"))
+ vim_id = network["properties"]["location_info"]["vimid"],
+ ret = api.create_subnet(vim_id, param)
+ do_notify(RES_SUBNET, progress, ret)