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

v0x05 implementation #556

Open
wants to merge 83 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
7b797a6
Create the packages v0x05 and symmetric
Apr 8, 2019
60465df
Created the file hello and its classes. There missing files that will…
Apr 8, 2019
992480d
Change an import from the system to one of the classes IntEnum
Apr 8, 2019
8034758
Created missing files for the hello messages. Added the Header and co…
Apr 10, 2019
0e94dc9
Delete R_User_Library.xml
RoyAl82 Apr 10, 2019
35e1a58
Delete vcs.xml
RoyAl82 Apr 10, 2019
297539e
Deleted repeated comments under HelloElemVersionBitmap.
RoyAl82 May 7, 2019
e5f4c58
Deleted repeated comments in the Header Class.
RoyAl82 May 7, 2019
a7d322f
Merge branch 'master' into v0x05/symmetric/hello
RoyAl82 May 7, 2019
3b09f3b
Deleted extra space before the __init__ method
RoyAl82 May 7, 2019
58d87f5
Fix some indentation and spaces in comments
RoyAl82 May 7, 2019
81322f9
All indentation and spaces in Header files has been fix in relation t…
RoyAl82 May 7, 2019
6902c53
Eliminated the warnings in the hello file
RoyAl82 May 7, 2019
82be74e
Merge pull request #1 from RoyAl82/temp
RoyAl82 May 7, 2019
53540ac
Changing the comment in the HelloElemVersionBitmap
RoyAl82 May 7, 2019
bdc2bb9
Changing the indentation in the HelloElemVersionBitmap
RoyAl82 May 7, 2019
da312ff
Changing the indentation and creating spaces to the HelloElemVersionB…
RoyAl82 May 8, 2019
22929e5
Rewrite the method HelloElemVersionBitmap
RoyAl82 May 8, 2019
dcaa2a5
add some space the method HelloElemVersionBitmap: 3
RoyAl82 May 8, 2019
060f1f2
add some space the method HelloElemVersionBitmap: 8 and the method __…
RoyAl82 May 8, 2019
c673841
Add some space to the comment in the method HelloElemVersionBitmap
RoyAl82 May 8, 2019
dc0bb8a
Add some space to the comment in the method HelloElemVersionBitmap
RoyAl82 May 8, 2019
2338d32
Add some space to the comment in the method HelloElemVersionBitmap
RoyAl82 May 8, 2019
0b1a82c
Change the parameter representation to the method __init__ in the cla…
RoyAl82 May 8, 2019
f5bebf7
Changed variable name in the HelloElemHeader
RoyAl82 May 8, 2019
de1c697
Changed the type its variable name in the HelloElemHeader
RoyAl82 May 8, 2019
16bd2bb
Change the name of HelloElemHeader to eliminate the cross-reference
RoyAl82 May 8, 2019
53452f8
Change the name in the all list
RoyAl82 May 8, 2019
c722bce
Fix minor changes to comply with the docstring
RoyAl82 May 8, 2019
9627614
Fix indentation
RoyAl82 May 8, 2019
6609355
Add a blank line to the definition in HelloElemVersionBitmap
RoyAl82 May 8, 2019
c3718ac
Add a blank line to the definition in HelloElemVersionBitmap
RoyAl82 May 8, 2019
33ecf23
Add a blank line to the definition in HelloElemVersionBitmap to fix t…
RoyAl82 May 8, 2019
40ff5de
Add a newlines, spaces to fix the indentation
RoyAl82 May 8, 2019
843bd3f
Add a newlines, spaces to fix the indentation
RoyAl82 May 8, 2019
e742e9d
Add a newlines, spaces to fix the indentation
RoyAl82 May 8, 2019
692b4fb
Add a newlines, spaces to fix the indentation
RoyAl82 May 8, 2019
ccf33aa
Fixing some indentations
RoyAl82 May 8, 2019
8c66a0b
Created two new files the action and the flow_match the action file u…
RoyAl82 May 8, 2019
5f3e3bc
Fixing some spaces and indentations to the action file.
RoyAl82 May 8, 2019
6ed2851
Delete a file to submit only one file to Kytos.
RoyAl82 May 9, 2019
c9c2f23
Change the name of the class to eliminate the cross-reference error f…
RoyAl82 May 9, 2019
636d3cf
Change the name of the class to eliminate the cross-reference error f…
RoyAl82 May 9, 2019
80f1294
Change the name of the class to eliminate the cross-reference error f…
RoyAl82 May 9, 2019
78f0043
Change the name of the class to eliminate the cross-reference error f…
RoyAl82 May 9, 2019
9536b2a
Create a new line for the parameter list that violate the length of t…
RoyAl82 May 9, 2019
339b8a8
Fix the import sorted issue.
RoyAl82 May 9, 2019
3fc0d15
Change the name of the classes to prevent the error cross reference w…
RoyAl82 May 9, 2019
7c5e2ec
Change some spaces in the comments to fix the indentation of the comm…
RoyAl82 May 9, 2019
052c28c
Fix the spaces, indentation problems encounter by the Scrutinizer.
RoyAl82 May 9, 2019
dfee85c
Fix the spaces problems encounter by the Scrutinizer.
RoyAl82 May 9, 2019
693b970
Fix the spaces problems encounter by the Scrutinizer.
RoyAl82 May 9, 2019
7e7d4a7
Submitting the port feature from Open Flow Version 1.4.1 Specificatio…
RoyAl82 May 9, 2019
04e998e
Fixing the cross reference and updating the length of some of the por…
RoyAl82 May 9, 2019
3dbc3bb
Fixed the limited lines problems and the sorted imports
RoyAl82 May 9, 2019
4d7d90e
Fixed the indentation.
RoyAl82 May 9, 2019
71fb384
Rewrote the description under the OPFPortDescPropHeader
RoyAl82 May 9, 2019
15e4f50
Rewrote the description under the OPFPortDescPropHeader
RoyAl82 May 9, 2019
792baaf
Rewrote the description under the OPFPortDescPropHeader
RoyAl82 May 9, 2019
0897df5
Fixing the sorted import error.
RoyAl82 May 9, 2019
92d7ad1
Added the echo_reply file
RoyAl82 May 10, 2019
d62aaf2
Added the echo_request file
RoyAl82 May 10, 2019
981c065
Added the error_msg file
RoyAl82 May 10, 2019
65e32c5
Fixing the sorted import and spaces.
RoyAl82 May 10, 2019
65d00ae
Fixed the Errors.
RoyAl82 May 10, 2019
7a3956e
Fixed the limited line.
RoyAl82 May 10, 2019
e034b93
Fixing the Invalid Name.
RoyAl82 May 10, 2019
9f90db3
Fixing the Invalid Name.
RoyAl82 May 10, 2019
780f6e5
Add the experimenter feature for v0x05
RoyAl82 May 10, 2019
3891f65
Fixing some line limits
RoyAl82 May 10, 2019
0736281
Fixed the cross reference.
RoyAl82 May 10, 2019
a73cefb
Add the Packet In feature from V0x05
RoyAl82 May 10, 2019
bbb2f28
Add the Request Forward feature from V0x05
RoyAl82 May 10, 2019
50aa4e9
Fixing the cross reference
RoyAl82 May 10, 2019
23edb94
Fixing the cross reference
RoyAl82 May 10, 2019
86c1c2d
Fixing a space line after the imports
RoyAl82 May 10, 2019
96cdfcf
Fixing the spaces error
RoyAl82 May 10, 2019
d5b39b6
Fixing the spaces error
RoyAl82 May 10, 2019
551459d
Fixing the spaces error
RoyAl82 May 10, 2019
affab25
Fixing the spaces error
RoyAl82 May 10, 2019
3136ea6
Fixing the spaces error
RoyAl82 May 10, 2019
8166d05
Fixing the spaces error
RoyAl82 May 10, 2019
e286874
Fixing the spaces error
RoyAl82 May 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyof/v0x05/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""The ofx parser package - spec version 0x05 (1.4.1)."""
1 change: 1 addition & 0 deletions pyof/v0x05/asynchronous/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Asynchronous messages."""
107 changes: 107 additions & 0 deletions pyof/v0x05/asynchronous/packet_in.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
"""For packets received by the datapath and sent to the controller."""

# System imports

from pyof.foundation.base import Enum, GenericMessage
from pyof.foundation.basic_types import (
BinaryData, UBInt8, UBInt16, UBInt32, UBInt64)
from pyof.v0x05.common.flow_match import OPFMatch, OPFOxmOfbMatchField
from pyof.v0x05.common.header import Header, Type

# Third-party imports


__all__ = ('OPFPacketIn', 'OPFPacketInReason')

# Enums


class OPFPacketInReason(Enum):
"""Reason why this packet is being sent to the controller."""

#: No matching flow (table- miss flow entry).
OFPR_TABLE_MISS = 0
#: Output to controller in apply-actions.
OFPR_APPLY_ACTION = 1
#: Packet has invalid TTL.
OFPR_INVALID_TTL = 2
#: Output to controller in action set.
OFPR_ACTION_SET = 3
#: Output to controller in group bucket.
OFPR_GROUP = 4
#: Output to controller in packet-out.
OFPR_PACKET_OUT = 5


# Classes


class OPFPacketIn(GenericMessage):
"""Packet received on port (datapath -> controller)."""

#: :class:`~pyof.v0x05.common.header.Header`: OpenFlow Header
header = Header(message_type=Type.OFPT_PACKET_IN)
#: ID assigned by datapath.
buffer_id = UBInt32()
#: Full length of frame.
total_len = UBInt16()
#: Reason packet is being sent (one of OFPR_*),
reason = UBInt8(enum_ref=OPFPacketInReason)
#: ID of the table that was looked up.
table_id = UBInt8()
#: Cookie of the flow entry that was looked up.
cookie = UBInt64()
#: Packet metadata. Variable size.
match = OPFMatch()

#: Align to 64 bit + 16 bit
#: pad = Pad(2)
#: Ethernet frame whose length is inferred from header.length.
#: The padding bytes preceding the Ethernet frame ensure that the IP
#: header (if any) following the Ethernet header is 32-bit aligned.
data = BinaryData()

def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None,
table_id=None, cookie=None, match=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.
reason (~pyof.v0x05.asynchronous.packet_in.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
match (:class:`~pyof.v0x05.common.flow_match.Match`):
Packet metadata with variable size.
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,
offsetof(struct ofp_packet_in, data) ==
sizeof(struct ofp_packet_in) - 2.
"""
super().__init__(xid)
self.buffer_id = buffer_id
self.total_len = total_len
self.reason = reason
self.table_id = table_id
self.cookie = cookie
self.match = match
self.data = data

@property
def in_port(self):
"""Retrieve the 'in_port' that generated the PacketIn.

This method will look for the OXM_TLV with type OFPXMT_OFB_IN_PORT on
the `oxm_match_fields` field from `match` field and return its value,
if the OXM exists.

Returns:
The integer number of the 'in_port' that generated the PacketIn if
it exists. Otherwise return None.

"""
in_port = self.match.get_field(OPFOxmOfbMatchField.OFPXMT_OFB_IN_PORT)
return int.from_bytes(in_port, 'big')
46 changes: 46 additions & 0 deletions pyof/v0x05/asynchronous/request_forward.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Defines a Request Forward Header."""

#: System imports.

from pyof.foundation.base import Enum, GenericStruct
from pyof.v0x05.common.header import Header, Type

#: Third-party imports.


__all__ = ('RequestForwardHeader', 'RequestForwardReason')


# Enums

class RequestForwardReason(Enum):
"""Request forward reason."""

#: Forward group mod requests.
OFPRFR_GROUP_MOD = 0
#: Forward meter mod requests.
OFPRFR_METER_MOD = 1


class RequestForwardHeader(GenericStruct):
"""Group/Meter request forwarding."""

# :class:`~.header.Header`: OpenFlow Header
# :class:`~.header.Type`: OpenFlow Type
header = Header(Type.OFPT_REQUESTFORWARD)
# :class:`~.header.Header`: OpenFlow Header
request = Header()

def __init__(self, header=Header(Type.OFPT_REQUESTFORWARD),
request=Header):
"""Create an instance of the header.

Args:
header (:class: `~pyof.v0x05.common.header.Header`):
:class: `~pyof.v0x05.common.header.Type` OFPT_REQUESTFORWARD.
request (:class: `~pyof.v0x05.common.header.Header`):
Request being forwarded.
"""
super().__init__()
self.header = header
self.request = request
1 change: 1 addition & 0 deletions pyof/v0x05/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Common structures used on OpenFlow Protocol."""
Loading