Skip to content

Feature emac merge test (again) #6837

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e98f3c8
Networking update: general refactoring, unifying EMAC
kjbracey Aug 15, 2017
25257a2
Insert EMACInterface class
kjbracey Dec 5, 2017
23dc09d
Remove CellularInterface
kjbracey Dec 5, 2017
2996fcb
Add downcast methods to NetworkInterface
kjbracey Dec 19, 2017
23aa6cb
Updated greentea network interface configuration files
Jan 8, 2018
27c16fe
Move Freescale EMAC driver out of lwIP
kjbracey Jan 15, 2018
2150bc4
Tell mbed build to ignore old lwIP+EMAC drivers
kjbracey Jan 15, 2018
5bce4ea
Work around Nuvoton #define EMAC
kjbracey Jan 16, 2018
5d26015
Adjust test configurations for EMAC
kjbracey Jan 31, 2018
b576f2f
Restrict client and socket example tests to K64F+K66F
kjbracey Jan 31, 2018
bfd385e
Disable Nanostack border router test
kjbracey Jan 31, 2018
7a68a7e
Ignore old EMAC Wifi drivers
kjbracey Jan 31, 2018
b645db1
Remove Ethernet from NUCLEO_F429ZI test
kjbracey Jan 31, 2018
5d41c8c
Connectivity test: don't create interface object twice
kjbracey Feb 1, 2018
5735986
Created memory manager class to netsocket and updated lwip to use it
Dec 21, 2017
f95f09f
Updated K64F ethernet driver to use memory manager
Dec 21, 2017
e3a2e1a
Updated STM ethernet driver to use emac and memory manager
Dec 21, 2017
231c6d8
Move STM EMAC driver out out lwIP
kjbracey Jan 15, 2018
dd6f66e
Added preferred alignment to emac and copy to/from to memory manager
Jan 11, 2018
5bacfc6
K64F EMAC: Fix TX error path leaks
kjbracey Jan 12, 2018
ffc394c
Enabled greentea and mbed-os-example-tls/client/sockets test for STM
Feb 8, 2018
9d4da12
EMAC: check link status callback is set
kjbracey Jan 10, 2018
31d86d5
Extend EMAC multicast APIs
kjbracey Jan 11, 2018
c38e211
Nanostack EMAC implementation
kjbracey Dec 8, 2017
43e7054
Corrected STM eth driver flagging, memory allocation and thread init
Feb 22, 2018
1acb513
Emac greentea tests for feature-emac
Feb 16, 2018
6fc3b8d
Made feature-emac changes to emac greentea tests default code
Mar 2, 2018
2d14fb1
Stop drivers checking DEVICE_EMAC
kjbracey Mar 5, 2018
3c4d143
Add extra labels for Freescale & STM EMAC drivers
kjbracey Mar 5, 2018
72d665f
Add EMAC driver README.md with porting guide
kjbracey Mar 13, 2018
946b58a
Changed STM emac driver to loop RX frame reading
Mar 15, 2018
dea5606
K64F: Updated the SYSMPU SDK driver
mmahadevan108 Apr 23, 2018
a73adf5
K64F, K66F: Update the SYSMPU implementation
mmahadevan108 Apr 23, 2018
41d16e6
Kinetis EMAC: Renamed K64F files to Kinetis
mmahadevan108 Apr 23, 2018
ea912d5
Updated non-blocking connect changes to EMAC greentea test server
Apr 27, 2018
edaba68
Test merge of feature-emac with master
kjbracey May 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion TESTS/netsocket/connectivity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@

using namespace utest::v1;

// Avoid creating the interface twice
static NetworkInterface *get_interface()
{
static NetworkInterface *interface = MBED_CONF_APP_OBJECT_CONSTRUCTION;

return interface;
}

// Bringing the network up and down
template <int COUNT>
void test_bring_up_down() {
NetworkInterface* net = MBED_CONF_APP_OBJECT_CONSTRUCTION;
NetworkInterface* net = get_interface();

for (int i = 0; i < COUNT; i++) {
int err = MBED_CONF_APP_CONNECT_STATEMENT;
Expand Down
93 changes: 79 additions & 14 deletions TESTS/network/emac/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,93 @@
# Description
# Introduction

This document describes how to run EMAC tests. The EMAC test cases are made using Ethernet Configuration Testing Protocol (CTP). To run the tests, one device in the Ethernet segment needs to be configured to be a CTP echo server. The devices running the test cases, use the echo server to forward the CTP Ethernet frames back.
This document describes how to run EMAC tests. The EMAC test cases are made using the Ethernet Configuration Testing Protocol (CTP). To run the tests, one device in the Ethernet segment needs to be configured to be a CTP echo server. The devices running the test cases, use the echo server to forward the CTP Ethernet frames back.

# Configuring CTP echo server
## Configuring the CTP echo server

A device can be configured to be a CTP echo server by enabling `echo-server` setting in the test environment's application `json` file. When device is configured to be a CTP echo server, it starts to forward CTP messages automatically after power up and will continue forwarding until power down.
To configure a device to be a CTP echo server, you need to enable the `echo-server` setting in the `json` file of the test environment application. When a device is configured to be a CTP echo server, it starts to forward CTP messages automatically when it is switched on and continues to do so until it is switched off.

# Test cases
## Test cases

## EMAC interface initialise
### EMAC initialize

Initializes EMAC interface driver.
The test case initializes the EMAC driver and the test network stack.

For WLAN installs test case so that it can intercept incoming Ethernet messages from the WLAN driver. Incoming CTP frames are handed by the test case and other frames are forwarded to the LWIP stack.
The EMAC test environment uses the test network stack as the default stack. To enable the stack, set the `nsapi.default-stack` option in the `json` file of the test environment application to value `TEST`.

## EMAC interface broadcast
The test network stack is a bare minimum implementation and has the functionality needed to set up the network interface. The test network stack is defined in the `emac_TestNetworkStack.h` and `emac_TestNetworkStack.cpp` files. The stack uses the test memory manager for the EMAC. The test memory manager is defined in the `emac_TestMemoryManager.h` and `emac_TestMemoryManager.cpp` files. Message buffers sent to the EMAC in `link_out()` are allocated from the buffer pool of the test memory manager. The test memory manager pool allocation unit (buffer size) is 610 bytes.

Sends three 100 byte CTP broadcast messages, waits for three seconds and sends three 50 byte CTP broadcast messages. Listens for the CTP echo server responses and stores the addresses of the echo servers if replies are received. The test case will pass if there are no responses from echo server, but further test cases will be skipped.
The initialization test constructs the network interface and connects to it. The test network stack and the EMAC are bound to the network interface using `get_default_instance()` calls to the stack and to the EMAC.

## EMAC interface unicast
After the construction, the network interface is connected. A connect call triggers a set up call to the test network stack. The set up call triggers a call to `emac_if_init()` function in the EMAC initialization test case.

Sends three CTP unicast messages to the CTP echo server. Verifies that all are replied.
The `emac_if_init()` function of the test case configures and powers up the EMAC.

## EMAC interface unicast frame length
The configuration steps are:

* Setting the test memory manager for the EMAC.
* Setting the EMAC link input and state callbacks to call the test environment input and state callback handlers.
* Reading and setting the Ethernet MAC address.

### EMAC broadcast

1. Sends three CTP broadcast messages (100 bytes each)
2. Waits for three seconds
3. Sends three CTP broadcast messages (60 bytes each).
4. Listens for the CTP echo server responses.
5. Stores the addresses of the echo servers if replies are received.

The test case passes if there are no responses from the echo server, but further test cases are skipped.

### EMAC unicast

1. Sends three CTP unicast messages (100 bytes each) to the CTP echo server.
2. Verifies that all are replied.

### EMAC unicast frame length

1. Sends CTP unicast messages with Ethernet message length from 100 bytes to the maximum defined by the MTU of the EMAC with 50 bytes increments.
2. Verifies that all are replied.

### EMAC unicast burst

1. Sends CTP unicast messages with Ethernet message length from 100 bytes to the maximum defined by the MTU of the EMAC with 50 bytes increments.
2. Repeats the sending 10 times.
3. Verifies that all are replied.

### EMAC multicast filter

Sends CTP unicast messages with Ethernet message length from 100 bytes to maximum. Verifies that all are replied.
Tests multicast filtering. Multicast filtering is an optional feature for the EMAC. The test does not fail if filtering is not implemented.

The multicast testing requests the CTP echo server to forward the CTP messages to a specified multicast address as the destination address.

Test steps:

1. Using unicast, verify that the echo server responses are received.
2. Set the IPv6 multicast filter address and the echo server reply (forward) address to different values. Check if the echo response is filtered.
3. Set the IPv6 multicast filter address and the echo server reply address to same value. Check that the response is not filtered.
4. Set the IPv4 multicast filter address and the echo server reply address to different values. Check if the response is filtered.
5. Set the IPv4 multicast filter address and the echo server reply address to same value. Check that the response is not filtered.
6. Enable the receiving of all multicasts. Check that the response is not filtered.

### EMAC memory

Tests memory manager out-of-memory situations. The test case configures the test memory manager to reject memory buffer allocations made by the EMAC. Memory buffer allocations are divided into output and input memory allocations:

* The output memory allocations are the ones made by the EMAC in the `link_out()` function called by the network stack (test case).
* The input memory allocations are other memory allocations made by the EMAC.

Depending on the EMAC implementation, it may or may not allocate memory manager buffers in the link output function. If the memory manager buffers are not allocated, disabling the link output memory allocations in the test does not affect the functionality.

In each test step, the test case sends CTP unicast messages with Ethernet message length from 100 bytes to the maximum defined by the MTU of the EMAC with 50 bytes increments. Memory buffers sent to the EMAC in the `link_out()` function are forced to be non-aligned in this test case.

Test steps:

1. Memory buffer allocations are allowed. Verify that echo server responses are received.
2. Disable input memory buffer allocations. The echo server responses should not be received.
3. Allow memory buffer allocations. Verify that the echo server responses are received.
4. Disable output memory buffer allocations. The echo server responses may or may not be received depending on the EMAC link out implementation.
5. Allow memory buffer allocations. Verify that the echo server responses are received.
6. Disable input and output memory buffer allocations. The echo server responses should not be received.
7. Allow memory buffer allocations. Verify that the echo server responses are received.
8. Allocate memory buffers that are sent to the EMAC in link out from the heap (contiguous memory). Verify that the echo server responses are received.

Loading