From bf501d6465d33cef424d59f1b1a40b056e66c391 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 18:54:09 +0200 Subject: [PATCH 1/8] clean up flake8 / mypy errors --- src/someip/utils.py | 4 ++-- tools/find-subscribe.py | 2 +- tools/get.py | 2 +- tools/monitor-sd.py | 2 +- tools/simpleservice.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/someip/utils.py b/src/someip/utils.py index 5157869..86fc1e6 100644 --- a/src/someip/utils.py +++ b/src/someip/utils.py @@ -25,7 +25,7 @@ async def wrapper(self, *args, **kwargs): return await f(self, *args, **kwargs) except Exception: self.log.exception( - msg.format(__func__=f.__qualname__, *args, **kwargs) + msg.format(*args, __func__=f.__qualname__, **kwargs) ) else: @@ -36,7 +36,7 @@ def wrapper(self, *args, **kwargs): return f(self, *args, **kwargs) except Exception: self.log.exception( - msg.format(__func__=f.__qualname__, *args, **kwargs) + msg.format(*args, __func__=f.__qualname__, **kwargs) ) return wrapper diff --git a/tools/find-subscribe.py b/tools/find-subscribe.py index 2d3a09c..208a9dd 100755 --- a/tools/find-subscribe.py +++ b/tools/find-subscribe.py @@ -85,7 +85,7 @@ def auto_int(s): def setup_log(fmt="", **kwargs): try: - import coloredlogs # type: ignore[import] + import coloredlogs # type: ignore[import-not-found] coloredlogs.install(fmt="%(asctime)s,%(msecs)03d " + fmt, **kwargs) except ModuleNotFoundError: logging.basicConfig(format="%(asctime)s " + fmt, **kwargs) diff --git a/tools/get.py b/tools/get.py index 4f6ac97..e55a1fd 100755 --- a/tools/get.py +++ b/tools/get.py @@ -52,7 +52,7 @@ def auto_int(s): def setup_log(fmt="", **kwargs): try: - import coloredlogs # type: ignore[import] + import coloredlogs # type: ignore[import-not-found] coloredlogs.install(fmt="%(asctime)s,%(msecs)03d " + fmt, **kwargs) except ModuleNotFoundError: logging.basicConfig(format="%(asctime)s " + fmt, **kwargs) diff --git a/tools/monitor-sd.py b/tools/monitor-sd.py index 5be8f88..7533905 100755 --- a/tools/monitor-sd.py +++ b/tools/monitor-sd.py @@ -53,7 +53,7 @@ def auto_int(s): def setup_log(fmt="", **kwargs): try: - import coloredlogs # type: ignore[import] + import coloredlogs # type: ignore[import-not-found] coloredlogs.install(fmt="%(asctime)s,%(msecs)03d " + fmt, **kwargs) except ModuleNotFoundError: logging.basicConfig(format="%(asctime)s " + fmt, **kwargs) diff --git a/tools/simpleservice.py b/tools/simpleservice.py index de72619..84c00b2 100755 --- a/tools/simpleservice.py +++ b/tools/simpleservice.py @@ -95,7 +95,7 @@ async def run(local_addr, multicast_addr, port): def setup_log(fmt="", **kwargs): try: - import coloredlogs # type: ignore[import] + import coloredlogs # type: ignore[import-not-found] coloredlogs.install(fmt="%(asctime)s,%(msecs)03d " + fmt, **kwargs) except ModuleNotFoundError: From 9d18018f79c481db74d7a7402a947327401cd8a1 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 18:55:02 +0200 Subject: [PATCH 2/8] run ipv6 multicast tests in CI --- .github/workflows/pythonpackage.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 00f8f04..e1ea46e 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -18,17 +18,29 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install tox run: | python -m pip install --upgrade pip pip install tox + + - name: Setup network interfaces + run: | + sudo ip link add type veth + sudo ip link set dev veth0 address 02:00:00:00:00:00 + sudo ip link set dev veth1 address 02:00:00:00:00:01 + sudo ip link set up dev veth0 + sudo ip link set up dev veth1 + - name: Run tests, flake8 and mypy run: | tox + - name: "Upload coverage to Codecov" uses: "codecov/codecov-action@v3" with: From 0c4f2d7a36a02bcc2b9a29ef4b39556479096561 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 19:25:54 +0200 Subject: [PATCH 3/8] update github actions --- .github/workflows/pythonpackage.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index e1ea46e..9143f23 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -17,10 +17,10 @@ jobs: os: ["ubuntu-latest", "windows-latest", "macos-latest"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From 789c0464d17ff8137667a29e24d23a6bfb5ca9a9 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 19:19:51 +0200 Subject: [PATCH 4/8] ci: use codecov repo secret --- .github/workflows/pythonpackage.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 9143f23..4a9ae54 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -42,6 +42,7 @@ jobs: tox - name: "Upload coverage to Codecov" - uses: "codecov/codecov-action@v3" + uses: "codecov/codecov-action@v4" with: fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From b76c3a1d0e7d0f9dc6f4f464da6fc207cc3fef5f Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 19:20:12 +0200 Subject: [PATCH 5/8] run ipv6 multicast tests on ubuntu and macos --- .github/workflows/pythonpackage.yaml | 23 +++++++++++++++++++---- tests/test_sd.py | 24 ++++++++++++------------ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 4a9ae54..4420760 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -30,12 +30,27 @@ jobs: pip install tox - name: Setup network interfaces + if: ${{ startsWith(matrix.os, 'ubuntu') }} run: | + set -x sudo ip link add type veth - sudo ip link set dev veth0 address 02:00:00:00:00:00 - sudo ip link set dev veth1 address 02:00:00:00:00:01 - sudo ip link set up dev veth0 - sudo ip link set up dev veth1 + sudo ip link set dev veth0 address 02:00:00:00:00:00 name feth0 + sudo ip link set dev veth1 address 02:00:00:00:00:01 name feth1 + sudo ip link set up dev feth0 + sudo ip link set up dev feth1 + + - name: Setup network interfaces + if: ${{ startsWith(matrix.os, 'macos') }} + run: | + set -x + # it looks like macos will only assign the link-local address + # when another address was assigned?? let's just directly assign our + # fixed LL addresses here directly + sudo ifconfig feth0 create inet6 fe80::ff:fe00:0 + sudo ifconfig feth1 create inet6 fe80::ff:fe00:1 + sudo ifconfig feth0 peer feth1 + sudo ifconfig feth0 up + sudo ifconfig feth1 up - name: Run tests, flake8 and mypy run: | diff --git a/tests/test_sd.py b/tests/test_sd.py index 7f218ba..0944498 100644 --- a/tests/test_sd.py +++ b/tests/test_sd.py @@ -2377,19 +2377,19 @@ class TestMulticastEndpointsV6( required setup on Linux: ip link add type veth - ip link set dev veth0 address 02:00:00:00:00:00 - ip link set dev veth1 address 02:00:00:00:00:01 - ip link set up dev veth0 - ip link set up dev veth1 + ip link set dev veth0 address 02:00:00:00:00:00 name feth0 + ip link set dev veth1 address 02:00:00:00:00:01 name feth1 + ip link set up dev feth0 + ip link set up dev feth1 """ - bind_lo_addr = "fe80::ff:fe00:0%veth0" - sender_lo_addr = "fe80::ff:fe00:1%veth0" - send_addr = "fe80::ff:fe00:0%veth1" - bind_mc_addr = "ff02::dead:beef%veth0" - send_mc_addr = "ff02::dead:beef%veth1" - bind_interface = "veth0" - send_interface = "veth1" + bind_lo_addr = "fe80::ff:fe00:0%feth0" + sender_lo_addr = "fe80::ff:fe00:1%feth0" + send_addr = "fe80::ff:fe00:0%feth1" + bind_mc_addr = "ff02::dead:beef%feth0" + send_mc_addr = "ff02::dead:beef%feth1" + bind_interface = "feth0" + send_interface = "feth1" AF = socket.AF_INET6 def setUp(self): @@ -2397,7 +2397,7 @@ def setUp(self): socket.if_nametoindex(self.bind_interface) socket.if_nametoindex(self.send_interface) except OSError as exc: - raise unittest.SkipTest("test interfaces veth0 / veth1 not up") from exc + raise unittest.SkipTest("test interfaces feth0 / feth1 not up") from exc def _mc_sockopts(self, sock: socket.socket) -> None: ifindex = socket.if_nametoindex(self.send_interface) From 8ffb0d7ba195ebe023346d3878299f0b4f708263 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 19:51:56 +0200 Subject: [PATCH 6/8] ci: fix indent --- .github/workflows/pythonpackage.yaml | 88 ++++++++++++++-------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 4420760..cc4eae6 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -17,47 +17,47 @@ jobs: os: ["ubuntu-latest", "windows-latest", "macos-latest"] steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install tox - run: | - python -m pip install --upgrade pip - pip install tox - - - name: Setup network interfaces - if: ${{ startsWith(matrix.os, 'ubuntu') }} - run: | - set -x - sudo ip link add type veth - sudo ip link set dev veth0 address 02:00:00:00:00:00 name feth0 - sudo ip link set dev veth1 address 02:00:00:00:00:01 name feth1 - sudo ip link set up dev feth0 - sudo ip link set up dev feth1 - - - name: Setup network interfaces - if: ${{ startsWith(matrix.os, 'macos') }} - run: | - set -x - # it looks like macos will only assign the link-local address - # when another address was assigned?? let's just directly assign our - # fixed LL addresses here directly - sudo ifconfig feth0 create inet6 fe80::ff:fe00:0 - sudo ifconfig feth1 create inet6 fe80::ff:fe00:1 - sudo ifconfig feth0 peer feth1 - sudo ifconfig feth0 up - sudo ifconfig feth1 up - - - name: Run tests, flake8 and mypy - run: | - tox - - - name: "Upload coverage to Codecov" - uses: "codecov/codecov-action@v4" - with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install tox + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Setup network interfaces + if: ${{ startsWith(matrix.os, 'ubuntu') }} + run: | + set -x + sudo ip link add type veth + sudo ip link set dev veth0 address 02:00:00:00:00:00 name feth0 + sudo ip link set dev veth1 address 02:00:00:00:00:01 name feth1 + sudo ip link set up dev feth0 + sudo ip link set up dev feth1 + + - name: Setup network interfaces + if: ${{ startsWith(matrix.os, 'macos') }} + run: | + set -x + # it looks like macos will only assign the link-local address + # when another address was assigned?? let's just directly assign our + # fixed LL addresses here directly + sudo ifconfig feth0 create inet6 fe80::ff:fe00:0 + sudo ifconfig feth1 create inet6 fe80::ff:fe00:1 + sudo ifconfig feth0 peer feth1 + sudo ifconfig feth0 up + sudo ifconfig feth1 up + + - name: Run tests, flake8 and mypy + run: | + tox + + - name: "Upload coverage to Codecov" + uses: "codecov/codecov-action@v4" + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From b9de240a8921b52a091392f65e5b8251ecf45add Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 20:03:11 +0200 Subject: [PATCH 7/8] ci macos: test address assignment --- .github/workflows/pythonpackage.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index cc4eae6..5e3c606 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -46,9 +46,11 @@ jobs: # it looks like macos will only assign the link-local address # when another address was assigned?? let's just directly assign our # fixed LL addresses here directly - sudo ifconfig feth0 create inet6 fe80::ff:fe00:0 - sudo ifconfig feth1 create inet6 fe80::ff:fe00:1 + sudo ifconfig feth0 create lladdr 02:00:00:00:00:00 + sudo ifconfig feth1 create lladdr 02:00:00:00:00:01 sudo ifconfig feth0 peer feth1 + sudo ifconfig feth0 inet6 fd00::0 + sudo ifconfig feth1 inet6 fd00::1 sudo ifconfig feth0 up sudo ifconfig feth1 up From 302ce9159a0c38cb559184e7f35eb3fb6ad40104 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Sat, 8 Jun 2024 19:34:31 +0200 Subject: [PATCH 8/8] DO NOT MERGE: debug ipv6 link local addressing setup --- .github/workflows/pythonpackage.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 5e3c606..14a6b2c 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -38,6 +38,8 @@ jobs: sudo ip link set dev veth1 address 02:00:00:00:00:01 name feth1 sudo ip link set up dev feth0 sudo ip link set up dev feth1 + sudo ip addr show dev feth0 + sudo ip addr show dev feth1 - name: Setup network interfaces if: ${{ startsWith(matrix.os, 'macos') }} @@ -53,9 +55,12 @@ jobs: sudo ifconfig feth1 inet6 fd00::1 sudo ifconfig feth0 up sudo ifconfig feth1 up + sudo ifconfig feth0 + sudo ifconfig feth1 - name: Run tests, flake8 and mypy run: | + false tox - name: "Upload coverage to Codecov"