Enable allowed address pairs

1. What is the problem?
Currently, the allowed-address-pairs is not supported in the Tricircle.

2. What is the solution to the problem?
Enable allowed address pairs in central neutron.

3. What the features to be implemented in the Tricircle
to realize the solution?
No new features.

Change-Id: I5c4f1bf1b146d5fdf49c14d43f7226d81770e667
This commit is contained in:
Yipei Niu 2017-03-15 10:15:21 +08:00
parent 56b21ada7c
commit 0beeb82197
3 changed files with 14 additions and 4 deletions

View File

@ -0,0 +1,4 @@
---
features:
- |
Enable allowed-address-pairs in the central plugin.

View File

@ -140,7 +140,8 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
"network_availability_zone",
"dvr",
"router",
"router_availability_zone"]
"router_availability_zone",
"allowed-address-pairs"]
def __new__(cls, *args, **kwargs):
n = super(TricirclePlugin, cls).__new__(cls, *args, **kwargs)
@ -564,8 +565,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
new_mac=port['mac_address'])
def _filter_unsupported_attrs(self, port_data):
unsupported_attrs = ['fixed_ips', 'qos_policy',
'allowed_address_pair']
unsupported_attrs = ['fixed_ips', 'qos_policy']
remove_keys = [key for key in port_data.keys() if (
key in unsupported_attrs)]
for key in remove_keys:

View File

@ -2174,7 +2174,9 @@ class PluginTest(unittest.TestCase,
'name': 'new_name',
'admin_state_up': False,
'mac_address': 'fa:16:3e:cd:76:bb',
'security_groups': [t_sg_id]
'security_groups': [t_sg_id],
'allowed_address_pairs': [{"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"}]
}
}
@ -2196,6 +2198,8 @@ class PluginTest(unittest.TestCase,
body_copy['port']['mac_address'])
self.assertEqual(top_port['security_groups'],
body_copy['port']['security_groups'])
self.assertEqual(top_port['allowed_address_pairs'][0],
body_copy['port']['allowed_address_pairs'][0])
bottom_port = fake_client.get_ports(t_ctx, b_port_id)
# name is set to bottom resource id, which is used by lock_handle to
@ -2217,6 +2221,8 @@ class PluginTest(unittest.TestCase,
body_copy['port']['mac_address'])
self.assertEqual(bottom_port['security_groups'],
body_copy['port']['security_groups'])
self.assertEqual(bottom_port['allowed_address_pairs'][0],
body_copy['port']['allowed_address_pairs'][0])
@patch.object(directory, 'get_plugin', new=fake_get_plugin)
@patch.object(driver.Pool, 'get_instance', new=fake_get_instance)