From c3adb46835c17ed6a17a8fc3c9f2b742bef1e320 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 12:31:19 +0100 Subject: Revert "[LLDP] Remove the lldp.xml interface definition to avoid template ..." This reverts commit 6b2028e5a40cc435875c2b516b81a2a84ecc6ee0. --- interface-definitions/lldp.xml | 288 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 interface-definitions/lldp.xml (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml b/interface-definitions/lldp.xml new file mode 100644 index 000000000..a0c610dfa --- /dev/null +++ b/interface-definitions/lldp.xml @@ -0,0 +1,288 @@ + + + + + + + + LLDP settings + 985 + + + + + Location data for interface + + all + Location data all interfaces + + + <intf> + Location data for a specific interface + + + + + + + + + Disable lldp on this interface + + + + + LLDP-MED location data [REQUIRED] + + + + + Civic-based location data + + + + + LLDP-MED Civic Address type [REQUIRED] + + 0 + Language + + + 1 + National subdivisions + + + 2 + County, parish, district + + + 3 + City, township + + + 4 + City division, borough, ward + + + 5 + Neighborhood, block + + + 6 + Street + + + 16 + Leading street direction + + + 17 + Trailing street suffix + + + 18 + Street suffix + + + 19 + House number + + + 20 + House number suffix + + + 21 + Landmark or vanity address + + + 22 + Additional location info + + + 23 + Name + + + 24 + Postal/ZIP code + + + 25 + Building + + + 26 + Unit + + + 27 + Floor + + + 28 + Room number + + + 29 + Place type + + + 128 + Script + + ca-type must between 0-128 + + + + + + + + Civic address value for ca-type [REQUIRED] + ca-value must be less than 256 characters + + ^[A-Za-z0-9\ \-\_\.\,]{0,255}$ + + + + + + + + Country code [REQUIRED] + + <AA> + Two letter ISO 3166 country code + + country-code must be 2 characters + + ^[a-zA-Z]{2}$ + + + + + + + + Coordinate based location + + + + + Altitude in meters + + [+-]<meters> + Altitude in meters + + Altitude should be a positive or negative number + + + + + + + + Coordinate datum type + + WGS84 + WGS84 (default) + + + NAD83 + NAD83 + + + MLLW + NAD83/MLLW + + + WGS84 NAD83 MLLW + + Datum should be WGS84, NAD83, or MLLW + + ^(WGS84|NAD83|MLLW)$ + + + + + + Latitude [REQUIRED] + + <latitude> + Latitude (example "37.524449N") + + Latitude should be a number followed by S or N + + ^(\d+)(\.\d+)?[nNsS]$ + + + + + + Longitude [REQUIRED] + + <longitude> + Longitude (example "122.267255W") + + Longiture should be a number followed by E or W + + ^(\d+)(\.\d+)?[eEwW]$ + + + + + + + + + + + + Legacy (vendor specific) protocols + + + + + Listen for CDP for Cisco routers/switches + + + + + Listen for EDP for Extreme routers/switches + + + + + Listen for FDP for Foundry routers/switches + + + + + Listen for SONMP for Nortel routers/switches + + + + + + + IPv4 management address + + + + + SNMP parameters for LLDP + + + + + Enable SNMP queries of the LLDP database + + + + + + + + + -- cgit v1.2.3 From dddacd5fa7865384bf8e77c5db9e02105d8e23ac Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 13:28:26 +0100 Subject: lldp: T393: rename XML interface definition to xml.in --- interface-definitions/lldp.xml | 288 -------------------------------------- interface-definitions/lldp.xml.in | 287 +++++++++++++++++++++++++++++++++++++ 2 files changed, 287 insertions(+), 288 deletions(-) delete mode 100644 interface-definitions/lldp.xml create mode 100644 interface-definitions/lldp.xml.in (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml b/interface-definitions/lldp.xml deleted file mode 100644 index a0c610dfa..000000000 --- a/interface-definitions/lldp.xml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - LLDP settings - 985 - - - - - Location data for interface - - all - Location data all interfaces - - - <intf> - Location data for a specific interface - - - - - - - - - Disable lldp on this interface - - - - - LLDP-MED location data [REQUIRED] - - - - - Civic-based location data - - - - - LLDP-MED Civic Address type [REQUIRED] - - 0 - Language - - - 1 - National subdivisions - - - 2 - County, parish, district - - - 3 - City, township - - - 4 - City division, borough, ward - - - 5 - Neighborhood, block - - - 6 - Street - - - 16 - Leading street direction - - - 17 - Trailing street suffix - - - 18 - Street suffix - - - 19 - House number - - - 20 - House number suffix - - - 21 - Landmark or vanity address - - - 22 - Additional location info - - - 23 - Name - - - 24 - Postal/ZIP code - - - 25 - Building - - - 26 - Unit - - - 27 - Floor - - - 28 - Room number - - - 29 - Place type - - - 128 - Script - - ca-type must between 0-128 - - - - - - - - Civic address value for ca-type [REQUIRED] - ca-value must be less than 256 characters - - ^[A-Za-z0-9\ \-\_\.\,]{0,255}$ - - - - - - - - Country code [REQUIRED] - - <AA> - Two letter ISO 3166 country code - - country-code must be 2 characters - - ^[a-zA-Z]{2}$ - - - - - - - - Coordinate based location - - - - - Altitude in meters - - [+-]<meters> - Altitude in meters - - Altitude should be a positive or negative number - - - - - - - - Coordinate datum type - - WGS84 - WGS84 (default) - - - NAD83 - NAD83 - - - MLLW - NAD83/MLLW - - - WGS84 NAD83 MLLW - - Datum should be WGS84, NAD83, or MLLW - - ^(WGS84|NAD83|MLLW)$ - - - - - - Latitude [REQUIRED] - - <latitude> - Latitude (example "37.524449N") - - Latitude should be a number followed by S or N - - ^(\d+)(\.\d+)?[nNsS]$ - - - - - - Longitude [REQUIRED] - - <longitude> - Longitude (example "122.267255W") - - Longiture should be a number followed by E or W - - ^(\d+)(\.\d+)?[eEwW]$ - - - - - - - - - - - - Legacy (vendor specific) protocols - - - - - Listen for CDP for Cisco routers/switches - - - - - Listen for EDP for Extreme routers/switches - - - - - Listen for FDP for Foundry routers/switches - - - - - Listen for SONMP for Nortel routers/switches - - - - - - - IPv4 management address - - - - - SNMP parameters for LLDP - - - - - Enable SNMP queries of the LLDP database - - - - - - - - - diff --git a/interface-definitions/lldp.xml.in b/interface-definitions/lldp.xml.in new file mode 100644 index 000000000..f04994607 --- /dev/null +++ b/interface-definitions/lldp.xml.in @@ -0,0 +1,287 @@ + + + + + + + LLDP settings + 985 + + + + + Location data for interface + + all + Location data all interfaces + + + <intf> + Location data for a specific interface + + + + + + + + + Disable lldp on this interface + + + + + LLDP-MED location data [REQUIRED] + + + + + Civic-based location data + + + + + LLDP-MED Civic Address type [REQUIRED] + + 0 + Language + + + 1 + National subdivisions + + + 2 + County, parish, district + + + 3 + City, township + + + 4 + City division, borough, ward + + + 5 + Neighborhood, block + + + 6 + Street + + + 16 + Leading street direction + + + 17 + Trailing street suffix + + + 18 + Street suffix + + + 19 + House number + + + 20 + House number suffix + + + 21 + Landmark or vanity address + + + 22 + Additional location info + + + 23 + Name + + + 24 + Postal/ZIP code + + + 25 + Building + + + 26 + Unit + + + 27 + Floor + + + 28 + Room number + + + 29 + Place type + + + 128 + Script + + ca-type must between 0-128 + + + + + + + + Civic address value for ca-type [REQUIRED] + ca-value must be less than 256 characters + + ^[A-Za-z0-9\ \-\_\.\,]{0,255}$ + + + + + + + + Country code [REQUIRED] + + <AA> + Two letter ISO 3166 country code + + country-code must be 2 characters + + ^[a-zA-Z]{2}$ + + + + + + + + Coordinate based location + + + + + Altitude in meters + + [+-]<meters> + Altitude in meters + + Altitude should be a positive or negative number + + + + + + + + Coordinate datum type + + WGS84 + WGS84 (default) + + + NAD83 + NAD83 + + + MLLW + NAD83/MLLW + + + WGS84 NAD83 MLLW + + Datum should be WGS84, NAD83, or MLLW + + ^(WGS84|NAD83|MLLW)$ + + + + + + Latitude [REQUIRED] + + <latitude> + Latitude (example "37.524449N") + + Latitude should be a number followed by S or N + + ^(\d+)(\.\d+)?[nNsS]$ + + + + + + Longitude [REQUIRED] + + <longitude> + Longitude (example "122.267255W") + + Longiture should be a number followed by E or W + + ^(\d+)(\.\d+)?[eEwW]$ + + + + + + + + + + + + Legacy (vendor specific) protocols + + + + + Listen for CDP for Cisco routers/switches + + + + + Listen for EDP for Extreme routers/switches + + + + + Listen for FDP for Foundry routers/switches + + + + + Listen for SONMP for Nortel routers/switches + + + + + + + IPv4 management address + + + + + SNMP parameters for LLDP + + + + + Enable SNMP queries of the LLDP database + + + + + + + + + -- cgit v1.2.3 From 0d36afb047bbd02b79e75d320e92b0ac8618d7d7 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 13:33:17 +0100 Subject: lldp: T393: legacy-protocols must be --- interface-definitions/lldp.xml.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml.in b/interface-definitions/lldp.xml.in index f04994607..204e26169 100644 --- a/interface-definitions/lldp.xml.in +++ b/interface-definitions/lldp.xml.in @@ -20,7 +20,7 @@ Location data for a specific interface - + @@ -244,21 +244,25 @@ Listen for CDP for Cisco routers/switches + Listen for EDP for Extreme routers/switches + Listen for FDP for Foundry routers/switches + Listen for SONMP for Nortel routers/switches + @@ -266,6 +270,13 @@ IPv4 management address + + ipv4 + IP address to listen for incoming connections + + + + -- cgit v1.2.3 From 65dc8e8ba939fad3acaa8744d51a232d022ffdf8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 13:54:57 +0100 Subject: lldp: T393: 'snmp enable' must be --- interface-definitions/lldp.xml.in | 1 + 1 file changed, 1 insertion(+) (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml.in b/interface-definitions/lldp.xml.in index 204e26169..2ec699b91 100644 --- a/interface-definitions/lldp.xml.in +++ b/interface-definitions/lldp.xml.in @@ -287,6 +287,7 @@ Enable SNMP queries of the LLDP database + -- cgit v1.2.3 From 7e0e0e504817ed1d6654893c457b7ebc71a3a909 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 18:24:36 +0100 Subject: lldp: T393: interface disable node must be valueless --- interface-definitions/lldp.xml.in | 1 + 1 file changed, 1 insertion(+) (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml.in b/interface-definitions/lldp.xml.in index 2ec699b91..4c927f603 100644 --- a/interface-definitions/lldp.xml.in +++ b/interface-definitions/lldp.xml.in @@ -27,6 +27,7 @@ Disable lldp on this interface + -- cgit v1.2.3 From 2f0119a2aa6cf6375657e7ab4b16f5b750b45f68 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 20:17:11 +0100 Subject: lldp: T393: add Emergency Location Identifier Number (ELIN) support --- interface-definitions/lldp.xml.in | 13 +++++++++++++ src/conf_mode/lldp.py | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml.in b/interface-definitions/lldp.xml.in index 4c927f603..8aaaaf102 100644 --- a/interface-definitions/lldp.xml.in +++ b/interface-definitions/lldp.xml.in @@ -233,6 +233,19 @@ + + + ECS ELIN (Emergency location identifier number) + + 0-9999999999 + Emergency Call Service ELIN number (between 10-25 numbers) + + + [0-9]{10,25}$ + + ELIN number must be between 10-25 numbers + + diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index 15c0f7812..be7880c55 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -41,6 +41,13 @@ configure system description "VyOS {{ options.description }}" configure system interface pattern "{{ options.listen_on | join(",") }}" {% endif %} +{% for loc in location %} +{%- if loc.elin %} +configure ports {{ loc.name }} med location elin "{{ loc.elin }}" +{%- endif %} +{% endfor %} + + """ default_config_data = { @@ -99,7 +106,7 @@ def get_location_intf(config, name): config.set_level('{} location'.format(path)) civic_based = {} - elin = None + elin = '' coordinate_based = {} if config.exists('civic-based'): -- cgit v1.2.3 From e4b56e2988d3c5599702e858bd2b9ea8ed0ec9a1 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 21:36:37 +0100 Subject: lldp: T393: support IPv6 management address --- interface-definitions/lldp.xml.in | 10 +++++++--- src/conf_mode/lldp.py | 17 ++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'interface-definitions') diff --git a/interface-definitions/lldp.xml.in b/interface-definitions/lldp.xml.in index 8aaaaf102..b44f4baf6 100644 --- a/interface-definitions/lldp.xml.in +++ b/interface-definitions/lldp.xml.in @@ -283,13 +283,17 @@ - IPv4 management address + Management IP Address ipv4 - IP address to listen for incoming connections + IPv4 Management Address + + + ipv6 + IPv6 Management Address - + diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index be7880c55..9fd32d83f 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -27,7 +27,7 @@ from vyos import ConfigError config_file = "/etc/default/lldpd" lldp_tmpl = """ ### Autogenerated by lldp.py ### -DAEMON_ARGS="-M 4{% if options.snmp %} -x{% endif %}{% if options.addr %} -m {{ options.addr }}{% endif %}{% if options.cdp %} -c{% endif %}{% if options.edp %} -e{% endif %}{% if options.fdp %} -f{% endif %}{% if options.sonmp %} -s{% endif %}" +DAEMON_ARGS="-M 4{% if options.snmp %} -x{% endif %}{% if options.cdp %} -c{% endif %}{% if options.edp %} -e{% endif %}{% if options.fdp %} -f{% endif %}{% if options.sonmp %} -s{% endif %}" """ @@ -37,17 +37,17 @@ vyos_tmpl = """ configure system platform VyOS configure system description "VyOS {{ options.description }}" -{% if listen_on %} +{%- if listen_on -%} configure system interface pattern "{{ options.listen_on | join(",") }}" -{% endif %} - -{% for loc in location %} -{%- if loc.elin %} +{%- endif %} +{% if options.addr -%} +configure system ip management pattern "{{ options.addr }}" +{%- endif %} +{%- for loc in location -%} +{%- if loc.elin -%} configure ports {{ loc.name }} med location elin "{{ loc.elin }}" {%- endif %} {% endfor %} - - """ default_config_data = { @@ -289,7 +289,6 @@ def apply(lldp): os.system('sudo systemctl stop lldpd.service') os.unlink(config_file) - if __name__ == '__main__': try: c = get_config() -- cgit v1.2.3