Skip to content

Added new configuration parameters to Wi-SUN network interface and Border Router class #12657

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

Merged
merged 2 commits into from
Apr 29, 2020
Merged

Added new configuration parameters to Wi-SUN network interface and Border Router class #12657

merged 2 commits into from
Apr 29, 2020

Conversation

mikaleppanen
Copy link

Summary of changes

Added get/validate/set functions for following Wi-SUN mesh interface configuration options:

- Network name
- Regulatory domain
- Network size
- FHSS channel mask
- FHSS unicast channel function related parameters
- FHSS broadcast channel function related parameters
- Timing parameters

Moved Wi-SUN .json configuration parsing from wisun tasklet to Wi-SUN mesh interface class.

Added Wi-SUN Border Router class. Class can be used to start and stop Wi-SUN Border Router.

Border Router class supports following configuration options:

- RPL DIO trickle parameters
- PAN configuration

Added support of network interface name method to Nanostack Mesh, EMAC and PPP interfaces.

NOTE: this pull request depends on nanostack interfaces that will be released on the next 
nanostack release and can be merged only after the release has been made.

Impact of changes

None

Migration actions required

None

Documentation

None

Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@mikter @artokin @juhhei01 @JarkkoPaso


@ciarmcom
Copy link
Member

@mikaleppanen, thank you for your changes.
@juhhei01 @artokin @mikter @JarkkoPaso @ARMmbed/mbed-os-maintainers please review.

* \return MESH_ERROR_NONE on success.
* \return MESH_ERROR_UNKNOWN in case of failure.
* */
mesh_error_t set_fhss_broadcast_channel_function(uint8_t channel_function, uint16_t fixed_channel = 0xffff, uint8_t dwell_interval = 0x00, uint32_t broadcast_interval = 0x00);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FHSS is not needed in the name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, NetworkInterface *backbone_if)
{
InterfaceNanostack *nano_mesh_if = reinterpret_cast<InterfaceNanostack *>(mesh_if);
int8_t mesh_if_id = nano_mesh_if->get_interface_id();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there null check needed it could be in if?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added null checks


mesh_error_t WisunBorderRouter::stop()
{
if (_mesh_if_id < 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there really a need to return error on unknown usually pointless when you are shutting down

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed return parameter

#if (MBED_CONF_MBED_MESH_API_WISUN_REGULATORY_DOMAIN != 255) || (MBED_CONF_MBED_MESH_API_WISUN_OPERATING_CLASS != 255) || (MBED_CONF_MBED_MESH_API_WISUN_OPERATING_MODE != 255)
status = set_network_regulatory_domain(MBED_CONF_MBED_MESH_API_WISUN_REGULATORY_DOMAIN,
MBED_CONF_MBED_MESH_API_WISUN_OPERATING_CLASS,
MBED_CONF_MBED_MESH_API_WISUN_OPERATING_MODE);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look like you are able to call changes on these parameters before calling connect

It was previously collected in structure at creation and could be modified by user calling functions and then before interface up these were called

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration is made on network interface init. So after that and before connect() is called, it is possible to change the settings similarly as previously.

There is no need for settings cache on application side, since on the new configuration system, the settings can be programmed directly to Wi-SUN stack after the init.

/**
* \brief Validate Wi-SUN RPL DIO trickle parameters.
*
* Function validates DIO trickle timer Imin, DIO trickle timer Imax and DIO trickle timer redundancy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please describe when and why validate function should be used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added brief description

*
* Function reads network name from mbed-mesh-api.
*
* \param network_name Network name as NUL terminated string. Must have space for 32 characters and null terminator (in total 33 characters).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be shorter like Must have space for 33 characters.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

* When network size is changed, and if timing or RPL values should be other than defaults set by stack for the network size,
* they need to set again using above function calls.
*
* \param network_size Values defined in Wi-SUN management API. Automatic 0x00, small 0x01, medium 0x08, large 0x10 and certificate 0xff.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is error prone if values are changed in the future.
Could we use NETWORK_SIZE_XX constants from ws_management_api.h? Or should WiSUN-Interface define its own constants and map them to NETWORK_SIZE before calling the nanostack api?

There is already today mismatch as Certificate 0 and automatic is 0xff.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enum

*
* Function reads network size from mbed-mesh-api.
*
* \param network_size Values defined in Wi-SUN management API. Automatic 0x00, small 0x01, medium 0x08, large 0x10 and certificate 0xff.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, can we use NETWORK_SIZE constants?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enum

*
* Function validates network size from mbed-mesh-api.
*
* \param network_size Values defined in Wi-SUN management API. Automatic 0x00, small 0x01, medium 0x08, large 0x10 and certificate 0xff.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enum

*
* Function overwrites parameters defined by Mbed OS configuration.
*
* \param channel_function Values defined in Wi-SUN management API. Fixed 0x00, TR51CF 0x01, DH1CF 0x02 and vendor defined 0x03.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using hardcoded constants, can we use CHANNEL_FUNCTION_ somehow?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enum

return MESH_ERROR_UNKNOWN;
}

int backbone_if_id = atoi(&backbone_if_name[3]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can get_interface_name be renamed and extended to return also if_id? Or maybe separate method for it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface id is a nanostack specific feature, so I think we should not add high level NetworkInterface.h (or EMACInterface.h) methods for that, if we can avoid it.

We might need at some point to change for backhaul from NetworkInterface::get_default_instance() to more specific nanostack backhaul interface constructors, but a the moment the default instance is working as it is.

@mikaleppanen
Copy link
Author

@amarjeet-arm @gkumaar @debdeep-arm @prashant-arm @umesh-arm Here is the configuration interface pull request to mbed-os

@mikaleppanen
Copy link
Author

@mikter @artokin corrected based on review comments.

@mikaleppanen
Copy link
Author

corrected coding style

* Medium network size: hundreds of devices
* Large network size: thousands of devices
* Automatic: when discovering the network, network size is learned from advertisements and timings adjusted accordingly
* Certificate: used on testing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should limit the network size in this interface by enum it could be from 0 to 20 or something
Then just assign values for those points that we have inside stack
Otherwise changing this later on becomes really hard

Also Automatic is not valid option and should not be here
0 == 25 less
1 == 100
2== 200
10 == 1000
20 == 10000

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nanostack interface has these fixed values (and only those are supported):
#define NETWORK_SIZE_CERTIFICATE 0x00
#define NETWORK_SIZE_SMALL 0x01
#define NETWORK_SIZE_MEDIUM 0x08
#define NETWORK_SIZE_LARGE 0x10
#define NETWORK_SIZE_AUTOMATIC 0xFF
so will I add a conversion to mesh api so that 0 --> 6 means small, 7 - 12 medium, 13 to 18 large etc...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed network size to hundreds of devices, removed defines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that automatic. It was causing more problems at nano stack side.

@mikaleppanen mikaleppanen requested a review from mikter March 31, 2020 14:07
@mikaleppanen
Copy link
Author

updated based on comments


mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, OnboardNetworkStack::Interface *backbone_if)
{
InterfaceNanostack *nano_mesh_if = reinterpret_cast<InterfaceNanostack *>(mesh_if);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need null checks here?

mikter
mikter previously approved these changes Apr 1, 2020
Copy link
Contributor

@juhhei01 juhhei01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing what I would like to remove is that network size automatic. It is nice idea but not a good in practise.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2020

@mikaleppanen Can you review travis failures to compile events?

@0xc0170 0xc0170 removed the needs: CI label Apr 8, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 14, 2020

Any update for this PR?

@mergify
Copy link

mergify bot commented Apr 15, 2020

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@mergify mergify bot dismissed mikter’s stale review April 27, 2020 06:37

Pull request has been modified.

@mikaleppanen
Copy link
Author

New version of nanostack is now on feature-wisun branch. Rebased commits.

@mikaleppanen mikaleppanen requested review from juhhei01 and mikter April 27, 2020 07:31
@mikaleppanen
Copy link
Author

@0xc0170 can this proceed?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 28, 2020

Set for CI, will schedule

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 29, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Apr 29, 2020

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_wisun-mesh-test-lts

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 29, 2020

wisun restarted, all fine now

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 29, 2020

@artokin merge if its ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants