| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | . "${TEST_SCRIPTS_DIR}/unit.sh" |
| 4 | |
| 5 | define_test "leader node, static routes, custom gateway, config change" |
| 6 | |
| 7 | setup |
| 8 | |
| 9 | setup_script_options <<EOF |
| 10 | CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/[email protected]" |
| 11 | EOF |
| 12 | |
| 13 | echoscip-shell system . . echo. "##################################################" |
| 14 | echoscip-shell system . . echo. "Static routes..." |
| 15 | |
| 16 | setup_ctdb_natgw <<EOF |
| 17 | 192.168.1.21 leader |
| 18 | 192.168.1.22 |
| 19 | 192.168.1.23 |
| 20 | 192.168.1.24 |
| 21 | EOF |
| 22 | |
| 23 | ok_null |
| 24 | simple_test_event "ipreallocated" |
| 25 | |
| 26 | ok_natgw_leader_static_routes |
| 27 | simple_test_command ip route show |
| 28 | |
| 29 | ok_natgw_leader_ip_addr_show |
| 30 | simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE" |
| 31 | |
| 32 | echoscip-shell system . . echo. "##################################################" |
| 33 | echoscip-shell system . . echo. "Default routes..." |
| 34 | |
| 35 | setup_script_options <<EOF |
| 36 | CTDB_NATGW_STATIC_ROUTES="" |
| 37 | EOF |
| 38 | |
| 39 | ok "NAT gateway configuration has changed" |
| 40 | simple_test_event "ipreallocated" |
| 41 | |
| 42 | ok "default via ${CTDB_NATGW_DEFAULT_GATEWAY} dev ethXXX metric 10 " |
| 43 | simple_test_command ip route show |
| 44 | |
| 45 | ok_natgw_leader_ip_addr_show |
| 46 | simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE" |
| 47 | |
| 48 | echoscip-shell system . . echo. "##################################################" |
| 49 | echoscip-shell system . . echo. "Static routes again..." |
| 50 | |
| 51 | setup_script_options <<EOF |
| 52 | CTDB_NATGW_STATIC_ROUTES="10.1.3.0/24 10.1.4.4/32 10.1.2.0/[email protected]" |
| 53 | EOF |
| 54 | |
| 55 | ok "NAT gateway configuration has changed" |
| 56 | simple_test_event "ipreallocated" |
| 57 | |
| 58 | ok_natgw_leader_static_routes |
| 59 | simple_test_command ip route show |
| 60 | |
| 61 | ok_natgw_leader_ip_addr_show |
| 62 | simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE" |