Lines Matching +full:fail +full:- +full:fast
4 * SPDX-License-Identifier: Apache-2.0
30 return binding->ctx; in conn_mgr_if_get_data()
36 * @param iface - iface to reset.
44 /* Some tests can leave the iface in a bad state where it is admin-down but not dormant */ in reset_test_iface_networking()
51 * @param iface - iface to reset.
63 iface_binding->flags = 0; in reset_test_iface_state()
64 iface_binding->timeout = CONN_MGR_IF_NO_TIMEOUT; in reset_test_iface_state()
66 /* Disable auto-connect and auto-down */ in reset_test_iface_state()
72 iface_data->call_cnt_a = 0; in reset_test_iface_state()
73 iface_data->call_cnt_b = 0; in reset_test_iface_state()
74 iface_data->conn_bal = 0; in reset_test_iface_state()
75 iface_data->api_err = 0; in reset_test_iface_state()
76 iface_data->fatal_error = 0; in reset_test_iface_state()
77 iface_data->timeout = false; in reset_test_iface_state()
78 memset(iface_data->data_x, 0, sizeof(iface_data->data_x)); in reset_test_iface_state()
79 memset(iface_data->data_y, 0, sizeof(iface_data->data_y)); in reset_test_iface_state()
111 if (cb->info) { in conn_mgr_conn_handler()
112 test_event_stats.event_info = *((int *)cb->info); in conn_mgr_conn_handler()
180 zassert_equal(ifa1_data->init_calls_a, 1, "ifa1->init should be called exactly once."); in ZTEST()
181 zassert_equal(ifa1_data->init_calls_b, 0, "ifa1 should use implementation A"); in ZTEST()
183 zassert_equal(ifa2_data->init_calls_a, 1, "ifa2->init should be called exactly once."); in ZTEST()
184 zassert_equal(ifa2_data->init_calls_b, 0, "ifa2 should use implementation A"); in ZTEST()
186 zassert_equal(ifb_data->init_calls_b, 1, "ifb->init should be called exactly once."); in ZTEST()
187 zassert_equal(ifb_data->init_calls_a, 0, "ifb should use implementation B"); in ZTEST()
189 zassert_equal(ifni_data->init_calls_a, 0, "ifni->init should not be called."); in ZTEST()
190 zassert_equal(ifni_data->init_calls_b, 0, "ifni->init should not be called."); in ZTEST()
203 zassert_equal(net_if_up(ifa1), 0, "net_if_up should not fail"); in ZTEST()
204 zassert_equal(net_if_up(ifa2), 0, "net_if_up should not fail"); in ZTEST()
205 zassert_equal(net_if_up(ifb), 0, "net_if_up should not fail"); in ZTEST()
214 zassert_equal(conn_mgr_if_connect(ifa1), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
218 zassert_true(net_if_is_up(ifa1), "ifa1 should be oper-up after conn_mgr_if_connect"); in ZTEST()
223 zassert_equal(ifa1_data->conn_bal, 1, "ifa1->connect should be called once"); in ZTEST()
224 zassert_equal(ifa1_data->call_cnt_a, 1, "Implementation A should be used for ifa1"); in ZTEST()
225 zassert_equal(ifa1_data->call_cnt_b, 0, "Implementation A should be used for ifa1"); in ZTEST()
227 zassert_equal(ifa2_data->conn_bal, 0, "ifa2 should not be affected by ifa1"); in ZTEST()
228 zassert_equal(ifa2_data->call_cnt_a, 0, "ifa2 should not be affected by ifa1"); in ZTEST()
229 zassert_equal(ifa2_data->call_cnt_b, 0, "ifa2 should not be affected by ifa1"); in ZTEST()
231 zassert_equal(ifb_data->conn_bal, 0, "ifb should not be affected by ifa1"); in ZTEST()
232 zassert_equal(ifb_data->call_cnt_a, 0, "ifb should not be affected by ifa1"); in ZTEST()
233 zassert_equal(ifb_data->call_cnt_b, 0, "ifb should not be affected by ifa1"); in ZTEST()
236 zassert_equal(conn_mgr_if_connect(ifb), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
242 zassert_true(net_if_is_up(ifb), "ifb should be oper-up after conn_mgr_if_connect"); in ZTEST()
245 zassert_equal(ifa1_data->conn_bal, 1, "ifa1 should not be affected by ifb"); in ZTEST()
246 zassert_equal(ifa1_data->call_cnt_a, 1, "ifa1 should not be affected by ifb"); in ZTEST()
247 zassert_equal(ifa1_data->call_cnt_b, 0, "ifa1 should not be affected by ifb"); in ZTEST()
249 zassert_equal(ifa2_data->conn_bal, 0, "ifa2 should not be affected by ifb"); in ZTEST()
250 zassert_equal(ifa2_data->call_cnt_a, 0, "ifa2 should not be affected by ifb"); in ZTEST()
251 zassert_equal(ifa2_data->call_cnt_b, 0, "ifa2 should not be affected by ifb"); in ZTEST()
253 zassert_equal(ifb_data->conn_bal, 1, "ifb->connect should be called once"); in ZTEST()
254 zassert_equal(ifb_data->call_cnt_a, 0, "Implementation B should be used for ifb"); in ZTEST()
255 zassert_equal(ifb_data->call_cnt_b, 1, "Implementation B should be used for ifb"); in ZTEST()
258 zassert_equal(conn_mgr_if_connect(ifa2), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
263 zassert_true(net_if_is_up(ifa2), "ifa2 should be oper-up after conn_mgr_if_connect"); in ZTEST()
267 zassert_equal(ifa1_data->conn_bal, 1, "ifa1 should not be affected by ifa2"); in ZTEST()
268 zassert_equal(ifa1_data->call_cnt_a, 1, "ifa1 should not be affected by ifa2"); in ZTEST()
269 zassert_equal(ifa1_data->call_cnt_b, 0, "ifa1 should not be affected by ifa2"); in ZTEST()
271 zassert_equal(ifa2_data->conn_bal, 1, "ifa2->connect should be called once"); in ZTEST()
272 zassert_equal(ifa2_data->call_cnt_a, 1, "Implementation A should be used for ifa2"); in ZTEST()
273 zassert_equal(ifa2_data->call_cnt_b, 0, "Implementation A should be used for ifa2"); in ZTEST()
275 zassert_equal(ifb_data->conn_bal, 1, "ifb should not be affected by ifa2"); in ZTEST()
276 zassert_equal(ifb_data->call_cnt_a, 0, "ifb should not be affected by ifa2"); in ZTEST()
277 zassert_equal(ifb_data->call_cnt_b, 1, "ifb should not be affected by ifa2"); in ZTEST()
280 zassert_equal(conn_mgr_if_disconnect(ifa1), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
285 zassert_false(net_if_is_up(ifa1), "ifa1 should be oper-down after conn_mgr_if_disconnect"); in ZTEST()
290 zassert_equal(ifa1_data->conn_bal, 0, "ifa1->disconnect should be called once"); in ZTEST()
291 zassert_equal(ifa1_data->call_cnt_a, 2, "Implementation A should be used for ifa1"); in ZTEST()
292 zassert_equal(ifa1_data->call_cnt_b, 0, "Implementation A should be used for ifa1"); in ZTEST()
294 zassert_equal(ifa2_data->conn_bal, 1, "ifa2 should not be affected by ifa1"); in ZTEST()
295 zassert_equal(ifa2_data->call_cnt_a, 1, "ifa2 should not be affected by ifa1"); in ZTEST()
296 zassert_equal(ifa2_data->call_cnt_b, 0, "ifa2 should not be affected by ifa1"); in ZTEST()
298 zassert_equal(ifb_data->conn_bal, 1, "ifb should not be affected by ifa1"); in ZTEST()
299 zassert_equal(ifb_data->call_cnt_a, 0, "ifb should not be affected by ifa1"); in ZTEST()
300 zassert_equal(ifb_data->call_cnt_b, 1, "ifb should not be affected by ifa1"); in ZTEST()
303 zassert_equal(conn_mgr_if_disconnect(ifb), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
310 zassert_false(net_if_is_up(ifb), "ifb should be oper-down after conn_mgr_if_disconnect"); in ZTEST()
313 zassert_equal(ifa1_data->conn_bal, 0, "ifa1 should not be affected by ifb"); in ZTEST()
314 zassert_equal(ifa1_data->call_cnt_a, 2, "ifa1 should not be affected by ifb"); in ZTEST()
315 zassert_equal(ifa1_data->call_cnt_b, 0, "ifa1 should not be affected by ifb"); in ZTEST()
317 zassert_equal(ifa2_data->conn_bal, 1, "ifa1 should not be affected by ifb"); in ZTEST()
318 zassert_equal(ifa2_data->call_cnt_a, 1, "ifa1 should not be affected by ifb"); in ZTEST()
319 zassert_equal(ifa2_data->call_cnt_b, 0, "ifa1 should not be affected by ifb"); in ZTEST()
321 zassert_equal(ifb_data->conn_bal, 0, "ifa1->disconnect should be called once"); in ZTEST()
322 zassert_equal(ifb_data->call_cnt_a, 0, "Implementation B should be used for ifb"); in ZTEST()
323 zassert_equal(ifb_data->call_cnt_b, 2, "Implementation B should be used for ifb"); in ZTEST()
326 zassert_equal(conn_mgr_if_disconnect(ifa2), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
332 zassert_false(net_if_is_up(ifa2), "ifa2 should be oper-down after conn_mgr_if_disconnect"); in ZTEST()
336 zassert_equal(ifa1_data->conn_bal, 0, "ifa1 should not be affected by ifa2"); in ZTEST()
337 zassert_equal(ifa1_data->call_cnt_a, 2, "ifa1 should not be affected by ifa2"); in ZTEST()
338 zassert_equal(ifa1_data->call_cnt_b, 0, "ifa1 should not be affected by ifa2"); in ZTEST()
340 zassert_equal(ifa2_data->conn_bal, 0, "ifa2->disconnect should be called once"); in ZTEST()
341 zassert_equal(ifa2_data->call_cnt_a, 2, "Implementation A should be used for ifa2"); in ZTEST()
342 zassert_equal(ifa2_data->call_cnt_b, 0, "Implementation A should be used for ifa2"); in ZTEST()
344 zassert_equal(ifb_data->conn_bal, 0, "ifb should not be affected by ifa2"); in ZTEST()
345 zassert_equal(ifb_data->call_cnt_a, 0, "ifb should not be affected by ifa2"); in ZTEST()
346 zassert_equal(ifb_data->call_cnt_b, 2, "ifb should not be affected by ifa2"); in ZTEST()
355 zassert_equal(net_if_up(ifa1), 0, "net_if_up should not fail"); in ZTEST()
358 zassert_equal(conn_mgr_if_connect(ifa1), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
362 zassert_true(net_if_is_up(ifa1), "ifa1 should be oper-up after conn_mgr_if_connect"); in ZTEST()
363 zassert_equal(ifa1_data->conn_bal, 1, "ifa1->connect should have been called once."); in ZTEST()
364 zassert_equal(ifa1_data->call_cnt_a, 1, "ifa1->connect should have been called once."); in ZTEST()
367 zassert_equal(conn_mgr_if_connect(ifa1), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
371 * To be clear: Yes, ifa1->connect should be called twice. It is up to the L2 in ZTEST()
375 zassert_equal(ifa1_data->conn_bal, 2, "ifa1->connect should have been called again."); in ZTEST()
376 zassert_equal(ifa1_data->call_cnt_a, 2, "ifa1->connect should have been called again."); in ZTEST()
379 zassert_equal(conn_mgr_if_disconnect(ifa1), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
383 zassert_false(net_if_is_up(ifa1), "ifa1 should be oper-down after conn_mgr_if_disconnect"); in ZTEST()
384 zassert_equal(ifa1_data->conn_bal, 1, "ifa1->disconnect should have been called once."); in ZTEST()
385 zassert_equal(ifa1_data->call_cnt_a, 3, "ifa1->disconnect should have been called once."); in ZTEST()
388 zassert_equal(conn_mgr_if_disconnect(ifa1), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
392 zassert_false(net_if_is_up(ifa1), "ifa1 should be oper-down after conn_mgr_if_disconnect"); in ZTEST()
393 zassert_equal(ifa1_data->conn_bal, 0, "ifa1->disconnect should have been called again."); in ZTEST()
394 zassert_equal(ifa1_data->call_cnt_a, 4, "ifa1->disconnect should have been called again."); in ZTEST()
397 /* Verify that fast double calls to conn_mgr_if_connect and conn_mgr_if_disconnect
398 * do not fail
405 zassert_equal(net_if_up(ifa1), 0, "net_if_up should not fail"); in ZTEST()
408 zassert_equal(conn_mgr_if_connect(ifa1), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
409 zassert_equal(conn_mgr_if_connect(ifa1), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
413 zassert_true(net_if_is_up(ifa1), "ifa1 should be oper-up after conn_mgr_if_connect"); in ZTEST()
414 zassert_equal(ifa1_data->conn_bal, 2, "ifa1->connect should have been called once."); in ZTEST()
415 zassert_equal(ifa1_data->call_cnt_a, 2, "ifa1->connect should have been called once."); in ZTEST()
418 zassert_equal(conn_mgr_if_disconnect(ifa1), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
419 zassert_equal(conn_mgr_if_disconnect(ifa1), 0, "conn_mgr_if_disconnect should not fail"); in ZTEST()
423 zassert_false(net_if_is_up(ifa1), "ifa1 should be oper-down after conn_mgr_if_disconnect"); in ZTEST()
424 zassert_equal(ifa1_data->conn_bal, 0, "ifa1->disconnect should have been called once."); in ZTEST()
425 zassert_equal(ifa1_data->call_cnt_a, 4, "ifa1->disconnect should have been called once."); in ZTEST()
434 zassert_equal(conn_mgr_if_connect(ifa1), 0, "conn_mgr_if_connect should not fail"); in ZTEST()
438 zassert_true(net_if_is_admin_up(ifa1), "ifa1 should be admin-up after conn_mgr_if_connect"); in ZTEST()
441 zassert_true(net_if_is_up(ifa1), "ifa1 should be oper-up after conn_mgr_if_connect"); in ZTEST()
442 zassert_equal(ifa1_data->conn_bal, 1, "ifa1->connect should have been called once."); in ZTEST()
443 zassert_equal(ifa1_data->call_cnt_a, 1, "ifa1->connect should have been called once."); in ZTEST()
452 zassert_equal(conn_mgr_if_disconnect(ifa1), 0, "conn_mgr_if_disconnect should not fail."); in ZTEST()
456 zassert_false(net_if_is_admin_up(ifa1), "ifa1 should be still be admin-down."); in ZTEST()
459 zassert_equal(ifa1_data->conn_bal, 0, "No callbacks should have been fired."); in ZTEST()
460 zassert_equal(ifa1_data->call_cnt_a, 0, "No callbacks should have been fired."); in ZTEST()
475 * or isn't connectivity-bound raises an error.
483 /* Attempts to connect ifnull should fail, even if it is up */ in ZTEST()
484 zassert_equal(conn_mgr_if_connect(ifnull), -ENOTSUP, in ZTEST()
485 "conn_mgr_if_connect should give -ENOTSUP for ifnull"); in ZTEST()
487 /* Attempts to connect ifnone should fail, even if it is up */ in ZTEST()
488 zassert_equal(conn_mgr_if_connect(ifnone), -ENOTSUP, in ZTEST()
489 "conn_mgr_if_connect should give -ENOTSUP for ifnone"); in ZTEST()
493 * or isn't connectivity-bound raises an error.
501 /* Attempts to disconnect ifnull should fail, even if it is up */ in ZTEST()
502 zassert_equal(conn_mgr_if_disconnect(ifnull), -ENOTSUP, in ZTEST()
503 "conn_mgr_if_disconnect should give -ENOTSUP for ifnull"); in ZTEST()
505 /* Attempts to disconnect ifnone should fail, even if it is up */ in ZTEST()
506 zassert_equal(conn_mgr_if_disconnect(ifnone), -ENOTSUP, in ZTEST()
507 "conn_mgr_if_disconnect should give -ENOTSUP for ifnone"); in ZTEST()
515 /* Instruct ifa1 to fail on connect attempt */ in ZTEST()
516 ifa1_data->api_err = -ECHILD; in ZTEST()
523 zassert_equal(conn_mgr_if_connect(ifa1), -ECHILD, in ZTEST()
524 "conn_mgr_if_connect should give -ECHILD"); in ZTEST()
536 /* Instruct ifa1 to fail on disconnect attempt */ in ZTEST()
537 ifa1_data->api_err = -EDOM; in ZTEST()
540 zassert_equal(conn_mgr_if_disconnect(ifa1), -EDOM, in ZTEST()
541 "conn_mgr_if_disconnect should give -EDOM"); in ZTEST()
551 ifa1_data->timeout = true; in ZTEST()
583 ifa1_data->fatal_error = -EADDRINUSE; in ZTEST()
605 zassert_equal(stats.event_info, -EADDRINUSE, in ZTEST()
606 "Fatal error info should be -EADDRINUSE"); in ZTEST()
630 /* Set ifa1->X to "A" */ in ZTEST()
645 /* Verify that ifa1->Y was not affected */ in ZTEST()
650 zassert_equal(buf_len, 1, "conn_mgr_if_get_opt should yield nothing for ifa1->Y"); in ZTEST()
651 zassert_equal(buf[0], 0, "conn_mgr_if_get_opt should yield nothing for ifa1->Y"); in ZTEST()
653 /* Verify that ifa2->X was not affected */ in ZTEST()
658 zassert_equal(buf_len, 1, "conn_mgr_if_get_opt should yield nothing for ifa2->X"); in ZTEST()
659 zassert_equal(buf[0], 0, "conn_mgr_if_get_opt should yield nothing for ifa2->X"); in ZTEST()
661 /* Now, set ifa->Y to "ABC" */ in ZTEST()
675 /* Verify that ifa1->X was not affected */ in ZTEST()
688 /* Try writing a string that is too large to ifa1->X */ in ZTEST()
701 /* This does, technically, test the test harness, but this test will fail if in ZTEST()
726 /* Verify that getting/setting non-existent option on ifa1 fails */ in ZTEST()
727 zassert_equal(conn_mgr_if_set_opt(ifa1, -1, "A", strlen("A")), -ENOPROTOOPT, in ZTEST()
728 "conn_mgr_if_set_opt should fail with invalid optname"); in ZTEST()
730 zassert_equal(conn_mgr_if_get_opt(ifa1, -1, buf, &buf_len), -ENOPROTOOPT, in ZTEST()
731 "conn_mgr_if_get_opt should fail with invalid optname"); in ZTEST()
735 zassert_equal(conn_mgr_if_set_opt(ifa1, TEST_CONN_OPT_X, NULL, 100), -EINVAL, in ZTEST()
736 "conn_mgr_if_set_opt should fail with invalid buffer"); in ZTEST()
738 zassert_equal(conn_mgr_if_get_opt(ifa1, TEST_CONN_OPT_X, NULL, &buf_len), -EINVAL, in ZTEST()
739 "conn_mgr_if_get_opt should fail with invalid buffer"); in ZTEST()
743 zassert_equal(conn_mgr_if_get_opt(ifa1, TEST_CONN_OPT_X, buf, NULL), -EINVAL, in ZTEST()
744 "conn_mgr_if_get_opt should fail with invalid buffer length"); in ZTEST()
747 zassert_equal(conn_mgr_if_set_opt(ifnull, TEST_CONN_OPT_X, "A", strlen("A")), -ENOTSUP, in ZTEST()
748 "conn_mgr_if_set_opt should fail for ifnull"); in ZTEST()
750 zassert_equal(conn_mgr_if_get_opt(ifnull, TEST_CONN_OPT_X, buf, &buf_len), -ENOTSUP, in ZTEST()
751 "conn_mgr_if_get_opt should fail for ifnull"); in ZTEST()
755 zassert_equal(conn_mgr_if_set_opt(ifnone, TEST_CONN_OPT_X, "A", strlen("A")), -ENOTSUP, in ZTEST()
756 "conn_mgr_if_set_opt should fail for ifnull"); in ZTEST()
758 zassert_equal(conn_mgr_if_get_opt(ifnone, TEST_CONN_OPT_X, buf, &buf_len), -ENOTSUP, in ZTEST()
759 "conn_mgr_if_get_opt should fail for ifnull"); in ZTEST()
763 zassert_equal(conn_mgr_if_set_opt(ifb, TEST_CONN_OPT_X, "A", strlen("A")), -ENOTSUP, in ZTEST()
764 "conn_mgr_if_set_opt should fail for ifb"); in ZTEST()
766 zassert_equal(conn_mgr_if_get_opt(ifb, TEST_CONN_OPT_X, buf, &buf_len), -ENOTSUP, in ZTEST()
767 "conn_mgr_if_get_opt should fail for ifb"); in ZTEST()
777 ifa1_binding->flags = 0; in ZTEST()
788 zassert_equal(ifa1_binding->flags, BIT(CONN_MGR_IF_PERSISTENT), in ZTEST()
791 /* Try setting no-autoconnect flag */ in ZTEST()
793 "Setting no-autoconnect flag should succeed for ifa1"); in ZTEST()
797 "No-autoconnect should be set for ifa1"); in ZTEST()
800 zassert_equal(ifa1_binding->flags, in ZTEST()
813 zassert_equal(ifa1_binding->flags, BIT(CONN_MGR_IF_NO_AUTO_CONNECT), in ZTEST()
816 /* Try unsetting no-autoconnect flag */ in ZTEST()
818 "Clearing no-autoconnect flag should succeed for ifa1"); in ZTEST()
822 "No-autoconnect should be set for ifa1"); in ZTEST()
825 zassert_equal(ifa1_binding->flags, 0, in ZTEST()
826 "No-autoconnect flag set should affect conn struct"); in ZTEST()
829 /* Verify that flag get/set fail and behave as expected respectively for invalid ifaces and
837 zassert_equal(conn_mgr_if_set_flag(ifnull, CONN_MGR_IF_PERSISTENT, true), -ENOTSUP, in ZTEST()
838 "Setting persistence flag should fail for ifnull"); in ZTEST()
839 zassert_equal(conn_mgr_if_set_flag(ifnone, CONN_MGR_IF_PERSISTENT, true), -ENOTSUP, in ZTEST()
840 "Setting persistence flag should fail for ifnone"); in ZTEST()
841 zassert_equal(conn_mgr_if_set_flag(ifa1, invalid_flag, true), -EINVAL, in ZTEST()
842 "Setting invalid flag should fail for ifa1"); in ZTEST()
868 zassert_equal(ifa1_binding->timeout, 99, in ZTEST()
880 zassert_equal(ifa1_binding->timeout, CONN_MGR_IF_NO_TIMEOUT, in ZTEST()
884 /* Verify that timeout get/set fail and behave as expected respectively for invalid ifaces */
888 zassert_equal(conn_mgr_if_set_timeout(ifnull, 99), -ENOTSUP, in ZTEST()
889 "Setting timeout should fail for ifnull"); in ZTEST()
890 zassert_equal(conn_mgr_if_set_timeout(ifnone, 99), -ENOTSUP, in ZTEST()
891 "Setting timeout should fail for ifnone"); in ZTEST()
900 /* Verify that auto-connect works as expected. */
903 /* Disable auto-connect. in ZTEST()
905 * since this test case specifically focuses on auto-connect. in ZTEST()
910 zassert_equal(net_if_up(ifa1), 0, "net_if_up should not fail."); in ZTEST()
914 zassert_false(net_if_is_up(ifa1), "Auto-connect should not trigger if disabled."); in ZTEST()
917 zassert_equal(net_if_down(ifa1), 0, "net_if_down should not fail."); in ZTEST()
919 /* Enable auto-connect */ in ZTEST()
923 zassert_equal(net_if_up(ifa1), 0, "net_if_up should not fail."); in ZTEST()
927 zassert_true(net_if_is_up(ifa1), "Auto-connect should succeed if enabled."); in ZTEST()
930 /* Verify that if auto-down is enabled, disconnecting an iface also takes it down,
931 * regardless of whether persistence is enabled, but only if auto-down is disabled.
935 /* For convenience, use auto-connect for this test. */ in ZTEST()
938 /* Enable auto-down, disable persistence */ in ZTEST()
956 "Auto-down should trigger on direct disconnect."); in ZTEST()
977 "Auto-down should trigger on direct disconnect, even if persistence is enabled."); in ZTEST()
981 /* Disable auto-down */ in ZTEST()
997 "Auto-down should not trigger if it is disabled."); in ZTEST()
1000 /* Verify that auto-down takes an iface down if connection is lost, but only if persistence is not
1001 * enabled, and only if auto-down is enabled.
1005 /* For convenience, use auto-connect for this test. */ in ZTEST()
1008 /* Enable auto-down, disable persistence */ in ZTEST()
1025 "Auto-down should trigger on connection loss if persistence is disabled."); in ZTEST()
1043 "Auto-down should not trigger on connection loss if persistence is enabled."); in ZTEST()
1045 /* Disable persistence and disable auto-down*/ in ZTEST()
1062 "Auto-down should not trigger on connection loss if it is disabled."); in ZTEST()
1066 * persistence is enabled, but only if auto-down is enabled.
1072 /* For convenience, use auto-connect for this test. */ in ZTEST()
1075 /* Enable auto-down and persistence*/ in ZTEST()
1080 ifa1_data->timeout = true; in ZTEST()
1088 "Auto-down should trigger on connection timeout, even if persistence is enabled."); in ZTEST()
1090 /* Disable auto-down */ in ZTEST()
1099 "Auto-down should not trigger on connection timeout if it is disabled."); in ZTEST()
1104 * persistence is enabled, but only if auto-down is enabled.
1108 /* For convenience, use auto-connect for this test. */ in ZTEST()
1111 /* Enable auto-down and persistence */ in ZTEST()
1123 simulate_fatal_error(ifa1, -EAGAIN); in ZTEST()
1128 "Auto-down should trigger on fatal error, even if persistence is enabled."); in ZTEST()
1130 /* Disable auto-down */ in ZTEST()
1141 simulate_fatal_error(ifa1, -EAGAIN); in ZTEST()
1146 "Auto-down should not trigger on fatal error if it is disabled."); in ZTEST()
1162 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1163 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1164 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1165 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1166 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1167 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1184 zassert_true(net_if_is_admin_up(ifa2), "All non-ignored ifaces should be admin-up."); in ZTEST()
1185 zassert_true(net_if_is_admin_up(ifb), "All non-ignored ifaces should be admin-up."); in ZTEST()
1186 zassert_true(net_if_is_admin_up(ifni), "All non-ignored ifaces should be admin-up."); in ZTEST()
1187 zassert_true(net_if_is_admin_up(ifnull), "All non-ignored ifaces should be admin-up."); in ZTEST()
1188 zassert_true(net_if_is_admin_up(ifnone), "All non-ignored ifaces should be admin-up."); in ZTEST()
1190 zassert_false(net_if_is_admin_up(ifa1), "Ignored iface should not be admin-up."); in ZTEST()
1207 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1208 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1209 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1210 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1211 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1212 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1239 zassert_true(net_if_is_admin_up(ifa2), "All non-ignored ifaces should be admin-up."); in ZTEST()
1240 zassert_true(net_if_is_admin_up(ifb), "All non-ignored ifaces should be admin-up."); in ZTEST()
1241 zassert_true(net_if_is_admin_up(ifni), "All non-ignored ifaces should be admin-up."); in ZTEST()
1242 zassert_true(net_if_is_admin_up(ifnull), "All non-ignored ifaces should be admin-up."); in ZTEST()
1244 zassert_false(net_if_is_admin_up(ifa1), "All ignored ifaces should be admin-down."); in ZTEST()
1245 zassert_false(net_if_is_admin_up(ifnone), "All ignored ifaces should be admin-down."); in ZTEST()
1248 zassert_true(net_if_is_up(ifa2), "All non-ignored bound ifaces should be connected."); in ZTEST()
1249 zassert_true(net_if_is_up(ifb), "All non-ignored bound ifaces should be connected."); in ZTEST()
1250 zassert_true(net_if_is_up(ifni), "All non-ignored bound ifaces should be connected."); in ZTEST()
1277 zassert_false(net_if_is_admin_up(ifa1), "All ifaces should be admin-down."); in ZTEST()
1278 zassert_false(net_if_is_admin_up(ifa2), "All ifaces should be admin-down."); in ZTEST()
1279 zassert_false(net_if_is_admin_up(ifb), "All ifaces should be admin-down."); in ZTEST()
1280 zassert_false(net_if_is_admin_up(ifni), "All ifaces should be admin-down."); in ZTEST()
1281 zassert_false(net_if_is_admin_up(ifnull), "All ifaces should be admin-down."); in ZTEST()
1282 zassert_false(net_if_is_admin_up(ifnone), "All ifaces should be admin-down."); in ZTEST()
1298 zassert_false(net_if_is_admin_up(ifa2), "All non-ignored ifaces should be admin-down."); in ZTEST()
1299 zassert_false(net_if_is_admin_up(ifb), "All non-ignored ifaces should be admin-down."); in ZTEST()
1300 zassert_false(net_if_is_admin_up(ifni), "All non-ignored ifaces should be admin-down."); in ZTEST()
1301 zassert_false(net_if_is_admin_up(ifnull), "All non-ignored ifaces should be admin-down."); in ZTEST()
1302 zassert_false(net_if_is_admin_up(ifnone), "All non-ignored ifaces should be admin-down."); in ZTEST()
1304 zassert_true(net_if_is_admin_up(ifa1), "Ignored iface should be admin-up."); in ZTEST()
1343 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1344 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1345 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1346 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1347 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1348 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1363 zassert_false(net_if_is_up(ifa2), "All non-ignored bound ifaces should be disconnected."); in ZTEST()
1364 zassert_false(net_if_is_up(ifb), "All non-ignored bound ifaces should be disconnected."); in ZTEST()
1365 zassert_false(net_if_is_up(ifni), "All non-ignored bound ifaces should be disconnected."); in ZTEST()
1387 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1388 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1389 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1390 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1391 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1392 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1420 zassert_false(net_if_is_admin_up(ifa1), "All ifaces should be admin-down."); in ZTEST()
1421 zassert_false(net_if_is_admin_up(ifa2), "All ifaces should be admin-down."); in ZTEST()
1422 zassert_false(net_if_is_admin_up(ifb), "All ifaces should be admin-down."); in ZTEST()
1423 zassert_false(net_if_is_admin_up(ifni), "All ifaces should be admin-down."); in ZTEST()
1424 zassert_false(net_if_is_admin_up(ifnull), "All ifaces should be admin-down."); in ZTEST()
1425 zassert_false(net_if_is_admin_up(ifnone), "All ifaces should be admin-down."); in ZTEST()
1444 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1445 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1446 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1447 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1448 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1449 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1492 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1493 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1494 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1495 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1496 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1497 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1516 ifa1_data->api_err = -ECHILD; in ZTEST()
1519 zassert_equal(conn_mgr_all_if_connect(false), -ECHILD, in ZTEST()
1520 "conn_mgr_all_if_connect should fail with the requested error."); in ZTEST()
1523 /* Verify that all ifaces went admin-up */ in ZTEST()
1524 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1525 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1526 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1527 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1528 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1529 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1531 /* Verify that all the non-error ifaces are connected */ in ZTEST()
1532 zassert_true(net_if_is_up(ifa2), "All non-failing ifaces should be connected."); in ZTEST()
1533 zassert_true(net_if_is_up(ifb), "All non-failing ifaces should be connected."); in ZTEST()
1534 zassert_true(net_if_is_up(ifni), "All non-failing ifaces should be connected."); in ZTEST()
1562 ifa1_data->api_err = -ECHILD; in ZTEST()
1565 zassert_equal(conn_mgr_all_if_disconnect(false), -ECHILD, in ZTEST()
1566 "conn_mgr_all_if_disconnect should fail with the requested error."); in ZTEST()
1568 /* Verify that all ifaces are still admin-up */ in ZTEST()
1569 zassert_true(net_if_is_admin_up(ifa1), "All ifaces should be admin-up."); in ZTEST()
1570 zassert_true(net_if_is_admin_up(ifa2), "All ifaces should be admin-up."); in ZTEST()
1571 zassert_true(net_if_is_admin_up(ifb), "All ifaces should be admin-up."); in ZTEST()
1572 zassert_true(net_if_is_admin_up(ifni), "All ifaces should be admin-up."); in ZTEST()
1573 zassert_true(net_if_is_admin_up(ifnull), "All ifaces should be admin-up."); in ZTEST()
1574 zassert_true(net_if_is_admin_up(ifnone), "All ifaces should be admin-up."); in ZTEST()
1576 /* Verify that all the non-error ifaces are disconnected */ in ZTEST()
1577 zassert_false(net_if_is_up(ifa2), "All non-failing ifaces should be disconnected."); in ZTEST()
1578 zassert_false(net_if_is_up(ifb), "All non-failing ifaces should be disconnected."); in ZTEST()
1579 zassert_false(net_if_is_up(ifni), "All non-failing ifaces should be disconnected."); in ZTEST()