genode/repos/dde_linux/run/nic_router_uplinks.run
Martin Stein f278a3bafb nic_router_uplinks.run: test uplink re-connect
Automated test for switching the NIC-router uplink between NIC driver and Wifi
driver with DHCP and different subnets. Tests also removal and later re-
insertion of the uplink domain tag.

Issue #2815
2018-05-30 13:36:35 +02:00

358 lines
11 KiB
Plaintext

if {[expr ![have_spec nova] && ![have_spec sel4] && ![have_spec hw] && ![have_spec foc] || ![have_spec x86] || [have_include power_on/qemu] ]} {
puts "\n Run script is not supported on this platform. \n"; exit 0 }
proc wifi_ssid {} {
return "$::env(GENODE_WIFI_SSID2)" }
proc wifi_psk {} {
return "$::env(GENODE_WIFI_PSK2)" }
source ${genode_dir}/repos/base/run/platform_drv.inc
proc platform_drv_priority {} { return { priority="-1"} }
append build_components { core }
append build_components { init }
append build_components { drivers/framebuffer }
append build_components { drivers/timer }
append build_components { server/nic_router }
append build_components { server/dynamic_rom }
append build_components { server/report_rom }
append build_components { drivers/wifi }
append build_components { lib/vfs/jitterentropy }
append build_components { drivers/rtc }
append build_components { drivers/nic }
append build_components { app/ping }
append_platform_drv_build_components
build $build_components
create_boot_directory
append config {
<config prio_levels="4">
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>}
append_platform_drv_config
append config {
<start name="timer" priority="0">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="rtc_drv" priority="-1">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Rtc"/>
</provides>
</start>
<start name="nic_drv" priority="-1">
<resource name="RAM" quantum="4M"/>
<provides><service name="Nic"/></provides>
</start>
<start name="wifi_drv" caps="300" priority="-1">
<resource name="RAM" quantum="54M"/>
<provides> <service name="Nic"/> </provides>
<config ld_verbose="no" verbose="no" use_11n="no" connected_scan_interval="0">
<vfs>
<dir name="dev"> <log/> <rtc/> <null/>
<jitterentropy name="random"/>
<jitterentropy name="urandom"/>
</dir>
<dir name="config"> <ram/> </dir>
</vfs>
<libc stdout="/dev/null" stderr="/dev/log" rtc="/dev/rtc"/>
</config>
<route>
<service name="Rtc"> <any-child/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="wlan_configuration"> <child name="config_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="report_rom" priority="-2">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Report"/> <service name="ROM"/> </provides>
<config/>
</start>
<start name="config_rom" priority="-2">
<binary name="dynamic_rom"/>
<resource name="RAM" quantum="4M"/>
<provides><service name="ROM"/></provides>
<config verbose="no">
<rom name="wlan_configuration">
<inline description="CONNECT">
<selected_network ssid="} [wifi_ssid] {"
protection="WPA-PSK"
psk="} [wifi_psk] {"/>
</inline>
<sleep milliseconds="600000"/> <!-- 10 minutes -->
</rom>
</config>
</start>
<start name="dynamic_rom" priority="-1">
<resource name="RAM" quantum="4M"/>
<provides><service name="ROM"/> </provides>
<config verbose="yes">
<rom name="router.config">
<inline>
<config/>
</inline>
<sleep milliseconds="5000"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="uplink" label="nic">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3001"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="uplink" label="wifi">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3002"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3003"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="uplink" label="nic">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3004"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="uplink" label="nic">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3005"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3006"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="uplink" label="wifi">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3007"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="uplink" label="nic">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3008"/>
<inline>
<config dhcp_discover_timeout_sec="1">
<default-policy domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="600000"/>
</rom>
</config>
</start>
<start name="router" caps="200" priority="-2">
<binary name="nic_router"/>
<resource name="RAM" quantum="10M"/>
<provides><service name="Nic"/></provides>
<route>
<service name="Nic" label="nic">
<child name="nic_drv"/>
</service>
<service name="Nic" label="wifi">
<child name="wifi_drv"/>
</service>
<service name="ROM" label="config">
<child name="dynamic_rom" label="router.config"/>
</service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ping" priority="-2">
<resource name="RAM" quantum="8M"/>
<config dst_ip="1.1.1.1"
period_sec="1"
count="999"/>
<route>
<service name="Nic"> <child name="router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
install_config $config
exec cp ${genode_dir}/repos/ports/run/virtualbox_nic_router.vbox bin/.
append boot_modules { iwlwifi-6000-4.ucode }
append boot_modules { iwlwifi-6000g2a-6.ucode }
append boot_modules { iwlwifi-6000g2b-6.ucode }
append boot_modules { iwlwifi-7260-16.ucode }
append boot_modules { iwlwifi-7265-16.ucode }
append boot_modules { iwlwifi-7265D-16.ucode }
append boot_modules { iwlwifi-8000C-16.ucode }
append boot_modules { report_rom }
append boot_modules { vfs_jitterentropy.lib.so }
append boot_modules { libcrypto.lib.so }
append boot_modules { libssl.lib.so }
append boot_modules { wpa_driver_nl80211.lib.so }
append boot_modules { wpa_supplicant.lib.so }
append boot_modules { wifi.lib.so }
append boot_modules { wifi_drv }
append boot_modules { core }
append boot_modules { nic_router }
append boot_modules { ld.lib.so }
append boot_modules { init }
append boot_modules { timer }
append boot_modules { ping }
append boot_modules { libc.lib.so }
append boot_modules { dynamic_rom }
append boot_modules { rtc_drv }
append boot_modules { vfs.lib.so }
append boot_modules { nic_drv }
append_platform_drv_boot_modules
build_boot_image $boot_modules
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3001 milliseconds.*"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3002 milliseconds.*"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3003 milliseconds.*"
append done_string "From 10.0.1.79 icmp_seq=.* Destination Unreachable"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3004 milliseconds.*"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3005 milliseconds.*"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3006 milliseconds.*"
append done_string "From 10.0.1.79 icmp_seq=.* Destination Unreachable"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3007 milliseconds.*"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 3008 milliseconds.*"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq=.*"
append done_string ".*router.config: change.*"
append done_string ".*router.config: sleep 600000 milliseconds.*"
append done_string "From 10.0.1.79 icmp_seq=.* Destination Unreachable"
run_genode_until $done_string 60