Merge "[QoS] Unify agent "qos_network_policy_id" constant"
This commit is contained in:
commit
cddd2e5ffa
@ -245,9 +245,9 @@ class QosAgentExtension(l2_extension.L2AgentExtension):
|
||||
Update events are handled in _handle_notification.
|
||||
"""
|
||||
port_id = port['port_id']
|
||||
port_qos_policy_id = port.get('qos_policy_id')
|
||||
network_qos_policy_id = port.get('network_qos_policy_id')
|
||||
qos_policy_id = port_qos_policy_id or network_qos_policy_id
|
||||
port_qos_policy_id = port.get(qos_consts.QOS_POLICY_ID)
|
||||
qos_network_policy_id = port.get(qos_consts.QOS_NETWORK_POLICY_ID)
|
||||
qos_policy_id = port_qos_policy_id or qos_network_policy_id
|
||||
if qos_policy_id is None:
|
||||
self._process_reset_port(port)
|
||||
return
|
||||
|
@ -26,6 +26,7 @@ from neutron_lib.callbacks import resources as callback_resources
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.plugins import utils
|
||||
from neutron_lib import rpc as lib_rpc
|
||||
from neutron_lib.services.qos import constants as qos_consts
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -351,7 +352,7 @@ class CacheBackedPluginApi(PluginApi):
|
||||
constants.NO_ACTIVE_BINDING: True}
|
||||
net = self.remote_resource_cache.get_resource_by_id(
|
||||
resources.NETWORK, port_obj.network_id)
|
||||
net_qos_policy_id = net.qos_policy_id
|
||||
qos_network_policy_id = net.qos_policy_id
|
||||
# match format of old RPC interface
|
||||
mac_addr = str(netaddr.EUI(str(port_obj.mac_address),
|
||||
dialect=netaddr.mac_unix_expanded))
|
||||
@ -375,8 +376,8 @@ class CacheBackedPluginApi(PluginApi):
|
||||
for o in port_obj.allowed_address_pairs],
|
||||
'port_security_enabled': getattr(port_obj.security,
|
||||
'port_security_enabled', True),
|
||||
'qos_policy_id': port_obj.qos_policy_id,
|
||||
'network_qos_policy_id': net_qos_policy_id,
|
||||
qos_consts.QOS_POLICY_ID: port_obj.qos_policy_id,
|
||||
qos_consts.QOS_NETWORK_POLICY_ID: qos_network_policy_id,
|
||||
'profile': binding.profile,
|
||||
'vif_type': binding.vif_type,
|
||||
'vnic_type': binding.vnic_type,
|
||||
|
@ -161,7 +161,7 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
||||
return {'device': device,
|
||||
n_const.NO_ACTIVE_BINDING: True}
|
||||
|
||||
network_qos_policy_id = port_context.network._network.get(
|
||||
qos_network_policy_id = port_context.network._network.get(
|
||||
qos_consts.QOS_POLICY_ID)
|
||||
entry = {'device': device,
|
||||
'network_id': port['network_id'],
|
||||
@ -176,8 +176,8 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
||||
'device_owner': port['device_owner'],
|
||||
'allowed_address_pairs': port['allowed_address_pairs'],
|
||||
'port_security_enabled': port.get(psec.PORTSECURITY, True),
|
||||
'qos_policy_id': port.get(qos_consts.QOS_POLICY_ID),
|
||||
'network_qos_policy_id': network_qos_policy_id,
|
||||
qos_consts.QOS_POLICY_ID: port.get(qos_consts.QOS_POLICY_ID),
|
||||
qos_consts.QOS_NETWORK_POLICY_ID: qos_network_policy_id,
|
||||
'profile': port[portbindings.PROFILE],
|
||||
'propagate_uplink_status': port.get(
|
||||
usp.PROPAGATE_UPLINK_STATUS, False)}
|
||||
|
@ -104,7 +104,7 @@ class OVSAgentQoSExtensionTestFramework(base.OVSAgentTestFramework):
|
||||
port_dict = super(OVSAgentQoSExtensionTestFramework,
|
||||
self)._create_test_port_dict()
|
||||
port_dict['qos_policy_id'] = policy_id
|
||||
port_dict['network_qos_policy_id'] = None
|
||||
port_dict['qos_network_policy_id'] = None
|
||||
return port_dict
|
||||
|
||||
def _get_device_details(self, port, network):
|
||||
|
@ -110,7 +110,7 @@ class QosAgentDriverTestCase(base.BaseTestCase):
|
||||
direction=common_constants.INGRESS_DIRECTION))
|
||||
self.policy.rules = [self.egress_bandwidth_limit_rule,
|
||||
self.ingress_bandwidth_limit_rule]
|
||||
self.port = {'qos_policy_id': None, 'network_qos_policy_id': None,
|
||||
self.port = {'qos_policy_id': None, 'qos_network_policy_id': None,
|
||||
'device_owner': 'random-device-owner'}
|
||||
|
||||
self.fake_rule = QosFakeRule(context=None, id=REALLY_FAKE_RULE_ID,
|
||||
|
@ -62,7 +62,7 @@ class QosLinuxbridgeAgentDriverTestCase(base.BaseTestCase):
|
||||
|
||||
def _create_fake_port(self, policy_id):
|
||||
return {'qos_policy_id': policy_id,
|
||||
'network_qos_policy_id': None,
|
||||
'qos_network_policy_id': None,
|
||||
'device': 'fake_tap'}
|
||||
|
||||
def _dscp_mark_chain_name(self, device):
|
||||
|
@ -114,7 +114,7 @@ class QosOVSAgentDriverTestCase(ovs_test_base.OVSAgentConfigTestBase):
|
||||
|
||||
return {'vif_port': FakeVifPort(),
|
||||
'qos_policy_id': policy_id,
|
||||
'network_qos_policy_id': None,
|
||||
'qos_network_policy_id': None,
|
||||
'port_id': uuidutils.generate_uuid(),
|
||||
'device_owner': uuidutils.generate_uuid()}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class RpcCallbacksTestCase(base.BaseTestCase):
|
||||
{"id": "fake_network",
|
||||
qos_consts.QOS_POLICY_ID: 'test-policy-id'})
|
||||
res = self.callbacks.get_device_details(mock.Mock(), host='fake')
|
||||
self.assertEqual('test-policy-id', res['network_qos_policy_id'])
|
||||
self.assertEqual('test-policy-id', res['qos_network_policy_id'])
|
||||
|
||||
def test_get_device_details_port_no_active_in_host(self):
|
||||
port = collections.defaultdict(lambda: 'fake_port')
|
||||
|
Loading…
Reference in New Issue
Block a user