summaryrefslogtreecommitdiff
path: root/plugins/modules
diff options
context:
space:
mode:
authorGaige B Paulsen <gaige@cluetrust.com>2025-02-07 14:11:19 -0500
committerGitHub <noreply@github.com>2025-02-07 11:11:19 -0800
commitd75becb8e46d764552b0df605ef9192592ae2633 (patch)
tree1a8d98cfd62ee956017302685d6e0d0453833764 /plugins/modules
parent4b1cc399b285fbf3f2535424b444d8d3282515c5 (diff)
downloadvyos.vyos-d75becb8e46d764552b0df605ef9192592ae2633.tar.gz
vyos.vyos-d75becb8e46d764552b0df605ef9192592ae2633.zip
T7011: fix: lldp global integration (#385)
* T7011: fix: lldp global integration * T7011: Fix lldp interfaces integration
Diffstat (limited to 'plugins/modules')
-rw-r--r--plugins/modules/vyos_lldp_global.py40
-rw-r--r--plugins/modules/vyos_lldp_interfaces.py133
2 files changed, 50 insertions, 123 deletions
diff --git a/plugins/modules/vyos_lldp_global.py b/plugins/modules/vyos_lldp_global.py
index e2f7914e..190f4513 100644
--- a/plugins/modules/vyos_lldp_global.py
+++ b/plugins/modules/vyos_lldp_global.py
@@ -60,8 +60,16 @@ options:
type: bool
address:
description:
- - This argument defines management-address.
+ - Exactly one management address (exclusive with addresses).
+ Deprecated in favor of addresses. To be removed in 7.0.0.
type: str
+ addresses:
+ description:
+ - One or more management addresses. The management address is used to identify
+ the management interface of the system. Only addresses connected to the
+ system will be transmitted.
+ type: list
+ elements: str
snmp:
description:
- This argument enable the SNMP queries to LLDP database.
@@ -113,7 +121,8 @@ EXAMPLES = """
- fdp
- cdp
snmp: enable
- address: 192.0.2.11
+ addresses:
+ - 192.0.2.11
state: merged
#
#
@@ -132,7 +141,9 @@ EXAMPLES = """
#
# after": {
# "snmp": "enable"
-# "address": "192.0.2.11"
+# "addresses": [
+# "192.0.2.11"
+# ]
# "legacy_protocols": [
# "cdp",
# "fdp"
@@ -167,7 +178,8 @@ EXAMPLES = """
- edp
- sonmp
- cdp
- address: 192.0.2.14
+ addresses:
+ - 192.0.2.14
state: replaced
#
#
@@ -178,7 +190,9 @@ EXAMPLES = """
#
# "before": {
# "snmp": "enable"
-# "address": "192.0.2.11"
+# "addresses": [
+# "192.0.2.11"
+# ]
# "legacy_protocols": [
# "cdp",
# "fdp"
@@ -189,13 +203,16 @@ EXAMPLES = """
# "commands": [
# "delete service lldp snmp",
# "delete service lldp legacy-protocols fdp",
+# "delete service lldp management-address '192.0.2.11'",
# "set service lldp management-address '192.0.2.14'",
# "set service lldp legacy-protocols edp",
# "set service lldp legacy-protocols sonmp"
# ]
#
# "after": {
-# "address": "192.0.2.14"
+# "addresses": [
+# "192.0.2.14"
+# ]
# "legacy_protocols": [
# "cdp",
# "edp",
@@ -236,7 +253,9 @@ EXAMPLES = """
# ------------------------
#
# "before": {
-# "address": "192.0.2.14"
+# "addresses": [
+# "192.0.2.14"
+# ]
# "legacy_protocols": [
# "cdp",
# "edp",
@@ -368,7 +387,8 @@ EXAMPLES = """
- name: Render the commands for provided configuration
vyos.vyos.vyos_lldp_global:
config:
- address: 192.0.2.17
+ addresses:
+ - 192.0.2.17
enable: true
legacy_protocols:
- cdp
@@ -406,7 +426,9 @@ EXAMPLES = """
#
#
# "parsed": {
-# "address": "192.0.2.11",
+# "addresses": [
+# "192.0.2.11"
+# ]
# "enable": true,
# "legacy_protocols": [
# "cdp",
diff --git a/plugins/modules/vyos_lldp_interfaces.py b/plugins/modules/vyos_lldp_interfaces.py
index 14160c76..0a8f892b 100644
--- a/plugins/modules/vyos_lldp_interfaces.py
+++ b/plugins/modules/vyos_lldp_interfaces.py
@@ -70,28 +70,6 @@ options:
- LLDP-MED location data.
type: dict
suboptions:
- civic_based:
- description:
- - Civic-based location data.
- type: dict
- suboptions:
- ca_info:
- description: LLDP-MED address info
- type: list
- elements: dict
- suboptions:
- ca_type:
- description: LLDP-MED Civic Address type.
- type: int
- required: true
- ca_value:
- description: LLDP-MED Civic Address value.
- type: str
- required: true
- country_code:
- description: Country Code
- type: str
- required: true
coordinate_based:
description:
- Coordinate-based location.
@@ -154,11 +132,7 @@ EXAMPLES = """
config:
- name: eth1
location:
- civic_based:
- country_code: US
- ca_info:
- - ca_type: 0
- ca_value: ENGLISH
+ elin: 0000000911
- name: eth2
location:
coordinate_based:
@@ -176,10 +150,7 @@ EXAMPLES = """
# before": {}
#
# "commands": [
-# "set service lldp interface eth1 location civic-based country-code 'US'",
-# "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'",
-# "set service lldp interface eth1 location civic-based country-code 'US'",
-# "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'",
+# "set service lldp interface eth1 location elin '0000000911'",
# "set service lldp interface eth1",
# "set service lldp interface eth2 location coordinate-based latitude '33.524449N'",
# "set service lldp interface eth2 location coordinate-based altitude '2200'",
@@ -205,14 +176,7 @@ EXAMPLES = """
# },
# {
# "location": {
-# "civic_based": {
-# "ca_info": [
-# {
-# "ca_type": 0,
-# "ca_value": "ENGLISH"
-# }
-# ],
-# "country_code": "US"
+# "elin": "0000000911"
# }
# },
# "name": "eth1"
@@ -222,8 +186,7 @@ EXAMPLES = """
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
-# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
-# set service lldp interface eth1 location civic-based country-code 'US'
+# set service lldp interface eth1 location elin '0000000911'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
@@ -236,8 +199,7 @@ EXAMPLES = """
# -------------
#
# vyos@vyos:~$ show configuration commands | grep lldp
-# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
-# set service lldp interface eth1 location civic-based country-code 'US'
+# set service lldp interface eth1 location elin '0000000911'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
@@ -250,11 +212,7 @@ EXAMPLES = """
config:
- name: eth2
location:
- civic_based:
- country_code: US
- ca_info:
- - ca_type: 0
- ca_value: ENGLISH
+ elin: 0000000911
- name: eth1
location:
coordinate_based:
@@ -283,15 +241,7 @@ EXAMPLES = """
# },
# {
# "location": {
-# "civic_based": {
-# "ca_info": [
-# {
-# "ca_type": 0,
-# "ca_value": "ENGLISH"
-# }
-# ],
-# "country_code": "US"
-# }
+# "elin": "0000000911"
# },
# "name": "eth1"
# }
@@ -300,8 +250,7 @@ EXAMPLES = """
# "commands": [
# "delete service lldp interface eth2 location",
# "set service lldp interface eth2 'disable'",
-# "set service lldp interface eth2 location civic-based country-code 'US'",
-# "set service lldp interface eth2 location civic-based ca-type 0 ca-value 'ENGLISH'",
+# "set service lldp interface eth2 location elin '0000000911'",
# "delete service lldp interface eth1 location",
# "set service lldp interface eth1 'disable'",
# "set service lldp interface eth1 location coordinate-based latitude '33.524449N'",
@@ -312,15 +261,7 @@ EXAMPLES = """
#
# "after": {
# "location": {
-# "civic_based": {
-# "ca_info": [
-# {
-# "ca_type": 0,
-# "ca_value": "ENGLISH"
-# }
-# ],
-# "country_code": "US"
-# }
+# "elin": "0000000911"
# },
# "name": "eth2"
# },
@@ -346,8 +287,7 @@ EXAMPLES = """
# set service lldp interface eth1 location coordinate-based latitude '33.524449N'
# set service lldp interface eth1 location coordinate-based longitude '222.267255W'
# set service lldp interface eth2 'disable'
-# set service lldp interface eth2 location civic-based ca-type 0 ca-value 'ENGLISH'
-# set service lldp interface eth2 location civic-based country-code 'US'
+# set service lldp interface eth2 location elin '0000000911'
# Using overridden
@@ -362,8 +302,7 @@ EXAMPLES = """
# set service lldp interface eth1 location coordinate-based latitude '33.524449N'
# set service lldp interface eth1 location coordinate-based longitude '222.267255W'
# set service lldp interface eth2 'disable'
-# set service lldp interface eth2 location civic-based ca-type 0 ca-value 'ENGLISH'
-# set service lldp interface eth2 location civic-based country-code 'US'
+# set service lldp interface eth2 location elin '0000000911'
#
- name: Overrides all device configuration with provided configuration
vyos.vyos.vyos_lldp_interfaces:
@@ -382,17 +321,7 @@ EXAMPLES = """
# "before": [
# {
# "enable": false,
-# "location": {
-# "civic_based": {
-# "ca_info": [
-# {
-# "ca_type": 0,
-# "ca_value": "ENGLISH"
-# }
-# ],
-# "country_code": "US"
-# }
-# },
+# "elin": "0000000911",
# "name": "eth2"
# },
# {
@@ -476,8 +405,7 @@ EXAMPLES = """
# -------------
#
# vyos@192# run show configuration commands | grep lldp
-# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
-# set service lldp interface eth1 location civic-based country-code 'US'
+# set service lldp interface eth1 location elin '0000000911'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
@@ -507,15 +435,7 @@ EXAMPLES = """
# },
# {
# "location": {
-# "civic_based": {
-# "ca_info": [
-# {
-# "ca_type": 0,
-# "ca_value": "ENGLISH"
-# }
-# ],
-# "country_code": "US"
-# }
+# "elin": "0000000911"
# },
# "name": "eth1"
# }
@@ -526,8 +446,7 @@ EXAMPLES = """
# -------------
#
# vyos@192# run show configuration commands | grep lldp
-# set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
-# set service lldp interface eth1 location civic-based country-code 'US'
+# set service lldp interface eth1 location elin '0000000911'
# set service lldp interface eth2 location coordinate-based altitude '2200'
# set service lldp interface eth2 location coordinate-based datum 'WGS84'
# set service lldp interface eth2 location coordinate-based latitude '33.524449N'
@@ -542,11 +461,7 @@ EXAMPLES = """
config:
- name: eth1
location:
- civic_based:
- country_code: US
- ca_info:
- - ca_type: 0
- ca_value: ENGLISH
+ elin: 0000000911
- name: eth2
location:
coordinate_based:
@@ -564,8 +479,7 @@ EXAMPLES = """
#
#
# "rendered": [
-# "set service lldp interface eth1 location civic-based country-code 'US'",
-# "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'",
+# "set service lldp interface eth1 location elin '0000000911'",
# "set service lldp interface eth1",
# "set service lldp interface eth2 location coordinate-based latitude '33.524449N'",
# "set service lldp interface eth2 location coordinate-based altitude '2200'",
@@ -581,8 +495,7 @@ EXAMPLES = """
- name: Parsed the commands to provide structured configuration.
vyos.vyos.vyos_lldp_interfaces:
running_config:
- "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
- set service lldp interface eth1 location civic-based country-code 'US'
+ "set service lldp interface eth1 location elin '0000000911'
set service lldp interface eth2 location coordinate-based altitude '2200'
set service lldp interface eth2 location coordinate-based datum 'WGS84'
set service lldp interface eth2 location coordinate-based latitude '33.524449N'
@@ -609,15 +522,7 @@ EXAMPLES = """
# },
# {
# "location": {
-# "civic_based": {
-# "ca_info": [
-# {
-# "ca_type": 0,
-# "ca_value": "ENGLISH"
-# }
-# ],
-# "country_code": "US"
-# }
+# "elin": "0000000911"
# },
# "name": "eth1"
# }