sriov-agent: fullstack test resource info report
Change-Id: Ibbe656707276d6c3c68b051e6d66d6d388dbfd18 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
aefd805cca
commit
9b23e1be07
|
@ -246,6 +246,33 @@ class OVSConfigFixture(ConfigFixture):
|
||||||
return self.config.ovs.tunnel_bridge
|
return self.config.ovs.tunnel_bridge
|
||||||
|
|
||||||
|
|
||||||
|
class SRIOVConfigFixture(ConfigFixture):
|
||||||
|
def __init__(self, env_desc, host_desc, temp_dir, local_ip):
|
||||||
|
super(SRIOVConfigFixture, self).__init__(
|
||||||
|
env_desc, host_desc, temp_dir,
|
||||||
|
base_filename='sriov_agent.ini')
|
||||||
|
|
||||||
|
device1 = utils.get_rand_device_name(prefix='ens5')
|
||||||
|
device2 = utils.get_rand_device_name(prefix='ens6')
|
||||||
|
phys_dev_mapping = '%s:%s,%s:%s' % (PHYSICAL_NETWORK_NAME, device1,
|
||||||
|
PHYSICAL_NETWORK_NAME, device2)
|
||||||
|
rp_bandwidths = '%s:%s:%s,%s:%s:%s' % (device1,
|
||||||
|
MINIMUM_BANDWIDTH_EGRESS_KBPS,
|
||||||
|
MINIMUM_BANDWIDTH_INGRESS_KBPS,
|
||||||
|
device2,
|
||||||
|
MINIMUM_BANDWIDTH_EGRESS_KBPS,
|
||||||
|
MINIMUM_BANDWIDTH_INGRESS_KBPS)
|
||||||
|
self.config.update({
|
||||||
|
'sriov_nic': {
|
||||||
|
'physical_device_mappings': phys_dev_mapping,
|
||||||
|
'resource_provider_bandwidths': rp_bandwidths,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
def _setUp(self):
|
||||||
|
super(SRIOVConfigFixture, self)._setUp()
|
||||||
|
|
||||||
|
|
||||||
class LinuxBridgeConfigFixture(ConfigFixture):
|
class LinuxBridgeConfigFixture(ConfigFixture):
|
||||||
|
|
||||||
def __init__(self, env_desc, host_desc, temp_dir, local_ip,
|
def __init__(self, env_desc, host_desc, temp_dir, local_ip,
|
||||||
|
|
|
@ -116,6 +116,8 @@ class Host(fixtures.Fixture):
|
||||||
|
|
||||||
if self.host_desc.l2_agent_type == constants.AGENT_TYPE_OVS:
|
if self.host_desc.l2_agent_type == constants.AGENT_TYPE_OVS:
|
||||||
self.setup_host_with_ovs_agent()
|
self.setup_host_with_ovs_agent()
|
||||||
|
elif self.host_desc.l2_agent_type == constants.AGENT_TYPE_NIC_SWITCH:
|
||||||
|
self.setup_host_with_sriov_agent()
|
||||||
elif self.host_desc.l2_agent_type == constants.AGENT_TYPE_LINUXBRIDGE:
|
elif self.host_desc.l2_agent_type == constants.AGENT_TYPE_LINUXBRIDGE:
|
||||||
self.setup_host_with_linuxbridge_agent()
|
self.setup_host_with_linuxbridge_agent()
|
||||||
if self.host_desc.l3_agent:
|
if self.host_desc.l3_agent:
|
||||||
|
@ -175,6 +177,16 @@ class Host(fixtures.Fixture):
|
||||||
self.neutron_config.temp_dir,
|
self.neutron_config.temp_dir,
|
||||||
self.ovs_agent.agent_cfg_fixture.get_br_int_name()))
|
self.ovs_agent.agent_cfg_fixture.get_br_int_name()))
|
||||||
|
|
||||||
|
def setup_host_with_sriov_agent(self):
|
||||||
|
agent_cfg_fixture = config.SRIOVConfigFixture(
|
||||||
|
self.env_desc, self.host_desc, self.neutron_config.temp_dir,
|
||||||
|
self.local_ip)
|
||||||
|
self.useFixture(agent_cfg_fixture)
|
||||||
|
self.sriov_agent = self.useFixture(
|
||||||
|
process.SRIOVAgentFixture(
|
||||||
|
self.env_desc, self.host_desc,
|
||||||
|
self.test_name, self.neutron_config, agent_cfg_fixture))
|
||||||
|
|
||||||
def setup_host_with_linuxbridge_agent(self):
|
def setup_host_with_linuxbridge_agent(self):
|
||||||
# First we need to provide connectivity for agent to prepare proper
|
# First we need to provide connectivity for agent to prepare proper
|
||||||
# bridge mappings in agent's config:
|
# bridge mappings in agent's config:
|
||||||
|
@ -299,6 +311,14 @@ class Host(fixtures.Fixture):
|
||||||
def ovs_agent(self, agent):
|
def ovs_agent(self, agent):
|
||||||
self.agents['ovs'] = agent
|
self.agents['ovs'] = agent
|
||||||
|
|
||||||
|
@property
|
||||||
|
def sriov_agent(self):
|
||||||
|
return self.agents['sriov']
|
||||||
|
|
||||||
|
@sriov_agent.setter
|
||||||
|
def sriov_agent(self, agent):
|
||||||
|
self.agents['sriov'] = agent
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def linuxbridge_agent(self):
|
def linuxbridge_agent(self):
|
||||||
return self.agents['linuxbridge']
|
return self.agents['linuxbridge']
|
||||||
|
@ -313,6 +333,8 @@ class Host(fixtures.Fixture):
|
||||||
return self.linuxbridge_agent
|
return self.linuxbridge_agent
|
||||||
elif self.host_desc.l2_agent_type == constants.AGENT_TYPE_OVS:
|
elif self.host_desc.l2_agent_type == constants.AGENT_TYPE_OVS:
|
||||||
return self.ovs_agent
|
return self.ovs_agent
|
||||||
|
elif self.host_desc.l2_agent_type == constants.AGENT_TYPE_NIC_SWITCH:
|
||||||
|
return self.sriov_agent
|
||||||
|
|
||||||
|
|
||||||
class Environment(fixtures.Fixture):
|
class Environment(fixtures.Fixture):
|
||||||
|
|
|
@ -210,6 +210,32 @@ class OVSAgentFixture(ServiceFixture):
|
||||||
kill_signal=signal.SIGTERM))
|
kill_signal=signal.SIGTERM))
|
||||||
|
|
||||||
|
|
||||||
|
class SRIOVAgentFixture(ServiceFixture):
|
||||||
|
|
||||||
|
NEUTRON_SRIOV_AGENT = "neutron-sriov-nic-agent"
|
||||||
|
|
||||||
|
def __init__(self, env_desc, host_desc,
|
||||||
|
test_name, neutron_cfg_fixture, agent_cfg_fixture):
|
||||||
|
super(SRIOVAgentFixture, self).__init__()
|
||||||
|
self.env_desc = env_desc
|
||||||
|
self.host_desc = host_desc
|
||||||
|
self.test_name = test_name
|
||||||
|
self.neutron_cfg_fixture = neutron_cfg_fixture
|
||||||
|
self.neutron_config = self.neutron_cfg_fixture.config
|
||||||
|
self.agent_cfg_fixture = agent_cfg_fixture
|
||||||
|
self.agent_config = agent_cfg_fixture.config
|
||||||
|
|
||||||
|
def _setUp(self):
|
||||||
|
config_filenames = [self.neutron_cfg_fixture.filename,
|
||||||
|
self.agent_cfg_fixture.filename]
|
||||||
|
self.process_fixture = self.useFixture(ProcessFixture(
|
||||||
|
test_name=self.test_name,
|
||||||
|
process_name=self.NEUTRON_SRIOV_AGENT,
|
||||||
|
exec_name=self.NEUTRON_SRIOV_AGENT,
|
||||||
|
config_filenames=config_filenames,
|
||||||
|
kill_signal=signal.SIGTERM))
|
||||||
|
|
||||||
|
|
||||||
class LinuxBridgeAgentFixture(ServiceFixture):
|
class LinuxBridgeAgentFixture(ServiceFixture):
|
||||||
|
|
||||||
NEUTRON_LINUXBRIDGE_AGENT = "neutron-linuxbridge-agent"
|
NEUTRON_LINUXBRIDGE_AGENT = "neutron-linuxbridge-agent"
|
||||||
|
|
|
@ -27,7 +27,9 @@ class TestAgentBandwidthReport(base.BaseFullStackTestCase):
|
||||||
|
|
||||||
scenarios = [
|
scenarios = [
|
||||||
(constants.AGENT_TYPE_OVS,
|
(constants.AGENT_TYPE_OVS,
|
||||||
{'l2_agent_type': constants.AGENT_TYPE_OVS})
|
{'l2_agent_type': constants.AGENT_TYPE_OVS}),
|
||||||
|
(constants.AGENT_TYPE_NIC_SWITCH,
|
||||||
|
{'l2_agent_type': constants.AGENT_TYPE_NIC_SWITCH})
|
||||||
]
|
]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -51,6 +53,8 @@ class TestAgentBandwidthReport(base.BaseFullStackTestCase):
|
||||||
agent_configurations = agents['agents'][0]['configurations']
|
agent_configurations = agents['agents'][0]['configurations']
|
||||||
if 'bridge_mappings' in agent_configurations:
|
if 'bridge_mappings' in agent_configurations:
|
||||||
mapping_key = 'bridge_mappings'
|
mapping_key = 'bridge_mappings'
|
||||||
|
elif 'device_mappings' in agent_configurations:
|
||||||
|
mapping_key = 'device_mappings'
|
||||||
else:
|
else:
|
||||||
self.fail('No mapping information is found in agent '
|
self.fail('No mapping information is found in agent '
|
||||||
'configurations')
|
'configurations')
|
||||||
|
@ -60,8 +64,13 @@ class TestAgentBandwidthReport(base.BaseFullStackTestCase):
|
||||||
|
|
||||||
self.assertIn(c_const.RP_BANDWIDTHS, agent_configurations)
|
self.assertIn(c_const.RP_BANDWIDTHS, agent_configurations)
|
||||||
self.assertIn(c_const.RP_INVENTORY_DEFAULTS, agent_configurations)
|
self.assertIn(c_const.RP_INVENTORY_DEFAULTS, agent_configurations)
|
||||||
|
if mapping_key == 'bridge_mappings':
|
||||||
self.assertIn(bridge_or_devices,
|
self.assertIn(bridge_or_devices,
|
||||||
agent_configurations[c_const.RP_BANDWIDTHS])
|
agent_configurations[c_const.RP_BANDWIDTHS])
|
||||||
|
else:
|
||||||
|
for device in bridge_or_devices:
|
||||||
|
self.assertIn(device, agent_configurations[
|
||||||
|
c_const.RP_BANDWIDTHS])
|
||||||
|
|
||||||
for device in agent_configurations[c_const.RP_BANDWIDTHS]:
|
for device in agent_configurations[c_const.RP_BANDWIDTHS]:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|
Loading…
Reference in New Issue