mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-30 10:38:55 +00:00
280ca8982b
Ref #4966
247 lines
7.9 KiB
Plaintext
247 lines
7.9 KiB
Plaintext
source ${genode_dir}/repos/os/run/assert_qemu_nic.inc
|
|
|
|
proc num_ping_rounds { } {
|
|
if {[have_spec sel4] && [have_spec x86]} {
|
|
return 10
|
|
}
|
|
if {[have_spec okl4] || [have_spec pistachio]} {
|
|
return 10
|
|
}
|
|
return 30
|
|
}
|
|
|
|
proc good_dst_ip { } { return "10.0.2.2" }
|
|
proc bad_dst_ip { } { return "10.0.0.123" }
|
|
|
|
create_boot_directory
|
|
|
|
import_from_depot [depot_user]/src/[base_src] \
|
|
[depot_user]/pkg/[drivers_nic_pkg] \
|
|
[depot_user]/src/init \
|
|
[depot_user]/src/report_rom
|
|
|
|
build { app/ping test/net_flood server/nic_router server/dynamic_rom }
|
|
|
|
install_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>
|
|
|
|
<start name="timer" caps="100" priority="0">
|
|
<resource name="CPU" quantum="10"/>
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
<route>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
<service name="IO_PORT"> <parent/> </service>
|
|
<service name="IO_MEM"> <parent/> </service>
|
|
<service name="IRQ"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="drivers" caps="1200" managing_system="yes" priority="0">
|
|
<binary name="init"/>
|
|
<resource name="CPU" quantum="10"/>
|
|
<resource name="RAM" quantum="32M"/>
|
|
<route>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="Uplink"> <child name="nic_router"/> </service>
|
|
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
<service name="RM"> <parent/> </service>
|
|
<service name="IO_PORT"> <parent/> </service>
|
|
<service name="IO_MEM"> <parent/> </service>
|
|
<service name="IRQ"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="nic_router" caps="200" priority="-1">
|
|
<resource name="CPU" quantum="10"/>
|
|
<resource name="RAM" quantum="10M"/>
|
|
<provides>
|
|
<service name="Nic"/>
|
|
<service name="Uplink"/>
|
|
</provides>
|
|
<config verbose="no"
|
|
verbose_packets="no"
|
|
verbose_packet_drop="yes"
|
|
verbose_domain_state="yes"
|
|
dhcp_discover_timeout_sec="1"
|
|
tcp_idle_timeout_sec="3600"
|
|
udp_idle_timeout_sec="3600"
|
|
icmp_idle_timeout_sec="3600">
|
|
|
|
<policy label_prefix="net_clients" domain="net_clients"/>
|
|
<policy label_prefix="drivers" domain="uplink"/>
|
|
|
|
<domain name="uplink" interface="10.0.2.15/24" gateway="10.0.2.2" verbose_packets="no">
|
|
<nat domain="net_clients" udp-ports="16384" tcp-ports="16384" icmp-ids="16384"/>
|
|
</domain>
|
|
|
|
<domain name="net_clients" interface="10.0.1.1/24">
|
|
<dhcp-server ip_first="10.0.1.100" ip_last="10.0.1.200"/>
|
|
<icmp dst="0.0.0.0/0" domain="uplink"/>
|
|
<udp dst="0.0.0.0/0"><permit-any domain="uplink"/></udp>
|
|
<tcp dst="0.0.0.0/0"><permit-any domain="uplink"/></tcp>
|
|
</domain>
|
|
|
|
</config>
|
|
<route>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="report_rom" caps="100" priority="-1">
|
|
<resource name="CPU" quantum="10"/>
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
<config verbose="yes"/>
|
|
<route>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="dynamic_rom" caps="100" priority="-1">
|
|
<resource name="CPU" quantum="10"/>
|
|
<resource name="RAM" quantum="4M"/>
|
|
<provides><service name="ROM"/> </provides>
|
|
<config>
|
|
<rom name="net_clients.config">
|
|
|
|
<!-- give the drivers time to come up -->
|
|
<inline> <config/> </inline>
|
|
|
|
<sleep milliseconds="5000"/>
|
|
|
|
<inline>
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="PD"/>
|
|
<service name="CPU"/>
|
|
<service name="LOG"/>
|
|
<service name="Nic"/>
|
|
<service name="Timer"/>
|
|
</parent-provides>
|
|
|
|
<start name="tcp_flood" caps="100">
|
|
<binary name="test-net_flood"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [bad_dst_ip] {" protocol="tcp" verbose="no"/>
|
|
<route>
|
|
<service name="Nic"> <parent/> </service>
|
|
<service name="Timer"> <parent/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="udp_flood" caps="100">
|
|
<binary name="test-net_flood"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [bad_dst_ip] {" protocol="udp" verbose="no"/>
|
|
<route>
|
|
<service name="Nic"> <parent/> </service>
|
|
<service name="Timer"> <parent/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="icmp_flood" caps="100">
|
|
<binary name="test-net_flood"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [bad_dst_ip] {" protocol="icmp" verbose="no"/>
|
|
<route>
|
|
<service name="Nic"> <parent/> </service>
|
|
<service name="Timer"> <parent/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="ping" caps="100">
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [good_dst_ip] {" period_sec="2" count="999"/>
|
|
<route>
|
|
<service name="Nic"> <parent/> </service>
|
|
<service name="Timer"> <parent/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
</config>
|
|
|
|
</inline>
|
|
<sleep milliseconds="3600000"/>
|
|
</rom>
|
|
</config>
|
|
<route>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="net_clients" caps="1000" priority="-2">
|
|
<binary name="init"/>
|
|
<resource name="CPU" quantum="0"/>
|
|
<resource name="RAM" quantum="200M"/>
|
|
<route>
|
|
<service name="ROM" label="config"> <child name="dynamic_rom" label="net_clients.config"/> </service>
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="CPU"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
|
|
</config>
|
|
}
|
|
|
|
build_boot_image [build_artifacts]
|
|
|
|
append qemu_args " -nographic "
|
|
append_qemu_nic_args
|
|
|
|
run_genode_until ".*ping\] 64 bytes from 10\.0\.2\.2: icmp_seq=[num_ping_rounds] .*\n" 125
|