__author__ = "Alfonso Tierno, Leonardo Mirabal"
__date__ = "$06-Feb-2017 12:07:15$"
-__version__ = "0.5.13-r529"
+__version__ = "0.5.14-r530"
version_date = "May 2017"
database_version = 18 #needed database schema version
ips = IPNetwork(cidr)
if "dhcp_first_ip" not in network:
- network["dhcp_first_ip"] = str(ips[2])
+ network["dhcp_first_ip"] = str(ips[3])
if "dhcp_last_ip" not in network:
network["dhcp_last_ip"] = str(ips[-2])
if "gateway_ip" not in network:
- network["gateway_ip"] = str(ips[1])
+ network["gateway_ip"] = str(ips[2])
return True
else:
module = temp_dict['of_controller']
if module not in ovim.of_module:
- for base in ("", "osm_openvim.", "lib_osm_openvim."):
- try:
- pkg = __import__(base + module)
- if base:
- of_conn_module = getattr(pkg, module)
- else:
- of_conn_module = pkg
- ovim.of_module[module] = of_conn_module
- self.logger.debug("Module load from {}".format(base + module))
- break
- except Exception as e:
- self.logger.warning("Module {} not found {}".format(base + module, e))
- else:
+ try:
+ pkg = __import__("osm_openvim." + module)
+ of_conn_module = getattr(pkg, module)
+ ovim.of_module[module] = of_conn_module
+ self.logger.debug("Module load from {}".format("osm_openvim." + module))
+ except Exception as e:
self.logger.error("Cannot open openflow controller module of type '%s'", module)
raise ovimException("Cannot open openflow controller of type module '{}'"
"Revise it is installed".format(module),
bridge_net_name = net_provider[7:]
for brnet in self.config['bridge_nets']:
if brnet[0] == bridge_net_name: # free
- if not brnet[3]:
+ if brnet[3]:
raise ovimException("invalid 'provider:physical', "
"bridge '%s' is already used" % bridge_net_name, HTTP_Conflict)
bridge_net = brnet
if network["name"] in self.config["dhcp_server"].get("nets", ()):
self.config["dhcp_nets"].append(content)
self.logger.debug("dhcp_server: add new net", content)
- elif not bridge_net and bridge_net[0] in self.config["dhcp_server"].get("bridge_ifaces", ()):
+ elif bridge_net and bridge_net[0] in self.config["dhcp_server"].get("bridge_ifaces", ()):
self.config["dhcp_nets"].append(content)
self.logger.debug("dhcp_server: add new net", content, content)
return content
self.config["dhcp_nets"].remove(network_id)
return content
else:
- raise ovimException("Error deleting network %s" % network_id, HTTP_Internal_Server_Error)
+ raise ovimException("Error deleting network '{}': {}".format(network_id, content), -result)
def get_openflow_rules(self, network_id=None):
"""
else:
raise ovimException("Default Openflow controller not not running", HTTP_Not_Found)
- if ofc_id in self.config['ofcs_thread']:
+ elif ofc_id in self.config['ofcs_thread']:
conn = self.config['ofcs_thread'][ofc_id].OF_connector
else:
raise ovimException("Openflow controller not found with ofc_id={}".format(ofc_id), HTTP_Not_Found)
controller_host = self.get_dhcp_controller()
controller_host.create_linux_bridge(vlan)
- controller_host.create_dhcp_interfaces(vlan, first_ip, dhcp_netmask)
+ controller_host.create_dhcp_interfaces(vlan, gateway, dhcp_netmask)
controller_host.launch_dhcp_server(vlan, ip_range, dhcp_netmask, dhcp_path, gateway)
if __name__ == "__main__":