def init(): ui.clearScreen() print(ui.blue("-------------application start-------------")) l = inittializeControllers() #checkControllerSwitches(); #network.createTopology() ui.pc("...Getting Topology Info...") network.createTopology() #network.buildGraphByControllers(controllers) network.buildGraph() #network.drawNetwork() #network.applyLayerTwoLinks() #paths = network.getShortestPathFor("3.6", "2.1") paths = network.getShortestPathFor("2.1", "2.2") eps = eligiblePaths(paths) ui.drawPaths(eps)
def networkMap(): global second_layer_flag network.reset() network.createTopology() network.buildGraph() if second_layer_flag: network.applyLayerTwoLinks() return jsonify([{ "nodes": network.getHosts(), "switches": network.getSwitches(), "edges": network.getEdges() }])
def getNetwork(): network.createTopology() #buildGraph() #getShortestPathFor("2.1", "2.2") db.prepareConnection() network.buildGraphByTable() count = 1 result = [] for path in network.getShortestPathFor("2.1", "2.3"): result.append({'id': count, 'path': path}) count += 1 return jsonify(result)
def button1Clicked(self, sender): #print(self.m_comboBox1.GetValue()) ui.clearScreen() print(ui.blue("-------------application start-------------")) l = inittializeControllers() #checkControllerSwitches() ui.pc("...Getting Topology Info...") network.createTopology() network.buildGraph() paths = network.getShortestPathFor(self.m_comboBox2.GetValue(), self.m_comboBox1.GetValue()) eps = eligiblePaths(paths) ui.drawPaths(eps) distributePathForPush(eps)
def shortestPath(): data = request.data.replace("{", "").replace("}", "").split(",") src = data[0].replace("'", "").replace('"', "").split(":")[1] des = data[1].replace("'", "").replace('"', "").split(":")[1] print(src) print(des) network.createTopology() network.buildGraph() if second_layer_flag: network.applyLayerTwoLinks() paths = [] for path in network.getShortestPathFor(src, des): print(path) paths.append({"path": path}) return jsonify([{"paths": paths}])
def button2Clicked(self, sender): l = inittializeControllers() network.createTopology() network.buildGraph() network.drawNetwork()