summaryrefslogtreecommitdiff
path: root/spec/unit/util/network_device
AgeCommit message (Collapse)AuthorFilesLines
2013-04-25Refactor how files are watchedNick Lewis1-64/+26
LoadedFile is now WatchedFile (since it has nothing to do with loading files, only with telling when they change), and some of its internal variables have been renamed for clarity. Also added a FileWatcher class whose entire purpose is to track a set of LoadedFiles in aggregate. This is now used by TypeCollection in place of its own hash. Puppet::FileServing::Configuration::Parser and Puppet::Util::NetworkDevice::Config were inheriting LoadedFile, simply for its changed? method, even though neither of them really has file properties. Now they wrap a WatchedFile instance instead.
2013-02-26(#18092) Use CGI.parse on network URI queryAdrien Thebo1-0/+26
The current implementation of the network device enable password parsing is unable to handle characters like sharps and spaces in the password, which are valid passwords. This commit adds CGI parsing of the query string to only extract and unescape the enable query parameter. This supercedes GH-1327 and GH-1491.
2013-02-07(maint) Update network_device spec to check for nilAdrien Thebo1-2/+2
Commit fe95a39 added a default value of false for instantiation of network transport types. I omitted that value and defaulted to nil since they're equivalent but didn't update the tests. This commits checks for nil instead of false.
2013-02-07Add the debug parameter in device.confGuillaume Rose2-0/+25
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune8-8/+8
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune8-8/+8
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2012-04-11Merge branch '2.7.x'Patrick Carlisle1-0/+9
* 2.7.x: Fix communication_error acceptance test Use :as_platform in the smf service spec Use :as_platform in the redhat service spec (#13690) add comments to spec_helper (#12392) Don't require eventlog gem on non-Windows platforms Updating CHANGELOG and lib/puppet.rb for 2.7.13 (#13690) Update 2.7.x for spec_helper compatibility with external projects (#12392) Add eventlog destination and log to it by default on Windows Stub mktmpdir and remove_entry_secure in os x package providers (#13260) Spec test to verify that mktmpdir is used (#12392) Created Windows eventlog message resource dll (#13260) Use mktmpdir when downloading packages Refactor pkgdmg specs Remove telnet Output_log parameter Fix for bucket_path security vulnerability Removed text/marshal support (#12466) unset X-Forwarded-For header (#13204) Workaround duplicate Augeas save events Conflicts: lib/puppet/util/settings.rb spec/spec_helper.rb
2012-04-03Remove telnet Output_log parameterMatthaus Litteken1-0/+9
The puppet telnet util opened an output log by default with a predictable name. This left the log open to a write-through symlink attack as the puppet user. This fix addresses that by removing the Output_log parameter from the Net::Telnet::new call. Without the parameter, Net::Telnet defaults to no output logging. The same is true for the dump_log parameter. The spec test for telnet has been updated to test and ensure that no files are opened during connect. It also stubs the TCPSocket for the telnet connection so that no connection is attempted if @transport.connect isn't stubbed.
2012-03-30Remove the "fails_on_ruby_1.9.2" tag from tests...Daniel Pittman2-3/+3
Now we have passing tests on Ruby 1.9, we can make all those tags go away and enable the full suite. Now anything that fails should be treated like a real failure, which is reasonable since this is a real and supported platform. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2011-09-14Fix #9164 - allow '-' in device certificate namesBrice Figureau1-0/+7
The regex was a little bit too strict and disallowed certnames containing a dash. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-09-13Fix #7984 - GigabitEthernet/TenGigabitEthernet are uncorrectly parsedBrice Figureau1-1/+2
The interface name abbreviation to canonical name doesn't return the correct name for GigabitEthernet and doesn't support TenGigabitEthernet interfaces. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-09-13Fix #7983 - Cisco uptime facts doesn't always workBrice Figureau1-1/+3
It was failing when one category (like week, day, hour) was missing. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-08-19Fix tests with "relative" paths on WindowsJosh Cooper1-3/+5
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows, which breaks many test cases. This commit adds a method to PuppetSpec::Files.make_absolute that makes the path absolute in test cases. On Unix (Puppet.features.posix?) it is a no-op. On Windows, (Puppet.features.microsoft_windows?) the drive from the current working directory is prepended. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 462a95e3d077b1915a919399b846068816c84583) Conflicts: spec/unit/parser/functions/extlookup_spec.rb
2011-05-17maint: fix spec_helper inclusions again.Daniel Pittman8-19/+11
We got rid of the '../../spec_helper' style requires, but a few of them snuck back in in recent changes. This purges them out, replaced with the header: #!/usr/bin/env rspec require 'spec_helper' Reviewed-By: Nick Lewis <nick@puppetlabs.com>
2011-05-17(#7507) Add ability to filter Ruby 1.9 spec failuresMatt Robinson2-3/+3
By running: rspec spec --tag ~@fails_on_ruby_1.9.2 We can now just run the specs that pass under Ruby 1.9. Obviously in the long term we want to have all the specs passing, but until then we need notification when we regress. From now on new code will be required to pass under Ruby 1.9, and Jenkins will give us email notification if it doesn't or if we break something that was already working. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
2011-04-18Merge remote-tracking branch 'community/feature/puppet-device' into 2.7.xPieter van de Bruggen4-125/+185
Reviewed-By: Mike Stahnke
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman6-10/+10
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-08Updated confine in Spec test for RSpec 2James Turnbull1-3/+2
2011-04-08Add management of router/switchs global vlansBrice Figureau1-1/+21
This allows to manage the global device list of vlans. Currently supports only cisco IOS devices. This is as easy as: Vlan { device_url => "ssh://user:pass@switch.domain.com/" } vlan { "200": description => "R&D"; "99": description => "Management"; } The device_url conforms to the same specs as for the interface type. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-04-08Cisco Switch/Router Interface managementBrice Figureau2-0/+590
This patch introduces managing remotely cisco IOS network devices through ssh or telnet with a puppet type/provider. This patch allows to manage router/switch interface with the interface type: interface { "FastEthernet 0/1": device_url => "ssh://user:pass@cisco2960.domain.com/", mode => trunk, encapsulation => dot1q, trunk_allowed_vlans => "1-99,200,253", description => "to back bone router" } It is possible with this patch to set interface: * mode (access or trunk) * native vlan (only for access mode) * speed (auto or a given speed) * duplex (auto, half or full) * trunk encapsulation * allowed trunk vlan * ipv4 addresses * ipv6 addresses * etherchannel membership The interface name (at least for the cisco provider) can be any shorthand interface name a switch or router can use. The device url should conform to: * scheme: either telnet or ssh * user: can be absent depending on switch/router line config * pass: must be present * port: optional * an optional enable password can be mentioned in the url query string Ex: To connect to a switch with a line password and an enable password: "telnet://:letmein@cisco29224XL.domain.com/?enable=letmeinagain" To connect to a switch/router through ssh and a privileged user: "ssh://brice:letmein@cisco1841L.domain.com/" Note: This patch only includes a Cisco IOS provider. Also terminology adopted in the various types are mostly the ones used in Cisco devices. This patch was tested against: * (really old) Cisco switch 2924XL with ios 12.0(5)WC10 * Cisco router 1841 with ios 12.4(15)T8 * Cisco router 877 with ios 12.4(11)XJ4 * Cisco switch 2960G with ios 12.2(44)SE Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-04-08Ssh transport for network device managementBrice Figureau1-0/+212
It is an adapatation of net-ssh-telnet, so that net-ssh conforms to a saner interface for consumer. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-04-08Telnet transport to connect to remote network deviceBrice Figureau1-0/+76
It is based on net/telnet. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-04-08Remote Network Device transport systemBrice Figureau1-0/+42
This is the base for upcoming telnet and ssh transport mechanism to send commands to network devices. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
2011-04-08Introduce a module for some IP computationsBrice Figureau1-0/+63
Those will be used to parse IPs, compute netmaks or prefix length. Unfortunately ruby IPAddr doesn't support those directly. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>