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

fixes for freeport issues #533

Merged
merged 3 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/cisco_node_utils/route_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1596,14 +1596,17 @@ def set_metric_get
end

def set_metric_set(plus, bndw, del, reliability, eff_bw, mtu)
state = bndw ? '' : 'no'
set_args_keys(state: 'no', additive: '', bw: '', delay: '',
rel: '', eff: '', mtu: '')
config_set('route_map', 'set_metric', @set_args)
return unless bndw
additive = plus ? '+' : ''
bw = bndw ? bndw : ''
delay = del ? del : ''
rel = reliability ? reliability : ''
eff = eff_bw ? eff_bw : ''
lmtu = mtu ? mtu : ''
set_args_keys(state: state, additive: additive, bw: bw, delay: delay,
set_args_keys(state: '', additive: additive, bw: bw, delay: delay,
rel: rel, eff: eff, mtu: lmtu)
config_set('route_map', 'set_metric', @set_args)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/cisco_node_utils/snmpuser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def auth_password_equal?(input_pw, is_localized=false)
# Retrieve password hashes
hashed_pw = SnmpUser.auth_password('dummy_user', @engine_id)
if hashed_pw.nil?
fail "SNMP dummy user #{dummy_user} #{@engine_id} was configured " \
fail "SNMP dummy user dummy_user #{@engine_id} was configured " \
"but password is missing?\n" \
+ @@node.get(command: 'show run snmp all')
end
Expand Down Expand Up @@ -289,7 +289,7 @@ def priv_password_equal?(input_pw, is_localized=false)
dummyau = SnmpUser.auth_password('dummy_user', @engine_id)
hashed_pw = SnmpUser.priv_password('dummy_user', @engine_id)
if hashed_pw.nil?
fail "SNMP dummy user #{dummy_user} #{@engine_id} was configured " \
fail "SNMP dummy user dummy_user #{@engine_id} was configured " \
"but password is missing?\n" \
+ @@node.get(command: 'show run snmp all')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cisco_node_utils/vlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def cli_error_check(result, ignore_message=nil)
(result[2]['body'].split(errors) - ['']).each_slice(2).map(&:join)
error_list.each do |msg|
next if ignore_message && msg.to_s.include?(ignore_message)
fail result[2]['body']
fail Cisco::CliError
Copy link
Contributor

@mikewiebe mikewiebe Mar 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not realize this until now, but we loose granularity. We still need to bubble the actual error message result[2]['body'] up so that puppet users see the specific error message.

end
end

Expand Down
6 changes: 6 additions & 0 deletions tests/test_ace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,20 @@ def test_addrs
assert_equal(val, a.src_addr)
assert_equal(val, a.dst_addr)

config_no_warn('object-group ip address my_addrgroup_ipv4')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we get confirmation that this object being present is intended/expected behavior in I6?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will send email shortly

config_no_warn('object-group ipv6 address my_addrgroup_ipv6')
%w(ipv4 ipv6).each do |afi|
val = "addrgroup my_addrgroup_#{afi}"
a = ace_helper(afi, src_addr: val, dst_addr: val)
assert_equal(val, a.src_addr)
assert_equal(val, a.dst_addr)
end
config_no_warn('no object-group ip address my_addrgroup_ipv4')
config_no_warn('no object-group ipv6 address my_addrgroup_ipv6')
end

def test_ports
config_no_warn('object-group ip port my_pg')
%w(ipv4 ipv6).each do |afi|
['eq 2', 'neq 2', 'gt 2', 'lt 2',
'portgroup my_pg'].each do |val|
Expand All @@ -129,6 +134,7 @@ def test_ports
assert_equal(val, a.dst_port)
end
end
config_no_warn('no object-group ip port my_pg')
end

def test_dscp
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bgp_af.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def check_test_exceptions(test_, os_, vrf_, af_)
case Platform.image_version
when /8.0/
expect = :success
when /I5.2/
when /I5.2|I6/
expect = :success if test == :maximum_paths || test == :maximum_paths_ibgp
else
expect = :CliError
Expand Down
4 changes: 2 additions & 2 deletions tests/test_vlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_state_valid

def test_shutdown_extended
v = Vlan.new(2000)
assert_raises(RuntimeError, 'vlan misconfig did not raise RuntimeError') do
assert_raises(CliError, 'vlan misconfig did not raise RuntimeError') do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message should reference CliError now instead of RuntimeError.

v.shutdown = 'shutdown'
end
v.destroy
Expand Down Expand Up @@ -338,7 +338,7 @@ def test_another_vlan_as_fabric_control
assert(vlan.fabric_control)
another_vlan = Vlan.new(101)

assert_raises(RuntimeError,
assert_raises(CliError,
'VLAN misconfig did not raise CliError') do
another_vlan.fabric_control = true
end
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vlan_private.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def test_association_failure
assert_equal(result, v1.pvlan_association)

pv_type = 'isolated'
assert_raises(RuntimeError, 'vlan misconf did not raise RuntimeError') do
assert_raises(CliError, 'vlan misconf did not raise RuntimeError') do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message needs to be updated.

v3.pvlan_type = pv_type
end

Expand Down