Skip to content
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
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Fix dcp tests #435

wants to merge 6 commits into from

Conversation

atlowl
Copy link

@atlowl atlowl commented Jun 27, 2021

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'.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants