puppet-network: add vlan support for poky-stx.rb
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppet-network / puppet-network-poky-stx.rb-add-vlan-support.patch
1 From c08ad0a7c950cf35a3f178fe8b84beb227bfe5ca Mon Sep 17 00:00:00 2001
2 From: Jackie Huang <jackie.huang@windriver.com>
3 Date: Fri, 13 Nov 2020 17:45:42 +0800
4 Subject: [PATCH] poky-stx.rb: add vlan support for poky-stx
5
6 Upstream-Status: Inappropriate [poky-stx specific]
7
8 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9 ---
10  lib/puppet/provider/network_config/poky-stx.rb | 10 +++++++++-
11  1 file changed, 9 insertions(+), 1 deletion(-)
12
13 diff --git a/lib/puppet/provider/network_config/poky-stx.rb b/lib/puppet/provider/network_config/poky-stx.rb
14 index 17fa34c..9b0506a 100644
15 --- a/lib/puppet/provider/network_config/poky-stx.rb
16 +++ b/lib/puppet/provider/network_config/poky-stx.rb
17 @@ -45,7 +45,7 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
18
19      # These fields are going to get rearranged to resolve issue 16
20      # https://github.com/adrienthebo/puppet-network/issues/16
21 -    attr_accessor :ipaddress, :netmask, :family, :method, :mtu
22 +    attr_accessor :ipaddress, :netmask, :family, :method, :mtu, :mode
23
24      # Options hash
25      attr_reader :options
26 @@ -66,6 +66,7 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
27          :family    => @family,
28          :method    => @method,
29          :mtu       => @mtu,
30 +        :mode      => @mode,
31          :options   => squeeze_options
32        }
33
34 @@ -185,6 +186,7 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
35            #Instance[name].name   = name
36            Instance[name].family = family
37            Instance[name].method = method
38 +          Instance[name].mode   = :raw
39
40          else
41            # If we match on a string with a leading iface, but it isn't in the
42 @@ -219,6 +221,7 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
43              when 'address'; Instance[name].ipaddress    = val
44              when 'netmask'; Instance[name].netmask      = val
45              when 'mtu';     Instance[name].mtu          = val
46 +            when 'vlan-raw-device'; Instance[name].mode = :vlan
47              else            Instance[name].options[key] << val
48              end
49            else
50 @@ -260,6 +263,11 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
51          stanza << %{iface #{provider.name} #{provider.family} #{provider.method}}
52        end
53
54 +      if provider.options['VLAN'] and  provider.options['VLAN'] == 'yes'
55 +        raw_device = provider.options['PHYSDEV']
56 +        stanza << "    vlan-raw-device #{raw_device}"
57 +      end
58 +
59        [
60          [:ipaddress, 'address'],
61          [:netmask,   'netmask'],
62 --
63 2.7.4