def __init__(self): EventMixin.__init__(self) udp_server = MWUdpServer(self.process_command, Transport.LPORT) core.protocols.addServer(udp_server) tcp_server = MWTcpServer(self.process_command, Transport.LPORT) core.protocols.addServer(tcp_server, needSend=True) core.middleware.listenTo(self) self.register_event_handler() # register decode class for input (request/response) message. # 本OFCサーバへの入力メッセージをデコードするクラスを登録する # (入力メッセージボディのNAMEプロパティから,対応するクラスメソッドが呼びだされる) self.decode_classes = { # JSON CMD Name : called Class InitializeReq.NAME : InitializeReq, CreateBiPathReq.NAME : CreateBiPathReq, UpdatePathReq.NAME : UpdatePathReq, DeleteBiPathReq.NAME : DeleteBiPathReq, OptimizeReq.NAME : OptimizeReq, HeartBeatReq.NAME : HeartBeatReq, DumpReq.NAME : DumpReq }
def __init__(self, src_ofp, dst_ofp): EventMixin.__init__(self) if not src_ofp or not isinstance(src_ofp, ScnOpenFlowPort): log.warn("no src ofp") return if not dst_ofp or not isinstance(dst_ofp, ScnOpenFlowPort): log.warn("no src ofp") return self.src_ofp = src_ofp self.dst_ofp = dst_ofp self.rx_bytes = 0 self.time = time.time() self.used_bw = 0 #unit used for the treatment of stats self.stat_unit = "bit" #list of Path using this link. self.reserved = [] self._id = id(self) # is it enough? we will need some id logic. self.cookies = [] #backward compatible for bwFlowBalancing class. if core.stats: core.stats.addListenerByName("PortStatsEv", self._handle_PortStatsEv) self.listenTo(core.stats)
def __init__ (self, name): Interface.__init__(self, name) EventMixin.__init__(self) self._q = Queue() p = PCap(name, callback=self._pcap_cb, start=False) p.set_direction(True, False) # Incoming, not outgoing p.start() self.pcap = p core.add_listener(self._handle_GoingDownEvent)
def __init__(self, macAddr, ofp, ipAddr = None): if not macAddr: raise AssertionError("ScnOpenFlowHost should have a Mac address") Host.__init__(self) EventMixin.__init__(self) self.macAddr = macAddr self.ipAddr = ipAddr self.ofp = ofp log.debug("ScnOpenFlowHost :%s", str(self))
def __init__(self, path_desc, cond_desc): EventMixin.__init__(self) self.last_update = time.time() self.links = [] self.path_id = None assert isinstance(path_desc, PathDescription) assert isinstance(cond_desc, ConditionDescription) self.path_description = path_desc self.condition_description = cond_desc self.cookie = self.__generate_cookie__()
def __init__ (self, name="", tun=False, raw=False, protocol=None): self.tap = None self.last_flags = None self.last_protocol = None if protocol: self.default_send_protocol = protocol self.io_loop = ReadLoop.singleton Interface.__init__(self, name) EventMixin.__init__(self) self.tap = TunTap(name, raw=raw, tun=tun) if not name: self._name = self.tap.name self.io_loop.add(self)
def __init__(self, heartbeatActivate, heartbeatInterval): EventMixin.__init__(self) RedisFeature.__init__(self) self._path_info = {} self._node_list = NodeList() self.heartbeatActivate = heartbeatActivate self.heartbeatInterval = heartbeatInterval self.max_id = 2**16-1 self.prev_id = 0 self.cmds = [] core.openflow_discovery.addListenerByName('LinkEvent', self._handle_LinkEvent)