chore(release): 0.18.0 #85

Merged
christianmanivong merged 4 commits from chore/release-0.18.0 into main 2026-11-26 11:42:11 +00:00
3 changed files with 8 additions and 6 deletions
Showing only changes of commit fc4f08302c - Show all commits

No files matched your search

+7 -1
View File
@@ -13,6 +13,7 @@ from typing import TYPE_CHECKING, Literal
from napalm_device_types import ( from napalm_device_types import (
OPENED_PORTS_RECORD, OPENED_PORTS_RECORD,
SNMP_PURPOSE,
FixStepOutcomeDict, FixStepOutcomeDict,
OpenedRuleDict, OpenedRuleDict,
opened_rule_line, opened_rule_line,
@@ -24,6 +25,7 @@ from napalm_device_types import (
ufw_allow_recorded_command, ufw_allow_recorded_command,
ufw_delete_command, ufw_delete_command,
) )
from napalm_device_types.models import SnmpAgentSettingsDict
from napalm_linux._snmp_agent import ( from napalm_linux._snmp_agent import (
_source, _source,
@@ -83,7 +85,7 @@ def _count_command(firewall: Firewall, port: int, proto: str) -> str:
class OpenPortMixin: class OpenPortMixin:
"""``_allow_sources`` and ``_revoke_sources``: the shared firewall steps.""" """``_allow_sources`` and ``_revoke_sources``: the shared firewall steps, and SNMP's."""
def _firewall(self) -> Firewall: def _firewall(self) -> Firewall:
"""The firewall this host runs. firewalld first: its hosts have iptables too, and """The firewall this host runs. firewalld first: its hosts have iptables too, and
@@ -120,6 +122,10 @@ class OpenPortMixin:
done = f"{proto}/{port} open for {', '.join(sources)}" done = f"{proto}/{port} open for {', '.join(sources)}"
return self._root_outcome(" && ".join(rules), 30, done) return self._root_outcome(" && ".join(rules), 30, done)
def _allow_snmp_sources(self, settings: SnmpAgentSettingsDict) -> FixStepOutcomeDict:
"""SNMP's firewall step (napalm-device-types ``SnmpAgentMixin``): udp/161."""
return self._allow_sources(settings.get("allowed_sources", []), 161, "udp", SNMP_PURPOSE)
def _revoke_sources(self, purpose: str, port: int, proto: str) -> FixStepOutcomeDict: def _revoke_sources(self, purpose: str, port: int, proto: str) -> FixStepOutcomeDict:
"""Remove the rules recorded under *purpose*, whatever port they opened, and """Remove the rules recorded under *purpose*, whatever port they opened, and
nothing else; report what is left for *proto*/*port*. nothing else; report what is left for *proto*/*port*.
-4
View File
@@ -30,7 +30,6 @@ from napalm_device_types import (
DNF_INSTALLED_CVES_COMMAND, DNF_INSTALLED_CVES_COMMAND,
DNF_SECURITY_COMMAND, DNF_SECURITY_COMMAND,
LLDPCTL_KEYVALUE_COMMAND, LLDPCTL_KEYVALUE_COMMAND,
SNMP_PURPOSE,
AptProxyMixin, AptProxyMixin,
ByteStream, ByteStream,
CommandResult, CommandResult,
@@ -1798,9 +1797,6 @@ class LinuxDriver(
return {"ok": False, "output": (written.stdout or written.stderr).strip()[-300:]} return {"ok": False, "output": (written.stdout or written.stderr).strip()[-300:]}
return {"ok": True, "output": f"wrote {_SNMPD_CONF}"} return {"ok": True, "output": f"wrote {_SNMPD_CONF}"}
def _allow_snmp_sources(self, settings: SnmpAgentSettingsDict) -> FixStepOutcomeDict:
return self._allow_sources(settings.get("allowed_sources", []), 161, "udp", SNMP_PURPOSE)
def _start_snmp_agent(self) -> FixStepOutcomeDict: def _start_snmp_agent(self) -> FixStepOutcomeDict:
return self._root_outcome( return self._root_outcome(
"systemctl enable snmpd && systemctl restart snmpd && systemctl is-active snmpd", "systemctl enable snmpd && systemctl restart snmpd && systemctl is-active snmpd",
+1 -1
View File
@@ -20,7 +20,7 @@
"napalm_linux.linux" "napalm_linux.linux"
], ],
"python_file_lines": { "python_file_lines": {
"napalm_linux/linux.py": 1993 "napalm_linux/linux.py": 1990
}, },
"untyped_public": [] "untyped_public": []
} }