Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ARISTA-33) Add radius_server provider #11

Merged
merged 6 commits into from
Nov 18, 2014
Merged

(ARISTA-33) Add radius_server provider #11

merged 6 commits into from
Nov 18, 2014

Conversation

jeffmccune
Copy link
Contributor

This pull requests implements the radius_server provider. The pull request
depends upon https://github.com/puppetlabs/puppet_x_eos_eapi/pull/4 being
merged.

Jeff McCune added 6 commits November 3, 2014 15:48
Make the following command work to run the specs only:

    bundle exec guard start --group specs --clear
Without this patch there is no provider for the radius_global type.
This patch implements the initial collection of a single resource from
the target device which looks like:

    radius_global { 'settings':
      enable           => 'true',
      key              => '070E234F1F5B4A',
      key_format       => '7',
      retransmit_count => '5',
      timeout          => '50',
    }
Without this patch the radius_global provider does not change the system
to reflect the desired state of the global radius configuration
resource.  This patch addresses the problem by implementing the provider
setter methods which accumulate changes in the @property_flush instance
variable.  The patch also implements the flush instance method which
uses the PuppetX::Eos::Radius class to manage the radius key, timeout,
and retransmit count properties.
Without this patch there is no provider for the radius_server type.
This patch addresses the problem by implementing the radius_server
provider with the instances class method to collect existing resources
on the device.  The provider is incomplete in that the provider does not
yet flush updated properties to the target device.

The resources look like:

    radius_server { '10.11.12.13/1024/2048':
      acct_port        => '2048',
      auth_port        => '1024',
      hostname         => '10.11.12.13',
      key              => '011204070A5955',
      key_format       => '7',
      retransmit_count => '5',
      timeout          => '30',
    }
    radius_server { '10.11.12.13/1811/1813':
      acct_port => '1813',
      auth_port => '1811',
      hostname  => '10.11.12.13',
    }
    radius_server { '10.11.12.13/1811/1814':
      acct_port => '1814',
      auth_port => '1811',
      hostname  => '10.11.12.13',
    }
    radius_server { '10.11.12.13/1812/1813':
      acct_port  => '1813',
      auth_port  => '1812',
      hostname   => '10.11.12.13',
      key        => '1513090F557878',
      key_format => '7',
    }
    radius_server { '10.11.12.13/1812/1814':
      acct_port => '1814',
      auth_port => '1812',
      hostname  => '10.11.12.13',
    }
    radius_server { '10.11.12.14/1812/1813':
      acct_port => '1813',
      auth_port => '1812',
      hostname  => '10.11.12.14',
    }

Given the following switch configuration:

    radius-server host 10.11.12.13 key 7 1513090F557878
    radius-server host 10.11.12.13 auth-port 1811
    radius-server host 10.11.12.13 auth-port 1811 acct-port 1814
    radius-server host 10.11.12.13 acct-port 1814
    radius-server host 10.11.12.13 auth-port 1024 acct-port 2048 timeout 30 retransmit 5 key 7 011204070A5955
    radius-server host 10.11.12.14
Without this patch the radius_server provider does not have the ability
to create or destroy resources on the target device.  The following
error results from the attempt:

    $ puppet resource radius_server 10.11.12.15/1812/1813 ensure=present
    Error: Could not set 'present' on ensure: undefined method `create' for Radius_server[10.11.12.15/1812/1813]:Puppet::Type::Radius_server
    Error: Could not set 'present' on ensure: undefined method `create' for Radius_server[10.11.12.15/1812/1813]:Puppet::Type::Radius_server
    Wrapped exception:
    undefined method `create' for Radius_server[10.11.12.15/1812/1813]:Puppet::Type::Radius_server
    Error: /Radius_server[10.11.12.15/1812/1813]/ensure: change from absent to present failed: Could not set 'present' on ensure: undefined method `create' for Radius_server[10.11.12.15/1812/1813]:Puppet::Type::Radius_server
    radius_server { '10.11.12.15/1812/1813':
      ensure => 'absent',
    }

This patch addresses the problem by implementing the property setter
methods and deferring to the flush method to create the resource on the
target device.  This patch also implements the provider create and
destroy methods.
jeffmccune pushed a commit that referenced this pull request Nov 18, 2014
(ARISTA-33) Add radius_server provider
@jeffmccune jeffmccune merged commit bacf06b into arista-eosplus:master Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant