integ/config/puppet-modules/puppet-network/centos/files/ipv6-static-route-support.patch
Scott Little bab9bb6b69 Internal restructuring of stx-integ
Create new directories:
   ceph
   config
   config-files
   filesystem
   kernel
   kernel/kernel-modules
   ldap
   logging
   strorage-drivers
   tools
   utilities
   virt

Retire directories:
   connectivity
   core
   devtools
   support
   extended

Delete two packages:
   tgt
   irqbalance

Relocated packages:
   base/
      dhcp
      initscripts
      libevent
      lighttpd
      linuxptp
      memcached
      net-snmp
      novnc
      ntp
      openssh
      pam
      procps
      sanlock
      shadow
      sudo
      systemd
      util-linux
      vim
      watchdog

   ceph/
      python-cephclient

   config/
      facter
      puppet-4.8.2
      puppet-modules

   filesystem/
      e2fsprogs
      nfs-utils
      nfscheck

   kernel/
      kernel-std
      kernel-rt

   kernel/kernel-modules/
      mlnx-ofa_kernel

   ldap/
      nss-pam-ldapd
      openldap

   logging/
      syslog-ng
      logrotate

   networking/
      lldpd
      iproute
      mellanox
      python-ryu
      mlx4-config

   python/
      python-2.7.5
      python-django
      python-gunicorn
      python-setuptools
      python-smartpm
      python-voluptuous

   security/
      shim-signed
      shim-unsigned
      tboot

   strorage-drivers/
      python-3parclient
      python-lefthandclient

   virt/
      cloud-init
      libvirt
      libvirt-python
      qemu

   tools/
      storage-topology
      vm-topology

   utilities/
      tis-extensions
      namespace-utils
      nova-utils
      update-motd

Change-Id: I37ade764d873c701b35eac5881eb40412ba64a86
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 10:06:31 -04:00

101 lines
4.4 KiB
Diff

From 49820add1d1e5f63343615ead9b551b8679f466d Mon Sep 17 00:00:00 2001
From: Kevin Smith <kevin.smith@windriver.com>
Date: Mon, 16 Oct 2017 15:06:37 -0500
Subject: [PATCH 1/1] ipv6 static route support
---
.../lib/puppet/provider/network_route/redhat.rb | 3 ++-
.../network/lib/puppet/type/network_route.rb | 26 ++++++++++++++--------
.../network/spec/unit/type/network_route_spec.rb | 5 +++++
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb b/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb
index 5073519..c289f5f 100644
--- a/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb
+++ b/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb
@@ -93,7 +93,8 @@ Puppet::Type.type(:network_route).provide(:redhat) do
if provider.network == "default"
contents << "#{provider.network} via #{provider.gateway} dev #{provider.interface}"
else
- contents << "#{provider.network}/#{provider.netmask} via #{provider.gateway} dev #{provider.interface}"
+ # provider.name will have cidr notation
+ contents << "#{provider.name} via #{provider.gateway} dev #{provider.interface}"
end
contents << (provider.options == :absent ? "\n" : " #{provider.options}\n")
end
diff --git a/packstack/puppet/modules/network/lib/puppet/type/network_route.rb b/packstack/puppet/modules/network/lib/puppet/type/network_route.rb
index 7ab67dd..fd52c58 100644
--- a/packstack/puppet/modules/network/lib/puppet/type/network_route.rb
+++ b/packstack/puppet/modules/network/lib/puppet/type/network_route.rb
@@ -5,8 +5,6 @@ Puppet::Type.newtype(:network_route) do
ensurable
- IPV4_ADDRESS_REGEX = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/
-
newparam(:name) do
isnamevar
desc "The name of the network route"
@@ -18,7 +16,7 @@ Puppet::Type.newtype(:network_route) do
validate do |value|
begin
t = IPAddr.new(value) unless value == "default"
- rescue ArgumentError
+ rescue
fail("Invalid value for network: #{value}")
end
end
@@ -29,17 +27,27 @@ Puppet::Type.newtype(:network_route) do
desc "The subnet mask to apply to the route"
validate do |value|
- unless (value.length <= 2 or value =~ IPV4_ADDRESS_REGEX)
+ unless value.length <= 3 || (IPAddr.new(value) rescue false)
fail("Invalid value for argument netmask: #{value}")
end
end
munge do |value|
- case value
- when IPV4_ADDRESS_REGEX
- value
- when /^\d+$/
- IPAddr.new('255.255.255.255').mask(value.strip.to_i).to_s
+ # '255.255.255.255'.to_i will return 255, so we try to convert it back:
+ if value.to_i.to_s == value
+ if value.to_i <= 32
+ IPAddr.new('255.255.255.255').mask(value.strip.to_i).to_s
+ else
+ IPAddr.new('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff').mask(value.strip.to_i).to_s
+ end
+ else
+ if (IPAddr.new(value).ipv6? rescue false)
+ IPAddr.new('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff').mask(value).to_s
+ elsif (IPAddr.new(value).ipv4? rescue false)
+ IPAddr.new('255.255.255.255').mask(value).to_s
+ else
+ raise("Invalid value for argument netmask: #{value}")
+ end
end
end
end
diff --git a/packstack/puppet/modules/network/spec/unit/type/network_route_spec.rb b/packstack/puppet/modules/network/spec/unit/type/network_route_spec.rb
index 24e9da3..6e6f3e4 100644
--- a/packstack/puppet/modules/network/spec/unit/type/network_route_spec.rb
+++ b/packstack/puppet/modules/network/spec/unit/type/network_route_spec.rb
@@ -55,6 +55,11 @@ describe Puppet::Type.type(:network_route) do
r[:netmask].should == '255.255.255.0'
end
+ it 'should convert IPv6 netmasks of the CIDR form' do
+ r = Puppet::Type.type(:network_route).new(name: 'lxd bridge', network: 'fd58:281b:6eef:eb3d::', netmask: '64', gateway: 'fd58:281b:6eef:eb3d::1', interface: 'lxdbr0')
+ expect(r[:netmask]).to eq('ffff:ffff:ffff:ffff::')
+ end
+
it "should convert netmasks of the expanded netmask form" do
r = described_class.new(:name => '192.168.1.0/24', :network => '192.168.1.0', :netmask => '255.255.128.0', :gateway => '23.23.23.42', :interface => 'eth0')
r[:netmask].should == '255.255.128.0'
--
1.8.3.1