From 124b52c4252da835a404f1cfa6cdd775978e4563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Hor=C3=A1=C4=8Dek?= Date: Thu, 30 Nov 2017 19:30:06 +0200 Subject: [PATCH] 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 --- ovsdbapp/schema/ovn_northbound/commands.py | 5 +++-- .../tests/functional/schema/ovn_northbound/test_impl_idl.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ovsdbapp/schema/ovn_northbound/commands.py b/ovsdbapp/schema/ovn_northbound/commands.py index 5d82f455..a1959a9d 100644 --- a/ovsdbapp/schema/ovn_northbound/commands.py +++ b/ovsdbapp/schema/ovn_northbound/commands.py @@ -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 diff --git a/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py b/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py index dc0400dc..5eaf8b61 100644 --- a/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py +++ b/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py @@ -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 = [