-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dcp tests #435
Open
atlowl
wants to merge
6
commits into
rtlabs-com:master
Choose a base branch
from
atlowl:fix_dcp_tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix dcp tests #435
Conversation
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
IEC 61158-6-10:2019 4.3.1.2 specifies that an identify filter packet can contain 1 or more filter blocks and that any block type can be first. p-net determines that an identify packet is a filter, if the first block is a station name or alias filter block. This fixes pf_dcp_identify_req () so that p-net responds to single or multiple identify filter packets that start any supported filter type.
Adding a gtest for the identify by device id. This does both a check if the device id is correct, and not correct.
The function pf_dcp_identify_req, would return 1 even if the request wasn't handled by it, this would lead to replies to invalid requests sent to the device. Fixing this so that it only returns 1 if the request being made passes the necessary checks. Fixed the invalid ident_req array in the gtests, filled with proper station name, and tests now check if the station name, dcp data length and dcp block length are correct for packets.
Adding a gtest for the identify by device id. This does both a check if the device id is correct, and not correct.
The DCP tests would count packets at the end to ensure that p-net did actually reply, this count however included LLDP packets since LLDP is initiated at the start of the test, and is not really able to be turned off. Also add a small delay between sending identity requests so that the stack has time to add the outgoing messages to the queue, otherwise the 2nd message stomps the first.
Using the feature --gtest_repeat would fail for the dcp test as the new test introduced would change a byte of the array to make sure that the device ID was not recognized. But when running the test again on repeat, the array would stay modified, and the test fail because the ID was incorrect.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This builds on the previous patch of responding to all filter types.
The DCP tests were mainly looking for a return of 1 to say that the packet was handled, but pf_dcp_identify_req() would always return 1, the test would therefore always pass.
I believe if the packet isn't right, or if it does not match, then it should not return 'handled'.