Skip to content

Commit

Permalink
Merge IPv6 support
Browse files Browse the repository at this point in the history
IPv6 support
  • Loading branch information
sebageek authored Feb 20, 2025
2 parents bf0a69b + a65b120 commit 99497e3
Show file tree
Hide file tree
Showing 27 changed files with 1,999 additions and 547 deletions.
8 changes: 8 additions & 0 deletions asr1k_neutron_l3/common/asr1k_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,11 @@ class DynamicNatPoolGivenIPsDontBelongToNetwork(nexception.BadRequest):
class DynamicNatPoolExternalNetExhausted(nexception.BadRequest):
message = ("Could not find %(ip_count)s consecutive IP addresses in subnet %(subnet_id)s - "
"make sure there is enough undivided IP space")


class OnlyOneExternalIPv6AddressAllowed(nexception.BadRequest):
message = ("Only one external IPv6 address allowed per router")


class InvalidExternalGatewayIPDefinition(nexception.BadRequest):
message = ("Invalid external gateway ip definition found: %(ext_ip)s")
4 changes: 4 additions & 0 deletions asr1k_neutron_l3/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
cfg.BoolOpt('enable_fwaas_cleaning', default=True, help="Run FWaaS cleaning sync to remove stale FWaaS ACLs, "
"Class Maps and Service Policies"),
cfg.IntOpt('fwaas_cleaning_interval', default=300, help="Interval for FWaaS cleaning"),
cfg.BoolOpt('advertise_bgp_ipv4_routes_via_redistribute', default=False,
help=('Advertise BGP routes (BGPVPN/DAPNets) on IPv4 via redistribute static/connected + route-map '
'instead of using network statements. This avoids the global config lock, that occurs on current '
'firmwares (at least 17.15) when the BGP tree is modified.')),
]

ASR1K_L2_OPTS = [
Expand Down
10 changes: 9 additions & 1 deletion asr1k_neutron_l3/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import socket
import struct

from netaddr import IPNetwork, IPAddress
from netaddr import AddrFormatError, IPNetwork, IPAddress
from oslo_log import log as logging


Expand Down Expand Up @@ -134,6 +134,14 @@ def ip_in_network(ip, net):
return IPAddress(ip) in IPNetwork(net)


def get_ip_version(ip):
try:
ip = IPNetwork(ip)
return ip.version
except AddrFormatError:
return None


def network_in_network(net, parent_net):
"""Check if a network is contained inside another network (also true for net == parent_net)"""
return IPNetwork(net) in IPNetwork(parent_net)
Expand Down
Loading

0 comments on commit 99497e3

Please sign in to comment.