2892N/A# vim: tabstop=4 shiftwidth=4 softtabstop=4 2892N/A# Copyright 2012 OpenStack Foundation 6029N/A# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. 2521N/A# Licensed under the Apache License, Version 2.0 (the "License"); you may 2521N/A# not use this file except in compliance with the License. You may obtain 2521N/A# Unless required by applicable law or agreed to in writing, software 2521N/A# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 2521N/A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 2521N/A# License for the specific language governing permissions and limitations 5403N/A """ Wrapper around Linux implementation of Dnsmasq.""" 6846N/A # overrides method in DhcpLocalProcess due to no namespace support 6846N/A # or if local resolution is explicitly disabled. 6846N/A '--dhcp-match=set:ipxe,175',
2521N/A # if a subnet is specified to have dhcp disabled 2892N/A # We need to also set the DUID for the DHCPv6 server to use 2763N/A '-co',
'value',
'-p',
'mac-address',
2763N/A # IANA assigned ID for Oracle 3998N/A # Note(scollins) If the IPv6 attributes are not set, set it as 3998N/A # static to preserve previous behavior 3998N/A # mode is optional and is not set - skip it 5403N/A # Do not advertise unknown mtu 2892N/A # Cap the limit because creating lots of subnets can inflate 2959N/A """Release a DHCP lease.""" 6846N/A # Note(SridharG) dhcp_release is only supported for IPv4 6846N/A # addresses. For more details, please refer to man page. 2892N/A # TODO(gmoodalb): need to complete this when we support metadata 5403N/A # in neutron-dhcp-agent as-well for isolated subnets 5403N/A # TODO(gmoodalb): need to complete this when we support metadata 5403N/A # in neutron-dhcp-agent as-well for isolated subnets 6846N/A """Sets the default gateway for this dhcp namespace. 6846N/A This method is idempotent and will only adjust the route if adjusting 6846N/A it would change it from what it already is. This makes it safe to call 6846N/A and avoids unnecessary perturbation of the system. 6846N/A """Set up the existing DHCP port, if there is one.""" 6846N/A # To avoid pylint thinking that port might be undefined after 6846N/A # Look for an existing DHCP port for this network. 6846N/A # If using gateway IPs on this port, we can skip the 6846N/A # following code, whose purpose is just to review and 6846N/A # update the Neutron-allocated IP addresses for the 6846N/A # Otherwise break out, as we now have the DHCP port 6846N/A # whose subnets and addresses we need to review. 6846N/A # Compare what the subnets should be against what is already 6846N/A # If those differ, we need to call update. 6846N/A # Collect the subnets and fixed IPs that the port already 6846N/A # has, for subnets that are still in the DHCP-enabled set. 6846N/A # Add subnet IDs for new DHCP-enabled subnets. 6846N/A # Update the port to have the calculated subnets and fixed 6846N/A # IPs. The Neutron server will allocate a fresh IP for 6846N/A # each subnet that doesn't already have one. 2892N/A """Create and initialize a device for network's DHCP on this host.""" 6846N/A 'network %s. Releasing port.'),
6846N/A # For each DHCP-enabled subnet, add that subnet's gateway 6846N/A # IP address to the Linux device for the DHCP port.