diff options
author | Gaige B Paulsen <gaige@cluetrust.com> | 2025-02-07 14:11:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-07 11:11:19 -0800 |
commit | d75becb8e46d764552b0df605ef9192592ae2633 (patch) | |
tree | 1a8d98cfd62ee956017302685d6e0d0453833764 /plugins | |
parent | 4b1cc399b285fbf3f2535424b444d8d3282515c5 (diff) | |
download | vyos.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')
8 files changed, 128 insertions, 250 deletions
diff --git a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py index 5c33d67..d79de61 100644 --- a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py +++ b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py @@ -42,6 +42,10 @@ class Lldp_globalArgs(object): # pylint: disable=R0903 "config": { "options": { "address": {"type": "str"}, + "addresses": { + "elements": "str", + "type": "list", + }, "enable": {"type": "bool"}, "legacy_protocols": { "choices": [ @@ -56,6 +60,7 @@ class Lldp_globalArgs(object): # pylint: disable=R0903 "snmp": {"type": "str"}, }, "type": "dict", + "mutually_exclusive": [["addresses", "address"]], }, "running_config": {"type": "str"}, "state": { diff --git a/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py index 37a6afb..fd6c627 100644 --- a/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py @@ -45,29 +45,6 @@ class Lldp_interfacesArgs(object): # pylint: disable=R0903 "enable": {"default": True, "type": "bool"}, "location": { "options": { - "civic_based": { - "options": { - "ca_info": { - "elements": "dict", - "options": { - "ca_type": { - "required": True, - "type": "int", - }, - "ca_value": { - "required": True, - "type": "str", - }, - }, - "type": "list", - }, - "country_code": { - "required": True, - "type": "str", - }, - }, - "type": "dict", - }, "coordinate_based": { "options": { "altitude": {"type": "int"}, diff --git a/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py index 1afda78..1dfd25e 100644 --- a/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py +++ b/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py @@ -42,7 +42,8 @@ class Lldp_global(ConfigBase): "lldp_global", ] - params = ["enable", "address", "snmp", "legacy_protocols"] + # address intentionally omitted since it's coerced to addresses + params = ["enable", "addresses", "snmp", "legacy_protocols"] def __init__(self, module): super(Lldp_global, self).__init__(module) @@ -73,6 +74,12 @@ class Lldp_global(ConfigBase): warnings = list() commands = list() + # fix for new name/type + if self._module.params["config"]: + temp_have_address = self._module.params["config"].pop("address", None) + if temp_have_address: + self._module.params["config"]["addresses"] = [temp_have_address] + if self.state in self.ACTION_STATES: existing_lldp_global_facts = self.get_lldp_global_facts() else: @@ -184,14 +191,19 @@ class Lldp_global(ConfigBase): for item in Lldp_global.params: if item == "legacy_protocols": commands.extend(self._update_lldp_protocols(want, have)) + if item == "addresses": + commands.extend(self._update_management_addresses(want, have)) elif have.get(item) and not want.get(item) and item != "enable": commands.append(Lldp_global.del_cmd + item) elif have: + if have.get("enable"): + commands.append(self._compute_command(remove=True)) + return commands for item in Lldp_global.params: if have.get(item): if item == "legacy_protocols": commands.append(self._compute_command("legacy-protocols", remove=True)) - elif item == "address": + elif item == "addresses": commands.append(self._compute_command("management-address", remove=True)) elif item == "snmp": commands.append(self._compute_command(item, remove=True)) @@ -202,9 +214,17 @@ class Lldp_global(ConfigBase): commands = [] if have: temp_have_legacy_protos = have.pop("legacy_protocols", None) + temp_have_addreses = have.pop("addresses", None) + temp_have_address = have.pop("address", None) + if temp_have_address: + temp_have_addresses = [temp_have_address] else: have = {} temp_want_legacy_protos = want.pop("legacy_protocols", None) + temp_want_addreses = want.pop("addresses", None) + temp_want_address = want.pop("address", None) + if temp_want_address: + temp_want_addresses = [temp_want_address] updates = dict_diff(have, want) @@ -212,16 +232,23 @@ class Lldp_global(ConfigBase): have["legacy_protocols"] = temp_have_legacy_protos if not have and temp_want_legacy_protos: want["legacy_protocols"] = temp_want_legacy_protos + if have and temp_have_addreses: + have["addresses"] = temp_have_addreses + if not have and temp_want_addreses: + want["addresses"] = temp_want_addreses commands.extend(self._add_lldp_protocols(want, have)) + commands.extend(self._add_management_addresses(want, have)) if updates: for key, value in iteritems(updates): - if value: + if value is not None: if key == "enable": - commands.append(self._compute_command()) - elif key == "address": - commands.append(self._compute_command("management-address", str(value))) + if value is False: + commands.append(self._compute_command(remove=True)) + return commands + else: + commands.append(self._compute_command()) elif key == "snmp": if value == "disable": commands.append(self._compute_command(key, remove=True)) @@ -232,8 +259,17 @@ class Lldp_global(ConfigBase): def _add_lldp_protocols(self, want, have): commands = [] diff_members = get_lst_diff_for_dicts(want, have, "legacy_protocols") - for key in diff_members: - commands.append(self._compute_command("legacy-protocols", key)) + if diff_members: + for key in diff_members: + commands.append(self._compute_command("legacy-protocols", key)) + return commands + + def _add_management_addresses(self, want, have): + commands = [] + diff_members = get_lst_diff_for_dicts(want, have, "addresses") + if diff_members: + for key in diff_members: + commands.append(self._compute_command("management-address", key)) return commands def _update_lldp_protocols(self, want_item, have_item): @@ -247,6 +283,17 @@ class Lldp_global(ConfigBase): commands.append(self._compute_command("legacy-protocols", member, remove=True)) return commands + def _update_management_addresses(self, want_item, have_item): + commands = [] + want_addresses = want_item.get("addresses") or [] + have_addresses = have_item.get("addresses") or [] + + members_diff = list_diff_have_only(want_addresses, have_addresses) + if members_diff: + for member in members_diff: + commands.append(self._compute_command("management-address", member, remove=True)) + return commands + def _compute_command(self, key=None, value=None, remove=False): if remove: cmd = "delete service lldp" diff --git a/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py index 53e9aed..2fd6a54 100644 --- a/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py +++ b/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py @@ -29,7 +29,6 @@ from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.facts from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.utils.utils import ( is_dict_element_present, key_value_in_dict, - search_dict_tv_in_list, search_obj_in_list, ) @@ -290,31 +289,6 @@ class Lldp_interfaces(ConfigBase): if value: commands.append(self._compute_command(set_cmd + location_type, key, str(value))) - elif want_location_type["civic_based"]: - location_type = "civic-based" - want_dict = want_location_type.get("civic_based") or {} - want_ca = want_dict.get("ca_info") or [] - if is_dict_element_present(have_location_type, "civic_based"): - have_dict = have_location_type.get("civic_based") or {} - have_ca = have_dict.get("ca_info") or [] - if want_dict["country_code"] != have_dict["country_code"]: - commands.append( - self._compute_command( - set_cmd + location_type, - "country-code", - str(want_dict["country_code"]), - ), - ) - else: - commands.append( - self._compute_command( - set_cmd + location_type, - "country-code", - str(want_dict["country_code"]), - ), - ) - commands.extend(self._add_civic_address(name, want_ca, have_ca)) - elif want_location_type["elin"]: location_type = "elin" if is_dict_element_present(have_location_type, "elin"): @@ -354,16 +328,6 @@ class Lldp_interfaces(ConfigBase): else: commands.append(self._compute_command(del_cmd, remove=True)) - elif want_location_type["civic_based"]: - want_dict = want_location_type.get("civic_based") or {} - want_ca = want_dict.get("ca_info") or [] - if is_dict_element_present(have_location_type, "civic_based"): - have_dict = have_location_type.get("civic_based") or {} - have_ca = have_dict.get("ca_info") - commands.extend(self._update_civic_address(name, want_ca, have_ca)) - else: - commands.append(self._compute_command(del_cmd, remove=True)) - else: if is_dict_element_present(have_location_type, "elin"): if want_location_type.get("elin") != have_location_type.get("elin"): @@ -372,39 +336,6 @@ class Lldp_interfaces(ConfigBase): commands.append(self._compute_command(del_cmd, remove=True)) return commands - def _add_civic_address(self, name, want, have): - commands = [] - for item in want: - ca_type = item["ca_type"] - ca_value = item["ca_value"] - obj_in_have = search_dict_tv_in_list(ca_type, ca_value, have, "ca_type", "ca_value") - if not obj_in_have: - commands.append( - self._compute_command( - key=name + " location civic-based ca-type", - attrib=str(ca_type) + " ca-value", - value=ca_value, - ), - ) - return commands - - def _update_civic_address(self, name, want, have): - commands = [] - for item in have: - ca_type = item["ca_type"] - ca_value = item["ca_value"] - in_want = search_dict_tv_in_list(ca_type, ca_value, want, "ca_type", "ca_value") - if not in_want: - commands.append( - self._compute_command( - name, - "location civic-based ca-type", - str(ca_type), - remove=True, - ), - ) - return commands - def _compute_command(self, key, attrib=None, value=None, remove=False): if remove: cmd = "delete service lldp interface " diff --git a/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py index b2afe59..7a6e9b8 100644 --- a/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py +++ b/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py @@ -41,6 +41,9 @@ class Lldp_globalFacts(object): self.generated_spec = utils.generate_dict(facts_argument_spec) + def get_config(self, connection): + return connection.get("show configuration commands | grep lldp") + def populate_facts(self, connection, ansible_facts, data=None): """Populate the facts for lldp_global :param connection: the device connection @@ -50,7 +53,7 @@ class Lldp_globalFacts(object): :returns: facts """ if not data: - data = connection.get_config() + data = self.get_config(connection) objs = {} lldp_output = findall(r"^set service lldp (\S+)", data, M) @@ -85,9 +88,11 @@ class Lldp_globalFacts(object): :returns: The generated config """ protocol_conf = "\n".join(filter(lambda x: ("legacy-protocols" in x), conf)) - att_conf = "\n".join(filter(lambda x: ("legacy-protocols" not in x), conf)) - config = self.parse_attribs(["snmp", "address"], att_conf) + att_conf = "\n".join(filter(lambda x: ("snmp" in x), conf)) + addr_conf = "\n".join(filter(lambda x: ("management-address" in x), conf)) + config = self.parse_attribs(["snmp"], att_conf) config["legacy_protocols"] = self.parse_protocols(protocol_conf) + config["addresses"] = self.parse_addresses(addr_conf) return utils.remove_empties(config) def parse_protocols(self, conf): @@ -100,6 +105,16 @@ class Lldp_globalFacts(object): protocol_support.append(protocol.strip("'")) return protocol_support + def parse_addresses(self, conf): + management_addresses = None + if conf: + addresses = findall(r"^.*management-address (.+)", conf, M) + if addresses: + management_addresses = [] + for protocol in addresses: + management_addresses.append(protocol.strip("'")) + return management_addresses + def parse_attribs(self, attribs, conf): config = {} for item in attribs: diff --git a/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py index 5f439e7..e029b47 100644 --- a/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py +++ b/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py @@ -85,7 +85,6 @@ class Lldp_interfacesFacts(object): config = {} location = {} - civic_conf = "\n".join(filter(lambda x: ("civic-based" in x), conf)) elin_conf = "\n".join(filter(lambda x: ("elin" in x), conf)) coordinate_conf = "\n".join(filter(lambda x: ("coordinate-based" in x), conf)) disable = "\n".join(filter(lambda x: ("disable" in x), conf)) @@ -95,15 +94,11 @@ class Lldp_interfacesFacts(object): coordinate_conf, ) elin_based_conf = self.parse_lldp_elin_based(elin_conf) - civic_based_conf = self.parse_lldp_civic_based(civic_conf) if disable: config["enable"] = False if coordinate_conf: location["coordinate_based"] = coordinate_based_conf config["location"] = location - elif civic_based_conf: - location["civic_based"] = civic_based_conf - config["location"] = location elif elin_conf: location["elin"] = elin_based_conf config["location"] = location @@ -123,25 +118,6 @@ class Lldp_interfacesFacts(object): config[item] = None return utils.remove_empties(config) - def parse_lldp_civic_based(self, conf): - civic_based = None - if conf: - civic_info_list = [] - civic_add_list = findall(r"^.*civic-based ca-type (.+)", conf, M) - if civic_add_list: - for civic_add in civic_add_list: - ca = civic_add.split(" ") - c_add = {} - c_add["ca_type"] = int(ca[0].strip("'")) - c_add["ca_value"] = ca[2].strip("'") - civic_info_list.append(c_add) - - country_code = search(r"^.*civic-based country-code (.+)", conf, M) - civic_based = {} - civic_based["ca_info"] = civic_info_list - civic_based["country_code"] = country_code.group(1).strip("'") - return civic_based - def parse_lldp_elin_based(self, conf): elin_based = None if conf: diff --git a/plugins/modules/vyos_lldp_global.py b/plugins/modules/vyos_lldp_global.py index e2f7914..190f451 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 14160c7..0a8f892 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" # } |