PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
test_dcp_asioIntegration.cpp File Reference

Live Ethernet integration tests for DCP using AsioEthernetSocket. More...

#include <gtest/gtest.h>
#include <array>
#include <asio.hpp>
#include <cstdint>
#include <exception>
#include <string>
#include <thread>
#include <vector>
#include "profinet/AsioIoContextRunner.h"
#include "profinet/asioEthernetSocket.h"
#include "profinet/dcp.h"
#include "profinet/exceptions.h"
#include "profinet/protocol.h"
+ Include dependency graph for test_dcp_asioIntegration.cpp:

Go to the source code of this file.

Macros

#define PROFINET_TEST_INTERFACE   ""
 

Functions

 TEST_F (DcpAsioIntegrationTests, SendDiscoverTransmitsIdentifyRequest)
 
 TEST_F (DcpAsioIntegrationTests, ReadResponseParsesAsioEthernetFrame)
 
 TEST_F (DcpAsioIntegrationTests, ReadResponseParsesVlanTaggedAsioEthernetFrame)
 
 TEST_F (DcpAsioIntegrationTests, GetParamPerformsAsioRoundTrip)
 

Detailed Description

Live Ethernet integration tests for DCP using AsioEthernetSocket.

Exercises the DCP protocol implementation together with the real Ethernet packet transport. The transport is intentionally independent of the operating-system packet API.

Set PROFINET_TEST_INTERFACE to select the Ethernet interface used by these tests.

Definition in file test_dcp_asioIntegration.cpp.

Macro Definition Documentation

◆ PROFINET_TEST_INTERFACE

#define PROFINET_TEST_INTERFACE   ""

Definition at line 32 of file test_dcp_asioIntegration.cpp.

Function Documentation

◆ TEST_F() [1/4]

TEST_F ( DcpAsioIntegrationTests  ,
GetParamPerformsAsioRoundTrip   
)
Test:
Verifies that GetParam performs a complete DCP GET request and response exchange using two real Asio raw Ethernet transports.

DCP::GetParam() -> request transmitted -> peer receives request -> peer sends response -> controller receives matching response -> parameter returned More valueable then only AsioEthernetSocket::Send()

Definition at line 322 of file test_dcp_asioIntegration.cpp.

References profinet::PNDCPHeader::frameId, profinet::dcp::GetParam(), profinet::PNDCPHeader::length, profinet::Mac2String(), profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::PNDCPHeader::payload, profinet::PROFINET_ETHERTYPE, profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, and profinet::PNDCPHeader::xId.

+ Here is the call graph for this function:

◆ TEST_F() [2/4]

TEST_F ( DcpAsioIntegrationTests  ,
ReadResponseParsesAsioEthernetFrame   
)
Test:
Verifies that DCP ReadResponse parses a response received through the real Asio raw Ethernet transport.

Definition at line 261 of file test_dcp_asioIntegration.cpp.

References profinet::dcp::MakeBlockKey(), and profinet::dcp::ReadResponse().

+ Here is the call graph for this function:

◆ TEST_F() [3/4]

TEST_F ( DcpAsioIntegrationTests  ,
ReadResponseParsesVlanTaggedAsioEthernetFrame   
)
Test:
Verifies that DCP ReadResponse accepts a priority-tagged VLAN response received through the real Asio raw Ethernet transport.

Definition at line 288 of file test_dcp_asioIntegration.cpp.

References profinet::dcp::MakeBlockKey(), and profinet::dcp::ReadResponse().

+ Here is the call graph for this function:

◆ TEST_F() [4/4]

TEST_F ( DcpAsioIntegrationTests  ,
SendDiscoverTransmitsIdentifyRequest   
)
Test:
Verifies that DCP SendDiscover transmits a valid Identify request through the real Asio raw Ethernet transport.

Definition at line 195 of file test_dcp_asioIntegration.cpp.

References profinet::dcp::DEFAULT_RESPONSE_DELAY_FACTOR, frame, profinet::PNDCPHeader::Parse(), profinet::PROFINET_ETHERTYPE, and profinet::dcp::SendDiscover().

+ Here is the call graph for this function: