- routes = yaml.safe_load(net.get('routes'))
- dns = yaml.safe_load(net.get('dns'))
- self.launch_dhcp_server(net.get('vlan'),
- net.get('dhcp_first_ip'),
- net.get('dhcp_last_ip'),
- net.get('cidr'),
- net.get('gateway_ip'),
- dns,
- routes)
- self.launch_link_bridge_to_ovs(net['vlan'], net.get('links'), net.get('routes'))
+ config_routes = net.get('routes')
+ if config_routes:
+ routes = yaml.safe_load(config_routes)
+ else:
+ routes = None
+
+ config_dns = net.get('dns')
+ if config_dns:
+ dns = yaml.safe_load(config_dns)
+ else:
+ dns = None
+
+ links = net.get('links')
+ if links:
+ links = yaml.safe_load(net.get('links'))
+ if net.get('enable_dhcp'):
+ self.launch_dhcp_server(net.get('vlan'),
+ net.get('dhcp_first_ip'),
+ net.get('dhcp_last_ip'),
+ net.get('cidr'),
+ net.get('gateway_ip'),
+ dns,
+ routes)
+ self.launch_link_bridge_to_ovs(net['vlan'], net.get('gateway_ip'), net.get('cidr'), links, routes)
+ if net["status"] == "ERROR":
+ self.db.update_rows("nets", UPDATE={"status": "ACTIVE", "last_error": None},
+ WHERE={"uuid": net["uuid"]})