forked from nrfconnect/sdk-zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sample: net: RPL mesh sample over QEMU
Create a net sample to setup a multi-node RPL mesh network using QMEU. To enable this, it was necessary implement a hw filter on IEEE 802.15.4 UART Pipe driver and create a QEMU pipe management on cmake. This sample use a tool developed on zephyr net-tools repository called virtual-hub. Signed-off-by: Pedro Martucci <[email protected]>
- Loading branch information
1 parent
ede5b8f
commit a495b31
Showing
9 changed files
with
368 additions
and
2 deletions.
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
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,77 @@ | ||
# RPL Mesh Network over QEMU | ||
|
||
Overview | ||
******** | ||
|
||
This sample uses virtual-hub tool from zephyrproject-rtos/net-tools | ||
to setup a multi-node RPL network on top of QEMU. This way, is possible | ||
to validate different network topologies in virtualized environment. | ||
|
||
In this sample, we will build a three node graph connected like a row: | ||
|
||
root <-> node1 <-> node2 | ||
|
||
Requirements | ||
************ | ||
|
||
First of all, we must clone net-tools repository, and build virtual-hub: | ||
``` | ||
cd virtual-hub | ||
mkdir build && cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
Building and Running | ||
******************** | ||
|
||
1. Build and run the RPL root application: | ||
``` | ||
cd root | ||
mkdir build && cd build | ||
cmake -DQEMU_PIPE_ID=1 .. | ||
make | ||
make node | ||
``` | ||
|
||
2. Build and run the first RPL node application: | ||
``` | ||
cd node | ||
mkdir build-1 && cd build-1 | ||
cmake -DQEMU_PIPE_ID=2 .. | ||
make | ||
make node | ||
``` | ||
|
||
3. Build and run the second RPL node application: | ||
``` | ||
cd node | ||
mkdir build-2 && cd build-2 | ||
cmake -DQEMU_PIPE_ID=3 .. | ||
make | ||
make node | ||
``` | ||
|
||
4. Now we should run the virtual-hub, which will connect | ||
all the pipes according to the csv file: | ||
``` | ||
cd virtual-hub/build | ||
./hub ../input.csv | ||
``` | ||
|
||
5. Wait until the network is fine, you can check it | ||
using net shell on root application: | ||
``` | ||
select net | ||
route | ||
``` | ||
You should see two routes pointing to both clients application. | ||
|
||
Virtual-Hub Notes | ||
***************** | ||
|
||
When trying to reboot/drop a node from network you must | ||
also reboot the virtual-hub to keep it working properly. | ||
|
||
For more details about how to customize the network, follow the | ||
README instructions from virtual-hub repository. |
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,9 @@ | ||
set(BOARD qemu_cortex_m3) | ||
set(CONF_FILE prj_qemu.conf) | ||
|
||
set(QEMU_PIPE_STACK 1) | ||
|
||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) | ||
project(NONE) | ||
|
||
target_sources(app PRIVATE src/main.c) |
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,60 @@ | ||
#### Initial Configuration ############################ | ||
|
||
# Enable basic networking | ||
CONFIG_NETWORKING=y | ||
|
||
# 802.15.4 requires random generator | ||
CONFIG_TEST_RANDOM_GENERATOR=y | ||
|
||
# Network Interface Buffer Size | ||
CONFIG_NET_PKT_RX_COUNT=40 | ||
CONFIG_NET_PKT_TX_COUNT=40 | ||
|
||
#### Logging Configuration ############################ | ||
|
||
CONFIG_SYS_LOG=y | ||
CONFIG_NET_LOG=y | ||
CONFIG_SYS_LOG_NET_LEVEL=4 | ||
CONFIG_SYS_LOG_SHOW_COLOR=y | ||
|
||
#### Network Stack Configuration ###################### | ||
|
||
# RPL (Routing) | ||
CONFIG_NET_RPL=y | ||
CONFIG_NET_DEBUG_RPL=y | ||
CONFIG_NET_RPL_PROBING=y | ||
CONFIG_NET_RPL_MAX_DAG_PER_INSTANCE=1 | ||
|
||
# IPv6 (L3) | ||
CONFIG_NET_IPV6=y | ||
CONFIG_NET_DEBUG_IPV6=n | ||
CONFIG_NET_IPV6_ND=n | ||
CONFIG_NET_IPV6_DAD=y | ||
CONFIG_NET_IPV6_MLD=n | ||
|
||
# 6LoWPAN (L2 - Adaptation Layer) | ||
CONFIG_NET_6LO=y | ||
CONFIG_NET_DEBUG_6LO=n | ||
|
||
# 802.15.4 (L2) | ||
CONFIG_NET_L2_IEEE802154=y | ||
CONFIG_NET_DEBUG_L2_IEEE802154=n | ||
CONFIG_NET_L2_IEEE802154_FRAGMENT=y | ||
CONFIG_NET_DEBUG_L2_IEEE802154_FRAGMENT=n | ||
|
||
# 802.15.4 (L1) | ||
CONFIG_IEEE802154_UPIPE=y | ||
CONFIG_SYS_LOG_IEEE802154_DRIVER_LEVEL=2 | ||
|
||
#### Additional Configuration ######################### | ||
|
||
# Enabled Shell Extensions | ||
CONFIG_NET_SHELL=y | ||
CONFIG_NET_L2_IEEE802154_SHELL=y | ||
CONFIG_NET_APP_IEEE802154_DEV_NAME="IEEE802154_UPIPE" | ||
|
||
# Disable default Ethernet interface | ||
CONFIG_NET_SLIP_TAP=n | ||
|
||
# Application Settings | ||
CONFIG_NET_APP_SETTINGS=y |
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,13 @@ | ||
/* | ||
* Copyright (c) 2017 CPqD Foundation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr.h> | ||
#include <misc/printk.h> | ||
|
||
void main(void) | ||
{ | ||
printk("RPL node running\n"); | ||
} |
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,11 @@ | ||
set(BOARD qemu_cortex_m3) | ||
set(CONF_FILE prj_qemu.conf) | ||
|
||
set(QEMU_PIPE_STACK 1) | ||
|
||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) | ||
project(NONE) | ||
|
||
target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) | ||
|
||
target_sources(app PRIVATE src/main.c) |
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,69 @@ | ||
#### Initial Configuration ############################ | ||
|
||
# Enable basic networking | ||
CONFIG_NETWORKING=y | ||
|
||
# 802.15.4 requires random generator | ||
CONFIG_TEST_RANDOM_GENERATOR=y | ||
|
||
# Network Interface Buffer Size | ||
CONFIG_NET_PKT_RX_COUNT=40 | ||
CONFIG_NET_PKT_TX_COUNT=40 | ||
|
||
#### Logging Configuration ############################ | ||
|
||
CONFIG_SYS_LOG=y | ||
CONFIG_NET_LOG=y | ||
CONFIG_SYS_LOG_NET_LEVEL=4 | ||
CONFIG_SYS_LOG_SHOW_COLOR=y | ||
|
||
#### Network Stack Configuration ###################### | ||
|
||
# RPL (Routing) | ||
CONFIG_NET_RPL=y | ||
CONFIG_NET_DEBUG_RPL=y | ||
CONFIG_NET_RPL_GROUNDED=y | ||
CONFIG_NET_RPL_MAX_DAG_PER_INSTANCE=1 | ||
CONFIG_NET_RPL_PREFIX="2001:db8::1/64" | ||
|
||
# IPv6 (L3) | ||
CONFIG_NET_IPV6=y | ||
CONFIG_NET_DEBUG_IPV6=n | ||
CONFIG_NET_IPV6_ND=n | ||
CONFIG_NET_IPV6_DAD=y | ||
CONFIG_NET_IPV6_MLD=n | ||
|
||
# 6LoWPAN (L2 - Adaptation Layer) | ||
CONFIG_NET_6LO=y | ||
CONFIG_NET_DEBUG_6LO=n | ||
|
||
# 802.15.4 (L2) | ||
CONFIG_NET_L2_IEEE802154=y | ||
CONFIG_NET_DEBUG_L2_IEEE802154=n | ||
CONFIG_NET_L2_IEEE802154_FRAGMENT=y | ||
CONFIG_NET_DEBUG_L2_IEEE802154_FRAGMENT=n | ||
|
||
# 802.15.4 (L1) | ||
CONFIG_IEEE802154_UPIPE=y | ||
CONFIG_SYS_LOG_IEEE802154_DRIVER_LEVEL=2 | ||
|
||
#### Additional Configuration ######################### | ||
|
||
# Enabled Shell Extensions | ||
CONFIG_NET_SHELL=y | ||
CONFIG_NET_L2_IEEE802154_SHELL=y | ||
|
||
# Disable default Ethernet interface | ||
CONFIG_NET_SLIP_TAP=n | ||
|
||
# Application Settings | ||
CONFIG_NET_APP_SETTINGS=y | ||
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" | ||
CONFIG_NET_APP_IEEE802154_DEV_NAME="IEEE802154_UPIPE" | ||
|
||
# MAC Setup | ||
CONFIG_IEEE802154_UPIPE_RANDOM_MAC=n | ||
CONFIG_IEEE802154_UPIPE_MAC4=0xAA | ||
CONFIG_IEEE802154_UPIPE_MAC5=0xAA | ||
CONFIG_IEEE802154_UPIPE_MAC6=0xAA | ||
CONFIG_IEEE802154_UPIPE_MAC7=0xAA |
Oops, something went wrong.