Skip to content

chef-boneyard/netdev

Repository files navigation

netdev Cookbook

Build Status Cookbook Version

Provides a set of vendor-agnostic resources for managing networking devices.

Requirements

  • Chef 11.0.0+
  • Supported networking device from Arista or Juniper.

Usage

Add a dependency on netdev to your cookbook's metadata.rb

depends 'netdev'

Resources/Providers

All resources are fully documented on Chef's offical documentation site.

Resource Description Example Usage
netdev_interface This resource provides an abstraction for managing physical interfaces on network elements. netdev_interface integation test fixture
netdev_l2_interface This resource provides an abstraction for creating and deleting layer 2 interfaces on network devices. netdev_l2_interface integation test fixture.
netdev_lag This resource provides an abstraction for creating and deleting link aggregation group interfaces. netdev_lag integation test fixture.
netdev_vlan This resource provides an abstraction for creating and deleting VLANs. netdev_vlan integation test fixture.
netdev_group This resource provides an abstraction for creating and deleting JUNOS Groups. netdev_group integation test fixture.

Testing

You can run the tests in this cookbook using Rake:

rake integration  # Run Test Kitchen integration tests
rake style        # Run all style checks
rake style:chef   # Lint Chef cookbooks
rake style:ruby   # Run Ruby style checks
rake travis:ci    # Run tests on Travis

Test Kitchen

Test Kitchen 1.0.0+ ships with a proxy driver that proxies commands through to a test instance whose lifecycle is not managed by Test Kitchen. This driver is useful for testing against long-lived non-ephemeral test instances that are simply "reset" between test runs. This driver is also perfect for testing against physical network equipment!

You will need to specify the location and login details for the switch you will be running Test Kitchen against. This should be done in a .kitchen.local.yml file:

platforms:
- name: junos-13.2
  driver:
    # Set the login user of the test switch
    username: schisamo
    # Set the ipaddress or DNS name of the test switch.
    host: 10.66.44.10
    # Set the port sshd is listening on; defaults to 22.
    port: 22

This repository ships with an example file which can easily be copied into place:

cp kitchen.local.example.yml kitchen.local.yml

Juniper Equipment

Requirements:

Test run resets on Juniper device is achieved using Juno's rescue configuration feature. A rescue configuration allows you to define a known working configuration or a configuration with a known state that you can roll back to at any time.

Creating a rescue configuration is easy. SSH into your switch and run the following command:

{master:0}
schisamo@junos-chef-dev> request system configuration rescue save

{master:0}
schisamo@junos-chef-dev>

You now have a known good state to roll back to! Test Kitchen activates the rescue configuration by issuing the command cli -c 'configure; rollback rescue; commit' during the CREATE and DESTROY stages of testing. Reference the .kitchen.yml for some additional environment variables that are used to set host, username and sshd port of the switch being tested against.

Arista Equipment

Currently not supported.

License & Authors

  • Author: Peter Sprygada (Arista Networks)
  • Author: Jeremy Schulman (Juniper Networks)
  • Author: Seth Chisamore (CHEF, Inc.)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Development repository for Chef Cookbook netdev

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages