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