summaryrefslogtreecommitdiffstats
path: root/spec/unit/util
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2011-01-02 19:26:19 +0100
committerJames Turnbull <james@lovedthanlost.net>2011-04-08 18:19:54 +1000
commit28e3db87a105eba5eddbb11167d0a6c33b18f8ce (patch)
tree528522c0f8f73fdd88facbc4dfe27cc05444554d /spec/unit/util
parent1cb18410732a4b51efa0a106d4a1437daef08fc5 (diff)
downloadpuppet-28e3db87a105eba5eddbb11167d0a6c33b18f8ce.tar.gz
puppet-28e3db87a105eba5eddbb11167d0a6c33b18f8ce.tar.xz
puppet-28e3db87a105eba5eddbb11167d0a6c33b18f8ce.zip
Add management of router/switchs global vlans
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>
Diffstat (limited to 'spec/unit/util')
-rw-r--r--spec/unit/util/network_device/cisco/device_spec.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/unit/util/network_device/cisco/device_spec.rb b/spec/unit/util/network_device/cisco/device_spec.rb
index 9021bbd2c..31aec920e 100644
--- a/spec/unit/util/network_device/cisco/device_spec.rb
+++ b/spec/unit/util/network_device/cisco/device_spec.rb
@@ -150,6 +150,26 @@ eos
end
end
+ describe "when updating device vlans" do
+ describe "when removing a vlan" do
+ it "should issue the no vlan command" do
+ @transport.expects(:command).with("no vlan 200")
+ @cisco.update_vlan("200", {:ensure => :present, :name => "200"}, { :ensure=> :absent})
+ end
+ end
+
+ describe "when updating a vlan" do
+ it "should issue the vlan command to enter global vlan modifications" do
+ @transport.expects(:command).with("vlan 200")
+ @cisco.update_vlan("200", {:ensure => :present, :name => "200"}, { :ensure=> :present, :name => "200"})
+ end
+
+ it "should issue the name command to modify the vlan description" do
+ @transport.expects(:command).with("name myvlan")
+ @cisco.update_vlan("200", {:ensure => :present, :name => "200"}, { :ensure=> :present, :name => "200", :description => "myvlan"})
+ end
+ end
+ end
describe "when parsing interface" do
@@ -228,7 +248,7 @@ VLAN Name Status Ports
Switch#
eos
- @cisco.parse_vlans.should == {"100"=>{:status=>"active", :interfaces=>["FastEthernet0/1", "FastEthernet0/2"], :name=>"management", :id=>"100"}, "1"=>{:status=>"active", :interfaces=>["FastEthernet0/3", "FastEthernet0/4", "FastEthernet0/5", "FastEthernet0/6", "FastEthernet0/7", "FastEthernet0/8", "FastEthernet0/9", "FastEthernet0/10", "FastEthernet0/11", "FastEthernet0/12", "FastEthernet0/13", "FastEthernet0/14", "FastEthernet0/15", "FastEthernet0/16", "FastEthernet0/17", "FastEthernet0/18", "FastEthernet0/23", "FastEthernet0/24"], :name=>"default", :id=>"1"}, "10"=>{:status=>"active", :interfaces=>[], :name=>"VLAN0010", :id=>"10"}}
+ @cisco.parse_vlans.should == {"100"=>{:status=>"active", :interfaces=>["FastEthernet0/1", "FastEthernet0/2"], :description=>"management", :name=>"100"}, "1"=>{:status=>"active", :interfaces=>["FastEthernet0/3", "FastEthernet0/4", "FastEthernet0/5", "FastEthernet0/6", "FastEthernet0/7", "FastEthernet0/8", "FastEthernet0/9", "FastEthernet0/10", "FastEthernet0/11", "FastEthernet0/12", "FastEthernet0/13", "FastEthernet0/14", "FastEthernet0/15", "FastEthernet0/16", "FastEthernet0/17", "FastEthernet0/18", "FastEthernet0/23", "FastEthernet0/24"], :description=>"default", :name=>"1"}, "10"=>{:status=>"active", :interfaces=>[], :description=>"VLAN0010", :name=>"10"}}
end
it "should parse trunk switchport information" do