Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
PacketIn class (async message) compliance with OF 1.3.0 - Issue #158
Browse files Browse the repository at this point in the history
  • Loading branch information
abaruchi committed Sep 6, 2016
1 parent 4220f6f commit 97ec090
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions pyof/v0x04/asynchronous/packet_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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

0 comments on commit 97ec090

Please sign in to comment.