mirror of
https://github.com/espressif/openthread.git
synced 2026-09-12 20:20:04 +00:00
[thci] selectively configure Domain Prefix advertisement on the host (#7491)
Implement changes in `setupHost` method to be able to selectively configure the RA for the Domain Prefix.
This commit is contained in:
@@ -346,16 +346,15 @@ class OpenThread_BR(OpenThreadTHCI, IThci):
|
||||
self.bash(cmd)
|
||||
|
||||
@API
|
||||
def setupHost(self, setDua=False):
|
||||
def setupHost(self, setDp=False, setDua=False):
|
||||
self.IsHost = True
|
||||
|
||||
if not setDua:
|
||||
cmd = 'ip -6 addr add 910b::1 dev eth0'
|
||||
else:
|
||||
cmd = 'ip -6 addr add fd00:7d03:7d03:7d03::1 dev eth0'
|
||||
self.bash(cmd)
|
||||
self.bash('ip -6 addr add 910b::1 dev eth0')
|
||||
|
||||
self.__startRadvdService()
|
||||
if setDua:
|
||||
self.bash('ip -6 addr add fd00:7d03:7d03:7d03::1 dev eth0')
|
||||
|
||||
self.__startRadvdService(setDp)
|
||||
|
||||
def _deviceEscapeEscapable(self, string):
|
||||
"""Escape CLI escapable characters in the given string.
|
||||
@@ -560,34 +559,37 @@ class OpenThread_BR(OpenThreadTHCI, IThci):
|
||||
self.bash('sysctl net.ipv6.conf.eth0.accept_ra=2')
|
||||
|
||||
@watched
|
||||
def __startRadvdService(self):
|
||||
def __startRadvdService(self, setDp=False):
|
||||
assert self.IsHost, "radvd service runs on Host only"
|
||||
|
||||
self.bash("""sh -c "cat >/etc/radvd.conf <<EOF
|
||||
interface eth0
|
||||
{
|
||||
AdvSendAdvert on;
|
||||
conf = "EOF"
|
||||
conf += "\ninterface eth0"
|
||||
conf += "\n{"
|
||||
conf += "\n AdvSendAdvert on;"
|
||||
conf += "\n"
|
||||
conf += "\n MinRtrAdvInterval 3;"
|
||||
conf += "\n MaxRtrAdvInterval 30;"
|
||||
conf += "\n AdvDefaultPreference low;"
|
||||
conf += "\n"
|
||||
conf += "\n prefix 910b::/64"
|
||||
conf += "\n {"
|
||||
conf += "\n AdvOnLink on;"
|
||||
conf += "\n AdvAutonomous on;"
|
||||
conf += "\n AdvRouterAddr on;"
|
||||
conf += "\n };"
|
||||
if setDp:
|
||||
conf += "\n"
|
||||
conf += "\n prefix fd00:7d03:7d03:7d03::/64"
|
||||
conf += "\n {"
|
||||
conf += "\n AdvOnLink on;"
|
||||
conf += "\n AdvAutonomous off;"
|
||||
conf += "\n AdvRouterAddr off;"
|
||||
conf += "\n };"
|
||||
conf += "\n};"
|
||||
conf += "\nEOF"
|
||||
cmd = 'sh -c "cat >/etc/radvd.conf <<%s"' % conf
|
||||
|
||||
MinRtrAdvInterval 3;
|
||||
MaxRtrAdvInterval 30;
|
||||
AdvDefaultPreference low;
|
||||
|
||||
prefix 910b::/64
|
||||
{
|
||||
AdvOnLink on;
|
||||
AdvAutonomous on;
|
||||
AdvRouterAddr on;
|
||||
};
|
||||
|
||||
prefix fd00:7d03:7d03:7d03::/64
|
||||
{
|
||||
AdvOnLink on;
|
||||
AdvAutonomous off;
|
||||
AdvRouterAddr off;
|
||||
};
|
||||
};
|
||||
EOF"
|
||||
""")
|
||||
self.bash(cmd)
|
||||
self.bash('service radvd restart')
|
||||
self.bash('service radvd status')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user