Cedric Brandily [Fri, 19 Dec 2014 14:05:53 +0000 (15:05 +0100)]
get_binary_name should returns strings without spaces
Iptables does not support chain names with spaces. It implies
get_binary_name should return strings without spaces (they are used as
chain name prefix). But currently 'python -m unittest $module' implies
spaces in get_binary_name() result, it disallows to use it when $module
is a functional test module. This change replaces spaces with
underscores in get_binary_name results.
Angus Lees [Fri, 28 Nov 2014 01:18:49 +0000 (12:18 +1100)]
Remove unnecessary regex grouping
Several regexes in this class used had unnecessary (\s+) grouping. This
change makes the regexes slightly cheaper by removing the need for the
regex engine to remember the whitespace that was matched.
Robert Pothier [Mon, 22 Dec 2014 16:42:35 +0000 (11:42 -0500)]
ML2 UT: Fix incorrect mock return value
In the UT for ML2 Cisco Nexus MD,
in the function test_ncclient_version_detect()
The value being passed into the mock is incorrect
to mock the ncclient connect object.
Ihar Hrachyshka [Thu, 27 Nov 2014 14:43:48 +0000 (15:43 +0100)]
ipv6: set OtherConfig flag for DHCPv6 stateless subnets
In case of DHCPv6 stateless subnets, we should inform DHCP clients about
other configuration values available from DHCP server. This is done by
setting O (other) flag in RAs, which is controlled by AdvOtherConfigFlag
setting in radvd case.
Since radvd configuration file becomes quite complex, migrated its
generation to Jinja2.
Added a basic unit test that checks that flag is set for stateless mode
and not SLAAC. For stateful, it doesn't really matter whether other flag
is set, so no need to expect any value of it.
No more unit tests seem to be needed: conditional prefix generation is
already covered in test_l3_agent, and other statements are common for
all ipv6_ra_modes.
Fawad Khaliq [Sun, 21 Dec 2014 20:57:27 +0000 (12:57 -0800)]
PLUMgrid plugin: Fix for delete subnet with admin context
When delete call using admin for a subnet created from a
non-admin project is made, the tenant_id passed to backend
happened to be of admin project. This commit fixes the issues
by getting the correct tenant_id.
Angus Lees [Mon, 22 Dec 2014 04:35:32 +0000 (15:35 +1100)]
Use lazy logging interpolation
There are a small number of examples of "eager" interpolation in
neutron:
logging.debug("foo %s" % arg)
These should be converted to perform the interpolation lazily within
the logging function, since if the severity is below the logging level
then the interpolation can be skipped entirely.
This change addresses all such current examples found in neutron core
via a pylint test. Vendor plugins and services are fixed elsewhere.
Assaf Muller [Sun, 21 Dec 2014 14:15:12 +0000 (16:15 +0200)]
Update L3 agent drivers singletons to look at new agent
L3 agent drivers are singletons. They're created once, and hold
self.l3_agent. During testing, the agent is tossed away and
re-built, but the drivers singletons are pointing at the old
agent, and its old configuration.
This is necessary because pbr is stupid enough not to be
able to handle symlinks. The initial symlink was necessary to
avoid breaking the functional job. Once change [1] merges we
can drop the old contrib directory.
Russell Bryant [Tue, 9 Dec 2014 17:30:53 +0000 (17:30 +0000)]
Scope dhcp rpc api using a messaging namespace
This patch updates the rpc API used by the DHCP agent to make calls
back into the neutron plugin to use the 'dhcp' namespace instead of
the default namespace. The reason is that this API is exposed over
the 'q-plugin' topic along with several other interfaces. Without the
use of namespaces, all of the interfaces are effectively treated as
one by oslo.messaging. When a namespace is used, the interface can be
versioned independently and when a method is called, the only class
considered for fulfilling the request is the one that claims to
implement the 'dhcp' namespace.
While we're here, add documentation to both the client and server side
of this interface that indicates where the other side is located.
Salvatore [Wed, 17 Dec 2014 22:09:24 +0000 (23:09 +0100)]
Remove NSX 'service' plugin
Following the spin-off for Neutron advanced services, this plugin
has become non-functional.
This patch removes the plugin, the service drivers, the database
models which kept tracking of resource associations, exceptions,
and obviously unit tests.
As there were some extensions which were leveraged only by this
plugin, they are being removed as well. In particular, one of
these extensions, 'routed-service-insertion' was in the
neutron.extensions package rather than neutron.plugins.vmware
package. This was for historical reasons. As no other plugin is
using this extension, it is being removed as well with this
patch.
By removing this plugin vmware the temporary skips applied to
neutron unit tests can be lifted. This patch does this.
Henry Gessau [Sun, 5 Oct 2014 05:23:50 +0000 (01:23 -0400)]
Move DB TestModelsMigrations from unit to functional
The tests to check that DB migrations and models are in sync depends
on the mysql and postgresql backends being available with a specific
DB user and database created. This violates the principles for unit
tests and therefore these tests should be moved to functional tests.
For these tests to work in the functional job in the gate, the
backends must be installed and the DB user and database created.
We do this via the functional gate hook.
Jakub Libosvar [Tue, 16 Dec 2014 16:33:23 +0000 (17:33 +0100)]
Backward compatibility for advanced services
Patch implements translation from class paths to neutron to class paths
to neutron_<adv_service>. It's achieved by defining entry point in
setup.cfg which is translated by stevedore.
There will be needed patches in advanced services tree calling
get_provider_driver_class() function before importing class.
This patch specifically fixes loading service plugins and
drivers for service plugin. Patches for agents are still needed in
neutron repo and adv services repos.
Alternative and better solution would be implementing new DriverType
to oslo.config, which will have callback to
get_provider_driver_class()-like function.
Alembic 0.7.1 contains checks of foreign keys so
method check_foreign_keys is not needed anymore.
Heal script should be updated to make it possible to use alembic
methods.
Assaf Muller [Sun, 23 Nov 2014 14:09:41 +0000 (16:09 +0200)]
Add metadata proxy L3 agent driver
To-Do:
* vArmourL3NATAgent (Before this patch) overrides _spawn/destroy_metadata_proxy
with empty stubs. This behavior should be maintained so that the metadata proxy
is not created when using vArmourL3NATAgent. It also overrides _router_added
and _router_removed, causing L3 agent driver notifications to not send out.
RobinWang [Tue, 9 Dec 2014 03:52:14 +0000 (11:52 +0800)]
Add OVS status and fix OVS crash
OVS crash/restart is unpredictable, so neutron-ovs-agent should be
robust enough under that situation. But currently ovs-agent doesn't
figure out this error status(only check ovs restart/normal status)
and still continue to apply subsequent operations(set br/add patch
port/...) till causing exceptions/crash. Add flag to fully represent
ovs status. Base on that, we can add proper fail-over code in method
rpc_loop, to treat ovs dead/restart gracefully to prevent agent
crashes while it is running.
Closes-bug: #1296202
Angus Lees [Wed, 17 Dec 2014 04:44:12 +0000 (15:44 +1100)]
Cisco: unsupported format character in log format
CiscoCfgAgent.hosting_devices_removed() contains an error in the
format string used to log errors:
LOG.error(_LE("Invalid payload format for received RPC message "
"`hosting_devices_removed`. Error is %{error}s. "
"Payload is %(payload)s"),
{'error': e, 'payload': payload})
"%{error}s" should be "%(error)s"
The existing version raises "ValueError: unsupported format character
'{' (0x7b)" when invoked.
rossella [Tue, 19 Aug 2014 17:41:16 +0000 (19:41 +0200)]
Remove locking from network and subnet delete op
delete_subnet in Ml2 plugin instead of using SELECT FOR
UPDATE deletes the IPAllocations that can be auto-deleted
straight away.
An exception is raised if there are ports that cannot be
autodeleted.
delete_network in ML2 plugin tries to delete all ports
and subnets before performing the network deletion.
No lock is needed here - if some other process modifies
the Port or Subnet table, adding new items, the network
deletion will fail because of a violation of a foreign
key contraint.
In that case the operation will be retried.
Avoid unnecessary explicit str() conversion around exceptions
There are number of places like
except Exception as exc:
LOG.error("Failed to get network: %s", str(exc))
where str() is not needed since %s substitution already does
the same conversion. Also LOG.error could be replaced with
LOG.exception, so argument exc won't be needed at all.
Cedric Brandily [Fri, 21 Nov 2014 22:11:25 +0000 (23:11 +0100)]
Add functional test for l3-agent metadata proxy
This change add a functional test for l3-agent metadata proxy to
verify:
* iptables redirection from 169.254.169.254:80
* headers added by the neutron-ns-metadata-proxy
* proxy to the metadata_socket by the neutron-ns-metadata-proxy
Jakub Libosvar [Fri, 12 Dec 2014 17:39:56 +0000 (18:39 +0100)]
Set timeout for functional job
As functional jobs take more time to finish than unit tests and also
there is a chance that test will hang due to system interaction, this
patch sets maximum execution time to 90 seconds per test.
AKamyshnikova [Thu, 11 Dec 2014 10:00:48 +0000 (13:00 +0300)]
Enable test_migration
After splitting in neutron database was left a number of tables
that don't have any models. Test should be improved to skip these
tables from checking.
Ihar Hrachyshka [Mon, 8 Dec 2014 12:51:02 +0000 (13:51 +0100)]
tests: initialize admin context after super().setUp call
New policy code requires that CONF is already initialized when policy
checks are invoked. It means that no Neutron context objects should be
created before BaseTestCase.setUp() is called that will set
configuration, among other things.
Ideally, we would just make sure that all test cases invoke
super().setUp() as the very first line of any subclass setUp() methods.
But since some of test cases require prior setup (like mocking extension
manager) before proceeding to base class, we end up with magically
shuffling context instantiations to occur below super() calls.
yangxurong [Tue, 11 Nov 2014 09:06:22 +0000 (17:06 +0800)]
Improve performance of get_active_networks_info
RPC 'get_active_networks_info' currently uses nested loop to fill
the network structure with subnet and port info. Speed up this
operation by using itertools.groupby.
Roey Chen [Tue, 9 Dec 2014 13:57:33 +0000 (05:57 -0800)]
Fixed test test_update_port_security_off_address_pairs
This test checks that port-update fails with 409 return code when
port-security is turned off on a port which contains address-pairs.
The test had a typo ('security-groups' -> 'security-group') which would
have cause it to produce false-positive.
This change rewrites the test and eliminates the possibility of this
false-positive to occurs.