def monitor(): schemas = SchemaStore(getFiles()) schemas.printSchemas() recentMatches = [] #openflow = Openflow(schemas) sflow = Sflow(schemas, recentMatches) sflow.start() while True: if sflow.recentMatches: print sflow.recentMatches
print xmlFiles return xmlFiles <<<<<<< HEAD schemas = SchemaStore(getFiles()) schemas.printSchemas() """fix parsing, get flows to work. work on architecture. make canonical topology, with ip addresses. switch to layer 3 routing. check latency properly, testing different maounts and cleearing the ARP cache. then combine flows with latency """ openflow = Openflow(schemas) openflow.start() sflow = Sflow(schemas) sflow.start() monitor = Monitor(sflow,openflow) monitor.start() """another infinite loop means it needs its own thread so it doesn't stop routing""" #sflow = Sflow(schemas) #sflow.start() # if sflow.recentMatches: # print sflow.recentMatches ======= def monitor(): schemas = SchemaStore(getFiles())
from DDoSPrevention import DDoSPrevention def getFiles(): allFiles = os.listdir(os.getcwd()) print "current working directory is " + os.getcwd() xmlFiles = [] xmlPattern = re.compile('^.*\.(xml)$') for fileName in allFiles: m = re.match(xmlPattern, fileName) if m and fileName != "FlowSchema.xml": xmlFiles += [m.group(0)] print "\033[1m\033[37mLoaded schemas: " + str(xmlFiles) + "\033[0m" return xmlFiles schemas = SchemaStore(getFiles()) """get lowest threshold""" lowestThreshold = 9999999 for schema in schemas.schemas: if schema.ddos: if schema.ddos < lowestThreshold: lowestThreshold = schema.ddos openflow = Openflow(schemas) openflow.start() sflow = Sflow(schemas) sflow.start() monitor = Monitor(sflow, openflow, lowestThreshold, schemas.schemas) monitor.start()