# on the specific host to pass and receive vif port specific information to
# the plugin.
PROFILE = 'binding:profile'
+# The capabilities will be a dictionary that enables pass information about
+# functionalies quantum provides. The following value should be provided.
+# - port_filter : Boolean value indicating Quantum provides port filtering
+# features such as security group and anti MAC/IP spoofing
+CAPABILITIES = 'binding:capabilities'
+CAP_PORT_FILTER = 'port_filter'
VIF_TYPE_OVS = 'ovs'
VIF_TYPE_BRIDGE = 'bridge'
'is_visible': True},
PROFILE: {'allow_post': True, 'allow_put': True,
'default': attributes.ATTR_NOT_SPECIFIED,
+ 'validate': {'type:dict': None},
'is_visible': True},
+ CAPABILITIES: {'allow_post': False, 'allow_put': False,
+ 'default': attributes.ATTR_NOT_SPECIFIED,
+ 'is_visible': True},
}
}
def _extend_port_dict_binding(self, context, port):
if self._check_view_auth(context, port, self.binding_view):
port[portbindings.VIF_TYPE] = portbindings.VIF_TYPE_BRIDGE
+ port[portbindings.CAPABILITIES] = {
+ portbindings.CAP_PORT_FILTER:
+ 'security-group' in self.supported_extension_aliases}
return port
def get_port(self, context, id, fields=None):
plugin = QuantumManager.get_plugin()
with self.port(name='name') as port:
port_id = port['port']['id']
- self.assertEqual(port['port']['binding:vif_type'],
+ self.assertEqual(port['port'][portbindings.VIF_TYPE],
portbindings.VIF_TYPE_BRIDGE)
+ port_cap = port['port'][portbindings.CAPABILITIES]
+ self.assertEqual(port_cap[portbindings.CAP_PORT_FILTER], True)
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
tenant_id=self._tenant_id,
read_deleted="no")
non_admin_port = plugin.get_port(ctx, port_id)
self.assertTrue('status' in non_admin_port)
- self.assertFalse('binding:vif_type' in non_admin_port)
+ self.assertFalse(portbindings.VIF_TYPE in non_admin_port)
+ self.assertFalse(portbindings.CAPABILITIES in non_admin_port)
def test_ports_vif_details(self):
cfg.CONF.set_default('allow_overlapping_ips', True)
ports = plugin.get_ports(ctx)
self.assertEqual(len(ports), 2)
for port in ports:
- self.assertEqual(port['binding:vif_type'],
+ self.assertEqual(port[portbindings.VIF_TYPE],
portbindings.VIF_TYPE_BRIDGE)
+ port_cap = port[portbindings.CAPABILITIES]
+ self.assertEqual(port_cap[portbindings.CAP_PORT_FILTER], True)
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
tenant_id=self._tenant_id,
self.assertEqual(len(ports), 2)
for non_admin_port in ports:
self.assertTrue('status' in non_admin_port)
- self.assertFalse('binding:vif_type' in non_admin_port)
+ self.assertFalse(portbindings.VIF_TYPE in non_admin_port)
+ self.assertFalse(portbindings.CAP_PORT_FILTER
+ in non_admin_port)
class TestLinuxBridgeNetworksV2(test_plugin.TestNetworksV2,