Example #1
0
def testRoutingTableManager():
    from routingtablemanager import getRoutingTableManager, RoutingTableEntry
##    entry = RoutingTableEntry(None, 'C001', 'M001', 'C002', '10')
##    getRoutingTableManager().addEntry(entry)
##    entry = RoutingTableEntry(None, 'C001', 'M001', 'C002', '3')
##    getRoutingTableManager().addEntry(entry)
##    entry = RoutingTableEntry(None, 'C001', 'M001', 'C002', '12')
##    getRoutingTableManager().addEntry(entry)
##    for x in getRoutingTableManager().getAllEntriesForCommunity('C001'):
##        print "\t", x

##    print getRoutingTableManager().getNexthopForCommunity('C001')

##    from messagewrapper import getRoutingTableWrapper
##    y1 = ['C001','C002','C010','M005','5']
##    y2 = ['C002','C001','C009','M005','6']
##    x = [y1, y2]
##    
##    xml = getRoutingTableWrapper().encodeRoutingTable(x)
##    print xml
##    
##    dec = getRoutingTableWrapper().decodeRoutingTable(xml)
##    print dec

##    from routingtablemanager import getRoutingTableManager
##    print getRoutingTableManager().getRoutingTableXML()

##    from g4dsconfigurationcontroller import getRoutingController
##    print getRoutingController().downloadRoutingTable('M001', timeout = 10)
    
    from dynamicrouting import getRoutingTableUpdater
    getRoutingTableUpdater().updateNow()
Example #2
0
 def shutdown(self):
     """
     Shutdown G4DS.
     
     Connections are all shutdown (especially the network servers waiting for incoming connections) and 
     eventual dynamic data is written back to the database.
     """
     from maintainlib import _printAction, _finishActionLine, SUCESS_POS, SUCESS_NEG, SUCESS_SKIP
     from errorhandling import G4dsRuntimeException
     print "\n" + "*" * 90
     _printAction (0, "Shutting down G4DS ...",1)
     
     _printAction(1, "Shutting down dynamic routing")
     from dynamicrouting import getRoutingTableUpdater
     try:
         getRoutingTableUpdater().shutdown()
         _finishActionLine()
     except G4dsRuntimeException, msg:
         _finishActionLine(SUCESS_SKIP)
Example #3
0
##        except Exception, msg:
        except KeyError, msg:
            _finishActionLine(SUCESS_NEG)
            _printAction(2, str(msg))
            _finishActionLine(SUCESS_NEG)            

        _printAction(1, "Loading routing table into memory")
        from routingtablemanager import getRoutingTableManager
        getRoutingTableManager()
        _finishActionLine()

        _printAction(1, "Enable dynamic routing")
        from dynamicrouting import getRoutingTableUpdater
        from errorhandling import G4dsRuntimeException
        try:
            getRoutingTableUpdater()
            _finishActionLine()
        except G4dsRuntimeException, msg:
            _finishActionLine(SUCESS_SKIP)
        
        _printAction(0, "G4DS running")
        _finishActionLine()
        print "*" * 90 + "\n"
                
    def shutdown(self):
        """
        Shutdown G4DS.
        
        Connections are all shutdown (especially the network servers waiting for incoming connections) and 
        eventual dynamic data is written back to the database.
        """