Skip to content

Commit

Permalink
fixes for freeport issues (#533)
Browse files Browse the repository at this point in the history
* fixes for freeport issues

* review comment

* fix review comments
  • Loading branch information
saichint authored and mikewiebe committed Mar 21, 2017
1 parent ac8a976 commit a01b575
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
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, result[2]['body']
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')
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 CliError') do
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 CliError') do
v3.pvlan_type = pv_type
end

Expand Down

0 comments on commit a01b575

Please sign in to comment.