Commit 3c84223b authored by chrissi^'s avatar chrissi^
Browse files

parker: Test if webinterface redirects work

parent 3dad4cde
......@@ -8,7 +8,7 @@ import yaml
import re
import logging
l = logging.Logger("pytest")
logger = logging.Logger("pytest")
from labgrid import StepReporter
StepReporter()
......@@ -367,3 +367,38 @@ def test_good_running_ping_gandolf4(target, in_good_running, host_container):
return
time.sleep(5)
assert False, "Ping gandolv via v6 failed!"
@pytest.mark.running_mode
def test_good_running_localnode_redirect(target, in_good_running, host_container, command):
stdout, _, rc = host_container.run(
"curl -v http://172.16.127.1/cgi-bin/status"
)
for l in stdout:
match = re.search(r"^< Location: http:\/\/([10.\d.]*)\/", l, re.DOTALL)
if match:
ipv4_redir = match[1]
break
else:
assert False, "No IPv4 redirect detected"
stdout, _, rc = host_container.run(
"curl -v http://[2001:bf7:382::1]/cgi-bin/status"
)
for l in stdout:
match = re.search(r"^< Location: http:\/\/\[(2001:[0-9a-f:]*)", l, re.DOTALL)
if match:
ipv6_redir = match[1]
break
else:
assert False, "No IPv6 redirect detected"
stdout, _, rc = command.run(
"ip -j a"
)
ip_conf = json.loads("".join(stdout))
if_cfg = [x for x in ip_conf if x["ifname"] == "br-client"]
local_addrs = [x["local"] for x in if_cfg[0]["addr_info"] if x["scope"] == "global"]
assert len(local_addrs) > 0, "No addreses on router found"
assert ipv4_redir in local_addrs, "IPv4 redirect target not an address on br-client"
assert ipv6_redir in local_addrs, "IPv6 redirect target not an address on br-client"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment