From 0e4c7a056c8c9ca9e91ab43ebb30f9d37a330d83 Mon Sep 17 00:00:00 2001 From: Anton Vazhnetsov Date: Wed, 14 Jul 2021 13:43:02 +0300 Subject: [PATCH] nb: set chassis_name for new gateway chassis Set the passed 'chassis_name' on created gateway chassis. According to https://github.com/ovn-org/ovn/blob/main/ovn-nb.ovsschema#L538 Closses-Bug: #1946746 Change-Id: I4309b793c5d7b5b335e4d37fa7ced30b9f034b48 --- ovsdbapp/schema/ovn_northbound/commands.py | 1 + .../functional/schema/ovn_northbound/test_impl_idl.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/ovsdbapp/schema/ovn_northbound/commands.py b/ovsdbapp/schema/ovn_northbound/commands.py index 9f247207..979c593d 100644 --- a/ovsdbapp/schema/ovn_northbound/commands.py +++ b/ovsdbapp/schema/ovn_northbound/commands.py @@ -1473,6 +1473,7 @@ class GatewayChassisAddCommand(cmd.AddCommand): # since 'name' is indexed gwc = txn.insert(self.api.tables[self.table_name]) gwc.name = self.name + gwc.chassis_name = self.chassis_name gwc.priority = self.priority self.set_columns(gwc, **self.columns) self.result = gwc 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 aacbfea8..d4562a40 100644 --- a/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py +++ b/ovsdbapp/tests/functional/schema/ovn_northbound/test_impl_idl.py @@ -1218,6 +1218,15 @@ class TestLogicalRouterPortOps(OvnNorthboundTest): self.assertIn(c1, lrp.gateway_chassis) self.assertIn(c2, lrp.gateway_chassis) + def test_gwc_add(self): + # NOTE: no API method to create gateway chassis directly + name, c1_name = [utils.get_rand_device_name() for _ in range(2)] + lrp = self._lrp_add(name, gateway_chassis=[c1_name]) + c1 = self.api.lookup('Gateway_Chassis', "%s_%s" % (lrp.name, c1_name)) + self.assertEqual(c1.name, "%s_%s" % (lrp.name, c1_name)) + self.assertEqual(c1.chassis_name, c1_name) + self.assertEqual(c1.priority, 1) + def test_lrp_del_uuid(self): lrp = self._lrp_add(None) self.api.lrp_del(lrp.uuid).execute(check_error=True)