summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromnom62 <75066712+omnom62@users.noreply.github.com>2025-01-28 12:54:31 +1000
committerGitHub <noreply@github.com>2025-01-27 21:54:31 -0500
commit7dded0a0a411c2df7a0bcbcdc24da3ffef353efd (patch)
treed4c8693c84d5e45478b4ed22954c9427f8998981
parentf64dd509fc1f53a2e9b4296512f1ee5c46bb47e6 (diff)
downloadvyos.vyos-7dded0a0a411c2df7a0bcbcdc24da3ffef353efd.tar.gz
vyos.vyos-7dded0a0a411c2df7a0bcbcdc24da3ffef353efd.zip
T7083 p2p removed (#378)
* T7083 p2p removed
-rw-r--r--changelogs/fragments/T7083_firewall_rules.yml3
-rw-r--r--docs/vyos.vyos.vyos_firewall_rules_module.rst48
-rw-r--r--plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py18
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py27
-rw-r--r--plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py18
-rw-r--r--plugins/modules/vyos_firewall_rules.py18
6 files changed, 3 insertions, 129 deletions
diff --git a/changelogs/fragments/T7083_firewall_rules.yml b/changelogs/fragments/T7083_firewall_rules.yml
new file mode 100644
index 0000000..412b3ab
--- /dev/null
+++ b/changelogs/fragments/T7083_firewall_rules.yml
@@ -0,0 +1,3 @@
+---
+breaking_changes:
+ - firewall_rules - p2p -> the code and the corresponding documentation and configuration should be removed as deprecated since 1.2
diff --git a/docs/vyos.vyos.vyos_firewall_rules_module.rst b/docs/vyos.vyos.vyos_firewall_rules_module.rst
index 97f8b5e..75536b8 100644
--- a/docs/vyos.vyos.vyos_firewall_rules_module.rst
+++ b/docs/vyos.vyos.vyos_firewall_rules_module.rst
@@ -898,54 +898,6 @@ Parameters
<td class="elbow-placeholder"></td>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
- <b>p2p</b>
- <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
- <div style="font-size: small">
- <span style="color: purple">list</span>
- / <span style="color: purple">elements=dictionary</span>
- </div>
- </td>
- <td>
- </td>
- <td>
- <div>P2P application packets.</div>
- </td>
- </tr>
- <tr>
- <td class="elbow-placeholder"></td>
- <td class="elbow-placeholder"></td>
- <td class="elbow-placeholder"></td>
- <td class="elbow-placeholder"></td>
- <td colspan="2">
- <div class="ansibleOptionAnchor" id="parameter-"></div>
- <b>application</b>
- <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
- <div style="font-size: small">
- <span style="color: purple">string</span>
- </div>
- </td>
- <td>
- <ul style="margin: 0; padding: 0"><b>Choices:</b>
- <li>all</li>
- <li>applejuice</li>
- <li>bittorrent</li>
- <li>directconnect</li>
- <li>edonkey</li>
- <li>gnutella</li>
- <li>kazaa</li>
- </ul>
- </td>
- <td>
- <div>Name of the application.</div>
- </td>
- </tr>
-
- <tr>
- <td class="elbow-placeholder"></td>
- <td class="elbow-placeholder"></td>
- <td class="elbow-placeholder"></td>
- <td colspan="3">
- <div class="ansibleOptionAnchor" id="parameter-"></div>
<b>packet_length</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
diff --git a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
index 74fa9c1..6ae1758 100644
--- a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
@@ -217,24 +217,6 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903
},
"type": "dict",
},
- "p2p": {
- "elements": "dict",
- "options": {
- "application": {
- "choices": [
- "all",
- "applejuice",
- "bittorrent",
- "directconnect",
- "edonkey",
- "gnutella",
- "kazaa",
- ],
- "type": "str",
- },
- },
- "type": "list",
- },
"packet_length": {
"elements": "dict",
"options": {"length": {"type": "str"}},
diff --git a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
index 68ceff8..bacc450 100644
--- a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
@@ -406,8 +406,6 @@ class Firewall_rules(ConfigBase):
and not self._is_del(l_set, h)
):
commands.append(self._add_r_base_attrib(rs_id, key, w, opr=opr))
- elif key == "p2p":
- commands.extend(self._add_p2p(key, w, h, cmd, opr))
elif key == "tcp":
commands.extend(self._add_tcp(key, w, h, cmd, opr))
elif key == "time":
@@ -430,31 +428,6 @@ class Firewall_rules(ConfigBase):
commands.extend(self._add_interface(key, w, h, cmd, opr))
return commands
- def _add_p2p(self, attr, w, h, cmd, opr):
- """
- This function forms the set/delete commands based on the 'opr' type
- for p2p applications attributes.
- :param want: desired config.
- :param have: target config.
- :return: generated commands list.
- """
- commands = []
- have = []
- if w:
- want = w.get(attr) or []
- if h:
- have = h.get(attr) or []
- if want:
- if opr:
- applications = list_diff_want_only(want, have)
- for app in applications:
- commands.append(cmd + (" " + attr + " " + app["application"]))
- elif not opr and have:
- applications = list_diff_want_only(want, have)
- for app in applications:
- commands.append(cmd + (" " + attr + " " + app["application"]))
- return commands
-
def _add_state(self, attr, w, h, cmd, opr):
"""
This function forms the command for 'state' attributes based on the 'opr'.
diff --git a/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
index 3da7089..c760e4d 100644
--- a/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
@@ -224,7 +224,6 @@ class Firewall_rulesFacts(object):
]
rule = self.parse_attr(conf, a_lst)
r_sub = {
- "p2p": self.parse_p2p(conf),
"tcp": self.parse_tcp(conf),
"icmp": self.parse_icmp(conf, "icmp"),
"time": self.parse_time(conf, "time"),
@@ -269,23 +268,6 @@ class Firewall_rulesFacts(object):
lengths.append(obj)
return lengths
- def parse_p2p(self, conf):
- """
- This function forms the regex to fetch the 'p2p' with in
- 'rules'
- :param conf: configuration data.
- :return: generated rule list configuration.
- """
- a_lst = []
- applications = findall(r"p2p (?:\'*)(\d+)(?:\'*)", conf, M)
- if applications:
- app_lst = []
- for r in set(applications):
- obj = {"application": r.strip("'")}
- app_lst.append(obj)
- a_lst = sorted(app_lst, key=lambda i: i["application"])
- return a_lst
-
def parse_src_or_dest(self, conf, attrib=None):
"""
This function triggers the parsing of 'source or
diff --git a/plugins/modules/vyos_firewall_rules.py b/plugins/modules/vyos_firewall_rules.py
index d8c7a1c..850299f 100644
--- a/plugins/modules/vyos_firewall_rules.py
+++ b/plugins/modules/vyos_firewall_rules.py
@@ -352,24 +352,6 @@ options:
- Packet type match.
type: str
choices: ['broadcast', 'multicast', 'host', 'other']
- p2p:
- description:
- - P2P application packets.
- type: list
- elements: dict
- suboptions:
- application:
- description:
- - Name of the application.
- type: str
- choices:
- - all
- - applejuice
- - bittorrent
- - directconnect
- - edonkey
- - gnutella
- - kazaa
protocol:
description:
- Protocol to match (protocol name in /etc/protocols or protocol number