예제 #1
0
class RemoteServer:
    def __init__(self):
        self.cmdSender = CommandSender()

    def get_my_ip(self):
        """Returns this computers IP address as a string."""
        ip = subprocess.check_output(GET_IP_CMD, shell=True).decode("utf-8")[:-1]
        return ip.strip()

    def main(self):
        port = DEFAULT_PORT

        print("Starting HMAT Web Server at:\n\n" "\thttp://{addr}:{port}\n\n".format(addr=self.get_my_ip(), port=port))

        # run the server
        server_address = ("", port)
        try:
            server = http.server.HTTPServer(server_address, RemoteWebHandler)
            server.serve_forever()
        except KeyboardInterrupt:
            print("^C received, shutting down server")
            server.socket.close()

    def handleCommand(self, query):
        return self.cmdSender.handleCommand(query)
예제 #2
0
    def __init__(self, *args, **kwargs):
        super(HLApp, self).__init__(*args, **kwargs)

        self.commandSender = CommandSender.get_instance()

        self.flow_collector = kwargs['flow_collector']

        self.network_monitor = kwargs['network_monitor']

        self.flowClassifier = FlowClassifier.get_instance()

        self.routeCalculator = RouteCalculator.get_instance()

        self.pathPreInstall = PathPreInstall()
        self.activePairSelector = ActivePairSelector()
        self.rerouter = None

        self.DISCOVER_PERIOD = 5
        self.COLLECTOR_PERIOD = 5
        self.FLOW_COUNT = 1
        self.TCP_IDLE_TIME = 10
        self.ICMP_IDLE_TIME = 60

        self.network_monitor_thread = hub.spawn(self._monitor)
        self.flow_collector_thread = hub.spawn(self._collector)
예제 #3
0
class RemoteServer():
    def __init__(self):
        self.cmdSender = CommandSender()

    def get_my_ip(self):
        """Returns this computers IP address as a string."""
        ip = subprocess.check_output(GET_IP_CMD,
                                     shell=True).decode('utf-8')[:-1]
        return ip.strip()

    def main(self):
        port = DEFAULT_PORT

        print("Starting HMAT Web Server at:\n\n"
              "\thttp://{addr}:{port}\n\n".format(addr=self.get_my_ip(),
                                                  port=port))

        # run the server
        server_address = ('', port)
        try:
            server = http.server.HTTPServer(server_address, RemoteWebHandler)
            server.serve_forever()
        except KeyboardInterrupt:
            print('^C received, shutting down server')
            server.socket.close()

    def handleCommand(self, query):
        return self.cmdSender.handleCommand(query)
예제 #4
0
    def __init__(self, *args, **kwargs):
        super(FlowCollector, self).__init__(*args, **kwargs)
        self.flowSender = CommandSender.get_instance()

        self.dpids = []

        # {dpid:[{"idle_timeout":...,"packet_count":...,"byte_count":...,},{},{},...],
        #  dpid:[{},{},{]...],...}
        self.dpid_to_flow = dict()
예제 #5
0
파일: base_app1.py 프로젝트: chenhuan0/ryu
    def __init__(self, *args, **kwargs):
        super(HLApp, self).__init__(*args, **kwargs)
        self.network_monitor = kwargs['network_monitor'] # context
        self.flow_collector = kwargs['flow_collector'] #context

        self.commandSender = CommandSender.get_instance() # util
        self.routeCalculator = RouteCalculator.get_instance() # util

        self.DISCOVER_PERIOD = 3

        self.network_monitor_thread = hub.spawn(self._monitor)
예제 #6
0
 def __init__(self):
     self.cmdSender = CommandSender()
예제 #7
0
 def __init__(self):
     self.cmdSender = CommandSender()