xref: /aosp_15_r20/external/openthread/tests/toranj/ncp/test-036-wpantund-host-route-management.py (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1*cfb92d14SAndroid Build Coastguard Worker#!/usr/bin/env python
2*cfb92d14SAndroid Build Coastguard Worker#
3*cfb92d14SAndroid Build Coastguard Worker#  Copyright (c) 2019, The OpenThread Authors.
4*cfb92d14SAndroid Build Coastguard Worker#  All rights reserved.
5*cfb92d14SAndroid Build Coastguard Worker#
6*cfb92d14SAndroid Build Coastguard Worker#  Redistribution and use in source and binary forms, with or without
7*cfb92d14SAndroid Build Coastguard Worker#  modification, are permitted provided that the following conditions are met:
8*cfb92d14SAndroid Build Coastguard Worker#  1. Redistributions of source code must retain the above copyright
9*cfb92d14SAndroid Build Coastguard Worker#     notice, this list of conditions and the following disclaimer.
10*cfb92d14SAndroid Build Coastguard Worker#  2. Redistributions in binary form must reproduce the above copyright
11*cfb92d14SAndroid Build Coastguard Worker#     notice, this list of conditions and the following disclaimer in the
12*cfb92d14SAndroid Build Coastguard Worker#     documentation and/or other materials provided with the distribution.
13*cfb92d14SAndroid Build Coastguard Worker#  3. Neither the name of the copyright holder nor the
14*cfb92d14SAndroid Build Coastguard Worker#     names of its contributors may be used to endorse or promote products
15*cfb92d14SAndroid Build Coastguard Worker#     derived from this software without specific prior written permission.
16*cfb92d14SAndroid Build Coastguard Worker#
17*cfb92d14SAndroid Build Coastguard Worker#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18*cfb92d14SAndroid Build Coastguard Worker#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*cfb92d14SAndroid Build Coastguard Worker#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*cfb92d14SAndroid Build Coastguard Worker#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21*cfb92d14SAndroid Build Coastguard Worker#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*cfb92d14SAndroid Build Coastguard Worker#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*cfb92d14SAndroid Build Coastguard Worker#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*cfb92d14SAndroid Build Coastguard Worker#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25*cfb92d14SAndroid Build Coastguard Worker#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26*cfb92d14SAndroid Build Coastguard Worker#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27*cfb92d14SAndroid Build Coastguard Worker#  POSSIBILITY OF SUCH DAMAGE.
28*cfb92d14SAndroid Build Coastguard Worker
29*cfb92d14SAndroid Build Coastguard Workerimport wpan
30*cfb92d14SAndroid Build Coastguard Workerfrom wpan import verify
31*cfb92d14SAndroid Build Coastguard Worker
32*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
33*cfb92d14SAndroid Build Coastguard Worker# Test description:
34*cfb92d14SAndroid Build Coastguard Worker#
35*cfb92d14SAndroid Build Coastguard Worker# This test covers behavior of wpantund feature for managing of host interface routes (related to off-mesh routes
36*cfb92d14SAndroid Build Coastguard Worker# within the Thread network). This feature can be enabled using "Daemon:OffMeshRoute:AutoAddOnInterface" property (is
37*cfb92d14SAndroid Build Coastguard Worker# enabled by default).
38*cfb92d14SAndroid Build Coastguard Worker#
39*cfb92d14SAndroid Build Coastguard Worker# A route corresponding to an off-mesh route would be added on host primary interface (by wpantund),
40*cfb92d14SAndroid Build Coastguard Worker# if it is added by at least one (other) device within the network and
41*cfb92d14SAndroid Build Coastguard Worker#    (a) either it is not added by host/this-device, or
42*cfb92d14SAndroid Build Coastguard Worker#    (b) if it is also added by the device itself then
43*cfb92d14SAndroid Build Coastguard Worker#        - filtering of self added routes is not enabled, and
44*cfb92d14SAndroid Build Coastguard Worker#        - it is added at lower preference level.
45*cfb92d14SAndroid Build Coastguard Worker
46*cfb92d14SAndroid Build Coastguard Workertest_name = __file__[:-3] if __file__.endswith('.py') else __file__
47*cfb92d14SAndroid Build Coastguard Workerprint('-' * 120)
48*cfb92d14SAndroid Build Coastguard Workerprint('Starting \'{}\''.format(test_name))
49*cfb92d14SAndroid Build Coastguard Worker
50*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
51*cfb92d14SAndroid Build Coastguard Worker# Utility functions
52*cfb92d14SAndroid Build Coastguard Worker
53*cfb92d14SAndroid Build Coastguard Worker
54*cfb92d14SAndroid Build Coastguard Workerdef verify_interface_routes(node, route_list):
55*cfb92d14SAndroid Build Coastguard Worker    """
56*cfb92d14SAndroid Build Coastguard Worker    This function verifies that node has the same interface routes as given by `route_list` which is an array of
57*cfb92d14SAndroid Build Coastguard Worker    tuples of (route, prefix_len, metric).
58*cfb92d14SAndroid Build Coastguard Worker    """
59*cfb92d14SAndroid Build Coastguard Worker    node_routes = wpan.parse_interface_routes_result(node.get(wpan.WPAN_IP6_INTERFACE_ROUTES))
60*cfb92d14SAndroid Build Coastguard Worker
61*cfb92d14SAndroid Build Coastguard Worker    verify(len(route_list) == len(node_routes))
62*cfb92d14SAndroid Build Coastguard Worker
63*cfb92d14SAndroid Build Coastguard Worker    for route in route_list:
64*cfb92d14SAndroid Build Coastguard Worker        for node_route in node_routes:
65*cfb92d14SAndroid Build Coastguard Worker            if (node_route.route_prefix, node_route.prefix_len, node_route.metric) == route:
66*cfb92d14SAndroid Build Coastguard Worker                break
67*cfb92d14SAndroid Build Coastguard Worker        else:
68*cfb92d14SAndroid Build Coastguard Worker            raise wpan.VerifyError('Did not find route {} on node {}'.format(route, node))
69*cfb92d14SAndroid Build Coastguard Worker
70*cfb92d14SAndroid Build Coastguard Worker
71*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
72*cfb92d14SAndroid Build Coastguard Worker# Creating `wpan.Nodes` instances
73*cfb92d14SAndroid Build Coastguard Worker
74*cfb92d14SAndroid Build Coastguard Workerspeedup = 4
75*cfb92d14SAndroid Build Coastguard Workerwpan.Node.set_time_speedup_factor(speedup)
76*cfb92d14SAndroid Build Coastguard Worker
77*cfb92d14SAndroid Build Coastguard Workerr1 = wpan.Node()
78*cfb92d14SAndroid Build Coastguard Workerr2 = wpan.Node()
79*cfb92d14SAndroid Build Coastguard Workerr3 = wpan.Node()
80*cfb92d14SAndroid Build Coastguard Workerc3 = wpan.Node()
81*cfb92d14SAndroid Build Coastguard Worker
82*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
83*cfb92d14SAndroid Build Coastguard Worker# Init all nodes
84*cfb92d14SAndroid Build Coastguard Worker
85*cfb92d14SAndroid Build Coastguard Workerwpan.Node.init_all_nodes()
86*cfb92d14SAndroid Build Coastguard Worker
87*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
88*cfb92d14SAndroid Build Coastguard Worker# Build network topology
89*cfb92d14SAndroid Build Coastguard Worker#
90*cfb92d14SAndroid Build Coastguard Worker# Test topology:
91*cfb92d14SAndroid Build Coastguard Worker#
92*cfb92d14SAndroid Build Coastguard Worker#    r1 ---- r2
93*cfb92d14SAndroid Build Coastguard Worker#     \      /
94*cfb92d14SAndroid Build Coastguard Worker#      \    /
95*cfb92d14SAndroid Build Coastguard Worker#       \  /
96*cfb92d14SAndroid Build Coastguard Worker#        r3 ---- c3
97*cfb92d14SAndroid Build Coastguard Worker#
98*cfb92d14SAndroid Build Coastguard Worker# 3 routers, c3 is added to ensure r3 is promoted to a router quickly!
99*cfb92d14SAndroid Build Coastguard Worker
100*cfb92d14SAndroid Build Coastguard Workerr1.form("route-test")
101*cfb92d14SAndroid Build Coastguard Worker
102*cfb92d14SAndroid Build Coastguard Workerr1.allowlist_node(r2)
103*cfb92d14SAndroid Build Coastguard Workerr2.allowlist_node(r1)
104*cfb92d14SAndroid Build Coastguard Workerr2.join_node(r1, wpan.JOIN_TYPE_ROUTER)
105*cfb92d14SAndroid Build Coastguard Worker
106*cfb92d14SAndroid Build Coastguard Workerr3.allowlist_node(r2)
107*cfb92d14SAndroid Build Coastguard Workerr2.allowlist_node(r3)
108*cfb92d14SAndroid Build Coastguard Workerr3.join_node(r2, wpan.JOIN_TYPE_ROUTER)
109*cfb92d14SAndroid Build Coastguard Worker
110*cfb92d14SAndroid Build Coastguard Workerc3.allowlist_node(r3)
111*cfb92d14SAndroid Build Coastguard Workerr3.allowlist_node(c3)
112*cfb92d14SAndroid Build Coastguard Workerc3.join_node(r3, wpan.JOIN_TYPE_END_DEVICE)
113*cfb92d14SAndroid Build Coastguard Worker
114*cfb92d14SAndroid Build Coastguard Workerr3.allowlist_node(r1)
115*cfb92d14SAndroid Build Coastguard Workerr1.allowlist_node(r3)
116*cfb92d14SAndroid Build Coastguard Worker
117*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
118*cfb92d14SAndroid Build Coastguard Worker# Test implementation
119*cfb92d14SAndroid Build Coastguard Worker
120*cfb92d14SAndroid Build Coastguard WorkerROUTE1 = 'fd00:abba::'
121*cfb92d14SAndroid Build Coastguard WorkerLEN1 = 64
122*cfb92d14SAndroid Build Coastguard Worker
123*cfb92d14SAndroid Build Coastguard WorkerROUTE2 = 'fd00:cafe:feed::'
124*cfb92d14SAndroid Build Coastguard WorkerLEN2 = 64
125*cfb92d14SAndroid Build Coastguard Worker
126*cfb92d14SAndroid Build Coastguard WorkerROUTE3 = 'fd00:abba::'
127*cfb92d14SAndroid Build Coastguard WorkerLEN3 = 48
128*cfb92d14SAndroid Build Coastguard Worker
129*cfb92d14SAndroid Build Coastguard WorkerROUTE4 = 'fd00:1234::'
130*cfb92d14SAndroid Build Coastguard WorkerLEN4 = 64
131*cfb92d14SAndroid Build Coastguard Worker
132*cfb92d14SAndroid Build Coastguard Worker# Route Priority for off-mesh routes
133*cfb92d14SAndroid Build Coastguard WorkerHIGH_PRIORITY = 1
134*cfb92d14SAndroid Build Coastguard WorkerMEDIUM_PRIORITY = 0
135*cfb92d14SAndroid Build Coastguard WorkerLOW_PRIORITY = -1
136*cfb92d14SAndroid Build Coastguard Worker
137*cfb92d14SAndroid Build Coastguard Worker# Host route metric mapping to off-mesh route (note lower metric value is higher priority)
138*cfb92d14SAndroid Build Coastguard WorkerHIGH_METRIC = 1
139*cfb92d14SAndroid Build Coastguard WorkerMEDIUM_METRIC = 256
140*cfb92d14SAndroid Build Coastguard WorkerLOW_METRIC = 512
141*cfb92d14SAndroid Build Coastguard Worker
142*cfb92d14SAndroid Build Coastguard WorkerWAIT_TIME = 10
143*cfb92d14SAndroid Build Coastguard Worker
144*cfb92d14SAndroid Build Coastguard Worker# Verify the default daemon configuration for managing host/off-mesh routes
145*cfb92d14SAndroid Build Coastguard Workerverify(r1.get(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_AUTO_ADD_ON_INTERFACE) == 'true')
146*cfb92d14SAndroid Build Coastguard Workerverify(r1.get(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_FILTER_SELF_AUTO_ADDED) == 'true')
147*cfb92d14SAndroid Build Coastguard Worker
148*cfb92d14SAndroid Build Coastguard Worker# Disable the auto route add on r2.
149*cfb92d14SAndroid Build Coastguard Workerr2.set(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_AUTO_ADD_ON_INTERFACE, 'false')
150*cfb92d14SAndroid Build Coastguard Worker
151*cfb92d14SAndroid Build Coastguard Worker# Verify the host interface routes are empty when we start.
152*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [])
153*cfb92d14SAndroid Build Coastguard Worker
154*cfb92d14SAndroid Build Coastguard Worker# Add all 3 routes on r2.
155*cfb92d14SAndroid Build Coastguard Workerr2.add_route(ROUTE1, prefix_len=LEN1, priority=LOW_PRIORITY)
156*cfb92d14SAndroid Build Coastguard Workerr2.add_route(ROUTE2, prefix_len=LEN2, priority=MEDIUM_PRIORITY)
157*cfb92d14SAndroid Build Coastguard Workerr2.add_route(ROUTE3, prefix_len=LEN3, priority=HIGH_PRIORITY)
158*cfb92d14SAndroid Build Coastguard Worker
159*cfb92d14SAndroid Build Coastguard Worker
160*cfb92d14SAndroid Build Coastguard Worker# We expect to see all 3 routes added on r1 host interface with same priority levels as r2.
161*cfb92d14SAndroid Build Coastguard Workerdef check_routes_on_r1_1():
162*cfb92d14SAndroid Build Coastguard Worker    verify_interface_routes(r1, [(ROUTE1, LEN1, LOW_METRIC), (ROUTE2, LEN2, MEDIUM_METRIC),
163*cfb92d14SAndroid Build Coastguard Worker                                 (ROUTE3, LEN3, HIGH_METRIC)])
164*cfb92d14SAndroid Build Coastguard Worker
165*cfb92d14SAndroid Build Coastguard Worker
166*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_routes_on_r1_1, WAIT_TIME)
167*cfb92d14SAndroid Build Coastguard Worker
168*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
169*cfb92d14SAndroid Build Coastguard Worker
170*cfb92d14SAndroid Build Coastguard Worker# Add the same routes on r3 with different priorities.
171*cfb92d14SAndroid Build Coastguard Workerr3.add_route(ROUTE1, prefix_len=LEN1, priority=MEDIUM_PRIORITY)
172*cfb92d14SAndroid Build Coastguard Workerr3.add_route(ROUTE2, prefix_len=LEN2, priority=LOW_PRIORITY)
173*cfb92d14SAndroid Build Coastguard Worker
174*cfb92d14SAndroid Build Coastguard Worker
175*cfb92d14SAndroid Build Coastguard Worker# We expect the host interface routes on r1 to change accordingly
176*cfb92d14SAndroid Build Coastguard Workerdef check_routes_on_r1_2():
177*cfb92d14SAndroid Build Coastguard Worker    route_list = [(ROUTE1, LEN1, MEDIUM_METRIC), (ROUTE2, LEN2, MEDIUM_METRIC), (ROUTE3, LEN3, HIGH_METRIC)]
178*cfb92d14SAndroid Build Coastguard Worker    verify_interface_routes(r1, route_list)
179*cfb92d14SAndroid Build Coastguard Worker
180*cfb92d14SAndroid Build Coastguard Worker
181*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_routes_on_r1_2, WAIT_TIME)
182*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r2, [])
183*cfb92d14SAndroid Build Coastguard Worker
184*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
185*cfb92d14SAndroid Build Coastguard Worker
186*cfb92d14SAndroid Build Coastguard Worker# Remove the previously added routes from r2.
187*cfb92d14SAndroid Build Coastguard Workerr2.remove_route(ROUTE1, prefix_len=LEN1)
188*cfb92d14SAndroid Build Coastguard Workerr2.remove_route(ROUTE2, prefix_len=LEN2)
189*cfb92d14SAndroid Build Coastguard Workerr2.remove_route(ROUTE3, prefix_len=LEN3)
190*cfb92d14SAndroid Build Coastguard Worker
191*cfb92d14SAndroid Build Coastguard Worker
192*cfb92d14SAndroid Build Coastguard Worker# We expect the host interface routes on r1 to again change accordingly:
193*cfb92d14SAndroid Build Coastguard Workerdef check_routes_on_r1_3():
194*cfb92d14SAndroid Build Coastguard Worker    verify_interface_routes(r1, [(ROUTE1, LEN1, MEDIUM_METRIC), (ROUTE2, LEN2, LOW_METRIC)])
195*cfb92d14SAndroid Build Coastguard Worker
196*cfb92d14SAndroid Build Coastguard Worker
197*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_routes_on_r1_3, WAIT_TIME)
198*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r2, [])
199*cfb92d14SAndroid Build Coastguard Worker
200*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
201*cfb92d14SAndroid Build Coastguard Worker
202*cfb92d14SAndroid Build Coastguard Worker# Disable "Daemon:OffMeshRoute:FilterSelfAutoAdded" feature on wpantund.
203*cfb92d14SAndroid Build Coastguard Worker#
204*cfb92d14SAndroid Build Coastguard Worker# The route should be added on host primary interface, if it
205*cfb92d14SAndroid Build Coastguard Worker# is added by at least one other device within the network and,
206*cfb92d14SAndroid Build Coastguard Worker#  (a) either it is not added by host/this-device, or
207*cfb92d14SAndroid Build Coastguard Worker#  (b) if it is also added by device then
208*cfb92d14SAndroid Build Coastguard Worker#      - filtering of self added routes is not enabled, and
209*cfb92d14SAndroid Build Coastguard Worker#      - it is added at lower preference level.
210*cfb92d14SAndroid Build Coastguard Worker
211*cfb92d14SAndroid Build Coastguard Workerr1.set(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_FILTER_SELF_AUTO_ADDED, 'false')
212*cfb92d14SAndroid Build Coastguard Workerverify(r1.get(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_FILTER_SELF_AUTO_ADDED) == 'false')
213*cfb92d14SAndroid Build Coastguard Worker
214*cfb92d14SAndroid Build Coastguard Worker# Add ROUTE1 on r1 with low-priority. Since it's also present on r3 with
215*cfb92d14SAndroid Build Coastguard Worker# medium priority, we should still see the route on host (as medium).
216*cfb92d14SAndroid Build Coastguard Worker
217*cfb92d14SAndroid Build Coastguard Workerr1.add_route(ROUTE1, prefix_len=LEN1, priority=LOW_PRIORITY)
218*cfb92d14SAndroid Build Coastguard Worker
219*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [(ROUTE1, LEN1, MEDIUM_METRIC), (ROUTE2, LEN2, LOW_METRIC)])
220*cfb92d14SAndroid Build Coastguard Worker
221*cfb92d14SAndroid Build Coastguard Worker# Now change ROUTE1 on r1 to be same priority as on r2, now the route should
222*cfb92d14SAndroid Build Coastguard Worker# no longer be present on host interface routes.
223*cfb92d14SAndroid Build Coastguard Worker
224*cfb92d14SAndroid Build Coastguard Workerr1.remove_route(ROUTE1, prefix_len=LEN1)
225*cfb92d14SAndroid Build Coastguard Workerr1.add_route(ROUTE1, prefix_len=LEN1, priority=MEDIUM_PRIORITY)
226*cfb92d14SAndroid Build Coastguard Worker
227*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [(ROUTE2, LEN2, LOW_METRIC)])
228*cfb92d14SAndroid Build Coastguard Worker
229*cfb92d14SAndroid Build Coastguard Worker# Adding ROUTE2 with higher priority should remove it from interface routes
230*cfb92d14SAndroid Build Coastguard Workerr1.add_route(ROUTE2, prefix_len=LEN2, priority=MEDIUM_PRIORITY)
231*cfb92d14SAndroid Build Coastguard Worker
232*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [])
233*cfb92d14SAndroid Build Coastguard Worker
234*cfb92d14SAndroid Build Coastguard Worker# Adding a new ROUTE4 on r1 should not change anything related to interface host routes.
235*cfb92d14SAndroid Build Coastguard Workerr1.add_route(ROUTE4, prefix_len=LEN4, priority=MEDIUM_METRIC)
236*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [])
237*cfb92d14SAndroid Build Coastguard Worker
238*cfb92d14SAndroid Build Coastguard Worker# Removing ROUTE1 and ROUT2 on r1 should cause them to be added back on host
239*cfb92d14SAndroid Build Coastguard Worker# interface (since they are still present as off-mesh routes on r3).
240*cfb92d14SAndroid Build Coastguard Workerr1.remove_route(ROUTE1, prefix_len=LEN1)
241*cfb92d14SAndroid Build Coastguard Workerr1.remove_route(ROUTE2, prefix_len=LEN2)
242*cfb92d14SAndroid Build Coastguard Worker
243*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [(ROUTE1, LEN1, MEDIUM_METRIC), (ROUTE2, LEN2, LOW_METRIC)])
244*cfb92d14SAndroid Build Coastguard Worker
245*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r2, [])
246*cfb92d14SAndroid Build Coastguard Worker
247*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
248*cfb92d14SAndroid Build Coastguard Worker# Enable "Daemon:OffMeshRoute:FilterSelfAutoAdded" feature on wpantund.
249*cfb92d14SAndroid Build Coastguard Worker
250*cfb92d14SAndroid Build Coastguard Workerr1.set(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_FILTER_SELF_AUTO_ADDED, 'true')
251*cfb92d14SAndroid Build Coastguard Workerverify(r1.get(wpan.WPAN_DAEMON_OFF_MESH_ROUTE_FILTER_SELF_AUTO_ADDED) == 'true')
252*cfb92d14SAndroid Build Coastguard Worker
253*cfb92d14SAndroid Build Coastguard Worker# Adding ROUTE1 with any priority should remove it from host interface routes.
254*cfb92d14SAndroid Build Coastguard Workerr1.add_route(ROUTE1, prefix_len=LEN1, priority=LOW_PRIORITY)
255*cfb92d14SAndroid Build Coastguard Worker
256*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [(ROUTE2, LEN2, LOW_METRIC)])
257*cfb92d14SAndroid Build Coastguard Worker
258*cfb92d14SAndroid Build Coastguard Workerr1.remove_route(ROUTE1, prefix_len=LEN1)
259*cfb92d14SAndroid Build Coastguard Worker
260*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r1, [(ROUTE1, LEN1, MEDIUM_METRIC), (ROUTE2, LEN2, LOW_METRIC)])
261*cfb92d14SAndroid Build Coastguard Worker
262*cfb92d14SAndroid Build Coastguard Workerverify_interface_routes(r2, [])
263*cfb92d14SAndroid Build Coastguard Worker
264*cfb92d14SAndroid Build Coastguard Worker# -----------------------------------------------------------------------------------------------------------------------
265*cfb92d14SAndroid Build Coastguard Worker# Test finished
266*cfb92d14SAndroid Build Coastguard Worker
267*cfb92d14SAndroid Build Coastguard Workerwpan.Node.finalize_all_nodes()
268*cfb92d14SAndroid Build Coastguard Worker
269*cfb92d14SAndroid Build Coastguard Workerprint('\'{}\' passed.'.format(test_name))
270