neutron-l3-agent revision 3162
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# verify paths are valid
print '%s does not exist or is not readable' % f
# System-wide forwarding (either ipv4 or ipv6 or both) must be enabled
# before neutron-l3-agent can be started.
"-o", "current", "ipv4"]
if p.returncode != 0:
print "failed to determine if IPv4 forwarding is enabled or not"
"-o", "current", "ipv6"]
if p.returncode != 0:
print "failed to determine if IPv6 forwarding is enabled or not"
print "System-wide IPv4 or IPv6 (or both) forwarding must be " \
"enabled before enabling neutron-l3-agent"
cmd = "/usr/lib/neutron/neutron-l3-agent --config-file %s " \
# remove IP Filter rules added by neutron-l3-agent
if version == 6:
if p.returncode != 0:
print "failed to retrieve IP Filter rules"
# L3 agent IP Filter rules are of the form
# block in quick on l3i64cbb496_a_0 from ... to pool/15417332
ippool_names = []
continue
# capture the IP pool name
try:
# remove the IP Filter rule
if version == 6:
# remove IP Pools added by neutron-l3-agent
try:
print "failed to remove IP Pool %s: %s" % (ippool_name, err)
return smf_include.SMF_EXIT_OK
def stop():
try:
# first kill the SMF contract
print "failed to kill the SMF contract: %s" % (err)
# We need to first remove the IP filter rules and then remove
# the IP interfaces on which the rules were applied.
# remove IPv4 Filter rules added by neutron-l3-agent
return rv
# remove IPv6 Filter rules added by neutron-l3-agent
return rv
# remove IP NAT rules added by neutron-l3-agent
if p.returncode != 0:
print "failed to retrieve IP NAT rules"
# L3 agent IP NAT rules are of the form
# bimap l3e64ccc496_a_0 192.168.1.3/32 -> 172.16.10.3/32
continue
# remove the IP NAT rule
try:
print "failed to remove IP NAT rule %s: %s" % (ipnat_rule, err)
# remove VNICs associated with L3 agent
if p.returncode != 0:
print "failed to retrieve IP interface names"
# L3 agent datalinks are always 15 characters in length. They start
# with either 'l3i' or 'l3e', end with '_0', and in between they are
# hexadecimal digits.
continue
try:
# first remove the IP
ifname])
# next remove the VNIC
ifname])
print "failed to remove datalinks used by L3 agent: %s" % (err)
return smf_include.SMF_EXIT_OK
if __name__ == "__main__":