Exemple #1
0
 def __init__(self):
     yapc.daemon.__init__(self)
     self.server = core.core()
     self.coin = coini.core(self.server)
     ##Force JSON connection or not
     self.forcejson = False
     ##Socket to talk to
     self.sock = coin.SOCK_NAME
    def run(self):
        """Run server
        """
        #Create yapc base
        server = core.core()
        ofconn = ofcomm.ofserver(server)
        jsonconn = jsoncomm.jsonserver(server, file=self.sock, 
                                       forcebind=self.forcejson)

        #Debug/Profiling
        #ofmsg = ofdbg.of_msg_count(server)

        #OpenFlow Parser
        ofparse = ofevents.parser(server)
        #COIN main server, maintaining connections
        coinserver = coinnat.nat(server, ofconn.connections,
                                 jsonconn.connections)
        coin_info = coini.core(server)

        #Information components
        bwm = ns.coin_intf_bandwidth(coin_info)

        #Network status
        sw = switches.dp_features(server)
        swhost = switchhost.mac2sw_binding(server)

        #OVS fabric manager
        ovs = coinovs.switch(server, jsonconn.connections)
        coinserver.switch = ovs

        #Flow management
        arph = coinnat.arp_handler(server, ofconn.connections)
        iph = coinnat.ip_handler(server, ofconn.connections, coinserver)

        #Add interfaces
        coinserver.setup(self.interfaces)

        server.order_handler(ofevents.features_reply.name,
                             sw, coinserver)
        server.order_cleanup(ofconn, ovs)

        coin_info.start()
        server.run()       
        sys.exit(0)