components/puppet/files/solaris/lib/puppet/type/link_aggregation.rb
branchs11-update
changeset 2771 8e4227dc2fc4
child 1921 489d0d0f656f
equal deleted inserted replaced
2767:82fe1f1d5d8d 2771:8e4227dc2fc4
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 
       
    22 #
       
    23 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
       
    24 #
       
    25 
       
    26 require 'puppet/property/list'
       
    27 
       
    28 Puppet::Type.newtype(:link_aggregation) do
       
    29     @doc = "Manage the configuration of Oracle Solaris link aggregations"
       
    30 
       
    31     ensurable
       
    32 
       
    33     newparam(:name) do
       
    34         desc "The name of the link aggregration"
       
    35         isnamevar
       
    36     end
       
    37 
       
    38     newparam(:temporary) do
       
    39         desc "Optional parameter that specifies that the aggreation is
       
    40               temporary.  Temporary aggreation links last until the next
       
    41               reboot."
       
    42         newvalues(:true, :false)
       
    43     end
       
    44 
       
    45     newproperty(:lower_links, :parent => Puppet::Property::List) do
       
    46         desc "Specifies an array of links over which the aggrestion is created."
       
    47 
       
    48         # ensure should remains an array
       
    49         def should
       
    50             @should
       
    51         end
       
    52 
       
    53         def insync?(is)
       
    54             is = [] if is == :absent or is.nil?
       
    55             is.sort == self.should.sort
       
    56         end
       
    57 
       
    58         # dladm returns multivalue entries delimited with a space
       
    59         def delimiter
       
    60             " "
       
    61         end
       
    62 
       
    63     end
       
    64 
       
    65     newproperty(:mode) do
       
    66         desc "Specifies which mode to set.  Valid values are trunk or dlmp.
       
    67               Defaults to :trunk"
       
    68         newvalues(:trunk, :dlmp)
       
    69     end
       
    70 
       
    71     newproperty(:policy) do
       
    72         desc "Specifies the port selection policy to use for load spreading
       
    73               of outbound traffic."
       
    74     end
       
    75 
       
    76     newproperty(:lacpmode) do
       
    77         desc "Specifies whether LACP should be used and, if used, the mode
       
    78               in which it should operate"
       
    79         newvalues(:off, :active, :passive)
       
    80     end
       
    81 
       
    82     newproperty(:lacptimer) do
       
    83         desc "Specifies the LACP timer value"
       
    84         newvalues(:short, :long)
       
    85     end
       
    86 
       
    87     newproperty(:address) do
       
    88         desc "Specifies a fixed unicast hardware address to be used for the
       
    89               aggregation"
       
    90     end
       
    91 end