This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Teststruct improvement application #404
Closed
erickvermot
wants to merge
53
commits into
kytos:master
from
erickvermot:teststruct_improvement_application
Closed
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
e9842dc
introduce general unpack method (comes from of_core.utils)
erickvermot 883358a
proposes more flexible TestStruct
erickvermot 5d6420e
remove comment as requested...
erickvermot acab250
apply new test implementation for basic types
erickvermot 990c121
apply new test implementation for basic types - remove unused
erickvermot e20298e
apply new test implementation for network types
erickvermot 79c6d54
apply new test implementation for network types - remove unused
erickvermot 6889fb6
apply new test implementation for error msg
erickvermot f62087d
errormsg packet dump fix
erickvermot 25db9a1
apply new test implementation for error msg - remove unused
erickvermot 98a6d87
apply new test implementation for flow removed
erickvermot 9267820
apply new test implementation for PacketIn
erickvermot 7accf0a
apply new test implementation for PortStatus
erickvermot 6509eb1
apply new test implementation for actions
erickvermot d616fe5
apply new test implementation for actions
erickvermot e2209c9
apply new test implementation for Match class
erickvermot 40efb0a
apply new test implementation for Header class
erickvermot 0c7912e
apply new test implementation for PhyPort class
erickvermot eb31213
apply new test implementation for queues
erickvermot af85d5b
apply new test implementation for agg stats reply
erickvermot 3fb8844
apply new test implementation for agg stats request
erickvermot 4190b19
apply new test implementation for BarrierReply class
erickvermot baa5104
apply new test implementation for BarrierRequest class
erickvermot 740ad26
apply new test implementation for DescStats class
erickvermot 4f7db61
apply new test implementation for FeaturesReply class
erickvermot a09632f
apply new test implementation for FeaturesRequest class
erickvermot 16bd12f
apply new test implementation for FlowMod class
erickvermot 9f846c9
apply new test implementation for flow stats (StatsReply msg)
erickvermot d4be345
apply new test implementation for flow stats request
erickvermot db73a7d
apply new test implementation for get config reply
erickvermot ef4f5ba
apply new test implementation for get config request
erickvermot 4f5e66d
apply new test implementation for packet out
erickvermot 51f77d5
apply new test implementation for port mod
erickvermot 0dcf972
apply new test implementation for port stats
erickvermot fb289de
apply new test implementation for port stats request
erickvermot 4d30809
apply new test implementation for get config reply
erickvermot 11d34b3
apply new test implementation for get config request
erickvermot 5cddf6e
test get config request wrong min size
erickvermot 82b52a2
apply new test implementation for queue stats
erickvermot 5600802
apply new test implementation for queue stats request
erickvermot 988d268
apply new test implementation for set config
erickvermot d1a1770
apply new test implementation for stats reply
erickvermot 883c637
apply new test implementation for stats request
erickvermot bc30ea4
apply new test implementation for table stats
erickvermot 11d7af4
apply new test implementation for echo reply
erickvermot a6fe4f9
apply new test implementation for echo request
erickvermot 0d56152
apply new test implementation for hello
erickvermot 897653b
apply new test implementation for vendor header
erickvermot 062e481
test port status isort
erickvermot f3c69ae
Requested changes on tests names, line breaks and such.
erickvermot d294d46
include dump object in TestStructDump docstring
erickvermot f2a02e5
make type(Char(length))(value) return new class but with same length
erickvermot 089b921
Include min_size tests for a few basic_types
erickvermot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""General Unpack utils for python-openflow.""" | ||
import pyof.v0x01.common.header | ||
import pyof.v0x01.common.utils | ||
import pyof.v0x04.common.header | ||
import pyof.v0x04.common.utils | ||
from pyof.foundation.exceptions import UnpackException | ||
|
||
pyof_version_libs = {0x01: pyof.v0x01, | ||
0x04: pyof.v0x04} | ||
|
||
|
||
def unpack(packet): | ||
"""Unpack the OpenFlow Packet and returns a message.""" | ||
try: | ||
version = packet[0] | ||
except IndexError: | ||
raise UnpackException('null packet') | ||
|
||
try: | ||
pyof_lib = pyof_version_libs[version] | ||
except KeyError: | ||
raise UnpackException('Version not supported') | ||
|
||
try: | ||
header = pyof_lib.common.header.Header() | ||
header.unpack(packet[:8]) | ||
message = pyof_lib.common.utils.new_message_from_header(header) | ||
binary_data = packet[8:] | ||
if binary_data: | ||
if len(binary_data) == header.length - 8: | ||
message.unpack(binary_data) | ||
else: | ||
raise UnpackException( | ||
'packet size does not match packet length field') | ||
return message | ||
except (UnpackException, ValueError) as e: | ||
raise UnpackException(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you removed this other tests here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because they are already being performed.