IP should be optional in lsp_set_addresses
ovsdbapp, unlike ovn-nbctl, does not allow address in lsp_set_addresses to be a MAC alone without an IP. ovn-nbctl.8 manual: "an Ethernet address, optionally followed by a space and one or more IP addresses" With this patch, IP address is optional. Change-Id: I6a3708b22b7f9c11af1960bfa6be7413e497534c
This commit is contained in:
parent
eac5d2dcf7
commit
124b52c425
@ -296,13 +296,14 @@ class LspGetTagCommand(cmd.BaseCommand):
|
||||
|
||||
class LspSetAddressesCommand(cmd.BaseCommand):
|
||||
addr_re = re.compile(
|
||||
r'^(router|unknown|dynamic|([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2} .+)$')
|
||||
r'^(router|unknown|dynamic|([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}( .+)*)$')
|
||||
|
||||
def __init__(self, api, port, addresses):
|
||||
for addr in addresses:
|
||||
if not self.addr_re.match(addr):
|
||||
raise TypeError(
|
||||
"address must be router/unknown/dynamic/ethaddr ipaddr...")
|
||||
"address must be router/unknown/dynamic/"
|
||||
"ethaddr[ ipaddr...]")
|
||||
super(LspSetAddressesCommand, self).__init__(api)
|
||||
self.port = port
|
||||
self.addresses = addresses
|
||||
|
@ -342,7 +342,7 @@ class TestLspOps(OvnNorthboundTest):
|
||||
|
||||
def test_lsp_set_addresses(self):
|
||||
lsp = self._lsp_add(self.switch, None)
|
||||
for addr in ('dynamic', 'unknown', 'router',
|
||||
for addr in ('dynamic', 'unknown', 'router', 'de:ad:be:ef:4d:ad',
|
||||
'de:ad:be:ef:4d:ad 192.0.2.1'):
|
||||
self.api.lsp_set_addresses(lsp.name, [addr]).execute(
|
||||
check_error=True)
|
||||
@ -351,7 +351,7 @@ class TestLspOps(OvnNorthboundTest):
|
||||
def test_lsp_set_addresses_invalid(self):
|
||||
self.assertRaises(
|
||||
TypeError,
|
||||
self.api.lsp_set_addresses, 'fake', '01:02:03:04:05:06')
|
||||
self.api.lsp_set_addresses, 'fake', 'invalidaddress')
|
||||
|
||||
def test_lsp_get_addresses(self):
|
||||
addresses = [
|
||||
|
Loading…
Reference in New Issue
Block a user