neutron/neutron/tests/unit/agent
Arjun Baindur f2111e0354 Do not release DHCP lease when no client ID is set on port
The DHCP agent has a really strict enforcement of client ID, which
is part of the DHCP extra options. If a VM advertises a client ID,
DHCP agent will automatically release it's lease whenever *any* other
port is updated/deleted, even if no client ID is set on the port,
because it thinks the client ID has changed.

When reload_allocations() is called, the DHCP agent parses the leases
and hosts files, and gets the list of all the ports in the network from the
DB, computing 3 different sets. The set from the leases file (v4_leases)
could have a client ID, but the set from the port DB and hosts file will
have None.

As a result, the set subtraction does not filter out the entry,
and all ports that have an active lease with a client ID are released.

The Client ID should only be enforced and leases released
if it's actually set in the port DB's DHCP extra Opts.
In that case it means someone knows what they are doing,
and we want to check for a mismatch. If the client ID on a port is
empty, it should not be treated like an unused lease.

We can't expect end users that just create VMs with auto created ports
to know/care about DHCP client IDs, then manually update ports or
change app templates.

In some cases, like Windows VMs, the client ID is advertised as the MAC by default.
In fact, there is a Windows bug which prevents you from even turning this off:
https://support.microsoft.com/en-us/help/3004537/dhcp-client-always-includes-option-61-in-the-dhcp-request-in-windows-8

Linux VMs don't have this on by default, but it may be enabled
in some templates unknown to users.

Change-Id: I8021f740bd78e654915337bd3287b45b2c422e95
Closes-Bug: #1806770
2019-01-30 18:24:06 -05:00
..
common Revert "Skip ovsdb_monitor events for ports with ofport=-1" 2019-01-20 10:02:07 +00:00
dhcp Improve port dhcp Provisioning 2019-01-28 07:26:45 +00:00
l2 Clear residual qos rules after l2-agent restarts. 2019-01-18 02:24:56 +00:00
l3 Update neutron files for new over-indentation hacking rule (E117) 2019-01-29 15:36:20 -05:00
linux Do not release DHCP lease when no client ID is set on port 2019-01-30 18:24:06 -05:00
metadata Use status_code instead of status in requests 2019-01-18 07:02:51 +00:00
ovsdb Add native OVSDB implementation for bridge monitor 2018-12-03 16:09:06 +00:00
windows Fix neutron-openvswitch-agent Windows support 2018-07-18 14:41:21 +03:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
test_agent_extensions_manager.py Refactoring config options for l2 agent ext opts 2016-11-21 19:45:04 +00:00
test_resource_cache.py Merge "Fix race condition with enabling SG on many ports at once" 2018-01-27 10:36:37 +00:00
test_rpc.py Integration of Port Binding Level OVO 2018-09-17 07:00:45 +00:00
test_securitygroups_rpc.py Use constant IP_VERSION_4/6 in unit tests 2018-08-27 21:45:39 +00:00