Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Puppet netdev Resources

 

Understanding the netdev_stdlib Puppet Resource Types

On the Puppet master, two Puppet modules are required to manage devices running Junos OS. The first module, netdevops/netdev_stdlib, includes the Puppet type definitions for the netdev resources. The netdev resources model the properties for various network resources and control specific Ethernet switch configuration such as VLANs. Table 1 describes the resource types defined by the netdev_stdlib module. In the Puppet manifest, you use the netdev resource types in resource declarations to specify the desired configurations of the agent nodes running Junos OS.

Note

The netdev_stdlib resource definitions represent a superset of configuration parameters for that resource. The manifest file should only configure those parameters that are supported on a given platform or that are relevant to the given interface type.

Table 1: Resource Types Defined in the netdev_stdlib Module

Type Name

Description

netdev_device

Models the properties of the network device.

netdev_interface

Models the properties for a physical interface.

The properties for a physical interface are managed separately from the services on the interface.

netdev_l2_interface

Models the properties for Layer 2 switching services on an interface.

The services for a Layer 2 interface are managed separately from the physical interface.

netdev_lag

Models the properties for a link aggregation group (LAG).

The properties for a LAG are managed separately from the physical member links and services on the interface.

netdev_vlan

Models the properties for a VLAN resource.

The second Puppet module, juniper/netdev_stdlib_junos, includes the Junos OS-specific code that implements each of the types defined by netdev_stdlib. When you install the netdev_stdlib_junos module on the Puppet master, it automatically installs the netdev_stdlib module.

In a Puppet manifest, you must specify one and only one netdev_device for a given node. The netdev provider code automatically creates dependencies between the netdev_device resource and the other netdev resources. If the netdev_device cannot be created, then the Puppet agent does not process the other resources.

To create the netdev_device resource, the Puppet agent must open a NETCONF session with the device running Junos OS and establish an exclusive lock on the configuration database. Since the Puppet agent is running on the device, opening a connection should not fail. However, obtaining an exclusive lock could fail if another administrator is managing the device and already has a lock on the configuration database.

The netdev_interface resource type models the properties for a physical interface, whereas netdev_l2_interface models the properties for Layer 2 switching services on an interface. You only need to define the netdev_interface resource to change physical interface properties such as speed, MTU, or duplex mode. You do not need to define a netdev_interface resource as a prerequisite for defining a netdev_l2_interface resource.

The netdev_vlan resource type models the properties for a VLAN resource. A netdev_l2_interface resource can reference VLANs created using netdev_vlan resources, or it can reference VLANs already existing in the device configuration. Thus, you do not need to define a netdev_vlan resource in order to use VLANs in the netdev_l2_interface definition.

Note

Only the netdev_device and netdev_interface resources are supported on OCX1100 switches.

Note

To manage resources that do not have type specifications in the netdev_stdlib module, you can use the apply_group defined resource type provided as part of the netdev_stdlib_junos module.

netdev_device

Syntax

Release Information

Resource support starting in netdev_stdlib_junos module version 1.0.0.

Description

Puppet resource type that models the management connection to the agent node running Junos OS. In a Puppet manifest, you must specify one and only one netdev_device for a given node.

Attributes

nameName identifying the agent node. This can be a user-defined identifier and does not need to have any relationship to the actual node name.

Usage Examples

The following Puppet manifest code creates a netdev_device resource. In this example, the netdev_device name is the value of the $hostname variable, which is provided by Facter.

netdev_interface

Syntax

Release Information

Resource support starting in netdev_stdlib_junos module version 1.0.0.

Description

Puppet resource type that enables you to model the properties and manage the configuration of a physical interface.

Note

The netdev_stdlib resource definitions represent a superset of configuration parameters for that resource. The manifest file should only configure those parameters that are supported on a given platform or that are relevant to the given interface type.

Attributes

nameJunos OS interface name, for example, ge-0/0/0.
active (Optional) Specify whether to activate or deactivate the corresponding configuration. A value of true activates the configuration. A value of false deactivates the configuration without removing it.

Default: true

Note

If the resource declaration includes the active attribute and also ensure => absent, the client deletes the corresponding configuration and ignores the active attribute.

admin(Optional) Configure the interface as administratively enabled or disabled. A value of up configures the interface as administratively enabled, and a value of down administratively disables the interface.

Default: up

description(Optional) Interface description.

Default: “Puppet created interface: <name>”

duplex(Optional) Interface duplex mode. Acceptable values are auto, full, and half.

Default: auto

Note

EX4300 switches support full duplex only. If you include the duplex attribute in your manifest file and set it to anything other than full, the Puppet agent displays an error message when it runs and ignores the duplex attribute setting.

ensure(Optional) Specify whether to create or delete the configuration. A value of present creates the configuration. A value of absent deletes the configuration.

Default: present

mtu(Optional) Maximum transmission unit (MTU) of the interface.
speed(Optional) Interface speed. Acceptable values are auto, 10m, 100m, 1g, and 10g.

Default: auto

Note

Setting the speed attribute to the default value of auto causes the device to use the existing configuration for the speed statement and does not explicitly configure anything for the interface speed.

Usage Examples

The following Puppet manifest code configures the description, speed, and duplex mode for interface ge-0/0/0:

On a switch running Junos OS, the resulting configuration is:

root@jd.example.com> show configuration interfaces ge-0/0/0

On an MX Series router running Junos OS, the resulting configuration is:

root@jd.example.com> show configuration interfaces ge-0/0/0

If the Puppet manifest sets the speed attribute to auto, the device uses the existing configuration for the speed statement and does not explicitly configure anything for the interface speed. The following Puppet manifest code configures the mtu statement for the ge-0/0/0 interface and instructs the device to use the existing configuration for the speed statement:

The resulting configuration uses the existing configuration for the speed statement, which in this case is 100m.

root@jd.example.com> show configuration interfaces ge-0/0/0

netdev_l2_interface

Syntax

Release Information

Resource support starting in netdev_stdlib_junos module version 1.0.0.

Description

Puppet resource type that enables you to model the properties and manage the configuration of Layer 2 switching services on an interface. You do not need to define a netdev_interface resource as a prerequisite for defining a netdev_l2_interface resource.

Note

The netdev_l2_interface resource is not supported on OCX1100 switches.

A netdev_l2_interface resource can reference VLANs created using netdev_vlan resources, or it can reference VLANs that already exist in the device configuration. Thus, you do not need to define a netdev_vlan resource in order to use VLANs in the netdev_l2_interface definition.

Attributes

nameJunos OS interface name, excluding any logical unit number, for example, ge-0/0/0.
active (Optional) Specify whether to activate or deactivate the corresponding configuration. A value of true activates the configuration. A value of false deactivates the configuration without removing it.

Default: true

Note

If the resource declaration includes the active attribute and also ensure => absent, the client deletes the corresponding configuration and ignores the active attribute.

description(Optional) Interface description.

Default: “Puppet created netdev_l2_interface: <name>”

ensure(Optional) Specify whether to create or delete the configuration. A value of present creates the configuration. A value of absent deletes the configuration.

Default: present

tagged_vlans(Optional) Configure one or more VLANs that can carry traffic on a trunk interface. The value can be a single VLAN name or an array of VLAN names. If you set this attribute, the code automatically configures the port as a trunk port.
untagged_vlan(Optional) Configure the specified VLAN as the native VLAN on an interface. The value is the name of the VLAN for untagged packets.
vlan_tagging(Optional) Configure the mode for the given port as access or trunk.

A value of enable configures the port in trunk mode, in which tagged packets are processed. A value of disable configures the port in access mode, in which tagged packets are discarded.

If you do not specify a value for this attribute, but you do set the tagged_vlans attribute, the code automatically configures the port as a trunk port. When you configure an MX Series router, you must define the tagged_vlans attribute for a trunk port configuration or define the untagged_vlan attribute for an access port configuration.

Default: disable

Usage Examples

The following Puppet manifest code configures ge-0/0/0 as a trunk port accepting tagged frames from the Pink and Green VLANs. The code configures the Red VLAN as the native VLAN for that interface.

On a switch running Junos OS, the resulting configuration is:

root@jd.example.com> show configuration interfaces ge-0/0/0

On an MX Series router, the resulting configuration uses the corresponding VLAN IDs instead of VLAN names, as shown in the following output:

root@jd.example.com> show configuration interfaces ge-0/0/0

netdev_lag

Syntax

Release Information

Resource support starting in netdev_stdlib_junos module version 1.0.0.

Description

Puppet resource type that enables you to model the properties and manage the configuration of link aggregation groups (LAGs). In Junos OS, LAG ports are referred to as aggregated Ethernet bundles or ae ports.

Note

The netdev_lag resource is not supported on OCX1100 switches.

The links attribute causes physical interfaces to be added or removed from the LAG. To successfully assign the physical interfaces in the links attribute list to a LAG, you must ensure that there are no existing logical units configured on those physical interfaces. To enforce this prerequisite, you can use the netdev_l2_interface resource with ensure=>absent to remove any existing logical units.

Note

Junos OS requires at least one unit configured under the LAG (ae) port for the links to display as part of the show command. Therefore, you need to define Layer 2 services using the netdev_l2_interface resource type.

Attributes

nameJunos OS LAG name, excluding any logical unit number, for example, ae0.
active(Optional) Specify whether to activate or deactivate the corresponding configuration. A value of true activates the configuration. A value of false deactivates the configuration without removing it.

Default: true

Note

If the resource declaration includes the active attribute and also ensure => absent, the client deletes the corresponding configuration and ignores the active attribute.

ensure(Optional) Specify whether to create or delete the configuration. A value of present creates the configuration. A value of absent deletes the configuration.

Default: present

lacp(Optional) Link Aggregation Control Protocol (LACP) mode.
  • disabled—LACP is not used.

  • active—LACP active mode.

  • passive—LACP passive mode.

Default: disabled

linksConfigure one or more physical interfaces as members of the LAG bundle. The value can be a single interface or an array of interfaces.
minimum_links(Optional) Integer that defines the minimum number of physical links that must be in the up state to declare the LAG port in the up state.

Usage Examples

The following Puppet manifest code configures a LAG bundle ae0 consisting of three interfaces, ge-0/0/15, ge-0/0/20, and ge-0/0/21, which accept tagged frames from the Blue and Green VLANs. The code configures the Red VLAN as the native VLAN.

On a switch running Junos OS, the resulting configuration is:

root@jd.example.com> show configuration interfaces

On an MX Series router running Junos OS, the resulting configuration is:

root@jd.example.com> show configuration interfaces
Note

Puppet for Junos OS uses an apply-macro statement in LAG configurations to identify the list of LAG members.

netdev_vlan

Syntax

Release Information

Resource support starting in netdev_stdlib_junos module version 1.0.0.

Description

Puppet resource type that enables you to model the properties and manage the configuration of VLANs on agent nodes running Junos OS.

Note

The netdev_vlan resource is not supported on OCX1100 switches.

Attributes

nameName of the VLAN, which must be a VLAN name that is valid on the agent node.
active(Optional) Specify whether to activate or deactivate the corresponding configuration. A value of true activates the configuration. A value of false deactivates the configuration without removing it.

Default: true

Note

If the resource declaration includes the active attribute and also ensure => absent, the client deletes the corresponding configuration and ignores the active attribute.

description(Optional) VLAN description.

Default: “Puppet created VLAN: <name>: <vlan-id>”

ensure(Optional) Specify whether to create or delete the configuration. A value of present creates the configuration. A value of absent deletes the configuration.

Default: present

vlan_idVLAN tag identifier. Valid VLAN IDs range from 1 through 4094.

Usage Examples

The following Puppet manifest code defines a VLAN named Green with a VLAN ID of 500:

On a switch running Junos OS, the resulting configuration is:

On an MX Series router, the resulting configuration is:

The following Puppet manifest code deactivates the Green VLAN, which has a VLAN ID of 500:

On a switch running Junos OS, the resulting configuration is:

root@jd.example.com> show configuration vlans

On an MX Series router, the resulting configuration is:

root@jd.example.com> show configuration bridge-domains