1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

add a helper switchd ifupdown script that returns reserved vlan range

Ticket:
Reviewed By: CCR-2279
Testing Done: tested ifupdown2 reserved vlan checks

THis patch adds a switchd ifupdown script to return the reserved vlan.

Ifupdown will use this to warn the user when he uses a reserved vlan

(THis patch is a result of wilsons request to have a reserved vlan check
if ifupdown)
(cherry picked from commit 4e693849aba1f1821dba9cfdc567c92baeb23db5)
This commit is contained in:
Roopa Prabhu
2014-11-25 22:25:33 -08:00
parent e8278339d3
commit 19f8bb0b39

View File

@@ -4,6 +4,7 @@
# Author: Roopa Prabhu, roopa@cumulusnetworks.com # Author: Roopa Prabhu, roopa@cumulusnetworks.com
# #
import os
import re import re
import io import io
import logging import logging
@@ -324,11 +325,14 @@ class moduleBase(object):
def _get_reserved_vlan_range(self): def _get_reserved_vlan_range(self):
start = end = 0 start = end = 0
get_resvvlan = '/usr/share/python-ifupdown2/get_reserved_vlan_range.sh' get_resvvlan = '/usr/share/python-ifupdown2/get_reserved_vlan_range.sh'
if not os.path.exists(get_resvvlan):
return (start, end)
try: try:
(s, e) = self.exec_command(get_resvvlan).strip('\n').split('-') (s, e) = self.exec_command(get_resvvlan).strip('\n').split('-')
start = int(s) start = int(s)
end = int(e) end = int(e)
except: except Exception, e:
self.logger.debug('%s failed (%s)' %(get_resvvlan, str(e)))
# ignore errors # ignore errors
pass pass
return (start, end) return (start, end)