NSX: Fix KeyError in sync if nsx_router_id not found
Previously, a KeyError would occur in the sync code which would
cause the sync thread to stop running. This would occur if there
was a router entry in the database but no nsx_router_mapping and
the router was not found in nsx. Note: this should never happen unless
one did not run the db migration which introduced and migrated the data
for the NeutronNsxRouterMapping table.
NSX: ensure dhcp port is setup on metadata network
Change in scheduling behavior caused a regression
where the dhcp port is no longer provisioned on
the (admin) metadata network created when a subnet
is uplinked to a router.
This change recovers the past behavior and extend UT
coverage to avoid further regression.
Ann Kamyshnikova [Fri, 14 Mar 2014 11:09:36 +0000 (15:09 +0400)]
Set correct columns' length
In migration 569e98a8132b_metering incorrect length is set for
description column (255 instead of 1024) and in migration
39cf3f799352_fwaas_havana_2_model for firewall_rules table
incorrect length is set for protocol column (24 instead of 40).
Irena Berezovsky [Tue, 25 Mar 2014 07:30:17 +0000 (09:30 +0200)]
Add L2 Agent side handling for non consistent security_group settings
Add setting of the firewall_driver to NoopDriver when firewall_driver is None and
add warning if driver combination is not valid.
Modify is_valid_driver_combination to verify default settings: enable_security_group (True) and firewall_driver (None).
Kevin Benton [Tue, 8 Apr 2014 05:30:09 +0000 (22:30 -0700)]
BSN: Remove module-level ref to httplib method
Removes a module-level variable that was just a
pointer to the httplib.HTTPConnection class. It's
purpose was to give mock.patch a target that wouldn't
affect other code using the httplib.HTTPConnection
library. However, it is unnecessary now that the
root cause of the original patches not being stopped
by mock.patch.stopall was fixed in bug 1303605 (change
Ia5b374c5f8d3a7905d915de4f1f8d4f3a6f0e58d).
Kevin Benton [Tue, 8 Apr 2014 03:25:23 +0000 (20:25 -0700)]
BigSwitch: Stop HTTP patch before overriding
Stops the default HTTPConnection patch used by the
Big Switch tests before patching HTTPConnection with
another substitution. This prevents mock from losing
track of the default patch which was resulting in it
not consistently being stopped by the stopall call in
cleanup.
This also corrects an incorrectly targeted mock for the
HTTP patch in one of the test files.
Sean Dague [Mon, 7 Apr 2014 21:07:41 +0000 (17:07 -0400)]
set api.extensions logging to ERROR in unit tests
neutron.api.extensions generates a lot of output in a normal
unit test run. It's responsible for > 80% of the lines in the
subunit_log.txt. Logging each file load 10k times slows everything
down, takes up valuable memory, and doesn't really help with testing.
Instead we can set this to ERROR level in a fixture to ignore most
of that logging and help make the unit tests run faster.
Refactor the functional tests a bit to add a common base class for agent
tests. This is needed an upcoming commit which adds a functional test
for VXLAN version checking.
Kevin Benton [Fri, 7 Mar 2014 04:51:11 +0000 (20:51 -0800)]
BigSwitch: Improves server manager UT coverage
Improves the unit test coverage for the Big Switch
server manager module (100%). Also reorganizes the
capabilities test to avoid duplicating a lot of
router tests that are already covered.
Kevin Benton [Thu, 3 Apr 2014 10:00:37 +0000 (10:00 +0000)]
BigSwitch: Don't import portbindings_db until use
The Big Switch ML2 driver re-uses large parts of
code from the Big Switch plugin. However, the plugin
uses the old portbindings_db in its port tracking
code. This db is not created/used by ML2, so it does
not exist when the Big Switch ML2 driver is being used.
This caused a problem when the portbindings_db module
would be imported even though it wasn't being used
since the SQLAlchemy models would create the
relationships during the import.
This patch moves the portbindings_db import down to
the methods that leverage it so it won't be imported
during use by the ML2 driver.
This is a temporary solution which can be back-ported
if disabling auto schema generation is back-ported
to icehouse. An appropriate fix will require some
refactoring to avoid the port tracking code from
being imported for ML2.
Carl Baldwin [Tue, 1 Apr 2014 22:16:59 +0000 (22:16 +0000)]
Clean out namespaces even if we don't delete namespaces
Even when we don't enable namespace deletion, we still want to run the
code that cleans out the namespaces so that the devices get unplugged,
etc. Otherwise, routers deleted while the agent is down will continue
to operate as if they were never deleted.
The trade-off to consider here is that if there are many stale
namespaces this will slow down the restart of the L3 agent. The best
option is to get namespace deletion working correctly. However, where
that has not been worked out yet, this patch provides the cleaning
service for deleted routers.
This patch changes the policy engine behaviour and the API base
controller in order to ensure policy.init is invoked only once
for each API request.
This will avoid issues arising from policy file updates during
API processing and speed up response generation for list operations,
by about 5%.
Jakub Libosvar [Mon, 17 Mar 2014 15:36:01 +0000 (16:36 +0100)]
Sync service and systemd modules from oslo-incubator
This patch make systemd know when neutron-service was started. This is
needed in HA environment, previously systemd returned success even
before neutron-server was able to handle requests.
Robert Kukura [Thu, 3 Apr 2014 21:01:00 +0000 (17:01 -0400)]
ML2: ODL driver sets port status
The OpenDaylight mechanism driver does not depend on an L2 agent to
plug the port. Now that nova waits for notification that the port
status is ACTIVE, the ML2 driver API is extended so that the mechanism
driver that binds a port can optionally set the port status, and the
OpenDaylight mechanism driver uses this to set the port status to
ACTIVE.
Andreas Jaeger [Mon, 31 Mar 2014 20:17:18 +0000 (22:17 +0200)]
Fix Jenkins translation jobs
The job neutron-propose-translation-update
does not update from
transifex since our po files contain duplicate entries where
obsolete entries duplicate normal entries.
Remove all obsolete entries to fix the job.
Add test to pep8 that checks that no new breakages get
introduced.
Carl Baldwin [Tue, 1 Apr 2014 22:02:17 +0000 (22:02 +0000)]
Delete routers that are requested but not reported as active
There are two cases that I can think of that result in a router being
requested but not reported as active. One is that admin_state_up has
been set to False. In this case, the router is never removed and
continues to be operational.
The other case is if a router is changed and then deleted before the
change is processed. In this case, it is prudent to be sure that the
router is queued for deletion.
Joe Gordon [Wed, 2 Apr 2014 18:25:27 +0000 (11:25 -0700)]
Explicitly import state_path opt in tests.base
This wasn't explicitly needed in the unit tests because
neutron.common.config was already loaded, but this broke for the
functional tests (which are non-voting) so add a CONF.import_opt line so
functional tests know where to find the definition for state_path.
Miguel Angel Ajo [Mon, 31 Mar 2014 13:50:55 +0000 (15:50 +0200)]
fixes tests using called_once_ without assert
A few tests were using mock's called_once, or called_once_with_args
instead of assert_called_once or assert_called_once_with_args. Those
methods return a bool that needs to be actively checked.
The tests are fixed to avoid them from passing if the call condition
is not met.