diff options
47 files changed, 483 insertions, 64 deletions
diff --git a/ryu/app/ofctl/service.py b/ryu/app/ofctl/service.py index ad943a2f..2a2e97d1 100644 --- a/ryu/app/ofctl/service.py +++ b/ryu/app/ofctl/service.py @@ -197,7 +197,7 @@ class OfctlService(app_manager.RyuApp): self.logger.error('unknown error xid %s', msg.xid) return if ((not isinstance(ev, ofp_event.EventOFPErrorMsg)) and - (req.reply_cls is None or not isinstance(ev.msg, req.reply_cls))): + (req.reply_cls is None or not isinstance(ev.msg, req.reply_cls))): self.logger.error('unexpected reply %s for xid %s', ev, msg.xid) return try: diff --git a/ryu/controller/event.py b/ryu/controller/event.py index e9d49211..3f5c3dbf 100644 --- a/ryu/controller/event.py +++ b/ryu/controller/event.py @@ -30,6 +30,7 @@ class EventRequestBase(EventBase): """ The base class for synchronous request for RyuApp.send_request. """ + def __init__(self): super(EventRequestBase, self).__init__() self.dst = None # app.name of provide the event. @@ -42,6 +43,7 @@ class EventReplyBase(EventBase): """ The base class for synchronous request reply for RyuApp.send_reply. """ + def __init__(self, dst): super(EventReplyBase, self).__init__() self.dst = dst diff --git a/ryu/controller/network.py b/ryu/controller/network.py index 83c91b4d..30efbc6a 100644 --- a/ryu/controller/network.py +++ b/ryu/controller/network.py @@ -109,6 +109,7 @@ class EventMacAddress(event.EventBase): class Networks(dict): "network_id -> set of (dpid, port_no)" + def __init__(self, f): super(Networks, self).__init__() self.send_event = f @@ -200,6 +201,7 @@ class Port(object): class DPIDs(dict): """dpid -> port_no -> Port(port_no, network_id, mac_address)""" + def __init__(self, f, nw_id_unknown): super(DPIDs, self).__init__() self.send_event = f @@ -306,6 +308,7 @@ MacPort = collections.namedtuple('MacPort', ('dpid', 'port_no')) class MacToPort(collections.defaultdict): """mac_address -> set of MacPort(dpid, port_no)""" + def __init__(self): super(MacToPort, self).__init__(set) @@ -324,6 +327,7 @@ class MacToPort(collections.defaultdict): class MacAddresses(dict): """network_id -> mac_address -> set of (dpid, port_no)""" + def add_port(self, network_id, dpid, port_no, mac_address): mac2port = self.setdefault(network_id, MacToPort()) mac2port.add_port(dpid, port_no, mac_address) diff --git a/ryu/controller/ofp_event.py b/ryu/controller/ofp_event.py index 7640b41f..f5c0c1cc 100644 --- a/ryu/controller/ofp_event.py +++ b/ryu/controller/ofp_event.py @@ -50,6 +50,7 @@ class EventOFPMsgBase(event.EventBase): The msg object has some more additional members whose values are extracted from the original OpenFlow message. """ + def __init__(self, msg): self.timestamp = time.time() super(EventOFPMsgBase, self).__init__() @@ -118,6 +119,7 @@ class EventOFPStateChange(event.EventBase): datapath ryu.controller.controller.Datapath instance of the switch ========= ================================================================= """ + def __init__(self, dp): super(EventOFPStateChange, self).__init__() self.datapath = dp @@ -139,6 +141,7 @@ class EventOFPPortStateChange(event.EventBase): port_no Port number which state was changed ========= ================================================================= """ + def __init__(self, dp, reason, port_no): super(EventOFPPortStateChange, self).__init__() self.datapath = dp diff --git a/ryu/controller/tunnels.py b/ryu/controller/tunnels.py index 61f0c160..83515530 100644 --- a/ryu/controller/tunnels.py +++ b/ryu/controller/tunnels.py @@ -98,6 +98,7 @@ class EventTunnelPort(event.EventBase): add_del True for adding a tunnel. False for removal. =========== =============================================================== """ + def __init__(self, dpid, port_no, remote_dpid, add_del): super(EventTunnelPort, self).__init__() self.dpid = dpid @@ -108,6 +109,7 @@ class EventTunnelPort(event.EventBase): class TunnelKeys(dict): """network id(uuid) <-> tunnel key(32bit unsigned int)""" + def __init__(self, f): super(TunnelKeys, self).__init__() self.send_event = f @@ -151,6 +153,7 @@ class TunnelKeys(dict): class DPIDs(object): """dpid -> port_no -> remote_dpid""" + def __init__(self, f): super(DPIDs, self).__init__() self.dpids = collections.defaultdict(dict) diff --git a/ryu/lib/bfdlib.py b/ryu/lib/bfdlib.py index 6818b3e7..5417b61b 100644 --- a/ryu/lib/bfdlib.py +++ b/ryu/lib/bfdlib.py @@ -72,6 +72,7 @@ class BFDSession(object): An instance maintains a BFD session. """ + def __init__(self, app, my_discr, dpid, ofport, src_mac, src_ip, src_port, dst_mac="FF:FF:FF:FF:FF:FF", dst_ip="255.255.255.255", @@ -639,6 +640,7 @@ class EventBFDSessionStateChanged(event.EventBase): """ An event class that notifies the state change of a BFD session. """ + def __init__(self, session, old_state, new_state): super(EventBFDSessionStateChanged, self).__init__() self.session = session diff --git a/ryu/lib/igmplib.py b/ryu/lib/igmplib.py index 719626f3..000b3088 100644 --- a/ryu/lib/igmplib.py +++ b/ryu/lib/igmplib.py @@ -38,6 +38,7 @@ from ryu.lib.packet import igmp class EventPacketIn(event.EventBase): """a PacketIn event class using except IGMP.""" + def __init__(self, msg): """initialization.""" super(EventPacketIn, self).__init__() diff --git a/ryu/lib/lacplib.py b/ryu/lib/lacplib.py index 36682a6f..8280e431 100644 --- a/ryu/lib/lacplib.py +++ b/ryu/lib/lacplib.py @@ -33,6 +33,7 @@ from ryu.lib.packet import slow class EventPacketIn(event.EventBase): """a PacketIn event class using except LACP.""" + def __init__(self, msg): """initialization.""" super(EventPacketIn, self).__init__() @@ -42,6 +43,7 @@ class EventPacketIn(event.EventBase): class EventSlaveStateChanged(event.EventBase): """a event class that notifies the changes of the statuses of the slave i/fs.""" + def __init__(self, datapath, port, enabled): """initialization.""" super(EventSlaveStateChanged, self).__init__() diff --git a/ryu/lib/packet/geneve.py b/ryu/lib/packet/geneve.py index 6cbba495..a28393a7 100644 --- a/ryu/lib/packet/geneve.py +++ b/ryu/lib/packet/geneve.py @@ -175,6 +175,7 @@ class OptionDataUnknown(Option): """ Unknown Option Class and Type specific Option """ + def __init__(self, buf, option_class=None, type_=None, length=0): super(OptionDataUnknown, self).__init__(option_class=option_class, type_=type_, diff --git a/ryu/lib/packet/icmp.py b/ryu/lib/packet/icmp.py index 4ce24c3e..72938e91 100644 --- a/ryu/lib/packet/icmp.py +++ b/ryu/lib/packet/icmp.py @@ -248,7 +248,7 @@ class dest_unreach(_ICMPv4Payload): def serialize(self): hdr = bytearray(struct.pack(dest_unreach._PACK_STR, - self.data_len, self.mtu)) + self.data_len, self.mtu)) if self.data is not None: hdr += self.data diff --git a/ryu/lib/packet/icmpv6.py b/ryu/lib/packet/icmpv6.py index 53d5ec3a..00b883bf 100644 --- a/ryu/lib/packet/icmpv6.py +++ b/ryu/lib/packet/icmpv6.py @@ -807,8 +807,8 @@ class mldv2_query(mld): def serialize(self): s_qrv = self.s_flg << 3 | self.qrv buf = bytearray(struct.pack(self._PACK_STR, self.maxresp, - addrconv.ipv6.text_to_bin(self.address), s_qrv, - self.qqic, self.num)) + addrconv.ipv6.text_to_bin(self.address), s_qrv, + self.qqic, self.num)) for src in self.srcs: buf.extend(struct.pack('16s', addrconv.ipv6.text_to_bin(src))) if 0 == self.num: @@ -951,8 +951,8 @@ class mldv2_report_group(stringify.StringifyMixin): def serialize(self): buf = bytearray(struct.pack(self._PACK_STR, self.type_, - self.aux_len, self.num, - addrconv.ipv6.text_to_bin(self.address))) + self.aux_len, self.num, + addrconv.ipv6.text_to_bin(self.address))) for src in self.srcs: buf.extend(struct.pack('16s', addrconv.ipv6.text_to_bin(src))) if 0 == self.num: diff --git a/ryu/lib/packet/igmp.py b/ryu/lib/packet/igmp.py index 909decba..8935da3b 100644 --- a/ryu/lib/packet/igmp.py +++ b/ryu/lib/packet/igmp.py @@ -207,8 +207,8 @@ class igmp(packet_base.PacketBase): def serialize(self, payload, prev): hdr = bytearray(struct.pack(self._PACK_STR, self.msgtype, - trunc(self.maxresp), self.csum, - addrconv.ipv4.text_to_bin(self.address))) + trunc(self.maxresp), self.csum, + addrconv.ipv4.text_to_bin(self.address))) if self.csum == 0: self.csum = packet_utils.checksum(hdr) @@ -297,9 +297,9 @@ class igmpv3_query(igmp): def serialize(self, payload, prev): s_qrv = self.s_flg << 3 | self.qrv buf = bytearray(struct.pack(self._PACK_STR, self.msgtype, - trunc(self.maxresp), self.csum, - addrconv.ipv4.text_to_bin(self.address), - s_qrv, trunc(self.qqic), self.num)) + trunc(self.maxresp), self.csum, + addrconv.ipv4.text_to_bin(self.address), + s_qrv, trunc(self.qqic), self.num)) for src in self.srcs: buf.extend(struct.pack('4s', addrconv.ipv4.text_to_bin(src))) if 0 == self.num: @@ -372,7 +372,7 @@ class igmpv3_report(igmp): def serialize(self, payload, prev): buf = bytearray(struct.pack(self._PACK_STR, self.msgtype, - self.csum, self.record_num)) + self.csum, self.record_num)) for record in self.records: buf.extend(record.serialize()) if 0 == self.record_num: @@ -461,8 +461,8 @@ class igmpv3_report_group(stringify.StringifyMixin): def serialize(self): buf = bytearray(struct.pack(self._PACK_STR, self.type_, - self.aux_len, self.num, - addrconv.ipv4.text_to_bin(self.address))) + self.aux_len, self.num, + addrconv.ipv4.text_to_bin(self.address))) for src in self.srcs: buf.extend(struct.pack('4s', addrconv.ipv4.text_to_bin(src))) if 0 == self.num: diff --git a/ryu/lib/packet/ipv6.py b/ryu/lib/packet/ipv6.py index 524a0864..007dc564 100644 --- a/ryu/lib/packet/ipv6.py +++ b/ryu/lib/packet/ipv6.py @@ -154,6 +154,7 @@ ipv6.register_packet_type(gre.gre, inet.IPPROTO_GRE) @six.add_metaclass(abc.ABCMeta) class header(stringify.StringifyMixin): """extension header abstract class.""" + def __init__(self, nxt): self.nxt = nxt @@ -434,7 +435,7 @@ class routing_type3(header): assert isinstance(adrs, list) self.adrs = adrs self._pad = (8 - ((len(self.adrs) - 1) * (16 - self.cmpi) + - (16 - self.cmpe) % 8)) % 8 + (16 - self.cmpe) % 8)) % 8 @classmethod def _get_size(cls, size): diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py index 87ddadae..914f07c1 100644 --- a/ryu/lib/packet/lldp.py +++ b/ryu/lib/packet/lldp.py @@ -208,6 +208,7 @@ class End(LLDPBasicTLV): buf Binary data to parse. ============== ===================================== """ + def __init__(self, buf=None, *args, **kwargs): super(End, self).__init__(buf, *args, **kwargs) if buf: diff --git a/ryu/lib/rpc.py b/ryu/lib/rpc.py index bb4742a0..7db0ebeb 100644 --- a/ryu/lib/rpc.py +++ b/ryu/lib/rpc.py @@ -37,6 +37,7 @@ class MessageEncoder(object): """msgpack-rpc encoder/decoder. intended to be transport-agnostic. """ + def __init__(self): super(MessageEncoder, self).__init__() self._packer = msgpack.Packer(encoding='utf-8', use_bin_type=True) @@ -91,6 +92,7 @@ class EndPoint(object): """An endpoint *sock* is a socket-like. it can be either blocking or non-blocking. """ + def __init__(self, sock, encoder=None, disp_table=None): if encoder is None: encoder = MessageEncoder() @@ -236,6 +238,7 @@ class EndPoint(object): class RPCError(Exception): """an error from server """ + def __init__(self, error): super(RPCError, self).__init__() self._error = error @@ -251,6 +254,7 @@ class Client(object): """a convenient class for a pure rpc client *sock* is a socket-like. it should be blocking. """ + def __init__(self, sock, encoder=None, notification_callback=None): self._endpoint = EndPoint(sock, encoder) if notification_callback is None: diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index 77803ccf..6d886853 100644 --- a/ryu/ofproto/nx_match.py +++ b/ryu/ofproto/nx_match.py @@ -122,6 +122,7 @@ class FlowWildcards(ofproto_parser.StringifyMixin): class ClsRule(ofproto_parser.StringifyMixin): """describe a matching rule for OF 1.0 OFPMatch (and NX). """ + def __init__(self, **kwargs): self.wc = FlowWildcards() self.flow = Flow() @@ -399,6 +400,7 @@ class ClsRule(ofproto_parser.StringifyMixin): def _set_nxm_headers(nxm_headers): '''Annotate corresponding NXM header''' + def _set_nxm_headers_dec(self): self.nxm_headers = nxm_headers return self diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index c2a25988..bfc55512 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -202,6 +202,7 @@ class OFPMatch(StringifyMixin): ... '192.168.0.1' """ + def __init__(self, wildcards=None, in_port=None, dl_src=None, dl_dst=None, dl_vlan=None, dl_vlan_pcp=None, dl_type=None, nw_tos=None, nw_proto=None, nw_src=None, nw_dst=None, @@ -420,6 +421,7 @@ class OFPActionOutput(OFPAction): is because there is no good constant in of1.0. The same value as OFPCML_MAX of of1.2 and of1.3 is used. """ + def __init__(self, port, max_len=0xffe5): super(OFPActionOutput, self).__init__() self.port = port @@ -452,6 +454,7 @@ class OFPActionVlanVid(OFPAction): vlan_vid VLAN id. ================ ====================================================== """ + def __init__(self, vlan_vid): super(OFPActionVlanVid, self).__init__() self.vlan_vid = vlan_vid @@ -483,6 +486,7 @@ class OFPActionVlanPcp(OFPAction): vlan_pcp VLAN priority. ================ ====================================================== """ + def __init__(self, vlan_pcp): super(OFPActionVlanPcp, self).__init__() self.vlan_pcp = vlan_pcp @@ -508,6 +512,7 @@ class OFPActionStripVlan(OFPAction): This action indicates the 802.1q priority to be striped. """ + def __init__(self): super(OFPActionStripVlan, self).__init__() @@ -564,6 +569,7 @@ class OFPActionSetDlSrc(OFPActionDlAddr): dl_addr Ethernet address. ================ ====================================================== """ + def __init__(self, dl_addr): super(OFPActionSetDlSrc, self).__init__(dl_addr) @@ -582,6 +588,7 @@ class OFPActionSetDlDst(OFPActionDlAddr): dl_addr Ethernet address. ================ ====================================================== """ + def __init__(self, dl_addr): super(OFPActionSetDlDst, self).__init__(dl_addr) @@ -629,6 +636,7 @@ class OFPActionSetNwSrc(OFPActionNwAddr): nw_addr IP address. ================ ====================================================== """ + def __init__(self, nw_addr): super(OFPActionSetNwSrc, self).__init__(nw_addr) @@ -647,6 +655,7 @@ class OFPActionSetNwDst(OFPActionNwAddr): nw_addr IP address. ================ ====================================================== """ + def __init__(self, nw_addr): super(OFPActionSetNwDst, self).__init__(nw_addr) @@ -665,6 +674,7 @@ class OFPActionSetNwTos(OFPAction): tos IP ToS (DSCP field, 6 bits). ================ ====================================================== """ + def __init__(self, tos): super(OFPActionSetNwTos, self).__init__() self.tos = tos @@ -715,6 +725,7 @@ class OFPActionSetTpSrc(OFPActionTpPort): tp TCP/UDP port. ================ ====================================================== """ + def __init__(self, tp): super(OFPActionSetTpSrc, self).__init__(tp) @@ -733,6 +744,7 @@ class OFPActionSetTpDst(OFPActionTpPort): tp TCP/UDP port. ================ ====================================================== """ + def __init__(self, tp): super(OFPActionSetTpDst, self).__init__(tp) @@ -752,6 +764,7 @@ class OFPActionEnqueue(OFPAction): queue_id Where to enqueue the packets. ================ ====================================================== """ + def __init__(self, port, queue_id): super(OFPActionEnqueue, self).__init__() self.port = port @@ -1150,6 +1163,7 @@ class OFPPacketQueue(StringifyMixin): properties List of ``OFPQueueProp*`` instance. ========== ========================================================= """ + def __init__(self, queue_id, len_): self.queue_id = queue_id self.len = len_ @@ -1192,6 +1206,7 @@ class OFPHello(MsgBase): This message is handled by the Ryu framework, so the Ryu application do not need to process this typically. """ + def __init__(self, datapath): super(OFPHello, self).__init__(datapath) @@ -1238,6 +1253,7 @@ class OFPErrorMsg(MsgBase): 'message=%s', msg.type, msg.code, utils.hex_array(msg.data)) """ + def __init__(self, datapath, type_=None, code=None, data=None): super(OFPErrorMsg, self).__init__(datapath) self.type = type_ @@ -1284,6 +1300,7 @@ class OFPEchoRequest(MsgBase): req = ofp_parser.OFPEchoRequest(datapath, data) datapath.send_msg(req) """ + def __init__(self, datapath, data=None): super(OFPEchoRequest, self).__init__(datapath) self.data = data @@ -1323,6 +1340,7 @@ class OFPEchoReply(MsgBase): self.logger.debug('OFPEchoReply received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoReply, self).__init__(datapath) self.data = data @@ -1686,6 +1704,7 @@ class OFPSwitchFeatures(MsgBase): msg.datapath_id, msg.n_buffers, msg.n_tables, msg.capabilities, msg.ports) """ + def __init__(self, datapath, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None): super(OFPSwitchFeatures, self).__init__(datapath) @@ -1760,6 +1779,7 @@ class OFPPortStatus(MsgBase): self.logger.debug('OFPPortStatus received: reason=%s desc=%s', reason, msg.desc) """ + def __init__(self, datapath, reason=None, desc=None): super(OFPPortStatus, self).__init__(datapath) self.reason = reason @@ -1823,6 +1843,7 @@ class OFPPacketIn(MsgBase): msg.buffer_id, msg.total_len, msg.in_port, reason, utils.hex_array(msg.data)) """ + def __init__(self, datapath, buffer_id=None, total_len=None, in_port=None, reason=None, data=None): super(OFPPacketIn, self).__init__(datapath) @@ -1893,6 +1914,7 @@ class OFPGetConfigReply(MsgBase): 'flags=%s miss_send_len=%d', flags, msg.miss_send_len) """ + def __init__(self, datapath): super(OFPGetConfigReply, self).__init__(datapath) @@ -1920,6 +1942,7 @@ class OFPBarrierReply(MsgBase): def barrier_reply_handler(self, ev): self.logger.debug('OFPBarrierReply received') """ + def __init__(self, datapath): super(OFPBarrierReply, self).__init__(datapath) @@ -1980,6 +2003,7 @@ class OFPFlowRemoved(MsgBase): msg.idle_timeout, msg.packet_count, msg.byte_count) """ + def __init__(self, datapath): super(OFPFlowRemoved, self).__init__(datapath) @@ -2029,6 +2053,7 @@ class OFPQueueGetConfigReply(MsgBase): 'port=%s queues=%s', msg.port, msg.queues) """ + def __init__(self, datapath): super(OFPQueueGetConfigReply, self).__init__(datapath) @@ -2150,6 +2175,7 @@ class OFPDescStatsReply(OFPStatsReply): body.mfr_desc, body.hw_desc, body.sw_desc, body.serial_num, body.dp_desc) """ + def __init__(self, datapath): super(OFPDescStatsReply, self).__init__(datapath) @@ -2206,6 +2232,7 @@ class OFPFlowStatsReply(OFPStatsReply): stat.actions)) self.logger.debug('FlowStats: %s', flows) """ + def __init__(self, datapath): super(OFPFlowStatsReply, self).__init__(datapath) @@ -2241,6 +2268,7 @@ class OFPAggregateStatsReply(OFPStatsReply): body.packet_count, body.byte_count, body.flow_count) """ + def __init__(self, datapath): super(OFPAggregateStatsReply, self).__init__(datapath) @@ -2286,6 +2314,7 @@ class OFPTableStatsReply(OFPStatsReply): stat.lookup_count, stat.matched_count)) self.logger.debug('TableStats: %s', tables) """ + def __init__(self, datapath): super(OFPTableStatsReply, self).__init__(datapath) @@ -2344,6 +2373,7 @@ class OFPPortStatsReply(OFPStatsReply): stat.rx_crc_err, stat.collisions)) self.logger.debug('PortStats: %s', ports) """ + def __init__(self, datapath): super(OFPPortStatsReply, self).__init__(datapath) @@ -2384,6 +2414,7 @@ class OFPQueueStatsReply(OFPStatsReply): stat.tx_bytes, stat.tx_packets, stat.tx_errors)) self.logger.debug('QueueStats: %s', queues) """ + def __init__(self, datapath): super(OFPQueueStatsReply, self).__init__(datapath) @@ -2527,6 +2558,7 @@ class OFPFeaturesRequest(MsgBase): req = ofp_parser.OFPFeaturesRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPFeaturesRequest, self).__init__(datapath) @@ -2547,6 +2579,7 @@ class OFPGetConfigRequest(MsgBase): req = ofp_parser.OFPGetConfigRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetConfigRequest, self).__init__(datapath) @@ -2581,6 +2614,7 @@ class OFPSetConfig(MsgBase): req = ofp_parser.OFPSetConfig(datapath, ofp.OFPC_FRAG_NORMAL, 256) datapath.send_msg(req) """ + def __init__(self, datapath, flags=None, miss_send_len=None): super(OFPSetConfig, self).__init__(datapath) self.flags = flags @@ -2625,6 +2659,7 @@ class OFPPacketOut(MsgBase): in_port, actions) datapath.send_msg(req) """ + def __init__(self, datapath, buffer_id=None, in_port=None, actions=None, data=None): super(OFPPacketOut, self).__init__(datapath) @@ -2733,6 +2768,7 @@ class OFPFlowMod(MsgBase): priority, buffer_id, out_port, flags, actions) datapath.send_msg(req) """ + def __init__(self, datapath, match=None, cookie=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, @@ -2890,6 +2926,7 @@ class OFPBarrierRequest(MsgBase): req = ofp_parser.OFPBarrierRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPBarrierRequest, self).__init__(datapath) @@ -2917,6 +2954,7 @@ class OFPQueueGetConfigRequest(MsgBase): ofp.OFPP_NONE) datapath.send_msg(req) """ + def __init__(self, datapath, port): super(OFPQueueGetConfigRequest, self).__init__(datapath) self.port = port @@ -2967,6 +3005,7 @@ class OFPDescStatsRequest(OFPStatsRequest): req = ofp_parser.OFPDescStatsRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath, flags): super(OFPDescStatsRequest, self).__init__(datapath, flags) @@ -3022,6 +3061,7 @@ class OFPFlowStatsRequest(OFPFlowStatsRequestBase): datapath.send_msg(req) """ + def __init__(self, datapath, flags, match, table_id, out_port): super(OFPFlowStatsRequest, self).__init__( datapath, flags, match, table_id, out_port) @@ -3061,6 +3101,7 @@ class OFPAggregateStatsRequest(OFPFlowStatsRequestBase): datapath.send_msg(req) """ + def __init__(self, datapath, flags, match, table_id, out_port): super(OFPAggregateStatsRequest, self).__init__( datapath, flags, match, table_id, out_port) @@ -3089,6 +3130,7 @@ class OFPTableStatsRequest(OFPStatsRequest): req = ofp_parser.OFPTableStatsRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath, flags): super(OFPTableStatsRequest, self).__init__(datapath, flags) @@ -3119,6 +3161,7 @@ class OFPPortStatsRequest(OFPStatsRequest): req = ofp_parser.OFPPortStatsRequest(datapath, 0, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, flags, port_no): super(OFPPortStatsRequest, self).__init__(datapath, flags) self.port_no = port_no @@ -3155,6 +3198,7 @@ class OFPQueueStatsRequest(OFPStatsRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags, port_no, queue_id): super(OFPQueueStatsRequest, self).__init__(datapath, flags) self.port_no = port_no @@ -3176,6 +3220,7 @@ class OFPVendorStatsRequest(OFPStatsRequest): The controller uses this message to query vendor-specific information of a switch. """ + def __init__(self, datapath, flags, vendor, specific_data=None): super(OFPVendorStatsRequest, self).__init__(datapath, flags) self.vendor = vendor diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 9758c26d..9b4dda4b 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -72,6 +72,7 @@ class OFPHello(MsgBase): This message is handled by the Ryu framework, so the Ryu application do not need to process this typically. """ + def __init__(self, datapath): super(OFPHello, self).__init__(datapath) @@ -135,6 +136,7 @@ class OFPErrorMsg(MsgBase): 'message=%s', msg.type, msg.code, utils.hex_array(msg.data)) """ + def __init__(self, datapath, type_=None, code=None, data=None, **kwargs): super(OFPErrorMsg, self).__init__(datapath) self.type = type_ @@ -227,6 +229,7 @@ class OFPEchoRequest(MsgBase): self.logger.debug('OFPEchoRequest received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoRequest, self).__init__(datapath) self.data = data @@ -272,6 +275,7 @@ class OFPEchoReply(MsgBase): self.logger.debug('OFPEchoReply received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoReply, self).__init__(datapath) self.data = data @@ -302,6 +306,7 @@ class OFPExperimenter(MsgBase): data Experimenter defined arbitrary additional data ============= ========================================================= """ + def __init__(self, datapath, experimenter=None, exp_type=None, data=None): super(OFPExperimenter, self).__init__(datapath) self.experimenter = experimenter @@ -402,6 +407,7 @@ class OFPFeaturesRequest(MsgBase): req = ofp_parser.OFPFeaturesRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPFeaturesRequest, self).__init__(datapath) @@ -430,6 +436,7 @@ class OFPSwitchFeatures(MsgBase): msg.datapath_id, msg.n_buffers, msg.n_tables, msg.capabilities, msg.ports) """ + def __init__(self, datapath, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, ports=None): super(OFPSwitchFeatures, self).__init__(datapath) @@ -479,6 +486,7 @@ class OFPGetConfigRequest(MsgBase): req = ofp_parser.OFPGetConfigRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetConfigRequest, self).__init__(datapath) @@ -530,6 +538,7 @@ class OFPGetConfigReply(MsgBase): 'flags=%s miss_send_len=%d', flags, msg.miss_send_len) """ + def __init__(self, datapath, flags=None, miss_send_len=None): super(OFPGetConfigReply, self).__init__(datapath) self.flags = flags @@ -576,6 +585,7 @@ class OFPSetConfig(MsgBase): req = ofp_parser.OFPSetConfig(datapath, ofp.OFPC_FRAG_NORMAL, 256) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, miss_send_len=0): super(OFPSetConfig, self).__init__(datapath) self.flags = flags @@ -637,6 +647,7 @@ class OFPPacketIn(MsgBase): msg.table_id, msg.match, utils.hex_array(msg.data)) """ + def __init__(self, datapath, buffer_id=None, total_len=None, reason=None, table_id=None, match=None, data=None): super(OFPPacketIn, self).__init__(datapath) @@ -729,6 +740,7 @@ class OFPFlowRemoved(MsgBase): msg.idle_timeout, msg.hard_timeout, msg.packet_count, msg.byte_count, msg.match) """ + def __init__(self, datapath, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, @@ -806,6 +818,7 @@ class OFPPortStatus(MsgBase): self.logger.debug('OFPPortStatus received: reason=%s desc=%s', reason, msg.desc) """ + def __init__(self, datapath, reason=None, desc=None): super(OFPPortStatus, self).__init__(datapath) self.reason = reason @@ -852,6 +865,7 @@ class OFPPacketOut(MsgBase): in_port, actions) datapath.send_msg(req) """ + def __init__(self, datapath, buffer_id=None, in_port=None, actions=None, data=None, actions_len=None): # The in_port field is the ingress port that must be associated @@ -967,6 +981,7 @@ class OFPFlowMod(MsgBase): match, inst) datapath.send_msg(req) """ + def __init__(self, datapath, cookie=0, cookie_mask=0, table_id=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, priority=0, @@ -1070,6 +1085,7 @@ class OFPInstructionGotoTable(OFPInstruction): table_id Next table ================ ====================================================== """ + def __init__(self, table_id, type_=None, len_=None): super(OFPInstructionGotoTable, self).__init__() self.type = ofproto.OFPIT_GOTO_TABLE @@ -1102,6 +1118,7 @@ class OFPInstructionWriteMetadata(OFPInstruction): metadata_mask Metadata write bitmask ================ ====================================================== """ + def __init__(self, metadata, metadata_mask, type_=None, len_=None): super(OFPInstructionWriteMetadata, self).__init__() self.type = ofproto.OFPIT_WRITE_METADATA @@ -1144,6 +1161,7 @@ class OFPInstructionActions(OFPInstruction): ``type`` attribute corresponds to ``type_`` parameter of __init__. """ + def __init__(self, type_, actions=None, len_=None): super(OFPInstructionActions, self).__init__() self.type = type_ @@ -1242,6 +1260,7 @@ class OFPActionOutput(OFPAction): max_len Max length to send to controller ================ ====================================================== """ + def __init__(self, port, max_len=ofproto.OFPCML_MAX, type_=None, len_=None): super(OFPActionOutput, self).__init__() @@ -1273,6 +1292,7 @@ class OFPActionGroup(OFPAction): group_id Group identifier ================ ====================================================== """ + def __init__(self, group_id=0, type_=None, len_=None): super(OFPActionGroup, self).__init__() self.group_id = group_id @@ -1303,6 +1323,7 @@ class OFPActionSetQueue(OFPAction): queue_id Queue ID for the packets ================ ====================================================== """ + def __init__(self, queue_id, type_=None, len_=None): super(OFPActionSetQueue, self).__init__() self.queue_id = queue_id @@ -1332,6 +1353,7 @@ class OFPActionSetMplsTtl(OFPAction): mpls_ttl MPLS TTL ================ ====================================================== """ + def __init__(self, mpls_ttl, type_=None, len_=None): super(OFPActionSetMplsTtl, self).__init__() self.mpls_ttl = mpls_ttl @@ -1355,6 +1377,7 @@ class OFPActionDecMplsTtl(OFPAction): This action decrements the MPLS TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecMplsTtl, self).__init__() @@ -1379,6 +1402,7 @@ class OFPActionSetNwTtl(OFPAction): nw_ttl IP TTL ================ ====================================================== """ + def __init__(self, nw_ttl, type_=None, len_=None): super(OFPActionSetNwTtl, self).__init__() self.nw_ttl = nw_ttl @@ -1402,6 +1426,7 @@ class OFPActionDecNwTtl(OFPAction): This action decrements the IP TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecNwTtl, self).__init__() @@ -1421,6 +1446,7 @@ class OFPActionCopyTtlOut(OFPAction): This action copies the TTL from the next-to-outermost header with TTL to the outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlOut, self).__init__() @@ -1440,6 +1466,7 @@ class OFPActionCopyTtlIn(OFPAction): This action copies the TTL from the outermost header with TTL to the next-to-outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlIn, self).__init__() @@ -1464,6 +1491,7 @@ class OFPActionPushVlan(OFPAction): ethertype Ether type. The default is 802.1Q. (0x8100) ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_8021Q, type_=None, len_=None): super(OFPActionPushVlan, self).__init__() self.ethertype = ethertype @@ -1493,6 +1521,7 @@ class OFPActionPushMpls(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_MPLS, type_=None, len_=None): super(OFPActionPushMpls, self).__init__() self.ethertype = ethertype @@ -1516,6 +1545,7 @@ class OFPActionPopVlan(OFPAction): This action pops the outermost VLAN tag from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopVlan, self).__init__() @@ -1534,6 +1564,7 @@ class OFPActionPopMpls(OFPAction): This action pops the MPLS header from the packet. """ + def __init__(self, ethertype=ether.ETH_TYPE_IP, type_=None, len_=None): super(OFPActionPopMpls, self).__init__() self.ethertype = ethertype @@ -1563,6 +1594,7 @@ class OFPActionSetField(OFPAction): set_field = OFPActionSetField(eth_src="00:00:00:00:00:00") """ + def __init__(self, field=None, **kwargs): # old api # OFPActionSetField(field) @@ -1683,6 +1715,7 @@ class OFPActionExperimenter(OFPAction): For the list of the supported Nicira experimenter actions, please refer to :ref:`ryu.ofproto.nx_actions <nx_actions_structures>`. """ + def __init__(self, experimenter, type_=None, len_=None): super(OFPActionExperimenter, self).__init__() self.experimenter = experimenter @@ -1789,6 +1822,7 @@ class OFPGroupMod(MsgBase): ofp.OFPGT_SELECT, group_id, buckets) datapath.send_msg(req) """ + def __init__(self, datapath, command=ofproto.OFPGC_ADD, type_=ofproto.OFPGT_ALL, group_id=0, buckets=None): buckets = buckets if buckets else [] @@ -1921,6 +1955,7 @@ class OFPTableMod(MsgBase): ofp.OFPTC_TABLE_MISS_DROP) datapath.send_msg(req) """ + def __init__(self, datapath, table_id, config): super(OFPTableMod, self).__init__(datapath) self.table_id = table_id @@ -2020,6 +2055,7 @@ class OFPDescStatsRequest(OFPStatsRequest): req = ofp_parser.OFPDescStatsRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0): super(OFPDescStatsRequest, self).__init__(datapath, ofproto.OFPST_DESC, @@ -2120,6 +2156,7 @@ class OFPFlowStatsRequest(OFPStatsRequest): cookie, cookie_mask, match) datapath.send_msg(req) """ + def __init__(self, datapath, table_id=ofproto.OFPTT_ALL, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, @@ -2202,6 +2239,7 @@ class OFPFlowStats(StringifyMixin): stat.match, stat.instructions)) self.logger.debug('FlowStats: %s', flows) """ + def __init__(self, table_id, duration_sec, duration_nsec, priority, idle_timeout, hard_timeout, cookie, packet_count, byte_count, match, instructions=None, length=None): @@ -2286,6 +2324,7 @@ class OFPAggregateStatsRequest(OFPStatsRequest): match) datapath.send_msg(req) """ + def __init__(self, datapath, table_id=ofproto.OFPTT_ALL, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPP_ANY, @@ -2384,6 +2423,7 @@ class OFPTableStatsRequest(OFPStatsRequest): req = ofp_parser.OFPTableStatsRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0): super(OFPTableStatsRequest, self).__init__(datapath, ofproto.OFPST_TABLE, @@ -2499,6 +2539,7 @@ class OFPPortStatsRequest(OFPStatsRequest): req = ofp_parser.OFPPortStatsRequest(datapath, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, port_no=ofproto.OFPP_ANY, flags=0): super(OFPPortStatsRequest, self).__init__(datapath, ofproto.OFPST_PORT, @@ -2608,6 +2649,7 @@ class OFPQueueStatsRequest(OFPStatsRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, port_no=ofproto.OFPP_ANY, queue_id=ofproto.OFPQ_ALL, flags=0): super(OFPQueueStatsRequest, self).__init__(datapath, @@ -2710,6 +2752,7 @@ class OFPGroupStatsRequest(OFPStatsRequest): req = ofp_parser.OFPGroupStatsRequest(datapath, ofp.OFPG_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, group_id=ofproto.OFPG_ALL, flags=0): super(OFPGroupStatsRequest, self).__init__(datapath, ofproto.OFPST_GROUP, @@ -2815,6 +2858,7 @@ class OFPGroupDescStatsRequest(OFPStatsRequest): req = ofp_parser.OFPGroupDescStatsRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0): super(OFPGroupDescStatsRequest, self).__init__( datapath, @@ -2858,6 +2902,7 @@ class OFPGroupDescStats(StringifyMixin): (stat.type, stat.group_id, stat.buckets)) self.logger.debug('GroupDescStats: %s', descs) """ + def __init__(self, type_, group_id, buckets, length=None): self.type = type_ self.group_id = group_id @@ -2905,6 +2950,7 @@ class OFPGroupFeaturesStatsRequest(OFPStatsRequest): req = ofp_parser.OFPGroupFeaturesStatsRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0): super(OFPGroupFeaturesStatsRequest, self).__init__( datapath, @@ -2948,6 +2994,7 @@ class OFPGroupFeaturesStats(StringifyMixin): body.types, body.capabilities, body.max_groups, body.actions) """ + def __init__(self, types, capabilities, max_groups, actions, length=None): self.types = types self.capabilities = capabilities @@ -2988,6 +3035,7 @@ class OFPQueueGetConfigRequest(MsgBase): req = ofp_parser.OFPQueueGetConfigRequest(datapath, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, port): super(OFPQueueGetConfigRequest, self).__init__(datapath) self.port = port @@ -3112,6 +3160,7 @@ class OFPQueueGetConfigReply(MsgBase): 'port=%s queues=%s', msg.port, msg.queues) """ + def __init__(self, datapath, port=None, queues=None): super(OFPQueueGetConfigReply, self).__init__(datapath) self.port = port @@ -3155,6 +3204,7 @@ class OFPBarrierRequest(MsgBase): req = ofp_parser.OFPBarrierRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPBarrierRequest, self).__init__(datapath) @@ -3173,6 +3223,7 @@ class OFPBarrierReply(MsgBase): def barrier_reply_handler(self, ev): self.logger.debug('OFPBarrierReply received') """ + def __init__(self, datapath): super(OFPBarrierReply, self).__init__(datapath) @@ -3205,6 +3256,7 @@ class OFPRoleRequest(MsgBase): req = ofp_parser.OFPRoleRequest(datapath, ofp.OFPCR_ROLE_EQUAL, 0) datapath.send_msg(req) """ + def __init__(self, datapath, role, generation_id): super(OFPRoleRequest, self).__init__(datapath) self.role = role @@ -3259,6 +3311,7 @@ class OFPRoleReply(MsgBase): 'role=%s generation_id=%d', role, msg.generation_id) """ + def __init__(self, datapath, role=None, generation_id=None): super(OFPRoleReply, self).__init__(datapath) self.role = role diff --git a/ryu/ofproto/ofproto_v1_3_parser.py b/ryu/ofproto/ofproto_v1_3_parser.py index 48b2513b..7730aa12 100644 --- a/ryu/ofproto/ofproto_v1_3_parser.py +++ b/ryu/ofproto/ofproto_v1_3_parser.py @@ -112,6 +112,7 @@ class OFPHello(MsgBase): elements list of ``OFPHelloElemVersionBitmap`` instance ========== ========================================================= """ + def __init__(self, datapath, elements=None): elements = elements if elements else [] super(OFPHello, self).__init__(datapath) @@ -150,6 +151,7 @@ class OFPHelloElemVersionBitmap(StringifyMixin): versions list of versions of OpenFlow protocol a device supports ========== ========================================================= """ + def __init__(self, versions, type_=None, length=None): super(OFPHelloElemVersionBitmap, self).__init__() self.type = ofproto.OFPHET_VERSIONBITMAP @@ -244,6 +246,7 @@ class OFPErrorMsg(MsgBase): 'message=%s', msg.type, msg.code, utils.hex_array(msg.data)) """ + def __init__(self, datapath, type_=None, code=None, data=None, **kwargs): super(OFPErrorMsg, self).__init__(datapath) self.type = type_ @@ -336,6 +339,7 @@ class OFPEchoRequest(MsgBase): self.logger.debug('OFPEchoRequest received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoRequest, self).__init__(datapath) self.data = data @@ -381,6 +385,7 @@ class OFPEchoReply(MsgBase): self.logger.debug('OFPEchoReply received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoReply, self).__init__(datapath) self.data = data @@ -465,6 +470,7 @@ class OFPFeaturesRequest(MsgBase): req = ofp_parser.OFPFeaturesRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPFeaturesRequest, self).__init__(datapath) @@ -494,6 +500,7 @@ class OFPSwitchFeatures(MsgBase): msg.datapath_id, msg.n_buffers, msg.n_tables, msg.auxiliary_id, msg.capabilities) """ + def __init__(self, datapath, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None): super(OFPSwitchFeatures, self).__init__(datapath) @@ -534,6 +541,7 @@ class OFPGetConfigRequest(MsgBase): req = ofp_parser.OFPGetConfigRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetConfigRequest, self).__init__(datapath) @@ -579,6 +587,7 @@ class OFPGetConfigReply(MsgBase): 'flags=%s miss_send_len=%d', ','.join(flags), msg.miss_send_len) """ + def __init__(self, datapath, flags=None, miss_send_len=None): super(OFPGetConfigReply, self).__init__(datapath) self.flags = flags @@ -623,6 +632,7 @@ class OFPSetConfig(MsgBase): req = ofp_parser.OFPSetConfig(datapath, ofp.OFPC_FRAG_NORMAL, 256) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, miss_send_len=0): super(OFPSetConfig, self).__init__(datapath) self.flags = flags @@ -2295,6 +2305,7 @@ class OFPPacketIn(MsgBase): msg.table_id, msg.cookie, msg.match, utils.hex_array(msg.data)) """ + def __init__(self, datapath, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): super(OFPPacketIn, self).__init__(datapath) @@ -2388,6 +2399,7 @@ class OFPFlowRemoved(MsgBase): msg.idle_timeout, msg.hard_timeout, msg.packet_count, msg.byte_count, msg.match) """ + def __init__(self, datapath, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, @@ -2522,6 +2534,7 @@ class OFPPortStatus(MsgBase): self.logger.debug('OFPPortStatus received: reason=%s desc=%s', reason, msg.desc) """ + def __init__(self, datapath, reason=None, desc=None): super(OFPPortStatus, self).__init__(datapath) self.reason = reason @@ -2568,6 +2581,7 @@ class OFPPacketOut(MsgBase): in_port, actions) datapath.send_msg(req) """ + def __init__(self, datapath, buffer_id=None, in_port=None, actions=None, data=None, actions_len=None): assert in_port is not None @@ -2683,6 +2697,7 @@ class OFPFlowMod(MsgBase): match, inst) datapath.send_msg(req) """ + def __init__(self, datapath, cookie=0, cookie_mask=0, table_id=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, @@ -2804,6 +2819,7 @@ class OFPInstructionGotoTable(OFPInstruction): table_id Next table ================ ====================================================== """ + def __init__(self, table_id, type_=None, len_=None): super(OFPInstructionGotoTable, self).__init__() self.type = ofproto.OFPIT_GOTO_TABLE @@ -2836,6 +2852,7 @@ class OFPInstructionWriteMetadata(OFPInstruction): metadata_mask Metadata write bitmask ================ ====================================================== """ + def __init__(self, metadata, metadata_mask, type_=None, len_=None): super(OFPInstructionWriteMetadata, self).__init__() self.type = ofproto.OFPIT_WRITE_METADATA @@ -2878,6 +2895,7 @@ class OFPInstructionActions(OFPInstruction): ``type`` attribute corresponds to ``type_`` parameter of __init__. """ + def __init__(self, type_, actions=None, len_=None): super(OFPInstructionActions, self).__init__() self.type = type_ @@ -3011,6 +3029,7 @@ class OFPActionOutput(OFPAction): max_len Max length to send to controller ================ ====================================================== """ + def __init__(self, port, max_len=ofproto.OFPCML_MAX, type_=None, len_=None): super(OFPActionOutput, self).__init__() @@ -3042,6 +3061,7 @@ class OFPActionGroup(OFPAction): group_id Group identifier ================ ====================================================== """ + def __init__(self, group_id=0, type_=None, len_=None): super(OFPActionGroup, self).__init__() self.group_id = group_id @@ -3072,6 +3092,7 @@ class OFPActionSetQueue(OFPAction): queue_id Queue ID for the packets ================ ====================================================== """ + def __init__(self, queue_id, type_=None, len_=None): super(OFPActionSetQueue, self).__init__() self.queue_id = queue_id @@ -3101,6 +3122,7 @@ class OFPActionSetMplsTtl(OFPAction): mpls_ttl MPLS TTL ================ ====================================================== """ + def __init__(self, mpls_ttl, type_=None, len_=None): super(OFPActionSetMplsTtl, self).__init__() self.mpls_ttl = mpls_ttl @@ -3124,6 +3146,7 @@ class OFPActionDecMplsTtl(OFPAction): This action decrements the MPLS TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecMplsTtl, self).__init__() @@ -3148,6 +3171,7 @@ class OFPActionSetNwTtl(OFPAction): nw_ttl IP TTL ================ ====================================================== """ + def __init__(self, nw_ttl, type_=None, len_=None): super(OFPActionSetNwTtl, self).__init__() self.nw_ttl = nw_ttl @@ -3171,6 +3195,7 @@ class OFPActionDecNwTtl(OFPAction): This action decrements the IP TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecNwTtl, self).__init__() @@ -3190,6 +3215,7 @@ class OFPActionCopyTtlOut(OFPAction): This action copies the TTL from the next-to-outermost header with TTL to the outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlOut, self).__init__() @@ -3209,6 +3235,7 @@ class OFPActionCopyTtlIn(OFPAction): This action copies the TTL from the outermost header with TTL to the next-to-outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlIn, self).__init__() @@ -3233,6 +3260,7 @@ class OFPActionPushVlan(OFPAction): ethertype Ether type. The default is 802.1Q. (0x8100) ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_8021Q, type_=None, len_=None): super(OFPActionPushVlan, self).__init__() self.ethertype = ethertype @@ -3262,6 +3290,7 @@ class OFPActionPushMpls(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_MPLS, type_=None, len_=None): super(OFPActionPushMpls, self).__init__() self.ethertype = ethertype @@ -3285,6 +3314,7 @@ class OFPActionPopVlan(OFPAction): This action pops the outermost VLAN tag from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopVlan, self).__init__() @@ -3303,6 +3333,7 @@ class OFPActionPopMpls(OFPAction): This action pops the MPLS header from the packet. """ + def __init__(self, ethertype=ether.ETH_TYPE_IP, type_=None, len_=None): super(OFPActionPopMpls, self).__init__() self.ethertype = ethertype @@ -3332,6 +3363,7 @@ class OFPActionSetField(OFPAction): set_field = OFPActionSetField(eth_src="00:00:00:00:00:00") """ + def __init__(self, field=None, **kwargs): # old api # OFPActionSetField(field) @@ -3447,6 +3479,7 @@ class OFPActionPushPbb(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype, type_=None, len_=None): super(OFPActionPushPbb, self).__init__() self.ethertype = ethertype @@ -3471,6 +3504,7 @@ class OFPActionPopPbb(OFPAction): This action pops the outermost PBB service instance header from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopPbb, self).__init__() @@ -3634,6 +3668,7 @@ class OFPGroupMod(MsgBase): ofp.OFPGT_SELECT, group_id, buckets) datapath.send_msg(req) """ + def __init__(self, datapath, command=ofproto.OFPGC_ADD, type_=ofproto.OFPGT_ALL, group_id=0, buckets=None): buckets = buckets if buckets else [] @@ -3766,6 +3801,7 @@ class OFPMeterMod(MsgBase): | OFPMeterBandExperimenter ================ ====================================================== """ + def __init__(self, datapath, command=ofproto.OFPMC_ADD, flags=ofproto.OFPMF_KBPS, meter_id=1, bands=None): bands = bands if bands else [] @@ -3809,6 +3845,7 @@ class OFPTableMod(MsgBase): req = ofp_parser.OFPTableMod(datapath, 1, 3) datapath.send_msg(req) """ + def __init__(self, datapath, table_id, config): super(OFPTableMod, self).__init__(datapath) self.table_id = table_id @@ -3958,6 +3995,7 @@ class OFPDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPDescStatsRequest, self).__init__(datapath, flags) @@ -3989,6 +4027,7 @@ class OFPDescStatsReply(OFPMultipartReply): body.mfr_desc, body.hw_desc, body.sw_desc, body.serial_num, body.dp_desc) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPDescStatsReply, self).__init__(datapath, **kwargs) @@ -4102,6 +4141,7 @@ class OFPFlowStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, table_id=ofproto.OFPTT_ALL, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, @@ -4149,6 +4189,7 @@ class OFPFlowStatsReply(OFPMultipartReply): stat.match, stat.instructions)) self.logger.debug('FlowStats: %s', flows) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPFlowStatsReply, self).__init__(datapath, **kwargs) @@ -4202,6 +4243,7 @@ class OFPAggregateStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags, table_id, out_port, out_group, cookie, cookie_mask, match, type_=None): super(OFPAggregateStatsRequest, self).__init__(datapath, @@ -4241,6 +4283,7 @@ class OFPAggregateStatsReply(OFPMultipartReply): body.packet_count, body.byte_count, body.flow_count) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPAggregateStatsReply, self).__init__(datapath, **kwargs) @@ -4279,6 +4322,7 @@ class OFPTableStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPTableStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPTableStatsRequest, self).__init__(datapath, flags) @@ -4310,6 +4354,7 @@ class OFPTableStatsReply(OFPMultipartReply): stat.lookup_count, stat.matched_count)) self.logger.debug('TableStats: %s', tables) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableStatsReply, self).__init__(datapath, **kwargs) @@ -4353,6 +4398,7 @@ class OFPPortStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortStatsRequest(datapath, 0, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, type_=None): super(OFPPortStatsRequest, self).__init__(datapath, flags) @@ -4403,6 +4449,7 @@ class OFPPortStatsReply(OFPMultipartReply): stat.duration_sec, stat.duration_nsec)) self.logger.debug('PortStats: %s', ports) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPPortStatsReply, self).__init__(datapath, **kwargs) @@ -4445,6 +4492,7 @@ class OFPQueueStatsRequest(OFPMultipartRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, queue_id=ofproto.OFPQ_ALL, type_=None): super(OFPQueueStatsRequest, self).__init__(datapath, flags) @@ -4488,6 +4536,7 @@ class OFPQueueStatsReply(OFPMultipartReply): stat.duration_sec, stat.duration_nsec)) self.logger.debug('QueueStats: %s', queues) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPQueueStatsReply, self).__init__(datapath, **kwargs) @@ -4561,6 +4610,7 @@ class OFPGroupStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupStatsRequest(datapath, 0, ofp.OFPG_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, group_id=ofproto.OFPG_ALL, type_=None): super(OFPGroupStatsRequest, self).__init__(datapath, flags) @@ -4603,6 +4653,7 @@ class OFPGroupStatsReply(OFPMultipartReply): stat.duration_nsec)) self.logger.debug('GroupStats: %s', groups) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupStatsReply, self).__init__(datapath, **kwargs) @@ -4656,6 +4707,7 @@ class OFPGroupDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPGroupDescStatsRequest, self).__init__(datapath, flags) @@ -4687,13 +4739,14 @@ class OFPGroupDescStatsReply(OFPMultipartReply): stat.bucket)) self.logger.debug('GroupDescStats: %s', descs) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupDescStatsReply, self).__init__(datapath, **kwargs) class OFPGroupFeaturesStats(ofproto_parser.namedtuple('OFPGroupFeaturesStats', - ('types', 'capabilities', 'max_groups', - 'actions'))): + ('types', 'capabilities', 'max_groups', + 'actions'))): @classmethod def parser(cls, buf, offset): group_features = struct.unpack_from( @@ -4730,6 +4783,7 @@ class OFPGroupFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPGroupFeaturesStatsRequest, self).__init__(datapath, flags) @@ -4761,6 +4815,7 @@ class OFPGroupFeaturesStatsReply(OFPMultipartReply): body.types, body.capabilities, body.max_groups, body.actions) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -4839,6 +4894,7 @@ class OFPMeterStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPMeterStatsRequest(datapath, 0, ofp.OFPM_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, meter_id=ofproto.OFPM_ALL, type_=None): super(OFPMeterStatsRequest, self).__init__(datapath, flags) @@ -4882,6 +4938,7 @@ class OFPMeterStatsReply(OFPMultipartReply): stat.band_stats)) self.logger.debug('MeterStats: %s', meters) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterStatsReply, self).__init__(datapath, **kwargs) @@ -5044,6 +5101,7 @@ class OFPMeterConfigStatsRequest(OFPMultipartRequest): ofp.OFPM_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, meter_id=ofproto.OFPM_ALL, type_=None): super(OFPMeterConfigStatsRequest, self).__init__(datapath, flags) @@ -5084,13 +5142,14 @@ class OFPMeterConfigStatsReply(OFPMultipartReply): stat.bands)) self.logger.debug('MeterConfigStats: %s', configs) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterConfigStatsReply, self).__init__(datapath, **kwargs) class OFPMeterFeaturesStats(ofproto_parser.namedtuple('OFPMeterFeaturesStats', - ('max_meter', 'band_types', 'capabilities', - 'max_bands', 'max_color'))): + ('max_meter', 'band_types', 'capabilities', + 'max_bands', 'max_color'))): @classmethod def parser(cls, buf, offset): meter_features = struct.unpack_from( @@ -5123,6 +5182,7 @@ class OFPMeterFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPMeterFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPMeterFeaturesStatsRequest, self).__init__(datapath, flags) @@ -5157,6 +5217,7 @@ class OFPMeterFeaturesStatsReply(OFPMultipartReply): stat.max_color)) self.logger.debug('MeterFeaturesStats: %s', features) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -5508,6 +5569,7 @@ class OFPTableFeaturesStatsRequest(OFPMultipartRequest): The default is []. ================ ====================================================== """ + def __init__(self, datapath, flags=0, body=None, type_=None): @@ -5538,6 +5600,7 @@ class OFPTableFeaturesStatsReply(OFPMultipartReply): body List of ``OFPTableFeaturesStats`` instance ================ ====================================================== """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -5564,6 +5627,7 @@ class OFPPortDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPPortDescStatsRequest, self).__init__(datapath, flags) @@ -5600,6 +5664,7 @@ class OFPPortDescStatsReply(OFPMultipartReply): p.max_speed)) self.logger.debug('OFPPortDescStatsReply received: %s', ports) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPPortDescStatsReply, self).__init__(datapath, **kwargs) @@ -5663,6 +5728,7 @@ class OFPExperimenterStatsRequest(OFPExperimenterStatsRequestBase): data Experimenter defined additional data ================ ====================================================== """ + def __init__(self, datapath, flags, experimenter, exp_type, data, type_=None): @@ -5727,6 +5793,7 @@ class ONFFlowMonitorStatsRequest(OFPExperimenterStatsRequestBase): body List of ONFFlowMonitorRequest instances ================ ====================================================== """ + def __init__(self, datapath, flags, body=None, type_=None, experimenter=None, exp_type=None): body = body if body else [] @@ -5759,6 +5826,7 @@ class OFPExperimenterStatsReply(OFPMultipartReply): body An ``OFPExperimenterMultipart`` instance ================ ====================================================== """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPExperimenterStatsReply, self).__init__(datapath, **kwargs) @@ -5779,6 +5847,7 @@ class OFPBarrierRequest(MsgBase): req = ofp_parser.OFPBarrierRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPBarrierRequest, self).__init__(datapath) @@ -5797,6 +5866,7 @@ class OFPBarrierReply(MsgBase): def barrier_reply_handler(self, ev): self.logger.debug('OFPBarrierReply received') """ + def __init__(self, datapath): super(OFPBarrierReply, self).__init__(datapath) @@ -5821,6 +5891,7 @@ class OFPQueueGetConfigRequest(MsgBase): req = ofp_parser.OFPQueueGetConfigRequest(datapath, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, port): super(OFPQueueGetConfigRequest, self).__init__(datapath) self.port = port @@ -5977,6 +6048,7 @@ class OFPQueueGetConfigReply(MsgBase): 'port=%s queues=%s', msg.port, msg.queues) """ + def __init__(self, datapath, queues=None, port=None): super(OFPQueueGetConfigReply, self).__init__(datapath) self.queues = queues @@ -6029,6 +6101,7 @@ class OFPRoleRequest(MsgBase): req = ofp_parser.OFPRoleRequest(datapath, ofp.OFPCR_ROLE_EQUAL, 0) datapath.send_msg(req) """ + def __init__(self, datapath, role=None, generation_id=None): super(OFPRoleRequest, self).__init__(datapath) self.role = role @@ -6085,6 +6158,7 @@ class OFPRoleReply(MsgBase): 'role=%s generation_id=%d', role, msg.generation_id) """ + def __init__(self, datapath, role=None, generation_id=None): super(OFPRoleReply, self).__init__(datapath) self.role = role @@ -6116,6 +6190,7 @@ class OFPGetAsyncRequest(MsgBase): req = ofp_parser.OFPGetAsyncRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetAsyncRequest, self).__init__(datapath) @@ -6172,6 +6247,7 @@ class OFPGetAsyncReply(MsgBase): msg.flow_removed_mask[0], msg.flow_removed_mask[1]) """ + def __init__(self, datapath, packet_in_mask=None, port_status_mask=None, flow_removed_mask=None): super(OFPGetAsyncReply, self).__init__(datapath) @@ -6248,6 +6324,7 @@ class OFPSetAsync(MsgBase): [flow_removed_mask, 0]) datapath.send_msg(req) """ + def __init__(self, datapath, packet_in_mask, port_status_mask, flow_removed_mask): super(OFPSetAsync, self).__init__(datapath) @@ -6303,6 +6380,7 @@ class ONFBundleCtrlMsg(OFPExperimenter): ofp.ONF_BF_ATOMIC, []) datapath.send_msg(req) """ + def __init__(self, datapath, bundle_id=None, type_=None, flags=None, properties=None): super(ONFBundleCtrlMsg, self).__init__( @@ -6370,6 +6448,7 @@ class ONFBundleAddMsg(OFPExperimenter): msg, []) datapath.send_msg(req) """ + def __init__(self, datapath, bundle_id, flags, message, properties): super(ONFBundleAddMsg, self).__init__( datapath, ofproto_common.ONF_EXPERIMENTER_ID, diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index a73ee7f2..fca35f57 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -76,6 +76,7 @@ class OFPHello(MsgBase): elements list of ``OFPHelloElemVersionBitmap`` instance ========== ========================================================= """ + def __init__(self, datapath, elements=None): elements = elements if elements else [] super(OFPHello, self).__init__(datapath) @@ -114,6 +115,7 @@ class OFPHelloElemVersionBitmap(StringifyMixin): versions list of versions of OpenFlow protocol a device supports ========== ========================================================= """ + def __init__(self, versions, type_=None, length=None): super(OFPHelloElemVersionBitmap, self).__init__() self.type = ofproto.OFPHET_VERSIONBITMAP @@ -177,6 +179,7 @@ class OFPEchoRequest(MsgBase): self.logger.debug('OFPEchoRequest received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoRequest, self).__init__(datapath) self.data = data @@ -254,6 +257,7 @@ class OFPErrorMsg(MsgBase): 'message=%s', msg.type, msg.code, utils.hex_array(msg.data)) """ + def __init__(self, datapath, type_=None, code=None, data=None, **kwargs): super(OFPErrorMsg, self).__init__(datapath) self.type = type_ @@ -346,6 +350,7 @@ class OFPEchoReply(MsgBase): self.logger.debug('OFPEchoReply received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoReply, self).__init__(datapath) self.data = data @@ -381,6 +386,7 @@ class OFPFeaturesRequest(MsgBase): req = ofp_parser.OFPFeaturesRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPFeaturesRequest, self).__init__(datapath) @@ -399,6 +405,7 @@ class OFPExperimenter(MsgBase): data Experimenter defined arbitrary additional data ============= ========================================================= """ + def __init__(self, datapath, experimenter=None, exp_type=None, data=None): super(OFPExperimenter, self).__init__(datapath) self.experimenter = experimenter @@ -450,6 +457,7 @@ class OFPSwitchFeatures(MsgBase): msg.datapath_id, msg.n_buffers, msg.n_tables, msg.auxiliary_id, msg.capabilities) """ + def __init__(self, datapath, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None): super(OFPSwitchFeatures, self).__init__(datapath) @@ -490,6 +498,7 @@ class OFPGetConfigRequest(MsgBase): req = ofp_parser.OFPGetConfigRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetConfigRequest, self).__init__(datapath) @@ -534,6 +543,7 @@ class OFPGetConfigReply(MsgBase): 'flags=%s miss_send_len=%d', ','.join(flags), msg.miss_send_len) """ + def __init__(self, datapath, flags=None, miss_send_len=None): super(OFPGetConfigReply, self).__init__(datapath) self.flags = flags @@ -578,6 +588,7 @@ class OFPSetConfig(MsgBase): req = ofp_parser.OFPSetConfig(datapath, ofp.OFPC_FRAG_NORMAL, 256) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, miss_send_len=0): super(OFPSetConfig, self).__init__(datapath) self.flags = flags @@ -1201,6 +1212,7 @@ class OFPPacketIn(MsgBase): msg.table_id, msg.cookie, msg.match, utils.hex_array(msg.data)) """ + def __init__(self, datapath, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): super(OFPPacketIn, self).__init__(datapath) @@ -1296,6 +1308,7 @@ class OFPFlowRemoved(MsgBase): msg.idle_timeout, msg.hard_timeout, msg.packet_count, msg.byte_count, msg.match) """ + def __init__(self, datapath, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, @@ -1497,6 +1510,7 @@ class OFPMeterMod(MsgBase): | OFPMeterBandExperimenter ================ ====================================================== """ + def __init__(self, datapath, command=ofproto.OFPMC_ADD, flags=ofproto.OFPMF_KBPS, meter_id=1, bands=None): bands = bands if bands else [] @@ -1564,6 +1578,7 @@ class OFPTableMod(MsgBase): req = ofp_parser.OFPTableMod(datapath, 1, 3, properties) datapath.send_msg(req) """ + def __init__(self, datapath, table_id, config, properties): super(OFPTableMod, self).__init__(datapath) self.table_id = table_id @@ -1695,6 +1710,7 @@ class OFPDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPDescStatsRequest, self).__init__(datapath, flags) @@ -1726,6 +1742,7 @@ class OFPDescStatsReply(OFPMultipartReply): body.mfr_desc, body.hw_desc, body.sw_desc, body.serial_num, body.dp_desc) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPDescStatsReply, self).__init__(datapath, **kwargs) @@ -2056,6 +2073,7 @@ class OFPTableFeaturesStatsRequest(OFPMultipartRequest): The default is []. ================ ====================================================== """ + def __init__(self, datapath, flags=0, body=None, type_=None): body = body if body else [] super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags) @@ -2084,6 +2102,7 @@ class OFPTableFeaturesStatsReply(OFPMultipartReply): body List of ``OFPTableFeaturesStats`` instance ================ ====================================================== """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -2110,6 +2129,7 @@ class OFPPortDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPPortDescStatsRequest, self).__init__(datapath, flags) @@ -2141,6 +2161,7 @@ class OFPPortDescStatsReply(OFPMultipartReply): p.name, p.config, p.state, repr(p.properties))) self.logger.debug('OFPPortDescStatsReply received: %s', ports) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPPortDescStatsReply, self).__init__(datapath, **kwargs) @@ -2167,6 +2188,7 @@ class OFPTableDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPTableDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPTableDescStatsRequest, self).__init__(datapath, flags) @@ -2196,6 +2218,7 @@ class OFPTableDescStatsReply(OFPMultipartReply): (p.table_id, p.config, repr(p.properties))) self.logger.debug('OFPTableDescStatsReply received: %s', tables) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableDescStatsReply, self).__init__(datapath, **kwargs) @@ -2226,6 +2249,7 @@ class OFPQueueDescStatsRequest(OFPMultipartRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, queue_id=ofproto.OFPQ_ALL, type_=None): super(OFPQueueDescStatsRequest, self).__init__(datapath, flags) @@ -2264,6 +2288,7 @@ class OFPQueueDescStatsReply(OFPMultipartReply): (q.port_no, q.queue_id, repr(q.properties))) self.logger.debug('OFPQueueDescStatsReply received: %s', queues) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPQueueDescStatsReply, self).__init__(datapath, **kwargs) @@ -2333,6 +2358,7 @@ class OFPQueueStatsRequest(OFPMultipartRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, queue_id=ofproto.OFPQ_ALL, type_=None): super(OFPQueueStatsRequest, self).__init__(datapath, flags) @@ -2378,6 +2404,7 @@ class OFPQueueStatsReply(OFPMultipartReply): repr(stat.properties))) self.logger.debug('QueueStats: %s', queues) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPQueueStatsReply, self).__init__(datapath, **kwargs) @@ -2451,6 +2478,7 @@ class OFPGroupStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupStatsRequest(datapath, 0, ofp.OFPG_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, group_id=ofproto.OFPG_ALL, type_=None): super(OFPGroupStatsRequest, self).__init__(datapath, flags) @@ -2493,6 +2521,7 @@ class OFPGroupStatsReply(OFPMultipartReply): stat.duration_nsec)) self.logger.debug('GroupStats: %s', groups) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupStatsReply, self).__init__(datapath, **kwargs) @@ -2547,6 +2576,7 @@ class OFPGroupDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPGroupDescStatsRequest, self).__init__(datapath, flags) @@ -2578,13 +2608,14 @@ class OFPGroupDescStatsReply(OFPMultipartReply): stat.bucket)) self.logger.debug('GroupDescStats: %s', descs) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupDescStatsReply, self).__init__(datapath, **kwargs) class OFPGroupFeaturesStats(ofproto_parser.namedtuple('OFPGroupFeaturesStats', - ('types', 'capabilities', 'max_groups', - 'actions'))): + ('types', 'capabilities', 'max_groups', + 'actions'))): @classmethod def parser(cls, buf, offset): group_features = struct.unpack_from( @@ -2621,6 +2652,7 @@ class OFPGroupFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPGroupFeaturesStatsRequest, self).__init__(datapath, flags) @@ -2652,6 +2684,7 @@ class OFPGroupFeaturesStatsReply(OFPMultipartReply): body.types, body.capabilities, body.max_groups, body.actions) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -2730,6 +2763,7 @@ class OFPMeterStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPMeterStatsRequest(datapath, 0, ofp.OFPM_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, meter_id=ofproto.OFPM_ALL, type_=None): super(OFPMeterStatsRequest, self).__init__(datapath, flags) @@ -2773,6 +2807,7 @@ class OFPMeterStatsReply(OFPMultipartReply): stat.band_stats)) self.logger.debug('MeterStats: %s', meters) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterStatsReply, self).__init__(datapath, **kwargs) @@ -2935,6 +2970,7 @@ class OFPMeterConfigStatsRequest(OFPMultipartRequest): ofp.OFPM_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, meter_id=ofproto.OFPM_ALL, type_=None): super(OFPMeterConfigStatsRequest, self).__init__(datapath, flags) @@ -2975,13 +3011,14 @@ class OFPMeterConfigStatsReply(OFPMultipartReply): stat.bands)) self.logger.debug('MeterConfigStats: %s', configs) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterConfigStatsReply, self).__init__(datapath, **kwargs) class OFPMeterFeaturesStats(ofproto_parser.namedtuple('OFPMeterFeaturesStats', - ('max_meter', 'band_types', 'capabilities', - 'max_bands', 'max_color'))): + ('max_meter', 'band_types', 'capabilities', + 'max_bands', 'max_color'))): @classmethod def parser(cls, buf, offset): meter_features = struct.unpack_from( @@ -3014,6 +3051,7 @@ class OFPMeterFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPMeterFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPMeterFeaturesStatsRequest, self).__init__(datapath, flags) @@ -3048,6 +3086,7 @@ class OFPMeterFeaturesStatsReply(OFPMultipartReply): stat.max_color)) self.logger.debug('MeterFeaturesStats: %s', features) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -3241,6 +3280,7 @@ class OFPFlowMonitorRequest(OFPFlowMonitorRequestBase): ofp.OFPFMC_ADD, match) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, monitor_id=0, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, monitor_flags=0, table_id=ofproto.OFPTT_ALL, @@ -3300,6 +3340,7 @@ class OFPFlowMonitorReply(OFPMultipartReply): flow_updates.append(update_str) self.logger.debug('FlowUpdates: %s', flow_updates) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPFlowMonitorReply, self).__init__(datapath, **kwargs) @@ -3363,6 +3404,7 @@ class OFPExperimenterStatsRequest(OFPExperimenterStatsRequestBase): data Experimenter defined additional data ================ ====================================================== """ + def __init__(self, datapath, flags, experimenter, exp_type, data, type_=None): @@ -3391,6 +3433,7 @@ class OFPExperimenterStatsReply(OFPMultipartReply): body An ``OFPExperimenterMultipart`` instance ================ ====================================================== """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPExperimenterStatsReply, self).__init__(datapath, **kwargs) @@ -3506,6 +3549,7 @@ class OFPFlowStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, table_id=ofproto.OFPTT_ALL, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, @@ -3554,6 +3598,7 @@ class OFPFlowStatsReply(OFPMultipartReply): stat.match, stat.instructions)) self.logger.debug('FlowStats: %s', flows) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPFlowStatsReply, self).__init__(datapath, **kwargs) @@ -3607,6 +3652,7 @@ class OFPAggregateStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags, table_id, out_port, out_group, cookie, cookie_mask, match, type_=None): super(OFPAggregateStatsRequest, self).__init__(datapath, @@ -3646,6 +3692,7 @@ class OFPAggregateStatsReply(OFPMultipartReply): body.packet_count, body.byte_count, body.flow_count) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPAggregateStatsReply, self).__init__(datapath, **kwargs) @@ -3684,6 +3731,7 @@ class OFPTableStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPTableStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags, type_=None): super(OFPTableStatsRequest, self).__init__(datapath, flags) @@ -3715,6 +3763,7 @@ class OFPTableStatsReply(OFPMultipartReply): stat.lookup_count, stat.matched_count)) self.logger.debug('TableStats: %s', tables) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableStatsReply, self).__init__(datapath, **kwargs) @@ -3844,6 +3893,7 @@ class OFPPortStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortStatsRequest(datapath, 0, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, flags, port_no, type_=None): super(OFPPortStatsRequest, self).__init__(datapath, flags) self.port_no = port_no @@ -3885,6 +3935,7 @@ class OFPPortStatsReply(OFPMultipartReply): repr(stat.properties)) self.logger.debug('PortStats: %s', ports) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPPortStatsReply, self).__init__(datapath, **kwargs) @@ -3905,6 +3956,7 @@ class OFPBarrierRequest(MsgBase): req = ofp_parser.OFPBarrierRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPBarrierRequest, self).__init__(datapath) @@ -3923,6 +3975,7 @@ class OFPBarrierReply(MsgBase): def barrier_reply_handler(self, ev): self.logger.debug('OFPBarrierReply received') """ + def __init__(self, datapath): super(OFPBarrierReply, self).__init__(datapath) @@ -3966,6 +4019,7 @@ class OFPPortStatus(MsgBase): self.logger.debug('OFPPortStatus received: reason=%s desc=%s', reason, msg.desc) """ + def __init__(self, datapath, reason=None, desc=None): super(OFPPortStatus, self).__init__(datapath) self.reason = reason @@ -4037,6 +4091,7 @@ class OFPRoleStatus(MsgBase): 'generation_id=%d properties=%s', role, reason, msg.generation_id, repr(msg.properties)) """ + def __init__(self, datapath, role=None, reason=None, generation_id=None, properties=None): super(OFPRoleStatus, self).__init__(datapath) @@ -4100,6 +4155,7 @@ class OFPTableStatus(MsgBase): reason, msg.table.table_id, msg.table.config, repr(msg.table.properties)) """ + def __init__(self, datapath, reason=None, table=None): super(OFPTableStatus, self).__init__(datapath) self.reason = reason @@ -4157,6 +4213,7 @@ class OFPRequestForward(MsgInMsgBase): self.logger.debug( 'OFPRequestForward received: request=Unknown') """ + def __init__(self, datapath, request=None): super(OFPRequestForward, self).__init__(datapath) self.request = request @@ -4206,6 +4263,7 @@ class OFPPacketOut(MsgBase): in_port, actions) datapath.send_msg(req) """ + def __init__(self, datapath, buffer_id=None, in_port=None, actions=None, data=None, actions_len=None): assert in_port is not None @@ -4324,6 +4382,7 @@ class OFPFlowMod(MsgBase): match, inst) datapath.send_msg(req) """ + def __init__(self, datapath, cookie=0, cookie_mask=0, table_id=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, @@ -4429,6 +4488,7 @@ class OFPInstructionGotoTable(OFPInstruction): table_id Next table ================ ====================================================== """ + def __init__(self, table_id, type_=None, len_=None): super(OFPInstructionGotoTable, self).__init__() self.type = ofproto.OFPIT_GOTO_TABLE @@ -4461,6 +4521,7 @@ class OFPInstructionWriteMetadata(OFPInstruction): metadata_mask Metadata write bitmask ================ ====================================================== """ + def __init__(self, metadata, metadata_mask, type_=None, len_=None): super(OFPInstructionWriteMetadata, self).__init__() self.type = ofproto.OFPIT_WRITE_METADATA @@ -4503,6 +4564,7 @@ class OFPInstructionActions(OFPInstruction): ``type`` attribute corresponds to ``type_`` parameter of __init__. """ + def __init__(self, type_, actions=None, len_=None): super(OFPInstructionActions, self).__init__() self.type = type_ @@ -4558,6 +4620,7 @@ class OFPInstructionMeter(OFPInstruction): meter_id Meter instance ================ ====================================================== """ + def __init__(self, meter_id=1, type_=None, len_=None): super(OFPInstructionMeter, self).__init__() self.type = ofproto.OFPIT_METER @@ -4627,6 +4690,7 @@ class OFPActionOutput(OFPAction): max_len Max length to send to controller ================ ====================================================== """ + def __init__(self, port, max_len=ofproto.OFPCML_MAX, type_=None, len_=None): super(OFPActionOutput, self).__init__() @@ -4658,6 +4722,7 @@ class OFPActionGroup(OFPAction): group_id Group identifier ================ ====================================================== """ + def __init__(self, group_id=0, type_=None, len_=None): super(OFPActionGroup, self).__init__() self.group_id = group_id @@ -4688,6 +4753,7 @@ class OFPActionSetQueue(OFPAction): queue_id Queue ID for the packets ================ ====================================================== """ + def __init__(self, queue_id, type_=None, len_=None): super(OFPActionSetQueue, self).__init__() self.queue_id = queue_id @@ -4717,6 +4783,7 @@ class OFPActionSetMplsTtl(OFPAction): mpls_ttl MPLS TTL ================ ====================================================== """ + def __init__(self, mpls_ttl, type_=None, len_=None): super(OFPActionSetMplsTtl, self).__init__() self.mpls_ttl = mpls_ttl @@ -4740,6 +4807,7 @@ class OFPActionDecMplsTtl(OFPAction): This action decrements the MPLS TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecMplsTtl, self).__init__() @@ -4764,6 +4832,7 @@ class OFPActionSetNwTtl(OFPAction): nw_ttl IP TTL ================ ====================================================== """ + def __init__(self, nw_ttl, type_=None, len_=None): super(OFPActionSetNwTtl, self).__init__() self.nw_ttl = nw_ttl @@ -4787,6 +4856,7 @@ class OFPActionDecNwTtl(OFPAction): This action decrements the IP TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecNwTtl, self).__init__() @@ -4806,6 +4876,7 @@ class OFPActionCopyTtlOut(OFPAction): This action copies the TTL from the next-to-outermost header with TTL to the outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlOut, self).__init__() @@ -4825,6 +4896,7 @@ class OFPActionCopyTtlIn(OFPAction): This action copies the TTL from the outermost header with TTL to the next-to-outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlIn, self).__init__() @@ -4849,6 +4921,7 @@ class OFPActionPushVlan(OFPAction): ethertype Ether type. The default is 802.1Q. (0x8100) ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_8021Q, type_=None, len_=None): super(OFPActionPushVlan, self).__init__() self.ethertype = ethertype @@ -4878,6 +4951,7 @@ class OFPActionPushMpls(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_MPLS, type_=None, len_=None): super(OFPActionPushMpls, self).__init__() self.ethertype = ethertype @@ -4901,6 +4975,7 @@ class OFPActionPopVlan(OFPAction): This action pops the outermost VLAN tag from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopVlan, self).__init__() @@ -4919,6 +4994,7 @@ class OFPActionPopMpls(OFPAction): This action pops the MPLS header from the packet. """ + def __init__(self, ethertype=ether.ETH_TYPE_IP, type_=None, len_=None): super(OFPActionPopMpls, self).__init__() self.ethertype = ethertype @@ -4948,6 +5024,7 @@ class OFPActionSetField(OFPAction): set_field = OFPActionSetField(eth_src="00:00:00:00:00:00") """ + def __init__(self, field=None, **kwargs): super(OFPActionSetField, self).__init__() assert len(kwargs) == 1 @@ -5008,6 +5085,7 @@ class OFPActionPushPbb(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype, type_=None, len_=None): super(OFPActionPushPbb, self).__init__() self.ethertype = ethertype @@ -5032,6 +5110,7 @@ class OFPActionPopPbb(OFPAction): This action pops the outermost PBB service instance header from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopPbb, self).__init__() @@ -5062,6 +5141,7 @@ class OFPActionExperimenter(OFPAction): For the list of the supported Nicira experimenter actions, please refer to :ref:`ryu.ofproto.nx_actions <nx_actions_structures>`. """ + def __init__(self, experimenter): super(OFPActionExperimenter, self).__init__() self.type = ofproto.OFPAT_EXPERIMENTER @@ -5155,6 +5235,7 @@ class OFPGroupMod(MsgBase): ofp.OFPGT_SELECT, group_id, buckets) datapath.send_msg(req) """ + def __init__(self, datapath, command=ofproto.OFPGC_ADD, type_=ofproto.OFPGT_ALL, group_id=0, buckets=None): buckets = buckets if buckets else [] @@ -5379,6 +5460,7 @@ class OFPRoleRequest(MsgBase): req = ofp_parser.OFPRoleRequest(datapath, ofp.OFPCR_ROLE_EQUAL, 0) datapath.send_msg(req) """ + def __init__(self, datapath, role=None, generation_id=None): super(OFPRoleRequest, self).__init__(datapath) self.role = role @@ -5435,6 +5517,7 @@ class OFPRoleReply(MsgBase): 'role=%s generation_id=%d', role, msg.generation_id) """ + def __init__(self, datapath, role=None, generation_id=None): super(OFPRoleReply, self).__init__(datapath) self.role = role @@ -5511,6 +5594,7 @@ class OFPGetAsyncRequest(MsgBase): req = ofp_parser.OFPGetAsyncRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetAsyncRequest, self).__init__(datapath) @@ -5539,6 +5623,7 @@ class OFPGetAsyncReply(MsgBase): self.logger.debug('OFPGetAsyncReply received: ' 'properties=%s', repr(msg.properties)) """ + def __init__(self, datapath, properties=None): super(OFPGetAsyncReply, self).__init__(datapath) self.properties = properties @@ -5586,6 +5671,7 @@ class OFPSetAsync(MsgBase): req = ofp_parser.OFPSetAsync(datapath, properties) datapath.send_msg(req) """ + def __init__(self, datapath, properties=None): super(OFPSetAsync, self).__init__(datapath) self.properties = properties @@ -5638,6 +5724,7 @@ class OFPBundleCtrlMsg(MsgBase): ofp.OFPBF_ATOMIC, []) datapath.send_msg(req) """ + def __init__(self, datapath, bundle_id=None, type_=None, flags=None, properties=None): super(OFPBundleCtrlMsg, self).__init__(datapath) @@ -5707,6 +5794,7 @@ class OFPBundleAddMsg(MsgInMsgBase): msg, []) datapath.send_msg(req) """ + def __init__(self, datapath, bundle_id, flags, message, properties): super(OFPBundleAddMsg, self).__init__(datapath) self.bundle_id = bundle_id diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py index 6e11d8a9..03946622 100644 --- a/ryu/ofproto/ofproto_v1_5_parser.py +++ b/ryu/ofproto/ofproto_v1_5_parser.py @@ -77,6 +77,7 @@ class OFPHello(MsgBase): elements list of ``OFPHelloElemVersionBitmap`` instance ========== ========================================================= """ + def __init__(self, datapath, elements=None): elements = elements if elements else [] super(OFPHello, self).__init__(datapath) @@ -115,6 +116,7 @@ class OFPHelloElemVersionBitmap(StringifyMixin): versions list of versions of OpenFlow protocol a device supports ========== ========================================================= """ + def __init__(self, versions, type_=None, length=None): super(OFPHelloElemVersionBitmap, self).__init__() self.type = ofproto.OFPHET_VERSIONBITMAP @@ -177,6 +179,7 @@ class OFPEchoRequest(MsgBase): self.logger.debug('OFPEchoRequest received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoRequest, self).__init__(datapath) self.data = data @@ -254,6 +257,7 @@ class OFPErrorMsg(MsgBase): 'message=%s', msg.type, msg.code, utils.hex_array(msg.data)) """ + def __init__(self, datapath, type_=None, code=None, data=None, **kwargs): super(OFPErrorMsg, self).__init__(datapath) self.type = type_ @@ -346,6 +350,7 @@ class OFPEchoReply(MsgBase): self.logger.debug('OFPEchoReply received: data=%s', utils.hex_array(ev.msg.data)) """ + def __init__(self, datapath, data=None): super(OFPEchoReply, self).__init__(datapath) self.data = data @@ -381,6 +386,7 @@ class OFPFeaturesRequest(MsgBase): req = ofp_parser.OFPFeaturesRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPFeaturesRequest, self).__init__(datapath) @@ -399,6 +405,7 @@ class OFPExperimenter(MsgBase): data Experimenter defined arbitrary additional data ============= ========================================================= """ + def __init__(self, datapath, experimenter=None, exp_type=None, data=None): super(OFPExperimenter, self).__init__(datapath) self.experimenter = experimenter @@ -450,6 +457,7 @@ class OFPSwitchFeatures(MsgBase): msg.datapath_id, msg.n_buffers, msg.n_tables, msg.auxiliary_id, msg.capabilities) """ + def __init__(self, datapath, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None): super(OFPSwitchFeatures, self).__init__(datapath) @@ -490,6 +498,7 @@ class OFPGetConfigRequest(MsgBase): req = ofp_parser.OFPGetConfigRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetConfigRequest, self).__init__(datapath) @@ -534,6 +543,7 @@ class OFPGetConfigReply(MsgBase): 'flags=%s miss_send_len=%d', ','.join(flags), msg.miss_send_len) """ + def __init__(self, datapath, flags=None, miss_send_len=None): super(OFPGetConfigReply, self).__init__(datapath) self.flags = flags @@ -578,6 +588,7 @@ class OFPSetConfig(MsgBase): req = ofp_parser.OFPSetConfig(datapath, ofp.OFPC_FRAG_NORMAL, 256) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, miss_send_len=0): super(OFPSetConfig, self).__init__(datapath) self.flags = flags @@ -1440,6 +1451,7 @@ class OFPPacketIn(MsgBase): msg.table_id, msg.cookie, msg.match, utils.hex_array(msg.data)) """ + def __init__(self, datapath, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): super(OFPPacketIn, self).__init__(datapath) @@ -1534,6 +1546,7 @@ class OFPFlowRemoved(MsgBase): msg.idle_timeout, msg.hard_timeout, msg.cookie, msg.match, msg.stats) """ + def __init__(self, datapath, table_id=None, reason=None, priority=None, idle_timeout=None, hard_timeout=None, cookie=None, match=None, stats=None): @@ -1733,6 +1746,7 @@ class OFPMeterMod(MsgBase): | OFPMeterBandExperimenter ================ ====================================================== """ + def __init__(self, datapath, command=ofproto.OFPMC_ADD, flags=ofproto.OFPMF_KBPS, meter_id=1, bands=None): bands = bands if bands else [] @@ -1800,6 +1814,7 @@ class OFPTableMod(MsgBase): req = ofp_parser.OFPTableMod(datapath, 1, 3, properties) datapath.send_msg(req) """ + def __init__(self, datapath, table_id, config, properties): super(OFPTableMod, self).__init__(datapath) self.table_id = table_id @@ -1934,6 +1949,7 @@ class OFPDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPDescStatsRequest, self).__init__(datapath, flags) @@ -1965,6 +1981,7 @@ class OFPDescStatsReply(OFPMultipartReply): body.mfr_desc, body.hw_desc, body.sw_desc, body.serial_num, body.dp_desc) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPDescStatsReply, self).__init__(datapath, **kwargs) @@ -2382,6 +2399,7 @@ class OFPTableFeaturesStatsRequest(OFPMultipartRequest): The default is []. ================ ====================================================== """ + def __init__(self, datapath, flags=0, body=None, type_=None): body = body if body else [] super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags) @@ -2410,6 +2428,7 @@ class OFPTableFeaturesStatsReply(OFPMultipartReply): body List of ``OFPTableFeaturesStats`` instance ================ ====================================================== """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -2438,6 +2457,7 @@ class OFPPortDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortDescStatsRequest(datapath, 0, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, type_=None): super(OFPPortDescStatsRequest, self).__init__(datapath, flags) self.port_no = port_no @@ -2476,6 +2496,7 @@ class OFPPortDescStatsReply(OFPMultipartReply): p.name, p.config, p.state, repr(p.properties))) self.logger.debug('OFPPortDescStatsReply received: %s', ports) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPPortDescStatsReply, self).__init__(datapath, **kwargs) @@ -2502,6 +2523,7 @@ class OFPTableDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPTableDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPTableDescStatsRequest, self).__init__(datapath, flags) @@ -2531,6 +2553,7 @@ class OFPTableDescStatsReply(OFPMultipartReply): (p.table_id, p.config, repr(p.properties))) self.logger.debug('OFPTableDescStatsReply received: %s', tables) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableDescStatsReply, self).__init__(datapath, **kwargs) @@ -2562,6 +2585,7 @@ class OFPQueueDescStatsRequest(OFPMultipartRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, queue_id=ofproto.OFPQ_ALL, type_=None): super(OFPQueueDescStatsRequest, self).__init__(datapath, flags) @@ -2600,6 +2624,7 @@ class OFPQueueDescStatsReply(OFPMultipartReply): (q.port_no, q.queue_id, repr(q.properties))) self.logger.debug('OFPQueueDescStatsReply received: %s', queues) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPQueueDescStatsReply, self).__init__(datapath, **kwargs) @@ -2669,6 +2694,7 @@ class OFPQueueStatsRequest(OFPMultipartRequest): ofp.OFPQ_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, port_no=ofproto.OFPP_ANY, queue_id=ofproto.OFPQ_ALL, type_=None): super(OFPQueueStatsRequest, self).__init__(datapath, flags) @@ -2714,6 +2740,7 @@ class OFPQueueStatsReply(OFPMultipartReply): repr(stat.properties))) self.logger.debug('QueueStats: %s', queues) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPQueueStatsReply, self).__init__(datapath, **kwargs) @@ -2787,6 +2814,7 @@ class OFPGroupStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupStatsRequest(datapath, 0, ofp.OFPG_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, group_id=ofproto.OFPG_ALL, type_=None): super(OFPGroupStatsRequest, self).__init__(datapath, flags) @@ -2829,6 +2857,7 @@ class OFPGroupStatsReply(OFPMultipartReply): stat.duration_nsec)) self.logger.debug('GroupStats: %s', groups) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupStatsReply, self).__init__(datapath, **kwargs) @@ -2894,6 +2923,7 @@ class OFPGroupDescStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupDescStatsRequest(datapath, 0, ofp.OFPG_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, group_id=ofproto.OFPG_ALL, type_=None): super(OFPGroupDescStatsRequest, self).__init__(datapath, flags) @@ -2933,13 +2963,14 @@ class OFPGroupDescStatsReply(OFPMultipartReply): stat.bucket, repr(stat.properties))) self.logger.debug('GroupDescStats: %s', descs) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupDescStatsReply, self).__init__(datapath, **kwargs) class OFPGroupFeaturesStats(ofproto_parser.namedtuple('OFPGroupFeaturesStats', - ('types', 'capabilities', 'max_groups', - 'actions'))): + ('types', 'capabilities', 'max_groups', + 'actions'))): @classmethod def parser(cls, buf, offset): group_features = struct.unpack_from( @@ -2976,6 +3007,7 @@ class OFPGroupFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPGroupFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPGroupFeaturesStatsRequest, self).__init__(datapath, flags) @@ -3007,6 +3039,7 @@ class OFPGroupFeaturesStatsReply(OFPMultipartReply): body.types, body.capabilities, body.max_groups, body.actions) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPGroupFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -3085,6 +3118,7 @@ class OFPMeterStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPMeterStatsRequest(datapath, 0, ofp.OFPM_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, meter_id=ofproto.OFPM_ALL, type_=None): super(OFPMeterStatsRequest, self).__init__(datapath, flags) @@ -3128,6 +3162,7 @@ class OFPMeterStatsReply(OFPMultipartReply): stat.band_stats)) self.logger.debug('MeterStats: %s', meters) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterStatsReply, self).__init__(datapath, **kwargs) @@ -3290,6 +3325,7 @@ class OFPMeterDescStatsRequest(OFPMultipartRequest): ofp.OFPM_ALL) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, meter_id=ofproto.OFPM_ALL, type_=None): super(OFPMeterDescStatsRequest, self).__init__(datapath, flags) @@ -3330,13 +3366,14 @@ class OFPMeterDescStatsReply(OFPMultipartReply): stat.bands)) self.logger.debug('MeterDescStats: %s', configs) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterDescStatsReply, self).__init__(datapath, **kwargs) class OFPMeterFeaturesStats(ofproto_parser.namedtuple('OFPMeterFeaturesStats', - ('max_meter', 'band_types', 'capabilities', - 'max_bands', 'max_color', 'features'))): + ('max_meter', 'band_types', 'capabilities', + 'max_bands', 'max_color', 'features'))): @classmethod def parser(cls, buf, offset): meter_features = struct.unpack_from( @@ -3369,6 +3406,7 @@ class OFPMeterFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPMeterFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPMeterFeaturesStatsRequest, self).__init__(datapath, flags) @@ -3403,6 +3441,7 @@ class OFPMeterFeaturesStatsReply(OFPMultipartReply): stat.max_color)) self.logger.debug('MeterFeaturesStats: %s', features) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPMeterFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -3596,6 +3635,7 @@ class OFPFlowMonitorRequest(OFPFlowMonitorRequestBase): ofp.OFPFMC_ADD, match) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, monitor_id=0, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, monitor_flags=0, table_id=ofproto.OFPTT_ALL, @@ -3655,6 +3695,7 @@ class OFPFlowMonitorReply(OFPMultipartReply): flow_updates.append(update_str) self.logger.debug('FlowUpdates: %s', flow_updates) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPFlowMonitorReply, self).__init__(datapath, **kwargs) @@ -3762,6 +3803,7 @@ class OFPBundleFeaturesStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPBundleFeaturesStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, feature_request_flags=0, properties=None, type_=None): properties = properties if properties else [] @@ -3805,6 +3847,7 @@ class OFPBundleFeaturesStatsReply(OFPMultipartReply): 'properties=%s', body.capabilities, repr(body.properties)) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPBundleFeaturesStatsReply, self).__init__(datapath, **kwargs) @@ -3868,6 +3911,7 @@ class OFPExperimenterStatsRequest(OFPExperimenterStatsRequestBase): data Experimenter defined additional data ================ ====================================================== """ + def __init__(self, datapath, flags, experimenter, exp_type, data, type_=None): @@ -3896,6 +3940,7 @@ class OFPExperimenterStatsReply(OFPMultipartReply): body An ``OFPExperimenterMultipart`` instance ================ ====================================================== """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPExperimenterStatsReply, self).__init__(datapath, **kwargs) @@ -4042,6 +4087,7 @@ class OFPFlowDescStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, table_id=ofproto.OFPTT_ALL, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, @@ -4086,6 +4132,7 @@ class OFPFlowDescStatsReply(OFPMultipartReply): stat.stats, stat.instructions)) self.logger.debug('FlowDesc: %s', flows) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPFlowDescStatsReply, self).__init__(datapath, **kwargs) @@ -4127,6 +4174,7 @@ class OFPFlowStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, table_id=ofproto.OFPTT_ALL, out_port=ofproto.OFPP_ANY, out_group=ofproto.OFPG_ANY, @@ -4166,6 +4214,7 @@ class OFPFlowStatsReply(OFPMultipartReply): stat.match, stat.stats)) self.logger.debug('FlowStats: %s', flows) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPFlowStatsReply, self).__init__(datapath, **kwargs) @@ -4224,6 +4273,7 @@ class OFPAggregateStatsRequest(OFPFlowStatsRequestBase): match) datapath.send_msg(req) """ + def __init__(self, datapath, flags, table_id, out_port, out_group, cookie, cookie_mask, match, type_=None): super(OFPAggregateStatsRequest, self).__init__(datapath, @@ -4260,6 +4310,7 @@ class OFPAggregateStatsReply(OFPMultipartReply): self.logger.debug('AggregateStats: stats=%s', body.stats) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPAggregateStatsReply, self).__init__(datapath, **kwargs) @@ -4298,6 +4349,7 @@ class OFPTableStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPTableStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags, type_=None): super(OFPTableStatsRequest, self).__init__(datapath, flags) @@ -4329,6 +4381,7 @@ class OFPTableStatsReply(OFPMultipartReply): stat.lookup_count, stat.matched_count)) self.logger.debug('TableStats: %s', tables) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPTableStatsReply, self).__init__(datapath, **kwargs) @@ -4458,6 +4511,7 @@ class OFPPortStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortStatsRequest(datapath, 0, ofp.OFPP_ANY) datapath.send_msg(req) """ + def __init__(self, datapath, flags, port_no, type_=None): super(OFPPortStatsRequest, self).__init__(datapath, flags) self.port_no = port_no @@ -4499,6 +4553,7 @@ class OFPPortStatsReply(OFPMultipartReply): repr(stat.properties)) self.logger.debug('PortStats: %s', ports) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPPortStatsReply, self).__init__(datapath, **kwargs) @@ -4519,6 +4574,7 @@ class OFPBarrierRequest(MsgBase): req = ofp_parser.OFPBarrierRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPBarrierRequest, self).__init__(datapath) @@ -4537,6 +4593,7 @@ class OFPBarrierReply(MsgBase): def barrier_reply_handler(self, ev): self.logger.debug('OFPBarrierReply received') """ + def __init__(self, datapath): super(OFPBarrierReply, self).__init__(datapath) @@ -4580,6 +4637,7 @@ class OFPPortStatus(MsgBase): self.logger.debug('OFPPortStatus received: reason=%s desc=%s', reason, msg.desc) """ + def __init__(self, datapath, reason=None, desc=None): super(OFPPortStatus, self).__init__(datapath) self.reason = reason @@ -4651,6 +4709,7 @@ class OFPRoleStatus(MsgBase): 'generation_id=%d properties=%s', role, reason, msg.generation_id, repr(msg.properties)) """ + def __init__(self, datapath, role=None, reason=None, generation_id=None, properties=None): super(OFPRoleStatus, self).__init__(datapath) @@ -4714,6 +4773,7 @@ class OFPTableStatus(MsgBase): reason, msg.table.table_id, msg.table.config, repr(msg.table.properties)) """ + def __init__(self, datapath, reason=None, table=None): super(OFPTableStatus, self).__init__(datapath) self.reason = reason @@ -4773,6 +4833,7 @@ class OFPRequestForward(MsgInMsgBase): self.logger.debug( 'OFPRequestForward received: request=Unknown') """ + def __init__(self, datapath, request=None): super(OFPRequestForward, self).__init__(datapath) self.request = request @@ -4907,6 +4968,7 @@ class OFPControllerStatusStatsRequest(OFPMultipartRequest): req = ofp_parser.OFPPortDescStatsRequest(datapath, 0) datapath.send_msg(req) """ + def __init__(self, datapath, flags=0, type_=None): super(OFPControllerStatusStatsRequest, self).__init__(datapath, flags) @@ -4942,6 +5004,7 @@ class OFPControllerStatusStatsReply(OFPMultipartReply): self.logger.debug('OFPControllerStatusStatsReply received: %s', status) """ + def __init__(self, datapath, type_=None, **kwargs): super(OFPControllerStatusStatsReply, self).__init__(datapath, **kwargs) @@ -5012,6 +5075,7 @@ class OFPControllerStatus(MsgBase): status.short_id, role, reason, channel_status, repr(status.properties)) """ + def __init__(self, datapath, status=None): super(OFPControllerStatus, self).__init__(datapath) self.status = status @@ -5059,6 +5123,7 @@ class OFPPacketOut(MsgBase): match, actions) datapath.send_msg(req) """ + def __init__(self, datapath, buffer_id=None, match=None, actions=None, data=None, actions_len=None): super(OFPPacketOut, self).__init__(datapath) @@ -5185,6 +5250,7 @@ class OFPFlowMod(MsgBase): match, inst) datapath.send_msg(req) """ + def __init__(self, datapath, cookie=0, cookie_mask=0, table_id=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, @@ -5290,6 +5356,7 @@ class OFPInstructionGotoTable(OFPInstruction): table_id Next table ================ ====================================================== """ + def __init__(self, table_id, type_=None, len_=None): super(OFPInstructionGotoTable, self).__init__() self.type = ofproto.OFPIT_GOTO_TABLE @@ -5322,6 +5389,7 @@ class OFPInstructionWriteMetadata(OFPInstruction): metadata_mask Metadata write bitmask ================ ====================================================== """ + def __init__(self, metadata, metadata_mask, type_=None, len_=None): super(OFPInstructionWriteMetadata, self).__init__() self.type = ofproto.OFPIT_WRITE_METADATA @@ -5364,6 +5432,7 @@ class OFPInstructionActions(OFPInstruction): ``type`` attribute corresponds to ``type_`` parameter of __init__. """ + def __init__(self, type_, actions=None, len_=None): super(OFPInstructionActions, self).__init__() self.type = type_ @@ -5423,6 +5492,7 @@ class OFPInstructionStatTrigger(OFPInstruction): thresholds Instance of ``OFPStats`` ================ ====================================================== """ + def __init__(self, flags, thresholds, type_=None, len_=None): super(OFPInstructionStatTrigger, self).__init__() self.type = ofproto.OFPIT_STAT_TRIGGER @@ -5502,6 +5572,7 @@ class OFPActionOutput(OFPAction): max_len Max length to send to controller ================ ====================================================== """ + def __init__(self, port, max_len=ofproto.OFPCML_MAX, type_=None, len_=None): super(OFPActionOutput, self).__init__() @@ -5533,6 +5604,7 @@ class OFPActionGroup(OFPAction): group_id Group identifier ================ ====================================================== """ + def __init__(self, group_id=0, type_=None, len_=None): super(OFPActionGroup, self).__init__() self.group_id = group_id @@ -5563,6 +5635,7 @@ class OFPActionSetQueue(OFPAction): queue_id Queue ID for the packets ================ ====================================================== """ + def __init__(self, queue_id, type_=None, len_=None): super(OFPActionSetQueue, self).__init__() self.queue_id = queue_id @@ -5592,6 +5665,7 @@ class OFPActionSetMplsTtl(OFPAction): mpls_ttl MPLS TTL ================ ====================================================== """ + def __init__(self, mpls_ttl, type_=None, len_=None): super(OFPActionSetMplsTtl, self).__init__() self.mpls_ttl = mpls_ttl @@ -5615,6 +5689,7 @@ class OFPActionDecMplsTtl(OFPAction): This action decrements the MPLS TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecMplsTtl, self).__init__() @@ -5639,6 +5714,7 @@ class OFPActionSetNwTtl(OFPAction): nw_ttl IP TTL ================ ====================================================== """ + def __init__(self, nw_ttl, type_=None, len_=None): super(OFPActionSetNwTtl, self).__init__() self.nw_ttl = nw_ttl @@ -5662,6 +5738,7 @@ class OFPActionDecNwTtl(OFPAction): This action decrements the IP TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionDecNwTtl, self).__init__() @@ -5681,6 +5758,7 @@ class OFPActionCopyTtlOut(OFPAction): This action copies the TTL from the next-to-outermost header with TTL to the outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlOut, self).__init__() @@ -5700,6 +5778,7 @@ class OFPActionCopyTtlIn(OFPAction): This action copies the TTL from the outermost header with TTL to the next-to-outermost header with TTL. """ + def __init__(self, type_=None, len_=None): super(OFPActionCopyTtlIn, self).__init__() @@ -5724,6 +5803,7 @@ class OFPActionPushVlan(OFPAction): ethertype Ether type. The default is 802.1Q. (0x8100) ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_8021Q, type_=None, len_=None): super(OFPActionPushVlan, self).__init__() self.ethertype = ethertype @@ -5753,6 +5833,7 @@ class OFPActionPushMpls(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype=ether.ETH_TYPE_MPLS, type_=None, len_=None): super(OFPActionPushMpls, self).__init__() self.ethertype = ethertype @@ -5776,6 +5857,7 @@ class OFPActionPopVlan(OFPAction): This action pops the outermost VLAN tag from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopVlan, self).__init__() @@ -5794,6 +5876,7 @@ class OFPActionPopMpls(OFPAction): This action pops the MPLS header from the packet. """ + def __init__(self, ethertype=ether.ETH_TYPE_IP, type_=None, len_=None): super(OFPActionPopMpls, self).__init__() self.ethertype = ethertype @@ -5826,6 +5909,7 @@ class OFPActionSetField(OFPAction): set_field = OFPActionSetField(ipv4_src=("192.168.100.0", "255.255.255.0")) """ + def __init__(self, field=None, **kwargs): super(OFPActionSetField, self).__init__() assert len(kwargs) == 1 @@ -5885,6 +5969,7 @@ class OFPActionPushPbb(OFPAction): ethertype Ether type ================ ====================================================== """ + def __init__(self, ethertype, type_=None, len_=None): super(OFPActionPushPbb, self).__init__() self.ethertype = ethertype @@ -5909,6 +5994,7 @@ class OFPActionPopPbb(OFPAction): This action pops the outermost PBB service instance header from the packet. """ + def __init__(self, type_=None, len_=None): super(OFPActionPopPbb, self).__init__() @@ -5941,6 +6027,7 @@ class OFPActionCopyField(OFPAction): The default is []. ================ ====================================================== """ + def __init__(self, n_bits=0, src_offset=0, dst_offset=0, oxm_ids=None, type_=None, len_=None): oxm_ids = oxm_ids if oxm_ids else [] @@ -5999,6 +6086,7 @@ class OFPActionMeter(OFPAction): meter_id Meter instance ================ ====================================================== """ + def __init__(self, meter_id, type_=None, len_=None): super(OFPActionMeter, self).__init__() @@ -6145,6 +6233,7 @@ class OFPGroupMod(MsgBase): command_bucket_id, buckets) datapath.send_msg(req) """ + def __init__(self, datapath, command=ofproto.OFPGC_ADD, type_=ofproto.OFPGT_ALL, group_id=0, command_bucket_id=ofproto.OFPG_BUCKET_ALL, @@ -6464,6 +6553,7 @@ class OFPRoleRequest(MsgBase): ofp.OFPCID_UNDEFINED, 0) datapath.send_msg(req) """ + def __init__(self, datapath, role=None, short_id=None, generation_id=None): super(OFPRoleRequest, self).__init__(datapath) @@ -6526,6 +6616,7 @@ class OFPRoleReply(MsgBase): 'role=%s short_id=%d, generation_id=%d', role, msg.short_id, msg.generation_id) """ + def __init__(self, datapath, role=None, short_id=None, generation_id=None): super(OFPRoleReply, self).__init__(datapath) @@ -6604,6 +6695,7 @@ class OFPGetAsyncRequest(MsgBase): req = ofp_parser.OFPGetAsyncRequest(datapath) datapath.send_msg(req) """ + def __init__(self, datapath): super(OFPGetAsyncRequest, self).__init__(datapath) @@ -6632,6 +6724,7 @@ class OFPGetAsyncReply(MsgBase): self.logger.debug('OFPGetAsyncReply received: ' 'properties=%s', repr(msg.properties)) """ + def __init__(self, datapath, properties=None): super(OFPGetAsyncReply, self).__init__(datapath) self.properties = properties @@ -6679,6 +6772,7 @@ class OFPSetAsync(MsgBase): req = ofp_parser.OFPSetAsync(datapath, properties) datapath.send_msg(req) """ + def __init__(self, datapath, properties=None): super(OFPSetAsync, self).__init__(datapath) self.properties = properties @@ -6731,6 +6825,7 @@ class OFPBundleCtrlMsg(MsgBase): ofp.OFPBF_ATOMIC, []) datapath.send_msg(req) """ + def __init__(self, datapath, bundle_id=None, type_=None, flags=None, properties=None): super(OFPBundleCtrlMsg, self).__init__(datapath) @@ -6800,6 +6895,7 @@ class OFPBundleAddMsg(MsgInMsgBase): msg, []) datapath.send_msg(req) """ + def __init__(self, datapath, bundle_id, flags, message, properties): super(OFPBundleAddMsg, self).__init__(datapath) self.bundle_id = bundle_id diff --git a/ryu/services/protocols/bgp/api/base.py b/ryu/services/protocols/bgp/api/base.py index 87dc13b6..6c4d0fa1 100644 --- a/ryu/services/protocols/bgp/api/base.py +++ b/ryu/services/protocols/bgp/api/base.py @@ -100,6 +100,7 @@ class RegisterWithArgChecks(object): Does some argument checking and validation of required arguments. """ + def __init__(self, name, req_args=None, opt_args=None): self._name = name if not req_args: diff --git a/ryu/services/protocols/bgp/api/rpc_log_handler.py b/ryu/services/protocols/bgp/api/rpc_log_handler.py index a5d4ae2c..09340b92 100644 --- a/ryu/services/protocols/bgp/api/rpc_log_handler.py +++ b/ryu/services/protocols/bgp/api/rpc_log_handler.py @@ -25,6 +25,7 @@ from ryu.services.protocols.bgp.net_ctrl import NOTIFICATION_LOG class RpcLogHandler(logging.Handler): """Outputs log records to `NET_CONTROLLER`.""" + def emit(self, record): msg = self.format(record) NET_CONTROLLER.send_rpc_notification( diff --git a/ryu/services/protocols/bgp/bmp.py b/ryu/services/protocols/bgp/bmp.py index eba642d9..a2842c85 100644 --- a/ryu/services/protocols/bgp/bmp.py +++ b/ryu/services/protocols/bgp/bmp.py @@ -68,10 +68,10 @@ class BMPClient(Activity): self._connect_tcp(self.server_address, self._handle_bmp_session) except socket.error: - self._connect_retry_event.set() - LOG.info('Will try to reconnect to %s after %s secs: %s', - self.server_address, self._connect_retry_time, - self._connect_retry_event.is_set()) + self._connect_retry_event.set() + LOG.info('Will try to reconnect to %s after %s secs: %s', + self.server_address, self._connect_retry_time, + self._connect_retry_event.is_set()) self.pause(self._connect_retry_time) diff --git a/ryu/services/protocols/bgp/info_base/vrffs.py b/ryu/services/protocols/bgp/info_base/vrffs.py index f8054a73..8f0fe3eb 100644 --- a/ryu/services/protocols/bgp/info_base/vrffs.py +++ b/ryu/services/protocols/bgp/info_base/vrffs.py @@ -45,6 +45,7 @@ class VRFFlowSpecTable(VrfTable): Keeps destination imported to given VRF Flow Specification in represents. """ + def insert_vrffs_path(self, nlri, communities, is_withdraw=False): assert nlri assert isinstance(communities, list) diff --git a/ryu/services/protocols/bgp/model.py b/ryu/services/protocols/bgp/model.py index db325580..696b6474 100644 --- a/ryu/services/protocols/bgp/model.py +++ b/ryu/services/protocols/bgp/model.py @@ -27,6 +27,7 @@ LOG = logging.getLogger('bgpspeaker.model') class Counter(object): """Simple counter for keeping count of several keys.""" + def __init__(self): self._counters = {} diff --git a/ryu/services/protocols/bgp/rtconf/base.py b/ryu/services/protocols/bgp/rtconf/base.py index c445a87a..718b8e38 100644 --- a/ryu/services/protocols/bgp/rtconf/base.py +++ b/ryu/services/protocols/bgp/rtconf/base.py @@ -99,6 +99,7 @@ class MissingRequiredConf(RuntimeConfigError): """Exception raised when trying to configure with missing required settings. """ + def __init__(self, **kwargs): conf_name = kwargs.get('conf_name') if conf_name: @@ -113,6 +114,7 @@ class MissingRequiredConf(RuntimeConfigError): class ConfigTypeError(RuntimeConfigError): """Exception raised when configuration value type miss-match happens. """ + def __init__(self, **kwargs): conf_name = kwargs.get(CONF_NAME) conf_value = kwargs.get(CONF_VALUE) @@ -133,6 +135,7 @@ class ConfigValueError(RuntimeConfigError): """Exception raised when configuration value is of correct type but incorrect value. """ + def __init__(self, **kwargs): conf_name = kwargs.get(CONF_NAME) conf_value = kwargs.get(CONF_VALUE) diff --git a/ryu/services/protocols/bgp/rtconf/neighbors.py b/ryu/services/protocols/bgp/rtconf/neighbors.py index 86e04b39..6c481a49 100644 --- a/ryu/services/protocols/bgp/rtconf/neighbors.py +++ b/ryu/services/protocols/bgp/rtconf/neighbors.py @@ -819,6 +819,7 @@ class NeighborsConf(BaseConf): class NeighborConfListener(ConfWithIdListener, ConfWithStatsListener): """Base listener for change events to a specific neighbors' configurations. """ + def __init__(self, neigh_conf): super(NeighborConfListener, self).__init__(neigh_conf) neigh_conf.add_listener(NeighborConf.UPDATE_ENABLED_EVT, diff --git a/ryu/services/protocols/bgp/utils/evtlet.py b/ryu/services/protocols/bgp/utils/evtlet.py index 339837fb..e9ec6471 100644 --- a/ryu/services/protocols/bgp/utils/evtlet.py +++ b/ryu/services/protocols/bgp/utils/evtlet.py @@ -39,6 +39,7 @@ class EventletIOFactory(object): class LoopingCall(object): """Call a function repeatedly. """ + def __init__(self, funct, *args, **kwargs): self._funct = funct self._args = args diff --git a/ryu/services/protocols/ovsdb/event.py b/ryu/services/protocols/ovsdb/event.py index f162b528..0695db2d 100644 --- a/ryu/services/protocols/ovsdb/event.py +++ b/ryu/services/protocols/ovsdb/event.py @@ -92,6 +92,7 @@ class EventModifyRequest(ryu_event.EventRequestBase): port_uuid = reply.insert_uuids[new_port_uuid] """ + def __init__(self, system_id, func): super(EventModifyRequest, self).__init__() self.dst = 'OVSDB' diff --git a/ryu/services/protocols/vrrp/event.py b/ryu/services/protocols/vrrp/event.py index dbf8e278..f78e26b5 100644 --- a/ryu/services/protocols/vrrp/event.py +++ b/ryu/services/protocols/vrrp/event.py @@ -42,6 +42,7 @@ class VRRPInterfaceBase(object): NOTE: multiple virtual router can be configured on single port See RFC 5798 4.2 Sample Configuration 2 """ + def __init__(self, mac_address, primary_ip_address, vlan_id=None): super(VRRPInterfaceBase, self).__init__() self.mac_address = mac_address @@ -115,6 +116,7 @@ class VRRPConfig(object): """ advertmisement_interval is in seconds as float. (Not in centiseconds) """ + def __init__(self, version=vrrp.VRRP_VERSION_V3, vrid=None, admin_state=True, priority=vrrp.VRRP_PRIORITY_BACKUP_DEFAULT, ip_addresses=None, @@ -165,6 +167,7 @@ class EventVRRPConfigRequest(event.EventRequestBase): """ Request from management layer to VRRP manager to initialize VRRP Router. """ + def __init__(self, interface, config): super(EventVRRPConfigRequest, self).__init__() self.dst = VRRP_MANAGER_NAME @@ -185,6 +188,7 @@ class EventVRRPShutdownRequest(event.EventRequestBase): """ Request from management layer to VRRP to shutdown VRRP Router. """ + def __init__(self, instance_name): super(EventVRRPShutdownRequest, self).__init__() self.instance_name = instance_name @@ -194,6 +198,7 @@ class EventVRRPStateChanged(event.EventBase): """ Event that this VRRP Router changed its state. """ + def __init__(self, instance_name, monitor_name, interface, config, old_state, new_state): super(EventVRRPStateChanged, self).__init__() @@ -220,6 +225,7 @@ class EventVRRPListRequest(event.EventRequestBase): Event that requests list of configured VRRP router instance_name=None means all instances. """ + def __init__(self, instance_name=None): super(EventVRRPListRequest, self).__init__() self.instance_name = instance_name @@ -236,6 +242,7 @@ class EventVRRPConfigChangeRequest(event.EventRequestBase): Event that requests to change configuration of a given VRRP router. None means no-change. """ + def __init__(self, instance_name, priority=None, advertisement_interval=None, preempt_mode=None, preempt_delay=None, accept_mode=None): @@ -255,6 +262,7 @@ class EventVRRPReceived(event.EventBase): Event that port manager received valid VRRP packet. Usually handed by VRRP Router. """ + def __init__(self, interface, packet): super(EventVRRPReceived, self).__init__() self.interface = interface @@ -265,6 +273,7 @@ class EventVRRPTransmitRequest(event.EventRequestBase): """ Request from VRRP router to port manager to transmit VRRP packet. """ + def __init__(self, data): super(EventVRRPTransmitRequest, self).__init__() self.data = data diff --git a/ryu/services/protocols/vrrp/monitor_linux.py b/ryu/services/protocols/vrrp/monitor_linux.py index 0beb0ef2..eaab6fc5 100644 --- a/ryu/services/protocols/vrrp/monitor_linux.py +++ b/ryu/services/protocols/vrrp/monitor_linux.py @@ -53,6 +53,7 @@ class VRRPInterfaceMonitorNetworkDevice(monitor.VRRPInterfaceMonitor): This module uses raw socket so that privilege(CAP_NET_ADMIN capability) is required. """ + def __init__(self, *args, **kwargs): super(VRRPInterfaceMonitorNetworkDevice, self).__init__(*args, **kwargs) diff --git a/ryu/tests/integrated/run_tests_with_ovs12.py b/ryu/tests/integrated/run_tests_with_ovs12.py index 9d82d370..2e84fef2 100755 --- a/ryu/tests/integrated/run_tests_with_ovs12.py +++ b/ryu/tests/integrated/run_tests_with_ovs12.py @@ -34,6 +34,7 @@ RYU_MGR = './bin/ryu-manager' class OVS12KernelSwitch(OVSKernelSwitch): """Set protocols parameter for OVS version 1.10""" + def start(self, controllers): super(OVS12KernelSwitch, self).start(controllers) self.cmd('ovs-vsctl set Bridge', self, diff --git a/ryu/tests/integrated/test_add_flow_v12_actions.py b/ryu/tests/integrated/test_add_flow_v12_actions.py index 7c75aa53..f2f0b3da 100644 --- a/ryu/tests/integrated/test_add_flow_v12_actions.py +++ b/ryu/tests/integrated/test_add_flow_v12_actions.py @@ -91,8 +91,8 @@ class RunTest(tester.TestFlowBase): s_val = s_val.value if name and s_val != value: - return "Value error. send:%s=%s val:%s" \ - % (name, value, s_val) + return "Value error. send:%s=%s val:%s" \ + % (name, value, s_val) return True diff --git a/ryu/tests/integrated/vrrp_common.py b/ryu/tests/integrated/vrrp_common.py index 58621f45..0123cb1f 100644 --- a/ryu/tests/integrated/vrrp_common.py +++ b/ryu/tests/integrated/vrrp_common.py @@ -94,9 +94,9 @@ class VRRPCommon(app_manager.RyuApp): if i.state == vrrp_event.VRRP_STATE_MASTER: print("bad master:") print('%s %s' % (d[vr[0].instance_name].state, - d[vr[0].instance_name].config.priority)) + d[vr[0].instance_name].config.priority)) print('%s %s' % (d[vr[1].instance_name].state, - d[vr[1].instance_name].config.priority)) + d[vr[1].instance_name].config.priority)) bad += 1 # assert i.state != vrrp_event.VRRP_STATE_MASTER if bad > 0: diff --git a/ryu/tests/packet_data_generator3/gen.py b/ryu/tests/packet_data_generator3/gen.py index aa5c2b7d..0216dc42 100644 --- a/ryu/tests/packet_data_generator3/gen.py +++ b/ryu/tests/packet_data_generator3/gen.py @@ -100,35 +100,35 @@ MESSAGES = [ 'versions': [4], 'cmd': 'add-flow', 'args': (['table=3', - 'importance=39032'] + + 'importance=39032'] + STD_MATCH + ['actions=resubmit(1234,99)'])}, {'name': 'action_ct', 'versions': [4], 'cmd': 'add-flow', 'args': (['table=3,', - 'importance=39032'] + + 'importance=39032'] + ['dl_type=0x0800,ct_state=-trk'] + ['actions=ct(table=4,zone=NXM_NX_REG0[4..31])'])}, {'name': 'action_ct_exec', 'versions': [4], 'cmd': 'add-flow', 'args': (['table=3,', - 'importance=39032'] + + 'importance=39032'] + ['dl_type=0x0800,ct_state=+trk+est'] + ['actions=ct(commit,exec(set_field:0x654321->ct_mark))'])}, {'name': 'action_ct_nat', 'versions': [4], 'cmd': 'add-flow', 'args': (['table=3,', - 'importance=39032'] + + 'importance=39032'] + ['dl_type=0x0800'] + ['actions=ct(commit,nat(src=10.1.12.0-10.1.13.255:1-1023)'])}, {'name': 'action_ct_nat_v6', 'versions': [4], 'cmd': 'add-flow', 'args': (['table=3,', - 'importance=39032'] + + 'importance=39032'] + ['dl_type=0x86dd'] + ['actions=ct(commit,nat(dst=2001:1::1-2001:1::ffff)'])}, {'name': 'action_note', diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py index f9075557..d57d8de5 100644 --- a/ryu/tests/switch/tester.py +++ b/ryu/tests/switch/tester.py @@ -1034,7 +1034,7 @@ class OfTester(app_manager.RyuApp): self.logger.debug("margin:[%s]", margin) if math.fabs(measured_value - expected_value) > margin: msgs.append('{0} {1:.2f}{2}'.format(fields, - measured_value / elapsed_sec / conv, unit)) + measured_value / elapsed_sec / conv, unit)) if msgs: raise TestFailure(self.state, detail=', '.join(msgs)) @@ -1289,6 +1289,7 @@ class OpenFlowSw(object): class TestPatterns(dict): """ List of Test class objects. """ + def __init__(self, test_dir, logger): super(TestPatterns, self).__init__() self.logger = logger @@ -1316,6 +1317,7 @@ class TestPatterns(dict): class TestFile(stringify.StringifyMixin): """Test File object include Test objects.""" + def __init__(self, path, logger): super(TestFile, self).__init__() self.logger = logger diff --git a/ryu/tests/test_lib.py b/ryu/tests/test_lib.py index c1c0f82e..380297bf 100644 --- a/ryu/tests/test_lib.py +++ b/ryu/tests/test_lib.py @@ -79,6 +79,7 @@ class _Win32Colorizer(object): """ See _AnsiColorizer docstring. """ + def __init__(self, stream): from win32console import GetStdHandle, STD_OUT_HANDLE from win32console import FOREGROUND_RED, FOREGROUND_BLUE @@ -127,6 +128,7 @@ class _NullColorizer(object): """ See _AnsiColorizer docstring. """ + def __init__(self, stream): self.stream = stream diff --git a/ryu/tests/unit/ofproto/test_parser_compat.py b/ryu/tests/unit/ofproto/test_parser_compat.py index 08be7583..f94c8194 100644 --- a/ryu/tests/unit/ofproto/test_parser_compat.py +++ b/ryu/tests/unit/ofproto/test_parser_compat.py @@ -58,7 +58,7 @@ class Test_Parser_Compat(unittest.TestCase): old_eth_src = addrconv.mac.text_to_bin(eth_src) old_ipv4_src = unpack('!I', addrconv.ipv4.text_to_bin(ipv4_src))[0] old_ipv6_src = list(unpack('!8H', - addrconv.ipv6.text_to_bin(ipv6_src))) + addrconv.ipv6.text_to_bin(ipv6_src))) def check(o): check_old(o) diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py b/ryu/tests/unit/ofproto/test_parser_v12.py index d0abdbcd..73b034b2 100644 --- a/ryu/tests/unit/ofproto/test_parser_v12.py +++ b/ryu/tests/unit/ofproto/test_parser_v12.py @@ -6392,6 +6392,7 @@ class TestOFPQueueGetConfigReply(unittest.TestCase): class TestOFPBarrierRequest(unittest.TestCase): """ Test case for ofproto_v1_2_parser.OFPBarrierRequest """ + def test_serialize(self): c = OFPBarrierRequest(_Datapath) c.serialize() diff --git a/ryu/tests/unit/packet/test_cfm.py b/ryu/tests/unit/packet/test_cfm.py index fb0749d7..8b56e2df 100644 --- a/ryu/tests/unit/packet/test_cfm.py +++ b/ryu/tests/unit/packet/test_cfm.py @@ -307,8 +307,8 @@ class Test_cfm(unittest.TestCase): def test_to_string(self): cfm_values = {'op': self.message} _cfm_str = ','.join(['%s=%s' % (k, cfm_values[k]) - for k, v in inspect.getmembers(self.ins) - if k in cfm_values]) + for k, v in inspect.getmembers(self.ins) + if k in cfm_values]) cfm_str = '%s(%s)' % (cfm.cfm.__name__, _cfm_str) eq_(str(self.ins), cfm_str) eq_(repr(self.ins), cfm_str) diff --git a/ryu/tests/unit/packet/test_icmpv6.py b/ryu/tests/unit/packet/test_icmpv6.py index 414eee20..3965b087 100644 --- a/ryu/tests/unit/packet/test_icmpv6.py +++ b/ryu/tests/unit/packet/test_icmpv6.py @@ -1048,8 +1048,8 @@ class Test_icmpv6_membership_query(unittest.TestCase): mld_values = {'maxresp': self.maxresp, 'address': self.address} _mld_str = ','.join(['%s=%s' % (k, repr(mld_values[k])) - for k, v in inspect.getmembers(ml) - if k in mld_values]) + for k, v in inspect.getmembers(ml) + if k in mld_values]) mld_str = '%s(%s)' % (icmpv6.mld.__name__, _mld_str) icmp_values = {'type_': repr(self.type_), @@ -1309,8 +1309,8 @@ class Test_mldv2_query(unittest.TestCase): 'num': self.num, 'srcs': self.srcs} _mld_str = ','.join(['%s=%s' % (k, repr(mld_values[k])) - for k, v in inspect.getmembers(self.mld) - if k in mld_values]) + for k, v in inspect.getmembers(self.mld) + if k in mld_values]) mld_str = '%s(%s)' % (icmpv6.mldv2_query.__name__, _mld_str) icmp_values = {'type_': repr(self.type_), @@ -1578,8 +1578,8 @@ class Test_mldv2_report(unittest.TestCase): mld_values = {'record_num': self.record_num, 'records': self.records} _mld_str = ','.join(['%s=%s' % (k, repr(mld_values[k])) - for k, v in inspect.getmembers(self.mld) - if k in mld_values]) + for k, v in inspect.getmembers(self.mld) + if k in mld_values]) mld_str = '%s(%s)' % (icmpv6.mldv2_report.__name__, _mld_str) icmp_values = {'type_': repr(self.type_), diff --git a/ryu/tests/unit/packet/test_igmp.py b/ryu/tests/unit/packet/test_igmp.py index 9813450d..a29ddafe 100644 --- a/ryu/tests/unit/packet/test_igmp.py +++ b/ryu/tests/unit/packet/test_igmp.py @@ -43,6 +43,7 @@ LOG = logging.getLogger(__name__) class Test_igmp(unittest.TestCase): """ Test case for Internet Group Management Protocol """ + def setUp(self): self.msgtype = IGMP_TYPE_QUERY self.maxresp = 100 @@ -170,6 +171,7 @@ class Test_igmp(unittest.TestCase): class Test_igmpv3_query(unittest.TestCase): """ Test case for Internet Group Management Protocol v3 Membership Query Message""" + def setUp(self): self.msgtype = IGMP_TYPE_QUERY self.maxresp = 100 @@ -440,6 +442,7 @@ class Test_igmpv3_query(unittest.TestCase): class Test_igmpv3_report(unittest.TestCase): """ Test case for Internet Group Management Protocol v3 Membership Report Message""" + def setUp(self): self.msgtype = IGMP_TYPE_REPORT_V3 self.csum = 0 @@ -705,6 +708,7 @@ class Test_igmpv3_report(unittest.TestCase): class Test_igmpv3_report_group(unittest.TestCase): """Test case for Group Records of Internet Group Management Protocol v3 Membership Report Message""" + def setUp(self): self.type_ = MODE_IS_INCLUDE self.aux_len = 0 diff --git a/ryu/tests/unit/packet/test_ipv6.py b/ryu/tests/unit/packet/test_ipv6.py index e62ba042..ac648dfa 100644 --- a/ryu/tests/unit/packet/test_ipv6.py +++ b/ryu/tests/unit/packet/test_ipv6.py @@ -760,7 +760,7 @@ class Test_routing(unittest.TestCase): "2001:db8:dead::3"] # calculate pad self.pad = (8 - ((len(self.adrs) - 1) * (16 - self.cmpi) + - (16 - self.cmpe) % 8)) % 8 + (16 - self.cmpe) % 8)) % 8 # create buf self.form = '!BBBBBB2x16s16s16s' self.buf = struct.pack(self.form, self.nxt, self.size, @@ -818,7 +818,7 @@ class Test_routing_type3(unittest.TestCase): "2001:db8:dead::3"] # calculate pad self.pad = (8 - ((len(self.adrs) - 1) * (16 - self.cmpi) + - (16 - self.cmpe) % 8)) % 8 + (16 - self.cmpe) % 8)) % 8 self.routing = ipv6.routing_type3( self.nxt, self.size, self.type_, self.seg, self.cmpi, diff --git a/ryu/tests/unit/packet/test_ospf.py b/ryu/tests/unit/packet/test_ospf.py index df57b8de..d0f8bc37 100644 --- a/ryu/tests/unit/packet/test_ospf.py +++ b/ryu/tests/unit/packet/test_ospf.py @@ -23,6 +23,7 @@ from ryu.lib.packet import ospf class Test_ospf(unittest.TestCase): """ Test case for ryu.lib.packet.ospf """ + def setUp(self): pass diff --git a/ryu/tests/unit/packet/test_packet.py b/ryu/tests/unit/packet/test_packet.py index 80d22143..ef212815 100644 --- a/ryu/tests/unit/packet/test_packet.py +++ b/ryu/tests/unit/packet/test_packet.py @@ -254,8 +254,8 @@ class TestPacket(unittest.TestCase): 'vid': 3, 'ethertype': ether.ETH_TYPE_ARP} _vlan_str = ','.join(['%s=%s' % (k, repr(vlan_values[k])) - for k, v in inspect.getmembers(p_vlan) - if k in vlan_values]) + for k, v in inspect.getmembers(p_vlan) + if k in vlan_values]) vlan_str = '%s(%s)' % (vlan.vlan.__name__, _vlan_str) arp_values = {'hwtype': 1, @@ -709,7 +709,7 @@ class TestPacket(unittest.TestCase): 'payload_id': 0, 'payload_data': self.payload} _data_str = ','.join(['%s=%s' % (k, repr(data_values[k])) - for k in sorted(data_values.keys())]) + for k in sorted(data_values.keys())]) data_str = '[%s(%s)]' % (sctp.chunk_data.__name__, _data_str) sctp_values = {'src_port': 1, @@ -718,8 +718,8 @@ class TestPacket(unittest.TestCase): 'csum': repr(p_sctp.csum), 'chunks': data_str} _sctp_str = ','.join(['%s=%s' % (k, sctp_values[k]) - for k, _ in inspect.getmembers(p_sctp) - if k in sctp_values]) + for k, _ in inspect.getmembers(p_sctp) + if k in sctp_values]) sctp_str = '%s(%s)' % (sctp.sctp.__name__, _sctp_str) pkt_str = '%s, %s, %s' % (eth_str, ipv4_str, sctp_str) @@ -1245,7 +1245,7 @@ class TestPacket(unittest.TestCase): 'payload_id': 0, 'payload_data': self.payload} _data_str = ','.join(['%s=%s' % (k, repr(data_values[k])) - for k in sorted(data_values.keys())]) + for k in sorted(data_values.keys())]) data_str = '[%s(%s)]' % (sctp.chunk_data.__name__, _data_str) sctp_values = {'src_port': 1, @@ -1254,8 +1254,8 @@ class TestPacket(unittest.TestCase): 'csum': repr(p_sctp.csum), 'chunks': data_str} _sctp_str = ','.join(['%s=%s' % (k, sctp_values[k]) - for k, _ in inspect.getmembers(p_sctp) - if k in sctp_values]) + for k, _ in inspect.getmembers(p_sctp) + if k in sctp_values]) sctp_str = '%s(%s)' % (sctp.sctp.__name__, _sctp_str) pkt_str = '%s, %s, %s' % (eth_str, ipv6_str, sctp_str) @@ -1496,8 +1496,8 @@ class TestPacket(unittest.TestCase): 'pf_bit': 0, 'modifier_function2': 0} _ctrl_str = ','.join(['%s=%s' % (k, repr(ctrl_values[k])) - for k, v in inspect.getmembers(p_llc.control) - if k in ctrl_values]) + for k, v in inspect.getmembers(p_llc.control) + if k in ctrl_values]) ctrl_str = '%s(%s)' % (llc.ControlFormatU.__name__, _ctrl_str) llc_values = {'dsap_addr': repr(llc.SAP_BPDU), @@ -1524,8 +1524,8 @@ class TestPacket(unittest.TestCase): 'hello_time': float(2), 'forward_delay': float(15)} _bpdu_str = ','.join(['%s=%s' % (k, repr(bpdu_values[k])) - for k, v in inspect.getmembers(p_bpdu) - if k in bpdu_values]) + for k, v in inspect.getmembers(p_bpdu) + if k in bpdu_values]) bpdu_str = '%s(%s)' % (bpdu.ConfigurationBPDUs.__name__, _bpdu_str) pkt_str = '%s, %s, %s' % (eth_str, llc_str, bpdu_str) diff --git a/ryu/tests/unit/packet/test_slow.py b/ryu/tests/unit/packet/test_slow.py index 3ce9d450..c3f6c4b0 100644 --- a/ryu/tests/unit/packet/test_slow.py +++ b/ryu/tests/unit/packet/test_slow.py @@ -36,6 +36,7 @@ LOG = logging.getLogger(__name__) class Test_slow(unittest.TestCase): """ Test case for Slow Protocol """ + def setUp(self): self.subtype = SLOW_SUBTYPE_LACP self.version = lacp.LACP_VERSION_NUMBER |