-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
"""Defines Header classes and related items.""" | ||
from pyof.v0x01.common.header import Header, Type | ||
"""Defines Header classes and related items. | ||
Only differences between versions. | ||
""" | ||
from pyof.v0x01.common.header import Header as Header0x01, Type | ||
from pyof.v0x02.foundation.base import OFP_VERSION | ||
from pyof.v0x02.foundation.basic_types import UBInt8 | ||
|
||
|
||
__all__ = ('Header', 'Type') | ||
|
||
|
||
class Header(Header0x01): | ||
"""v0x02 Header differences.""" | ||
|
||
version = UBInt8(OFP_VERSION) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
diraol
Contributor
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ def __init__(self, *args, **kwargs): | |
author_email='[email protected]', | ||
license='MIT', | ||
test_suite='tests', | ||
packages=find_packages(exclude=['tests', '*v0x02*']), | ||
packages=find_packages(exclude=['tests']), | ||
cmdclass={ | ||
'lint': Linter, | ||
'quick_lint': FastLinter | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Header testing.""" | ||
import unittest | ||
|
||
from pyof.v0x02.common.header import Header | ||
|
||
|
||
class TestHeader(unittest.TestCase): | ||
"""Test Header changes between v0x01 and v0x02.""" | ||
|
||
def test_version(self): | ||
"""Version must be 0x02 for OF 1.1.0.""" | ||
header = Header() | ||
self.assertEqual(0x02, header.version) |
@cemsbr We have a problem here.
We are loosing the 'parent class' odered attribute. So, if you do:
I can see two solutions here.
The first one is to implement the class again from the ground.
The second one is to override the ordered object.
The third one is to rewrite the MetaStruct class to consider inheritance cases.