ovs-agent: fullstack test resource info report
Change-Id: Ia36b05c835339fea8913103dffad1422a9aacaed Partial-Bug: #1578989 See-Also: https://review.openstack.org/502306 (nova spec) See-Also: https://review.openstack.org/508149 (neutron spec)
This commit is contained in:
parent
d7d433f729
commit
277c1e77b2
|
@ -18,6 +18,7 @@ import tempfile
|
|||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.common import constants as c_const
|
||||
from neutron.common import utils
|
||||
from neutron.plugins.ml2.extensions import qos as qos_ext
|
||||
from neutron.tests import base
|
||||
|
@ -27,6 +28,8 @@ from neutron.tests.common import helpers as c_helpers
|
|||
from neutron.tests.fullstack import base as fullstack_base
|
||||
|
||||
PHYSICAL_NETWORK_NAME = "physnet1"
|
||||
MINIMUM_BANDWIDTH_INGRESS_KBPS = 1000
|
||||
MINIMUM_BANDWIDTH_EGRESS_KBPS = 1000
|
||||
|
||||
|
||||
class ConfigFixture(config_fixtures.ConfigFileFixture):
|
||||
|
@ -186,8 +189,13 @@ class OVSConfigFixture(ConfigFixture):
|
|||
'int_peer_patch_port': self._generate_int_peer(),
|
||||
'tun_peer_patch_port': self._generate_tun_peer()})
|
||||
else:
|
||||
self.config['ovs']['bridge_mappings'] = (
|
||||
self._generate_bridge_mappings())
|
||||
device = utils.get_rand_device_name(prefix='br-eth')
|
||||
self.config['ovs']['bridge_mappings'] = '%s:%s' % (
|
||||
PHYSICAL_NETWORK_NAME, device)
|
||||
if env_desc.report_bandwidths:
|
||||
self.config['ovs'][c_const.RP_BANDWIDTHS] = \
|
||||
'%s:%s:%s' % (device, MINIMUM_BANDWIDTH_EGRESS_KBPS,
|
||||
MINIMUM_BANDWIDTH_INGRESS_KBPS)
|
||||
|
||||
if env_desc.qos:
|
||||
self.config['agent']['extensions'] = 'qos'
|
||||
|
@ -209,10 +217,6 @@ class OVSConfigFixture(ConfigFixture):
|
|||
})
|
||||
super(OVSConfigFixture, self)._setUp()
|
||||
|
||||
def _generate_bridge_mappings(self):
|
||||
return '%s:%s' % (PHYSICAL_NETWORK_NAME,
|
||||
utils.get_rand_device_name(prefix='br-eth'))
|
||||
|
||||
def _generate_integration_bridge(self):
|
||||
return utils.get_rand_device_name(prefix='br-int')
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class EnvironmentDescription(object):
|
|||
service_plugins='router', arp_responder=False,
|
||||
agent_down_time=75, router_scheduler=None,
|
||||
global_mtu=common_const.DEFAULT_NETWORK_MTU,
|
||||
debug_iptables=False, log=False):
|
||||
debug_iptables=False, log=False, report_bandwidths=False):
|
||||
self.network_type = network_type
|
||||
self.l2_pop = l2_pop
|
||||
self.qos = qos
|
||||
|
@ -52,6 +52,7 @@ class EnvironmentDescription(object):
|
|||
self.global_mtu = global_mtu
|
||||
self.service_plugins = service_plugins
|
||||
self.debug_iptables = debug_iptables
|
||||
self.report_bandwidths = report_bandwidths
|
||||
if self.qos:
|
||||
self.service_plugins += ',qos'
|
||||
if self.log:
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Ericsson
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.common import constants as c_const
|
||||
from neutron.tests.fullstack import base
|
||||
from neutron.tests.fullstack.resources import config as f_const
|
||||
from neutron.tests.fullstack.resources import environment
|
||||
from neutron.tests.unit import testlib_api
|
||||
|
||||
load_tests = testlib_api.module_load_tests
|
||||
|
||||
|
||||
class TestAgentBandwidthReport(base.BaseFullStackTestCase):
|
||||
|
||||
scenarios = [
|
||||
(constants.AGENT_TYPE_OVS,
|
||||
{'l2_agent_type': constants.AGENT_TYPE_OVS})
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
host_desc = [environment.HostDescription(
|
||||
l3_agent=False,
|
||||
l2_agent_type=self.l2_agent_type)]
|
||||
env_desc = environment.EnvironmentDescription(
|
||||
network_type='vlan',
|
||||
l2_pop=False,
|
||||
report_bandwidths=True
|
||||
)
|
||||
env = environment.Environment(env_desc, host_desc)
|
||||
|
||||
super(TestAgentBandwidthReport, self).setUp(env)
|
||||
|
||||
def test_agent_configurations(self):
|
||||
agents = self.client.list_agents()
|
||||
|
||||
self.assertEqual(1, len(agents['agents']))
|
||||
|
||||
agent_configurations = agents['agents'][0]['configurations']
|
||||
if 'bridge_mappings' in agent_configurations:
|
||||
mapping_key = 'bridge_mappings'
|
||||
else:
|
||||
self.fail('No mapping information is found in agent '
|
||||
'configurations')
|
||||
|
||||
physnet = list(agent_configurations[mapping_key])[0]
|
||||
bridge_or_devices = agent_configurations[mapping_key][physnet]
|
||||
|
||||
self.assertIn(c_const.RP_BANDWIDTHS, agent_configurations)
|
||||
self.assertIn(c_const.RP_INVENTORY_DEFAULTS, agent_configurations)
|
||||
self.assertIn(bridge_or_devices,
|
||||
agent_configurations[c_const.RP_BANDWIDTHS])
|
||||
|
||||
for device in agent_configurations[c_const.RP_BANDWIDTHS]:
|
||||
self.assertEqual(
|
||||
f_const.MINIMUM_BANDWIDTH_INGRESS_KBPS,
|
||||
agent_configurations[c_const.RP_BANDWIDTHS][device]['ingress'])
|
||||
self.assertEqual(
|
||||
f_const.MINIMUM_BANDWIDTH_EGRESS_KBPS,
|
||||
agent_configurations[c_const.RP_BANDWIDTHS][device]['egress'])
|
Loading…
Reference in New Issue