diff --git a/acceptance/hidden_paths/test.py b/acceptance/hidden_paths/test.py index 3a9f1af7f9..bf03782f35 100755 --- a/acceptance/hidden_paths/test.py +++ b/acceptance/hidden_paths/test.py @@ -5,11 +5,11 @@ import http.server import time import threading - -from plumbum import cmd +import sys from acceptance.common import base from acceptance.common import scion +from tools.topology.scion_addr import ISD_AS class Test(base.TestTopogen): @@ -109,12 +109,6 @@ def setup_start(self): super().setup_start() time.sleep(4) # Give applications time to download configurations - self._testers = { - "2": "tester_1-ff00_0_2", - "3": "tester_1-ff00_0_3", - "4": "tester_1-ff00_0_4", - "5": "tester_1-ff00_0_5", - } self._ases = { "2": "1-ff00:0:2", "3": "1-ff00:0:3", @@ -125,27 +119,30 @@ def setup_start(self): def _run(self): # Group 3 - self._showpaths_bidirectional("2", "3", 0) - self._showpaths_bidirectional("2", "5", 0) - self._showpaths_bidirectional("3", "5", 0) + self._showpaths_bidirectional("2", "3") + self._showpaths_bidirectional("2", "5") + self._showpaths_bidirectional("3", "5") # Group 4 - self._showpaths_bidirectional("2", "4", 0) - self._showpaths_bidirectional("2", "5", 0) - self._showpaths_bidirectional("4", "5", 0) + self._showpaths_bidirectional("2", "4") + self._showpaths_bidirectional("2", "5") + self._showpaths_bidirectional("4", "5") # Group 3 X 4 - self._showpaths_bidirectional("3", "4", 1) - - def _showpaths_bidirectional(self, source: str, destination: str, retcode: int): - self._showpaths_run(source, destination, retcode) - self._showpaths_run(destination, source, retcode) - - def _showpaths_run(self, source_as: str, destination_as: str, retcode: int): - print(cmd.docker("exec", "-t", self._testers[source_as], "scion", - "sp", self._ases[destination_as], - "--timeout", "2s", - retcode=retcode)) + try: + self._showpaths_bidirectional("3", "4") + except Exception as e: + print(e) + else: + assert("Unexpected success; should not have paths 3 -> 4") + + def _showpaths_bidirectional(self, source: str, destination: str): + self._showpaths_run(source, destination) + self._showpaths_run(destination, source) + + def _showpaths_run(self, source_as: str, destination_as: str): + print(self.execute_tester(ISD_AS(self._ases[source_as]), + "scion", "sp", self._ases[destination_as], "--timeout", "2s")) def configuration_server(server): diff --git a/demo/drkey/test.py b/demo/drkey/test.py index 19f08d40ce..0a6c589670 100644 --- a/demo/drkey/test.py +++ b/demo/drkey/test.py @@ -71,7 +71,7 @@ def setup_prepare(self): # Enable delegation for tester host on the fast side (server side), i.e. # allow the tester host to directly request the secret value from which # keys can be derived locally for any host. - tester_ip = self._container_ip("scion_disp_tester_%s" % self.server_isd_as.file_fmt()) + tester_ip = self._container_ip("disp_tester_%s" % self.server_isd_as.file_fmt()) cs_config = self._conf_dir(self.server_isd_as) // "cs*-1.toml" scion.update_toml({"drkey.delegation.scmp": [tester_ip]}, cs_config) @@ -82,9 +82,8 @@ def _run(self): # install demo binary in tester containers: drkey_demo = local["realpath"](self.get_executable("drkey-demo").executable).strip() - testers = ["tester_%s" % ia.file_fmt() for ia in {self.server_isd_as, self.client_isd_as}] - for tester in testers: - local["docker"]("cp", drkey_demo, tester + ":/bin/") + for ia in {self.server_isd_as, self.client_isd_as}: + self.dc("cp", drkey_demo, "tester_%s" % ia.file_fmt() + ":/bin/") # Define DRKey protocol identifiers and derivation typ for test for test in [ @@ -134,7 +133,7 @@ def _endhost_ip(self, isd_as: ISD_AS) -> str: """ Determine the IP used for the end host (client or server) in the given ISD-AS """ # The address must be the daemon IP (as it makes requests to the control # service on behalf of the end host application). - return self._container_ip("scion_sd%s" % isd_as.file_fmt()) + return self._container_ip("sd%s" % isd_as.file_fmt()) def _container_ip(self, container: str) -> str: """ Determine the IP of the container """