Skip to content

Commit

Permalink
repo: consolidate tools
Browse files Browse the repository at this point in the history
Follow up on #4163, further consolidate tools under `tools/`.

- `lint/` -> `tools/lint/`
- `scripts/cryptoplayground/` -> `tools/cryptoplayground/`
- `env/` -> `tools/env/`, `tools/install_deps`
- `supervisor/` -> `tools/`
- `python/` -> `tools/topology/`, `tools/topogen.py`
- `integration/` -> `tools/integration/`

Also includes some housekeeping
- further reduce python library code, by simplifying the ISD_AS (no integer representation needed) and LinkType enum
- remove left-over integration bash scripts
- remove topogentar and the related bazel infrastructure

Closes #4167

GitOrigin-RevId: 202b24809b241a0d2381ceeeaa81fb8bb7ff4833
  • Loading branch information
matzf authored and oncilla committed Mar 26, 2022
1 parent 03034e3 commit a574cee
Show file tree
Hide file tree
Showing 378 changed files with 569 additions and 1,329 deletions.
6 changes: 3 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ steps:
- ./scion.sh run
- tools/await-connectivity
- ./bin/end2end_integration || ( echo "^^^ +++" && false )
- ./integration/revocation_test.sh
- ./tools/integration/revocation_test.sh
plugins:
- scionproto/metahook#v0.3.0:
post-command: |
Expand Down Expand Up @@ -163,8 +163,8 @@ steps:
- echo "--- run test"
- mkdir -p /tmp/test-artifacts/trc-ceremony
- export SAFEDIR="/tmp/test-artifacts/trc-ceremony"
- ./scripts/cryptoplayground/trc_ceremony.sh
- ./scripts/cryptoplayground/trc_ceremony_sensitive.sh
- ./tools/cryptoplayground/trc_ceremony.sh
- ./tools/cryptoplayground/trc_ceremony_sensitive.sh
timeout_in_minutes: 15
key: trc_ceremony_test
artifact_paths:
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipeline_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gen_acceptance() {
echo " - ${accept_dir}/ctl grun $name"
echo " key: ${name}_acceptance"
echo " env:"
echo " PYTHONPATH: \"python/:.\""
echo " PYTHONPATH: \".\""
echo " ACCEPTANCE_DIR: \"$accept_dir\""
echo " artifact_paths:"
echo " - \"artifacts.out/**/*\""
Expand Down
8 changes: 4 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@io_bazel_rules_go//go:def.bzl", "nogo")
load("//lint:go_config.bzl", "go_lint_config")
load("//lint/private/python:flake8_config.bzl", "flake8_lint_config")
load("//tools/lint:go_config.bzl", "go_lint_config")
load("//tools/lint/python:flake8_config.bzl", "flake8_lint_config")
load("//:nogo.bzl", "nogo_deps")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@cgrindel_bazel_starlib//updatesrc:defs.bzl", "updatesrc_update_all")

# gazelle:prefix github.com/scionproto/scion
# gazelle:map_kind go_library go_library //lint:go.bzl
# gazelle:map_kind go_test go_test //lint:go.bzl
# gazelle:map_kind go_library go_library //tools/lint:go.bzl
# gazelle:map_kind go_test go_test //tools/lint:go.bzl
# gazelle:exclude docker/_build/**
# gazelle:exclude proto/**
# gazelle:exclude doc/**
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ load("@rules_python//python:pip.bzl", "pip_install")

pip_install(
name = "pip3_deps",
requirements = "//env/pip3:requirements.txt",
requirements = "//tools/env/pip3:requirements.txt",
)

http_archive(
Expand Down Expand Up @@ -250,7 +250,7 @@ load("//:bbcp.bzl", "bbcp_repository")

bbcp_repository()

load("//lint/private/python:deps.bzl", "python_lint_deps")
load("//tools/lint/python:deps.bzl", "python_lint_deps")

python_lint_deps()

Expand Down
2 changes: 1 addition & 1 deletion acceptance/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
10 changes: 5 additions & 5 deletions acceptance/cert_renewal/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from acceptance.common import base
from acceptance.common import docker
from acceptance.common import scion
from python.lib import scion_addr
from tools.topology.scion_addr import ISD_AS
import toml

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -117,7 +117,7 @@ def _run(self):

def _renewal_request(
self,
isd_as: scion_addr.ISD_AS,
isd_as: ISD_AS,
mode: str = "--force",
):
as_dir = self._to_as_dir(isd_as)
Expand Down Expand Up @@ -182,7 +182,7 @@ def _check_key_cert(self, cs_configs: List[pathlib.Path]):
resp.reason)
continue

isd_as = scion_addr.ISD_AS(cs_config.stem[2:-2])
isd_as = ISD_AS(cs_config.stem[2:-2])
as_dir = self._to_as_dir(isd_as)
chain_name = "ISD%s-AS%s.pem" % (isd_as.isd_str(),
isd_as.as_file_fmt())
Expand Down Expand Up @@ -223,7 +223,7 @@ def _extract_skid(self, file: pathlib.Path):
def _rel(self, path: pathlib.Path):
return path.relative_to(pathlib.Path(self.test_state.artifacts))

def _to_as_dir(self, isd_as: scion_addr.ISD_AS) -> pathlib.Path:
def _to_as_dir(self, isd_as: ISD_AS) -> pathlib.Path:
return pathlib.Path("%s/gen/AS%s" %
(self.test_state.artifacts, isd_as.as_file_fmt()))

Expand All @@ -232,7 +232,7 @@ def _cs_configs(self) -> List[pathlib.Path]:
pathlib.Path("%s/gen" %
self.test_state.artifacts).glob("AS*/cs*.toml"))

def _local_flags(self, isd_as: scion_addr.ISD_AS) -> List[str]:
def _local_flags(self, isd_as: ISD_AS) -> List[str]:
return [
"--local",
self.execute("tester_%s" % isd_as.file_fmt(), "sh", "-c",
Expand Down
2 changes: 1 addition & 1 deletion acceptance/cmd/sig_ping_acceptance/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")
load("//:scion.bzl", "scion_go_binary")

go_library(
Expand Down
4 changes: 2 additions & 2 deletions acceptance/common/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@pip3_deps//:requirements.bzl", "requirement")
load("//lint:py.bzl", "py_library", "py_test")
load("//tools/lint:py.bzl", "py_library", "py_test")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -39,7 +39,7 @@ py_library(
requirement("plumbum"),
requirement("toml"),
"log",
"//python/lib:scion_addr",
"//tools/topology:py_default_library",
],
)

Expand Down
2 changes: 1 addition & 1 deletion acceptance/common/raw.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:py.bzl", "py_binary", "py_library", "py_test")
load("//tools/lint:py.bzl", "py_binary", "py_library", "py_test")
load("@pip3_deps//:requirements.bzl", "requirement")

def raw_test(
Expand Down
11 changes: 5 additions & 6 deletions acceptance/common/scion.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
from plumbum.path.local import LocalPath

from acceptance.common.log import LogExec
from python.lib import scion_addr
from python.lib.scion_addr import ISD_AS
from tools.topology.scion_addr import ISD_AS

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -173,20 +172,20 @@ class ASList(object):
ASList is a list of AS separated by core and non-core ASes. It can be loaded
from the as_list.yml file created by the topology generator.
"""
def __init__(self, cores: List[scion_addr.ISD_AS], non_cores: List[scion_addr.ISD_AS]):
def __init__(self, cores: List[ISD_AS], non_cores: List[ISD_AS]):
self.cores = cores
self.non_cores = non_cores

@property
def all(self) -> List[scion_addr.ISD_AS]:
def all(self) -> List[ISD_AS]:
return self.cores + self.non_cores

@staticmethod
def load(file: str = "gen/as_list.yml") -> "ASList":
with open(file, "r") as content:
data = yaml.load(content, yaml.Loader)
cores = [scion_addr.ISD_AS(raw) for raw in data["Core"]]
non_cores = [scion_addr.ISD_AS(raw) for raw in data["Non-core"]]
cores = [ISD_AS(raw) for raw in data["Core"]]
non_cores = [ISD_AS(raw) for raw in data["Non-core"]]
return ASList(cores, non_cores)


Expand Down
6 changes: 3 additions & 3 deletions acceptance/common/topogen.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:py.bzl", "py_binary", "py_library", "py_test")
load("//tools/lint:py.bzl", "py_binary", "py_library", "py_test")
load("@pip3_deps//:requirements.bzl", "requirement")

def topogen_test(
Expand Down Expand Up @@ -47,13 +47,13 @@ def topogen_test(

common_args = [
"--executables=scion-pki:$(location //scion-pki/cmd/scion-pki)",
"--executables=topogen:$(location //python/topology:topogen)",
"--executables=topogen:$(location //tools:topogen)",
"--topo=$(location %s)" % topo,
"--setup-params='%s'" % setup_params,
]
common_data = [
"//scion-pki/cmd/scion-pki",
"//python/topology:topogen",
"//tools:topogen",
"//tools:docker_ip",
topo,
]
Expand Down
2 changes: 1 addition & 1 deletion acceptance/topo_cs_reload/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_test")
load("//tools/lint:go.bzl", "go_test")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")

go_test(
Expand Down
2 changes: 1 addition & 1 deletion acceptance/topo_daemon_reload/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_test")
load("//tools/lint:go.bzl", "go_test")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")

go_test(
Expand Down
4 changes: 2 additions & 2 deletions antlr/sequence/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//lint:go.bzl", "go_library")
load("//lint:go_config.bzl", "go_lint_config")
load("//tools/lint:go.bzl", "go_library")
load("//tools/lint:go_config.bzl", "go_lint_config")
load("@apple_rules_lint//lint:defs.bzl", "package_lint_config")

go_lint_config(
Expand Down
2 changes: 1 addition & 1 deletion antlr/traffic_class/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/beacon/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/beacon/beacondbtest/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/beacon/mock_beacon/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")
load("@com_github_jmhodges_bazel_gomock//:gomock.bzl", "gomock")

gomock(
Expand Down
2 changes: 1 addition & 1 deletion control/beaconing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/beaconing/grpc/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/beaconing/mock_beaconing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")
load("@com_github_jmhodges_bazel_gomock//:gomock.bzl", "gomock")

gomock(
Expand Down
2 changes: 1 addition & 1 deletion control/cmd/control/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")
load("//:scion.bzl", "scion_go_binary")

go_library(
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/conf/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/e2e/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/reservationdbtest/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/segment/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/segment/admission/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/segmenttest/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/sqlite/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservation/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservationstorage/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservationstorage/backend/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")
load("@com_github_jmhodges_bazel_gomock//:gomock.bzl", "gomock")

gomock(
Expand Down
2 changes: 1 addition & 1 deletion control/colibri/reservationstore/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_test(
name = "go_default_test",
Expand Down
2 changes: 1 addition & 1 deletion control/config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/ifstate/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/mgmtapi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library", "go_test")
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_generate_go")

genrule(
Expand Down
2 changes: 1 addition & 1 deletion control/mgmtapi/mock_mgmtapi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")
load("@com_github_jmhodges_bazel_gomock//:gomock.bzl", "gomock")

gomock(
Expand Down
2 changes: 1 addition & 1 deletion control/onehop/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion control/segreg/grpc/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//lint:go.bzl", "go_library")
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
Expand Down
Loading

0 comments on commit a574cee

Please sign in to comment.