Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups and some deletions #62

Merged
merged 7 commits into from
Jan 4, 2023
Merged
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
69 changes: 15 additions & 54 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,24 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-shell --run "pylama packetnetworking setup.py"
test-python-35:
pytests:
runs-on: ubuntu-latest
needs: [format, lint]
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.5'
python-version: "${{matrix.python-version}}"
- run: pip install tox
- run: tox -e py35
test-python-36:
runs-on: ubuntu-latest
needs: [format, lint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.6'
- run: pip install tox
- run: tox -e py36
test-python-37:
runs-on: ubuntu-latest
needs: [format, lint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.7'
- run: pip install tox
- run: tox -e py37
test-python-38:
runs-on: ubuntu-latest
needs: [format, lint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- run: pip install tox
- run: tox -e py38
test-python-39:
runs-on: ubuntu-latest
needs: [format, lint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: pip install tox
- run: tox -e py39
test-python-310:
runs-on: ubuntu-latest
needs: [format, lint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install tox
- run: tox -e py310
- name: Test on Python ${{matrix.python-version}}
run: |
pyversion=py${{matrix.python-version}}
pyversion=${pyversion//./}
tox -e "$pyversion"
2 changes: 0 additions & 2 deletions packetnetworking/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from .alpine import AlpineBuilder
from .debian import DebianBuilder
from .redhat import RedhatBuilder
from .suse import SuseBuilder

__all__ = [
"DistroBuilder",
Expand All @@ -12,5 +11,4 @@
"AlpineBuilder",
"DebianBuilder",
"RedhatBuilder",
"SuseBuilder",
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@ iface bond0 inet static
netmask {{ ip4priv.netmask }}
gateway {{ ip4priv.gateway }}
{% endif %}
dns-nameservers {{ resolvers | join(" ") }}

use bond
requires{% for iface in interfaces %} {{ iface.meta_name }}{% endfor %}

bond-members{% for iface in interfaces %} {{ iface.meta_name }}{% endfor %}

requires {{ interfaces | map(attribute="meta_name") | join(" ") }}
bond-members {{ interfaces | map(attribute="meta_name") | join(" ") }}
bond-mode {{ net.bonding.mode }}

bond-downdelay 200
bond-miimon 100
bond-updelay 200
bond-xmit_hash_policy layer3+4

dns-nameservers{% for dns in resolvers %} {{ dns }}{% endfor %}

{% if ip6pub %}

iface bond0 inet6 static
address {{ ip6pub.address }}
netmask {{ ip6pub.cidr }}
gateway {{ ip6pub.gateway }}
{% endif %}

{% if ip4pub %}

auto bond0:0
iface bond0:0 inet static
address {{ ip4priv.address }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ iface {{ iface0.meta_name }} inet static
netmask {{ ip4priv.netmask }}
gateway {{ ip4priv.gateway }}
{% endif %}

dns-nameservers{% for dns in resolvers %} {{ dns }}{% endfor %}

dns-nameservers {{ resolvers | join(" ") }}
{% if ip6pub %}

iface {{ iface0.meta_name }} inet6 static
address {{ ip6pub.address }}
netmask {{ ip6pub.cidr }}
gateway {{ ip6pub.gateway }}
{% endif %}

{% if ip4pub %}

auto {{ iface0.meta_name }}:0
iface {{ iface0.meta_name }}:0 inet static
address {{ ip4priv.address }}
Expand Down
16 changes: 4 additions & 12 deletions packetnetworking/distros/alpine/test_alpine_3_bonded.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@ def test_alpine_3_public_bonded_task_etc_network_interfaces(alpine_3_bonded_netw
address {ipv4pub.address}
netmask {ipv4pub.netmask}
gateway {ipv4pub.gateway}
dns-nameservers {dns1} {dns2}

use bond
requires {iface0.meta_name} {iface1.meta_name}
bond-members {iface0.meta_name} {iface1.meta_name}
bond-mode {bonding_mode}

bond-downdelay 200
bond-miimon 100
bond-updelay 200
bond-xmit_hash_policy layer3+4

dns-nameservers {dns1} {dns2}
iface bond0 inet6 static
address {ipv6pub.address}
netmask {ipv6pub.cidr}
Expand Down Expand Up @@ -80,19 +79,16 @@ def test_alpine_3_private_bonded_task_etc_network_interfaces(alpine_3_bonded_net
address {ipv4priv.address}
netmask {ipv4priv.netmask}
gateway {ipv4priv.gateway}
dns-nameservers {dns1} {dns2}

use bond
requires {iface0.meta_name} {iface1.meta_name}
bond-members {iface0.meta_name} {iface1.meta_name}
bond-mode {bonding_mode}

bond-downdelay 200
bond-miimon 100
bond-updelay 200
bond-xmit_hash_policy layer3+4

dns-nameservers {dns1} {dns2}

"""
).format(
ipv4priv=builder.ipv4priv.first,
Expand Down Expand Up @@ -122,18 +118,17 @@ def test_alpine_3_public_bonded_task_etc_network_interfaces_with_custom_private_
address {ipv4pub.address}
netmask {ipv4pub.netmask}
gateway {ipv4pub.gateway}
dns-nameservers {dns1} {dns2}

use bond
requires {iface0.meta_name} {iface1.meta_name}
bond-members {iface0.meta_name} {iface1.meta_name}
bond-mode {bonding_mode}

bond-downdelay 200
bond-miimon 100
bond-updelay 200
bond-xmit_hash_policy layer3+4

dns-nameservers {dns1} {dns2}
iface bond0 inet6 static
address {ipv6pub.address}
netmask {ipv6pub.cidr}
Expand Down Expand Up @@ -181,19 +176,16 @@ def test_alpine_3_private_bonded_task_etc_network_interfaces_with_custom_private
address {ipv4priv.address}
netmask {ipv4priv.netmask}
gateway {ipv4priv.gateway}
dns-nameservers {dns1} {dns2}

use bond
requires {iface0.meta_name} {iface1.meta_name}
bond-members {iface0.meta_name} {iface1.meta_name}
bond-mode {bonding_mode}

bond-downdelay 200
bond-miimon 100
bond-updelay 200
bond-xmit_hash_policy layer3+4

dns-nameservers {dns1} {dns2}

"""
).format(
ipv4priv=builder.ipv4priv.first,
Expand Down
8 changes: 2 additions & 6 deletions packetnetworking/distros/alpine/test_alpine_3_individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def test_alpine_3_public_individual_task_etc_network_interfaces(
address {ipv4pub.address}
netmask {ipv4pub.netmask}
gateway {ipv4pub.gateway}

dns-nameservers {dns1} {dns2}

iface eth0 inet6 static
address {ipv6pub.address}
netmask {ipv6pub.cidr}
Expand Down Expand Up @@ -71,9 +71,7 @@ def test_alpine_3_private_individual_task_etc_network_interfaces(
address {ipv4priv.address}
netmask {ipv4priv.netmask}
gateway {ipv4priv.gateway}

dns-nameservers {dns1} {dns2}

"""
).format(
ipv4priv=builder.ipv4priv.first,
Expand All @@ -100,8 +98,8 @@ def test_alpine_3_public_individual_task_etc_network_interfaces_with_custom_priv
address {ipv4pub.address}
netmask {ipv4pub.netmask}
gateway {ipv4pub.gateway}

dns-nameservers {dns1} {dns2}

iface eth0 inet6 static
address {ipv6pub.address}
netmask {ipv6pub.cidr}
Expand Down Expand Up @@ -146,9 +144,7 @@ def test_alpine_3_private_individual_task_etc_network_interfaces_with_custom_pri
address {ipv4priv.address}
netmask {ipv4priv.netmask}
gateway {ipv4priv.gateway}

dns-nameservers {dns1} {dns2}

"""
).format(
ipv4priv=builder.ipv4priv.first,
Expand Down
17 changes: 1 addition & 16 deletions packetnetworking/distros/debian/bonded.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,5 @@ def build(self):
def build_tasks(self):
self.task_template("etc/network/interfaces", "bonded/etc_network_interfaces.j2")
self.task_template("etc/modules", "bonded/etc_modules.j2", write_mode="a")

os = self.metadata.operating_system

if os.distro == "debian" and os.version not in ["7", "8"]:
self.tasks.update(generate_persistent_names_udev())
elif os.distro == "ubuntu" and os.version in [
"14.04",
"18.04",
"19.04",
"19.10",
"20.04",
"20.10",
"21.04",
"22.04",
]:
self.tasks.update(generate_persistent_names_udev())
self.tasks.update(generate_persistent_names_udev())
return self.tasks
5 changes: 0 additions & 5 deletions packetnetworking/distros/debian/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@ def build_tasks(self):
if os.distro == "debian" and os.version in ["10", "11"]:
self.tasks.update(generate_persistent_names_udev())
elif os.distro == "ubuntu" and os.version in [
"14.04",
"18.04",
"19.04",
"19.10",
"20.04",
"20.10",
"21.04",
"22.04",
]:
self.tasks.update(generate_persistent_names_udev())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ iface bond0 inet static
netmask {{ ip4priv.netmask }}
gateway {{ ip4priv.gateway }}
{% endif %}
dns-nameservers {{ resolvers | join(" ") }}

bond-downdelay 200
bond-miimon 100
bond-mode {{ net.bonding.mode }}
Expand All @@ -31,18 +33,16 @@ iface bond0 inet static
{% if osinfo.distro == 'ubuntu' and net.bonding.mode == 4 %}
bond-lacp-rate 1
{% endif %}
bond-slaves{% for iface in interfaces %} {{ iface.name }}{% endfor %}

dns-nameservers{% for dns in resolvers %} {{ dns }}{% endfor %}

bond-slaves {{ interfaces | map(attribute='name') | join(' ')}}
{% if ip6pub %}

iface bond0 inet6 static
address {{ ip6pub.address }}
netmask {{ ip6pub.cidr }}
gateway {{ ip6pub.gateway }}
{% endif %}

{% if ip4pub %}

auto bond0:0
iface bond0:0 inet static
address {{ ip4priv.address }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ iface {{ iface0.name }} inet static
netmask {{ ip4priv.netmask }}
gateway {{ ip4priv.gateway }}
{% endif %}

dns-nameservers{% for dns in resolvers %} {{ dns }}{% endfor %}

dns-nameservers {{ resolvers | join(" ") }}
{% if ip6pub %}

iface {{ iface0.name }} inet6 static
address {{ ip6pub.address }}
netmask {{ ip6pub.cidr }}
gateway {{ ip6pub.gateway }}
{% endif %}

{% if ip4pub %}

auto {{ iface0.name }}:0
iface {{ iface0.name }}:0 inet static
address {{ ip4priv.address }}
Expand Down
Loading