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
6 Current rules in poky-stx.rb doesn't recognize vlan mode,
7 so add the mode option and corresponding handling for vlan
10 Upstream-Status: Inappropriate [poky-stx specific]
12 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
14 lib/puppet/provider/network_config/poky-stx.rb | 10 +++++++++-
15 1 file changed, 9 insertions(+), 1 deletion(-)
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
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
30 @@ -66,6 +66,7 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
35 :options => squeeze_options
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
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
54 @@ -260,6 +263,11 @@ Puppet::Type.type(:network_config).provide(:pokystx) do
55 stanza << %{iface #{provider.name} #{provider.family} #{provider.method}}
58 + if provider.options['VLAN'] and provider.options['VLAN'] == 'yes'
59 + raw_device = provider.options['PHYSDEV']
60 + stanza << " vlan-raw-device #{raw_device}"
64 [:ipaddress, 'address'],
65 [:netmask, 'netmask'],