mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdown: valivals keyword: remove <auto> and renaming <ipaddr> to <ip>
Ticket: None Reviewed By: Daniel Walton Testing Done: This commit was need to keep nclu and ifupdown2 consistent. The naming were differing and we decided to keep nclu version. Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -26,7 +26,7 @@ class addressvirtual(moduleBase):
|
||||
'attrs' : {
|
||||
'address-virtual' :
|
||||
{ 'help' : 'bridge router virtual mac and ips',
|
||||
'validvals' : ['<mac-ipaddr/prefixlen-list>',],
|
||||
'validvals' : ['<mac-ip/prefixlen-list>',],
|
||||
'example' : ['address-virtual 00:11:22:33:44:01 11.0.1.1/24 11.0.1.2/24']}
|
||||
}}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ class vrf(moduleBase):
|
||||
'creating a vrf device. ' +
|
||||
'Table id is either \'auto\' or '+
|
||||
'\'valid routing table id\'',
|
||||
'validvals': ['<auto>', '<number>'],
|
||||
'validvals': ['auto', '<number>'],
|
||||
'example': ['vrf-table auto', 'vrf-table 1001']},
|
||||
'vrf':
|
||||
{'help' : 'vrf the interface is part of.',
|
||||
|
@@ -277,8 +277,7 @@ class ifupdownMain(ifupdownBase):
|
||||
'<text>': self._keyword_text,
|
||||
'<ipv4>': self._keyword_ipv4,
|
||||
'<ipv6>': self._keyword_ipv6,
|
||||
'<auto>': self._keyword_auto,
|
||||
'<ipaddr>': self._keyword_ipaddr,
|
||||
'<ip>': self._keyword_ip,
|
||||
'<number>': self._keyword_number,
|
||||
'<interface>': self._keyword_interface,
|
||||
'<ipv4-vrf-text>': self._keyword_ipv4_vrf_text,
|
||||
@@ -286,10 +285,10 @@ class ifupdownMain(ifupdownBase):
|
||||
'<interface-list>': self._keyword_interface_list,
|
||||
'<ipv4/prefixlen>': self._keyword_ipv4_prefixlen,
|
||||
'<ipv6/prefixlen>': self._keyword_ipv6_prefixlen,
|
||||
'<ipaddr/prefixlen>': self._keyword_ipaddr_prefixlen,
|
||||
'<ip/prefixlen>': self._keyword_ip_prefixlen,
|
||||
'<number-range-list>': self._keyword_number_range_list,
|
||||
'<interface-range-list>': self._keyword_interface_range_list,
|
||||
'<mac-ipaddr/prefixlen-list>': self._keyword_mac_ipaddr_prefixlen_list,
|
||||
'<mac-ip/prefixlen-list>': self._keyword_mac_ip_prefixlen_list,
|
||||
'<number-interface-list>': self._keyword_number_interface_list,
|
||||
'<interface-yes-no-list>': self._keyword_interface_yes_no_list,
|
||||
'<interface-yes-no-0-1-list>': self._keyword_interface_yes_no_0_1_list,
|
||||
@@ -783,15 +782,15 @@ class ifupdownMain(ifupdownBase):
|
||||
def _keyword_ipv6_prefixlen(self, value, validrange=None):
|
||||
return self._keyword_check_list(value.split(), IPv6Network, limit=1)
|
||||
|
||||
def _keyword_ipaddr(self, value, validrange=None):
|
||||
def _keyword_ip(self, value, validrange=None):
|
||||
return self._keyword_check_list(value.split(), IPAddress, limit=1)
|
||||
|
||||
def _keyword_ipaddr_prefixlen(self, value, validrange=None):
|
||||
def _keyword_ip_prefixlen(self, value, validrange=None):
|
||||
return self._keyword_check_list(value.split(), IPNetwork, limit=1)
|
||||
|
||||
def _keyword_mac_ipaddr_prefixlen_list(self, value, validrange=None):
|
||||
def _keyword_mac_ip_prefixlen_list(self, value, validrange=None):
|
||||
"""
|
||||
<mac> <ipaddr> [<ipaddr> ...]
|
||||
<mac> <ip> [<ip> ...]
|
||||
ex: address-virtual 00:11:22:33:44:01 11.0.1.1/24 11.0.1.2/24
|
||||
"""
|
||||
try:
|
||||
@@ -801,7 +800,7 @@ class ifupdownMain(ifupdownBase):
|
||||
if not self._keyword_mac(res[0]):
|
||||
return False
|
||||
for ip in res[1:]:
|
||||
if not self._keyword_ipaddr_prefixlen(ip):
|
||||
if not self._keyword_ip_prefixlen(ip):
|
||||
return False
|
||||
return True
|
||||
except Exception as e:
|
||||
@@ -1005,9 +1004,6 @@ class ifupdownMain(ifupdownBase):
|
||||
self.logger.debug('keyword: number interface list: %s' % str(e))
|
||||
return False
|
||||
|
||||
def _keyword_auto(self, value, validrange=None):
|
||||
return value == 'auto'
|
||||
|
||||
def _keyword_number(self, value, validrange=None):
|
||||
try:
|
||||
int(value)
|
||||
|
Reference in New Issue
Block a user