Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/unit_tests/test_target/base_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ patches:
- ./patches/tests/syscalls_logger.yaml
- ./patches/tests/lifeguard.yaml
- ./patches/tests/nvram.yaml
- ./patches/tests/net_external.yaml
# - ./patches/tests/uboot_env_cmp.yaml


Expand Down
51 changes: 51 additions & 0 deletions tests/unit_tests/test_target/patches/tests/net_external.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
core:
network: true

plugins:
verifier:
conditions:
net_external:
type: file_contains
file: console.log
string: "/tests/zzznet_external.sh PASS"


static_files:
#zzz here to ensure it runs last
/tests/zzznet_external.sh:
type: inline_file
contents: |
#!/igloo/utils/sh
set -ex

/igloo/utils/busybox sleep 5

/igloo/utils/busybox ip addr flush dev eth0
/igloo/utils/busybox ip route flush table main

/igloo/utils/busybox ip link set eth0 down
/igloo/utils/busybox ip link set eth0 up

# If iptables is available, reset firewall rules completely
if /igloo/utils/busybox which iptables >/dev/null 2>&1; then
/igloo/utils/busybox iptables -F
/igloo/utils/busybox iptables -X
/igloo/utils/busybox iptables -t nat -F
/igloo/utils/busybox iptables -t nat -X
/igloo/utils/busybox iptables -P INPUT ACCEPT
/igloo/utils/busybox iptables -P FORWARD ACCEPT
/igloo/utils/busybox iptables -P OUTPUT ACCEPT
fi
/igloo/utils/busybox ip addr add 10.0.2.15/24 dev eth0
/igloo/utils/busybox ip route add default via 10.0.2.2

/igloo/utils/busybox ping -c 3 8.8.8.8

if [ $? -ne 0 ]; then
echo "FAILED to ping external IP"
exit 1
else
echo "PASSED ping to external IP"
exit 0
fi
mode: 73
Loading