nic_router.run: fix invalid uplink

Do not generate invalid configurations for the uplink domain anymore. If
some tests are disabled and therefore their routing rules at the uplink
domain would be invalid, spare out these routing rules.

Issue #2899
This commit is contained in:
Martin Stein 2018-06-29 16:00:54 +02:00 committed by Norman Feske
parent 39e6dd3d25
commit 052ed10a17
1 changed files with 36 additions and 6 deletions

View File

@ -42,6 +42,8 @@ proc test_1_router_config { } {
<domain name="lan_1" interface="10.0.99.33/24" />} }
}
proc test_1_router_uplink_config { } { }
#
# Test 2 utilities
@ -59,6 +61,11 @@ proc test_2_router_config { } {
<domain name="udp_server_2" interface="18.17.16.14/24" />} }
}
proc test_2_router_uplink_config { } {
if {[enable_test_2]} { return {
<udp-forward port="1" domain="udp_server_2" to="18.17.16.15" />} }
}
#
# Test 3 utilities
@ -79,6 +86,11 @@ proc test_3_router_config { } {
</domain>} }
}
proc test_3_router_uplink_config { } {
if {[enable_test_3]} { return {
<ip dst="217.13.192.0/24" domain="udp_client_3" />} }
}
#
# Test 4 utilities
@ -96,6 +108,10 @@ proc test_4_router_config { } {
<domain name="http_server_1" interface="192.168.1.1/24" />} }
}
proc test_4_router_uplink_config { } {
if {[enable_test_4]} { return {
<tcp-forward port="80" domain="http_server_1" to="192.168.1.18" />} }
}
#
# Test 5 utilities
@ -113,6 +129,11 @@ proc test_5_router_config { } {
<domain name="http_server_2" interface="192.168.2.1/24" />} }
}
proc test_5_router_uplink_config { } {
if {[enable_test_5]} { return {
<tcp-forward port="8080" domain="http_server_2" to="192.168.2.72" />} }
}
#
# Test 6 utilities
@ -135,6 +156,11 @@ proc test_6_router_config { } {
</domain>} }
}
proc test_6_router_uplink_config { } {
if {[enable_test_6]} { return {
<nat domain="http_client_3" tcp-ports="6" />} }
}
#
# Test 7 utilities
@ -186,7 +212,6 @@ proc test_7_config { } {
}
}
proc test_7_router_config { } {
if {[enable_test_7]} { return {
<policy label_prefix="lan_2" domain="lan_2" />
@ -209,6 +234,8 @@ proc test_7_router_config { } {
</domain>} }
}
proc test_7_router_uplink_config { } { }
#
# Init config
@ -268,11 +295,14 @@ append config {
gateway="10.0.2.1"
verbose_packets="no">
<tcp-forward port="80" domain="http_server_1" to="192.168.1.18" />
<tcp-forward port="8080" domain="http_server_2" to="192.168.2.72" />
<udp-forward port="1" domain="udp_server_2" to="18.17.16.15" />
<nat domain="http_client_3" tcp-ports="6" />
<ip dst="217.13.192.0/24" domain="udp_client_3" />
} [test_1_router_uplink_config] {
} [test_2_router_uplink_config] {
} [test_3_router_uplink_config] {
} [test_4_router_uplink_config] {
} [test_5_router_uplink_config] {
} [test_6_router_uplink_config] {
} [test_7_router_uplink_config] {
</domain>
} [test_1_router_config] {