def __init__(self):
        
        #Start INIHandler
        log.info("INIHandler - Initializing...")
        self.inihandler = IniHandler()
        log.info("INIHandler - Ready")
        #Start ERCS Topology
        #TODO: choose the core switches
        log.info("ERCS Topology - Initializing...")
        self.topology = Topology(self.inihandler)
        log.info("ERCS Topology - Ready")
        
        #Start ERCS Statistics
        log.info("ERCS Stats - Initializing...")
        self.stats = Stats(self.inihandler)
        log.info("ERCS Stats - Ready")
        
        #Start ERCS Rules
        #TODO: Automatically adapt the rules in case a switch fails
        #TODO: Supernetting in the agg and core switches
        log.info("ERCS Rules - Initializing...")
        self.rules = Rules({}, {}, Rules.SUPERNET, self.topology)
        log.info("ERCS Rules - Ready")
        
        #Start the ERCS VM Request Receiver
        #TODO: Send confirmation of VM Request received and VM Installed so later can send traffic
        log.info("ERCS VM Receiver - Initializing...")
        self.vmreceiver = VMReceiver(self.inihandler)
        log.info("ERCS VM Receiver - Ready")
        
        #Initialize the Xen Communicator
        log.info("Xen Communicator - Initializing...")
        self.xencommunicator = XenCommunicator(self.inihandler)
        log.info("Xen Communicator - Ready")

        #Start the ERCS VM Allocator
        #If you want to use xen instead of simulating the allocation add self.xencommunicator in the 
        #end of the arguments
        log.info("ERCS VM Manager - Initializing...")
        self.vmmanager = VMManager(self.topology, self.stats, self.rules, self.vmreceiver, 
            self.inihandler)
        log.info("ERCS VM Manager - Ready")
        
        #run the ERCS VM Request Receicer
        #This thread closes when the main thread closes
        self.vmreceiver.daemon = True
        self.vmreceiver.start()
        
        #Start the ERCS Stats Exporter
        log.info("ERCS Stats Exporter - Initializing...")
        self.statsexporter = ERCSStatsExport(self.inihandler, self.topology, self.stats, self.vmmanager)
        log.info("ERCS Stats Exporter - Ready")

        #Start Dhcp server for vms
        #get args for dhcpd
        args = self.getArgsforDHCPD(self.inihandler)
        import pox.misc.dhcpd
        pox.misc.dhcpd.launch(network=args[0],dns=args[1],ip=args[2])
class ERCS():
    
    def __init__(self):
        
        #Start INIHandler
        log.info("INIHandler - Initializing...")
        self.inihandler = IniHandler()
        log.info("INIHandler - Ready")
        #Start ERCS Topology
        #TODO: choose the core switches
        log.info("ERCS Topology - Initializing...")
        self.topology = Topology(self.inihandler)
        log.info("ERCS Topology - Ready")
        
        #Start ERCS Statistics
        log.info("ERCS Stats - Initializing...")
        self.stats = Stats(self.inihandler)
        log.info("ERCS Stats - Ready")
        
        #Start ERCS Rules
        #TODO: Automatically adapt the rules in case a switch fails
        #TODO: Supernetting in the agg and core switches
        log.info("ERCS Rules - Initializing...")
        self.rules = Rules({}, {}, Rules.SUPERNET, self.topology)
        log.info("ERCS Rules - Ready")
        
        #Start the ERCS VM Request Receiver
        #TODO: Send confirmation of VM Request received and VM Installed so later can send traffic
        log.info("ERCS VM Receiver - Initializing...")
        self.vmreceiver = VMReceiver(self.inihandler)
        log.info("ERCS VM Receiver - Ready")
        
        #Initialize the Xen Communicator
        log.info("Xen Communicator - Initializing...")
        self.xencommunicator = XenCommunicator(self.inihandler)
        log.info("Xen Communicator - Ready")

        #Start the ERCS VM Allocator
        #If you want to use xen instead of simulating the allocation add self.xencommunicator in the 
        #end of the arguments
        log.info("ERCS VM Manager - Initializing...")
        self.vmmanager = VMManager(self.topology, self.stats, self.rules, self.vmreceiver, 
            self.inihandler)
        log.info("ERCS VM Manager - Ready")
        
        #run the ERCS VM Request Receicer
        #This thread closes when the main thread closes
        self.vmreceiver.daemon = True
        self.vmreceiver.start()
        
        #Start the ERCS Stats Exporter
        log.info("ERCS Stats Exporter - Initializing...")
        self.statsexporter = ERCSStatsExport(self.inihandler, self.topology, self.stats, self.vmmanager)
        log.info("ERCS Stats Exporter - Ready")

        #Start Dhcp server for vms
        #get args for dhcpd
        args = self.getArgsforDHCPD(self.inihandler)
        import pox.misc.dhcpd
        pox.misc.dhcpd.launch(network=args[0],dns=args[1],ip=args[2])

    def getArgsforDHCPD(self, inithandler):
        '''
        Get values from the ini file
        '''
        args = list()
        try :
            section = "hostippool"
            key = "vm"
            args.append(inithandler.read_ini_value(section, key))
            key = "dns"
            args.append(inithandler.read_ini_value(section, key))
            key = "dhcpip"
            args.append(inithandler.read_ini_value(section, key))
            print("%s,%s,%s",args[0],args[1],args[2])
        except Exception, e:
            log.error("INI File doesn't contain expected values")
            log.error(e)
            os._exit(0)

        return args