Do not allow a device to become a leader when the router role is disabled. (#439)

This commit is contained in:
Jonathan Hui
2016-08-19 13:11:51 -07:00
committed by GitHub
parent e9998c8830
commit ff3aa0c0f7
5 changed files with 67 additions and 7 deletions
+29
View File
@@ -38,6 +38,7 @@ OpenThread test scripts use the CLI to execute test cases.
* [rloc16](#rloc16)
* [route](#route)
* [router](#router)
* [routerrole](#routerrole)
* [routerupgradethreshold](#routerupgradethreshold)
* [scan](#scan)
* [singleton](#singleton)
@@ -702,6 +703,34 @@ Age: 7
Done
```
### routerrole
Indicates whether the router role is enabled or disabled.
```bash
> routerrole
Enabled
Done
```
### routerrole enable
Enable the router role.
```bash
> routerrole enable
Done
```
### routerrole disable
Disable the router role.
```bash
> routerrole disable
Done
```
### routerupgradethreshold
Get the ROUTER_UPGRADE_THRESHOLD value.
+33
View File
@@ -87,6 +87,7 @@ const struct Command Interpreter::sCommands[] =
{ "rloc16", &ProcessRloc16 },
{ "route", &ProcessRoute },
{ "router", &ProcessRouter },
{ "routerrole", &ProcessRouterRole },
{ "routerupgradethreshold", &ProcessRouterUpgradeThreshold },
{ "scan", &ProcessScan },
{ "singleton", &ProcessSingleton },
@@ -1479,6 +1480,38 @@ exit:
AppendResult(error);
}
void Interpreter::ProcessRouterRole(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
if (argc == 0)
{
if (otIsRouterRoleEnabled())
{
sServer->OutputFormat("Enabled\r\n");
}
else
{
sServer->OutputFormat("Disabled\r\n");
}
}
else if (strcmp(argv[0], "enable") == 0)
{
otSetRouterRoleEnabled(true);
}
else if (strcmp(argv[0], "disable") == 0)
{
otSetRouterRoleEnabled(false);
}
else
{
ExitNow(error = kThreadError_Parse);
}
exit:
AppendResult(error);
}
void Interpreter::ProcessRouterUpgradeThreshold(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
+1
View File
@@ -167,6 +167,7 @@ private:
static void ProcessReset(int argc, char *argv[]);
static void ProcessRoute(int argc, char *argv[]);
static void ProcessRouter(int argc, char *argv[]);
static void ProcessRouterRole(int argc, char *argv[]);
static ThreadError ProcessRouteAdd(int argc, char *argv[]);
static ThreadError ProcessRouteRemove(int argc, char *argv[]);
static void ProcessRouterUpgradeThreshold(int argc, char *argv[]);