components/ruby/puppet-modules/oracle-solaris_providers/files/etc/puppet/modules/solaris_providers/lib/puppet/type/evs.rb
author Shawn Ferry <shawn.ferry@oracle.com>
Wed, 10 Feb 2016 22:10:43 -0500
changeset 5438 c068f8c677e8
parent 4794 components/ruby/puppet/files/solaris/lib/puppet/type/evs.rb@be62c55aa235
permissions -rw-r--r--
PSARC/2016/016 Rename/Refactor Puppet and Puppet Module Packages 21041932 puppet, facter, and hiera need to build Ruby 2.1 packages 21042030 puppet, facter, and hiera need to stop building Ruby 1.9 packages 21613616 oracle-solaris_provider builds should come from the github repo we publish 22047789 puppet package name and dependencies are confusing 22301978 Overzealous use of $(RUBY_VERSION) in puppet packaging 22347610 GIT repos cannot be used as described in docs 22664785 Puppet module files should be owned by puppet 22675056 git clone could use --depth 1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4794
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     1
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     2
# CDDL HEADER START
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     3
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     4
# The contents of this file are subject to the terms of the
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     5
# Common Development and Distribution License (the "License").
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     6
# You may not use this file except in compliance with the License.
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     7
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     8
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
     9
# or http://www.opensolaris.org/os/licensing.
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    10
# See the License for the specific language governing permissions
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    11
# and limitations under the License.
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    12
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    13
# When distributing Covered Code, include this CDDL HEADER in each
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    14
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    15
# If applicable, add the following below this CDDL HEADER, with the
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    16
# fields enclosed by brackets "[]" replaced with your own identifying
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    17
# information: Portions Copyright [yyyy] [name of copyright owner]
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    18
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    19
# CDDL HEADER END
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    20
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    21
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    22
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    23
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    24
#
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    25
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    26
Puppet::Type.newtype(:evs) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    27
    @doc = "Manage the configuration of Oracle Solaris Elastic Virtual Switch
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    28
           (EVS)"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    29
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    30
    ensurable
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    31
    newparam(:name) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    32
        desc "The full name for EVS (including the tenant name)"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    33
        validate do |value|
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    34
            if value.split("/").length != 2
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    35
                raise Puppet::Error, "Invalid EVS name\n"\
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    36
                    "Name convention must be <tenant>/<evs>"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    37
            end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    38
        end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    39
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    40
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    41
    ## read/write properties (always updatable) ##
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    42
    newproperty(:maxbw) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    43
        desc "The full duplex bandwidth for the virtual port"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    44
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    45
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    46
    newproperty(:priority) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    47
        desc "The relative priority for the virtual port"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    48
        newvalues("high", "medium", "low", "")
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    49
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    50
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    51
    newproperty(:protection) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    52
        desc "Enables one or more types of link protection"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    53
        # verify protection value: comma(,) separatable
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    54
        validate do |value| 
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    55
            value.split(",").collect do |each_val|
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    56
                if not ["mac-nospoof", "restricted", "ip-nospoof", 
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    57
                    "dhcp-nospoof", "none", ""].include? each_val
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    58
                    raise Puppet::Error, "Invalid value \"#{each_val}\". "\
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    59
                        "Valid values are mac-nospoof, restricted, "\
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    60
                        "ip-nospoof, dhcp-nospoof, none."
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    61
                end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    62
            end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    63
        end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    64
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    65
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    66
    ## read-only properties (settable upon creation) ##
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    67
    newproperty(:l2_type) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    68
        desc "Define how an EVS will be implemented across machines"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    69
        newvalues("vlan", "vxlan", "flat", "")
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    70
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    71
    
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    72
    newproperty(:vlanid) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    73
        desc "VXLAN segment ID used to implement the EVS"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    74
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    75
    
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    76
    newproperty(:vni) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    77
        desc "VLAN ID used to implement the EVS"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    78
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    79
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    80
    newproperty(:uuid) do
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    81
        desc "UUID of the EVS instance"
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    82
    end
be62c55aa235 PSARC/2015/218 Add EVS support to Puppet
Sungmin Lee <sungmin.lee@oracle.com>
parents:
diff changeset
    83
end