virtualbox_nic_router.run: test uplink reconnect

* Enable USB input
* Get rid of variables that adapted runscript to other platforms than x86_64
  hardware with nova and instead restrict the run script to this platform
* Use a dynamic config for routers
* Switch label of the uplink of router 1 so it connects to Wifi and NIC driver
  alternately
* Let uplink domain tag appear and dissapear

Issue #2815
This commit is contained in:
Martin Stein 2018-05-04 15:38:07 +02:00 committed by Christian Helmuth
parent 6a384df412
commit 14482146c5

View File

@ -1,29 +1,31 @@
set use_net 1 if {[expr ![have_spec nova] || ![have_spec x86] || [have_include power_on/qemu] ]} {
set use_ps2 [have_spec ps2] puts "\n Run script is not supported on this platform. \n"; exit 0 }
set use_serial 1
set build_components { proc wifi_ssid {} {
core init return "$::env(GENODE_WIFI_SSID)" }
drivers/framebuffer
drivers/timer
server/nic_dump
server/nic_router
}
append build_components virtualbox proc wifi_psk {} {
set virtualbox_binary "virtualbox-rem" return "$::env(GENODE_WIFI_PSK)" }
if {[have_spec muen]} { set virtualbox_binary "virtualbox-muen" }
if {[have_spec nova]} { set virtualbox_binary "virtualbox-nova" }
source ${genode_dir}/repos/base/run/platform_drv.inc source ${genode_dir}/repos/base/run/platform_drv.inc
# override defaults of platform_drv.inc
proc platform_drv_priority {} { return { priority="-1"} } proc platform_drv_priority {} { return { priority="-1"} }
lappend_if [expr $use_ps2] build_components drivers/input append build_components { core }
lappend_if [expr $use_serial] build_components server/log_terminal append build_components { init }
lappend_if [have_spec x86] build_components drivers/rtc append build_components { drivers/framebuffer }
append build_components { drivers/timer }
lappend_if [expr $use_net] build_components drivers/nic append build_components { server/nic_router }
append build_components { virtualbox }
append build_components { server/dynamic_rom }
append build_components { server/report_rom }
append build_components { drivers/wifi }
append build_components { server/log_terminal }
append build_components { lib/vfs/jitterentropy }
append build_components { drivers/input }
append build_components { drivers/rtc }
append build_components { drivers/usb }
append build_components { drivers/nic }
append build_components { server/input_merger }
append_platform_drv_build_components append_platform_drv_build_components
@ -31,7 +33,8 @@ build $build_components
create_boot_directory create_boot_directory
set config { append config {
<config prio_levels="4"> <config prio_levels="4">
<parent-provides> <parent-provides>
<service name="ROM"/> <service name="ROM"/>
@ -41,146 +44,301 @@ set config {
<service name="PD"/> <service name="PD"/>
<service name="RM"/> <service name="RM"/>
<service name="CPU"/> <service name="CPU"/>
<service name="LOG"/>} <service name="LOG"/>
append_if [have_spec muen] config {
<service name="VM"/>}
append config {
</parent-provides> </parent-provides>
<default-route> <default-route>
<any-service> <parent/> <any-child/> </any-service> <any-service> <parent/> <any-child/> </any-service>
</default-route> </default-route>
<default caps="100"/> <default caps="100"/>}
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>}
append_platform_drv_config append_platform_drv_config
append config {
<start name="timer" priority="0">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
append_if [expr $use_ps2] config {
<start name="ps2_drv" priority="-1"> <start name="ps2_drv" priority="-1">
<resource name="RAM" quantum="1M"/> <resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
</start>} </start>
append_if [have_spec framebuffer] config {
<start name="fb_drv" priority="-1" caps="150"> <start name="fb_drv" priority="-1" caps="150">
<resource name="RAM" quantum="4M"/> <resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides> <provides><service name="Framebuffer"/></provides>
</start>} </start>
append_if [have_spec sdl] config {
<start name="fb_sdl" priority="-1">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}
append_if [have_spec x86] config {
<start name="rtc_drv" priority="-1"> <start name="rtc_drv" priority="-1">
<resource name="RAM" quantum="1M"/> <resource name="RAM" quantum="1M"/>
<provides> <provides>
<service name="Rtc"/> <service name="Rtc"/>
</provides> </provides>
</start>} </start>
<start name="usb_drv" priority="-1" caps="200">
<resource name="RAM" quantum="20M"/>
<provides><service name="Input"/></provides>
<config uhci="yes" ehci="yes" xhci="yes"> <hid/> </config>
</start>
append_if [expr $use_net] config {
<start name="nic_drv" priority="-1"> <start name="nic_drv" priority="-1">
<resource name="RAM" quantum="4M"/> <resource name="RAM" quantum="4M"/>
<provides><service name="Nic"/></provides> <provides><service name="Nic"/></provides>
</start> </start>
<start name="router1" caps="200"> <start name="wifi_drv" priority="-1" caps="300">
<binary name="nic_router"/> <resource name="RAM" quantum="54M"/>
<resource name="RAM" quantum="10M"/>
<provides> <service name="Nic"/> </provides> <provides> <service name="Nic"/> </provides>
<config verbose="yes"> <config ld_verbose="yes" verbose="yes" use_11n="no" connected_scan_interval="0">
<vfs>
<policy label_prefix="router2" domain="router2"/> <dir name="dev"> <log/> <rtc/> <null/>
<jitterentropy name="random"/>
<domain name="router2" interface="10.0.1.79/24"> <jitterentropy name="urandom"/>
<dhcp-server ip_first="10.0.1.80" </dir>
ip_last="10.0.1.100" <dir name="config"> <ram/> </dir>
ip_lease_time_sec="20" </vfs>
dns_server="10.0.0.2"/> <libc stdout="/dev/null" stderr="/dev/log" rtc="/dev/rtc"/>
<tcp dst="0.0.0.0/0"><permit-any domain="uplink"/></tcp>
<udp dst="0.0.0.0/0"><permit-any domain="uplink"/></udp>
</domain>
<domain name="uplink">
<nat domain="router2" tcp-ports="999" udp-ports="999"/>
</domain>
</config> </config>
<route> <route>
<service name="Nic"> <child name="nic_drv"/> </service> <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> <any-service> <parent/> <any-child/> </any-service>
</route> </route>
</start> </start>
<start name="router2" caps="200"> <start name="input_merger" priority="-2">
<binary name="nic_router"/> <resource name="RAM" quantum="1M" />
<resource name="RAM" quantum="10M"/> <provides>
<provides><service name="Nic"/></provides> <service name="Input" />
</provides>
<config>
<input label="ps2" />
<input label="usb_hid" />
</config>
<route>
<service name="Input" label="ps2"> <child name="ps2_drv" /> </service>
<service name="Input" label="usb_hid"> <child name="usb_drv" /> </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="yes"> <config verbose="yes">
<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>
<policy label_prefix="vbox1" domain="vbox"/> <start name="dynamic_rom" priority="-2">
<resource name="RAM" quantum="4M"/>
<provides><service name="ROM"/> </provides>
<config verbose="yes">
<rom name="router1.config">
<inline>
<domain name="vbox" interface="10.0.2.79/24"> <config verbose_domain_state="no"
<dhcp-server ip_first="10.0.2.80" verbose_packets="no"
ip_last="10.0.2.100" verbose="no"
ip_lease_time_sec="20" dhcp_discover_timeout_sec="1">
dns_server="10.0.0.2"/>
<tcp dst="0.0.0.0/0"><permit-any domain="uplink"/></tcp> <policy label_prefix="vbox" domain="downlink"/>
<udp dst="0.0.0.0/0"><permit-any domain="uplink"/></udp>
<domain name="uplink" label="wifi">
<nat domain="downlink"
tcp-ports="999"
udp-ports="999"
icmp-ids="999"/>
</domain> </domain>
<domain name="uplink"> <domain name="downlink" interface="10.0.1.79/24">
<nat domain="vbox" tcp-ports="999" udp-ports="999"/> <dhcp-server ip_first="10.0.1.80"
ip_last="10.0.1.100"
ip_lease_time_sec="20"
dns_server="1.1.1.1"/>
<tcp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</tcp>
<udp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</udp>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain> </domain>
</config> </config>
</inline>
<sleep milliseconds="15000"/>
<inline>
<config verbose_domain_state="no"
verbose_packets="no"
verbose="no"
dhcp_discover_timeout_sec="1">
<policy label_prefix="vbox" domain="downlink"/>
<domain name="uplink" label="wifi">
<nat domain="downlink"
tcp-ports="999"
udp-ports="999"
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"
ip_lease_time_sec="20"
dns_server="1.1.1.1"/>
<tcp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</tcp>
<udp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</udp>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="15000"/>
<inline>
<config verbose_domain_state="no"
verbose_packets="no"
verbose="no"
dhcp_discover_timeout_sec="1">
<policy label_prefix="vbox" 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"
ip_lease_time_sec="20"
dns_server="1.1.1.1"/>
<tcp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</tcp>
<udp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</udp>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="15000"/>
</rom>
<rom name="router2.config">
<inline>
<config verbose_domain_state="no"
verbose_packets="no"
verbose="no">
<policy label_prefix="vbox" domain="downlink"/>
<domain name="uplink">
<nat domain="downlink"
tcp-ports="999"
udp-ports="999"
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"
ip_lease_time_sec="20"
dns_server="1.1.1.1"/>
<tcp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</tcp>
<udp dst="0.0.0.0/0">
<permit-any domain="uplink"/>
</udp>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3600000"/>
</rom>
</config>
</start>
<start name="router1" caps="200" priority="-2">
<binary name="nic_router"/>
<resource name="RAM" quantum="10M"/>
<provides><service name="Nic"/></provides>
<route> <route>
<service name="Nic" label="wifi">
<child name="wifi_drv"/>
</service>
<service name="Nic" label="nic">
<child name="nic_drv"/>
</service>
<service name="ROM" label="config">
<child name="dynamic_rom" label="router1.config"/>
</service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="router2" caps="200" priority="-2">
<binary name="nic_router"/>
<resource name="RAM" quantum="10M"/>
<provides><service name="Nic"/></provides>
<route>
<service name="ROM" label="config">
<child name="dynamic_rom" label="router2.config"/>
</service>
<service name="Nic"> <child name="router1"/> </service> <service name="Nic"> <child name="router1"/> </service>
<any-service> <parent/> <any-child/> </any-service> <any-service> <parent/> <any-child/> </any-service>
</route> </route>
</start> </start>
}
append_if [expr $use_serial] config {
<start name="log_terminal" priority="-1"> <start name="log_terminal" priority="-1">
<resource name="RAM" quantum="2M"/> <resource name="RAM" quantum="2M"/>
<provides> <provides>
<service name="Terminal"/> <service name="Terminal"/>
</provides> </provides>
</start> </start>
}
append config { <start name="vbox" priority="-2" caps="500">
<start name="vbox1" priority="-2" caps="500">} <binary name="virtualbox-nova"/>
append config "
<binary name=\"$virtualbox_binary\"/>"
append config {
<resource name="RAM" quantum="2G"/> <resource name="RAM" quantum="2G"/>
<config vbox_file="virtualbox_nic_router.vbox" vm_name="TestVM"> <config vbox_file="virtualbox_nic_router.vbox" vm_name="TestVM">
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/> <libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
<vfs> <vfs>
<dir name="dev"> <log/> <rtc/> </dir>} <dir name="dev"> <log/> <rtc/> </dir>
<dir name="dev"> <terminal/> </dir>
append_if [expr $use_serial] config {
<dir name="dev"> <terminal/> </dir>}
append config {
<rom name="virtualbox_nic_router.vbox" /> <rom name="virtualbox_nic_router.vbox" />
<rom name="test.iso" /> <rom name="test.iso" />
</vfs> </vfs>
</config> </config>
<route> <route>
<service name="Input"><child name="input_merger" /></service>
<service name="Nic"> <child name="router2"/> </service> <service name="Nic"> <child name="router2"/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent /> <any-child /> </any-service> <any-service> <parent /> <any-child /> </any-service>
</route> </route>
</start> </start>
@ -191,33 +349,49 @@ install_config $config
exec cp ${genode_dir}/repos/ports/run/virtualbox_nic_router.vbox bin/. exec cp ${genode_dir}/repos/ports/run/virtualbox_nic_router.vbox bin/.
set boot_modules { core nic_dump nic_router ld.lib.so init timer test.iso virtualbox_nic_router.vbox } append boot_modules { virtualbox-nova }
append boot_modules { iwlwifi-6000-4.ucode }
append boot_modules $virtualbox_binary append boot_modules { iwlwifi-6000g2a-6.ucode }
append boot_modules { iwlwifi-6000g2b-6.ucode }
# platform-specific modules append boot_modules { iwlwifi-7260-16.ucode }
lappend_if [expr $use_ps2] boot_modules ps2_drv append boot_modules { iwlwifi-7265-16.ucode }
lappend_if [have_spec framebuffer] boot_modules fb_drv append boot_modules { iwlwifi-7265D-16.ucode }
lappend_if [have_spec linux] boot_modules fb_sdl append boot_modules { iwlwifi-8000C-16.ucode }
lappend_if [have_spec x86] boot_modules rtc_drv append boot_modules { report_rom }
append boot_modules { vfs_jitterentropy.lib.so }
append boot_modules { append boot_modules { libcrypto.lib.so }
ld.lib.so libc.lib.so vfs.lib.so libm.lib.so pthread.lib.so libc_pipe.lib.so append boot_modules { libssl.lib.so }
libc_terminal.lib.so libiconv.lib.so stdcxx.lib.so append boot_modules { wpa_driver_nl80211.lib.so }
qemu-usb.lib.so append boot_modules { wpa_supplicant.lib.so }
} append boot_modules { wifi.lib.so }
append boot_modules { wifi_drv }
append_if [expr $use_net] boot_modules { nic_drv } append boot_modules { core }
append_if [expr $use_serial] boot_modules { log_terminal } append boot_modules { nic_router }
append boot_modules { ld.lib.so }
append boot_modules { init }
append boot_modules { timer }
append boot_modules { test.iso }
append boot_modules { virtualbox_nic_router.vbox }
append boot_modules { ld.lib.so }
append boot_modules { libc.lib.so }
append boot_modules { libm.lib.so }
append boot_modules { pthread.lib.so }
append boot_modules { libc_pipe.lib.so }
append boot_modules { libc_terminal.lib.so }
append boot_modules { libiconv.lib.so }
append boot_modules { stdcxx.lib.so }
append boot_modules { qemu-usb.lib.so }
append boot_modules { dynamic_rom }
append boot_modules { ps2_drv }
append boot_modules { fb_drv }
append boot_modules { rtc_drv }
append boot_modules { usb_drv }
append boot_modules { vfs.lib.so }
append boot_modules { nic_drv }
append boot_modules { input_merger }
append boot_modules { log_terminal }
append_platform_drv_boot_modules append_platform_drv_boot_modules
build_boot_image $boot_modules build_boot_image $boot_modules
if {[have_include "power_on/qemu"]} {
append qemu_args " -m 768 "
append qemu_args " -cpu phenom "
}
run_genode_until forever run_genode_until forever