<commit_before>=begin
* Puppet Module  : netdev
* Author         : <NAME>
* File           : puppet/type/netdev_vlan.rb
* Version        : 2012-11-11
* Description    :
*
*    This file contains the Type definition for the network
*    device Vlan resource.
*
=end

Puppet::Type.newtype(:netdev_vlan) do
  @doc = "Network Device VLAN"

  ensurable
  feature :activable, "The ability to activate/deactive configuration"
  feature :describable, "The ability to add a description"
  feature :no_mac_learning, "The ability disable MAC learning"

  ##### -------------------------------------------------------------
  ##### Parameters
  ##### -------------------------------------------------------------

  newparam(:name, :namevar=>true) do
    desc "The VLAN name"
  end

  ##### -------------------------------------------------------------
  ##### Properties
  ##### -------------------------------------------------------------

  newproperty(:active, :required_features => :activable) do
    desc "Config activation"
    defaultto(:true)
    newvalues(:true, :false)
  end

  newproperty(:description, :required_features => :describable) do
    desc "The VLAN Description"
  end

  newproperty(:vlan_id) do
    desc "The VLAN ID"
  end

  newproperty(:no_mac_learning, :required_features => :no_mac_learning) do
    desc "Do not learn MAC addresses; used for 2-port VLANs"
    defaultto(:false)
    newvalues(:true, :false)
  end

  ##### -------------------------------------------------------------
  ##### Auto require the netdev_device resource -
  #####   There must be one netdev_device resource defined in the
  #####   catalog, it doesn't matter what the name of the device is,
  #####   just that one exists.
  ##### -------------------------------------------------------------

  autorequire(:netdev_device) do
    netdev = catalog.resources.select{ |r| r.type == :netdev_device }[0]
    raise "No netdev_device found in catalog" unless netdev
    netdev.title   # returns the name of the netdev_device resource
  end

end
<commit_msg>(ND-34) Rename netdev_vlan to network_vlan<commit_after>Puppet::Type.newtype(:network_vlan) do
  @doc = "Manage VLAN's.  Layer-2 VLAN's are managed by this resource type."

  ensurable

  feature :describable, "VLAN descriptions are supported by the platform"

  # Parameters (additional data)

  newparam(:name, :namevar=>true) do
    desc <<-EOT
      The resource identifier.  The value does not affect the configuration and
      instead is used to identify this resource within Puppet and related
      tools.
    EOT
  end

  # Properties (state management)

  newproperty(:description, :required_features => :describable) do
    desc "The VLAN Description"
  end

  newproperty(:id) do
    desc "The VLAN ID, e.g. 100"
  end
end

{'fraction_non_alphanumeric': 0.22405745062836624, 'fraction_numerical': 0.005745062836624776, 'mean_word_length': 2.071664829106946, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5426424', 'n_tokens_mistral': 775, 'n_tokens_neox': 744, 'n_words': 245}