I've created a ticket to track this work at http://projects.puppetlabs.com/issues/5764
On Mon, Jan 3, 2011 at 1:32 PM, Brice Figureau < [email protected]> wrote: > Hi, > > This is my Christmas Gift for the community :) > That's something that was haunting me for a long time: a way to manage > switch/routers directly from puppet. > Unfortunately most of the switches/routers don't run ruby natively and > as such can't run puppet. > > Based on an open-space discussion that happened at PuppetCamp EU in May > 2010, I > finally managed to find the time to implement a solution to this problem. > > This is currently a Proof Of Concept of a puppet type/provider connecting > to remote cisco switch/routers running ios to manage: > * interfaces (including ip address, trunking, etc...) > * vlans > > This has been tested successfully on some cisco hardware I happened > to have available (a couple of switch and low-end routers). > > The puppet provider can connect to remote switch/routers through > ssh and/or telnet. > > To manage an interface: > > interface { > "FastEthernet 0/1": > device_url => "ssh://user:[email protected]/", > mode => trunk, > encapsulation => dot1q, > trunk_allowed_vlans => "1-99,200,253", > description => "to back bone router" > } > > or > interface { > "Vlan 1": > device_url => "ssh://user:[email protected]/", > description => "internal net", > ipaddress => [ "192.168.0.1/24", "fe08::/128 link-local"] > } > > And to manage vlans: > vlan { > "99": > description => "management", > device_url => "ssh://user:[email protected]/", > } > > I didn't solve the uniqueness of the name of an interface yet (currently > it isn't possible to have 2 switches with the same interface name, which is > an issue). > > One possibility would be to use as interface name, the device_url. > If anyone has a better idea, let me know. > > If this patch proves to be a success, we can add more providers > (ie hp procurve, juniper routers, etc..) and more types (routers, access > lists, routing table entries, routing protocols, etc...). > > Please comment as usual :) > > Brice > > Brice Figureau (7): > Introduce a module for some IP computations > Remote Network Device transport system > Telnet transport to connect to remote network device > Ssh transport for network device management > Base class for network device based providers > Cisco Switch/Router Interface management > Add management of router/switchs global vlans > > lib/puppet/feature/ssh.rb | 4 + > lib/puppet/provider/interface/cisco.rb | 33 ++ > lib/puppet/provider/network_device.rb | 59 +++ > lib/puppet/provider/vlan/cisco.rb | 34 ++ > lib/puppet/type/interface.rb | 107 ++++ > lib/puppet/type/router.rb | 14 + > lib/puppet/type/vlan.rb | 24 + > lib/puppet/util/network_device.rb | 2 + > lib/puppet/util/network_device/base.rb | 29 ++ > lib/puppet/util/network_device/cisco.rb | 4 + > lib/puppet/util/network_device/cisco/device.rb | 246 +++++++++ > lib/puppet/util/network_device/cisco/interface.rb | 82 +++ > lib/puppet/util/network_device/ipcalc.rb | 68 +++ > lib/puppet/util/network_device/transport.rb | 5 + > lib/puppet/util/network_device/transport/base.rb | 26 + > lib/puppet/util/network_device/transport/ssh.rb | 115 +++++ > lib/puppet/util/network_device/transport/telnet.rb | 42 ++ > spec/unit/provider/interface/cisco_spec.rb | 64 +++ > spec/unit/provider/network_device_spec.rb | 148 ++++++ > spec/unit/provider/vlan/cisco_spec.rb | 62 +++ > spec/unit/type/interface_spec.rb | 93 ++++ > spec/unit/type/vlan_spec.rb | 40 ++ > spec/unit/util/network_device/cisco/device_spec.rb | 521 > ++++++++++++++++++++ > .../util/network_device/cisco/interface_spec.rb | 89 ++++ > spec/unit/util/network_device/ipcalc_spec.rb | 63 +++ > .../util/network_device/transport/base_spec.rb | 42 ++ > .../unit/util/network_device/transport/ssh_spec.rb | 212 ++++++++ > .../util/network_device/transport/telnet_spec.rb | 76 +++ > 28 files changed, 2304 insertions(+), 0 deletions(-) > create mode 100644 lib/puppet/feature/ssh.rb > create mode 100644 lib/puppet/provider/interface/base.rb > create mode 100644 lib/puppet/provider/interface/cisco.rb > create mode 100644 lib/puppet/provider/network_device.rb > create mode 100644 lib/puppet/provider/vlan/cisco.rb > create mode 100644 lib/puppet/type/interface.rb > create mode 100644 lib/puppet/type/router.rb > create mode 100644 lib/puppet/type/vlan.rb > create mode 100644 lib/puppet/util/network_device.rb > create mode 100644 lib/puppet/util/network_device/base.rb > create mode 100644 lib/puppet/util/network_device/cisco.rb > create mode 100644 lib/puppet/util/network_device/cisco/device.rb > create mode 100644 lib/puppet/util/network_device/cisco/interface.rb > create mode 100644 lib/puppet/util/network_device/ipcalc.rb > create mode 100644 lib/puppet/util/network_device/transport.rb > create mode 100644 lib/puppet/util/network_device/transport/base.rb > create mode 100644 lib/puppet/util/network_device/transport/ssh.rb > create mode 100644 lib/puppet/util/network_device/transport/telnet.rb > create mode 100644 spec/unit/provider/interface/cisco_spec.rb > create mode 100644 spec/unit/provider/network_device_spec.rb > create mode 100644 spec/unit/provider/vlan/cisco_spec.rb > create mode 100644 spec/unit/type/interface_spec.rb > create mode 100644 spec/unit/type/vlan_spec.rb > create mode 100644 spec/unit/util/network_device/cisco/device_spec.rb > create mode 100644 spec/unit/util/network_device/cisco/interface_spec.rb > create mode 100644 spec/unit/util/network_device/ipcalc_spec.rb > create mode 100644 spec/unit/util/network_device/transport/base_spec.rb > create mode 100644 spec/unit/util/network_device/transport/ssh_spec.rb > create mode 100644 spec/unit/util/network_device/transport/telnet_spec.rb > > -- > 1.7.2.1 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<puppet-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
