diff --git a/pyof/v0x04/asynchronous/packet_in.py b/pyof/v0x04/asynchronous/packet_in.py index ffcd65246..7a20dbdca 100644 --- a/pyof/v0x04/asynchronous/packet_in.py +++ b/pyof/v0x04/asynchronous/packet_in.py @@ -3,10 +3,11 @@ # System imports from enum import Enum +from pyof.v0x04.common.flow_match import Match from pyof.v0x04.common.header import Header, Type from pyof.foundation.base import GenericMessage from pyof.foundation.basic_types import (BinaryData, Pad, UBInt8, UBInt16, - UBInt32) + UBInt32, UBInt64) # Third-party imports @@ -35,22 +36,25 @@ class PacketIn(GenericMessage): header = Header(message_type=Type.OFPT_PACKET_IN) buffer_id = UBInt32() total_len = UBInt16() - in_port = UBInt16() reason = UBInt8(enum_ref=PacketInReason) - #: Align to 32-bits. - pad = Pad(1) + table_id = UBInt8() + cookie = UBInt64() + match = Match() + pad = Pad(2) data = BinaryData() - def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, - reason=None, data=b''): + def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, + table_id=None, cookie=None, data=b''): + """Assign parameters to object attributes. Args: xid (int): Header's xid. buffer_id (int): ID assigned by datapath. total_len (int): Full length of frame. - in_port (int): Port on which frame was received. reason (PacketInReason): The reason why the packet is being sent + table_id (int): ID of the table that was looked up + cookie (int): Cookie of the flow entry that was looked up data (bytes): Ethernet frame, halfway through 32-bit word, so the IP header is 32-bit aligned. The amount of data is inferred from the length field in the header. Because of padding, @@ -60,6 +64,7 @@ def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, super().__init__(xid) self.buffer_id = buffer_id self.total_len = total_len - self.in_port = in_port self.reason = reason + self.table_id = table_id + self.cookie = cookie self.data = data