cisco_node_utils 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +126 -1
- data/README.md +19 -12
- data/Rakefile +1 -0
- data/bin/git/hooks/commit-msg/enforce_style +8 -0
- data/cisco_node_utils.gemspec +4 -3
- data/docs/README-develop-best-practices.md +127 -109
- data/docs/README-develop-node-utils-APIs.md +47 -39
- data/docs/template-router.rb +3 -7
- data/lib/.rubocop.yml +4 -4
- data/lib/cisco_node_utils.rb +1 -1
- data/lib/cisco_node_utils/aaa_authentication_login.rb +96 -0
- data/lib/cisco_node_utils/aaa_authentication_login_service.rb +133 -0
- data/lib/cisco_node_utils/aaa_authorization_service.rb +150 -0
- data/lib/cisco_node_utils/ace.rb +196 -0
- data/lib/cisco_node_utils/acl.rb +100 -0
- data/lib/cisco_node_utils/bgp.rb +301 -163
- data/lib/cisco_node_utils/bgp_af.rb +187 -19
- data/lib/cisco_node_utils/bgp_neighbor.rb +18 -33
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +25 -48
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +23 -4
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +593 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +22 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +31 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +22 -0
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +43 -0
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +242 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +164 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +131 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +179 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +34 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +42 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +172 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +35 -0
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +42 -0
- data/lib/cisco_node_utils/cmd_ref/fex.yaml +9 -0
- data/lib/cisco_node_utils/cmd_ref/images.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +339 -0
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +28 -0
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +61 -0
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +54 -0
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +32 -0
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +13 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +14 -0
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +74 -0
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +40 -0
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +69 -0
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +64 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +14 -0
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +5 -0
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +72 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +23 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +50 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +51 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +55 -0
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +11 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +18 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/system.yaml +6 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +49 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +35 -0
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +6 -0
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +56 -0
- data/lib/cisco_node_utils/cmd_ref/vni.yaml +76 -0
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +197 -0
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +88 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +60 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +39 -0
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +13 -0
- data/lib/cisco_node_utils/command_reference.rb +359 -187
- data/lib/cisco_node_utils/configparser_lib.rb +1 -1
- data/lib/cisco_node_utils/dns_domain.rb +19 -5
- data/lib/cisco_node_utils/domain_name.rb +4 -8
- data/lib/cisco_node_utils/evpn_vni.rb +157 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +388 -0
- data/lib/cisco_node_utils/fabricpath_topology.rb +150 -0
- data/lib/cisco_node_utils/feature.rb +111 -0
- data/lib/cisco_node_utils/interface.rb +390 -97
- data/lib/cisco_node_utils/interface_channel_group.rb +124 -0
- data/lib/cisco_node_utils/interface_ospf.rb +11 -34
- data/lib/cisco_node_utils/interface_portchannel.rb +157 -0
- data/lib/cisco_node_utils/interface_service_vni.rb +132 -0
- data/lib/cisco_node_utils/name_server.rb +1 -1
- data/lib/cisco_node_utils/node.rb +55 -249
- data/lib/cisco_node_utils/node_util.rb +5 -1
- data/lib/cisco_node_utils/ntp_config.rb +2 -2
- data/lib/cisco_node_utils/ntp_server.rb +14 -5
- data/lib/cisco_node_utils/overlay_global.rb +153 -0
- data/lib/cisco_node_utils/pim.rb +124 -0
- data/lib/cisco_node_utils/pim_group_list.rb +108 -0
- data/lib/cisco_node_utils/pim_rp_address.rb +102 -0
- data/lib/cisco_node_utils/platform.rb +8 -9
- data/lib/cisco_node_utils/portchannel_global.rb +277 -0
- data/lib/cisco_node_utils/radius_global.rb +9 -19
- data/lib/cisco_node_utils/radius_server.rb +31 -41
- data/lib/cisco_node_utils/radius_server_group.rb +117 -0
- data/lib/cisco_node_utils/router_ospf.rb +1 -1
- data/lib/cisco_node_utils/router_ospf_vrf.rb +14 -19
- data/lib/cisco_node_utils/snmp_notification_receiver.rb +158 -0
- data/lib/cisco_node_utils/snmpcommunity.rb +3 -5
- data/lib/cisco_node_utils/snmpgroup.rb +1 -1
- data/lib/cisco_node_utils/snmpnotification.rb +57 -0
- data/lib/cisco_node_utils/snmpserver.rb +8 -17
- data/lib/cisco_node_utils/snmpuser.rb +67 -28
- data/lib/cisco_node_utils/syslog_server.rb +3 -9
- data/lib/cisco_node_utils/syslog_settings.rb +2 -10
- data/lib/cisco_node_utils/tacacs_server.rb +9 -14
- data/lib/cisco_node_utils/tacacs_server_group.rb +145 -0
- data/lib/cisco_node_utils/tacacs_server_host.rb +5 -9
- data/lib/cisco_node_utils/vdc.rb +88 -0
- data/lib/cisco_node_utils/version.rb +5 -2
- data/lib/cisco_node_utils/vlan.rb +71 -8
- data/lib/cisco_node_utils/vni.rb +227 -0
- data/lib/cisco_node_utils/vpc.rb +377 -0
- data/lib/cisco_node_utils/vrf.rb +60 -9
- data/lib/cisco_node_utils/vrf_af.rb +191 -0
- data/lib/cisco_node_utils/vtp.rb +8 -6
- data/lib/cisco_node_utils/vxlan_vtep.rb +151 -0
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +234 -0
- data/lib/cisco_node_utils/yum.rb +1 -1
- data/tests/.rubocop.yml +1 -1
- data/tests/basetest.rb +16 -7
- data/tests/ciscotest.rb +55 -13
- data/tests/cmd_config.yaml +2 -2
- data/tests/platform_info.rb +3 -2
- data/tests/test_aaa_authentication_login.rb +219 -0
- data/tests/test_aaa_authentication_login_service.rb +759 -0
- data/tests/test_aaa_authorization_service.rb +1041 -0
- data/tests/test_ace.rb +160 -0
- data/tests/test_acl.rb +176 -0
- data/tests/test_bgp_af.rb +269 -13
- data/tests/test_bgp_neighbor.rb +38 -40
- data/tests/test_bgp_neighbor_af.rb +92 -32
- data/tests/test_command_config.rb +5 -5
- data/tests/test_command_reference.rb +284 -101
- data/tests/test_dns_domain.rb +1 -1
- data/tests/test_domain_name.rb +1 -1
- data/tests/test_evpn_vni.rb +106 -0
- data/tests/test_fabricpath_global.rb +243 -0
- data/tests/test_fabricpath_topology.rb +98 -0
- data/tests/test_interface.rb +292 -74
- data/tests/test_interface_channel_group.rb +74 -0
- data/tests/test_interface_ospf.rb +9 -4
- data/tests/test_interface_portchannel.rb +105 -0
- data/tests/test_interface_service_vni.rb +232 -0
- data/tests/test_interface_svi.rb +77 -62
- data/tests/test_interface_switchport.rb +17 -5
- data/tests/test_name_server.rb +1 -1
- data/tests/test_node.rb +1 -1
- data/tests/test_node_ext.rb +10 -20
- data/tests/test_ntp_config.rb +1 -1
- data/tests/test_ntp_server.rb +18 -6
- data/tests/test_overlay_global.rb +102 -0
- data/tests/test_pim.rb +177 -0
- data/tests/test_pim_group_list.rb +181 -0
- data/tests/test_pim_rp_address.rb +153 -0
- data/tests/test_platform.rb +3 -3
- data/tests/test_portchannel_global.rb +202 -0
- data/tests/test_radius_global.rb +1 -1
- data/tests/test_radius_server.rb +92 -57
- data/tests/test_radius_server_group.rb +149 -0
- data/tests/test_router_bgp.rb +283 -112
- data/tests/test_router_ospf.rb +2 -2
- data/tests/test_router_ospf_vrf.rb +4 -4
- data/tests/test_snmp_notification_receiver.rb +167 -0
- data/tests/test_snmpcommunity.rb +1 -1
- data/tests/test_snmpgroup.rb +1 -1
- data/tests/test_snmpnotification.rb +72 -0
- data/tests/test_snmpserver.rb +29 -105
- data/tests/test_snmpuser.rb +32 -30
- data/tests/test_syslog_server.rb +36 -10
- data/tests/test_syslog_settings.rb +1 -1
- data/tests/test_tacacs_server.rb +1 -1
- data/tests/test_tacacs_server_group.rb +405 -0
- data/tests/test_tacacs_server_host.rb +1 -1
- data/tests/test_vdc.rb +78 -0
- data/tests/test_vlan.rb +74 -19
- data/tests/test_vlan_mt_full.rb +95 -0
- data/tests/test_vni.rb +106 -0
- data/tests/test_vpc.rb +361 -0
- data/tests/test_vrf.rb +172 -29
- data/tests/test_vtp.rb +1 -1
- data/tests/test_vxlan_vtep.rb +214 -0
- data/tests/test_vxlan_vtep_vni.rb +201 -0
- data/tests/test_yum.rb +1 -1
- metadata +120 -11
- data/lib/cisco_node_utils/README_YAML.md +0 -325
- data/lib/cisco_node_utils/command_reference_common.yaml +0 -1051
- data/lib/cisco_node_utils/command_reference_common_bgp.yaml +0 -535
- data/lib/cisco_node_utils/command_reference_n3064.yaml +0 -13
- data/lib/cisco_node_utils/command_reference_n7k.yaml +0 -52
- data/lib/cisco_node_utils/command_reference_n9k.yaml +0 -26
- data/tests/platform_info.yaml +0 -10
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Minitest for RadiusServerGroup class
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
|
|
18
|
+
require File.expand_path('../ciscotest', __FILE__)
|
|
19
|
+
require File.expand_path('../../lib/cisco_node_utils/radius_server_group', \
|
|
20
|
+
__FILE__)
|
|
21
|
+
|
|
22
|
+
# TestRadiusServerGroup - Minitest for RadiusServerGroup node utility.
|
|
23
|
+
class TestRadiusServerGroup < CiscoTestCase
|
|
24
|
+
def setup
|
|
25
|
+
# setup runs at the beginning of each test
|
|
26
|
+
super
|
|
27
|
+
config('radius-server host 8.8.8.8',
|
|
28
|
+
'radius-server host 9.9.9.9',
|
|
29
|
+
'radius-server host 10.10.10.10',
|
|
30
|
+
'radius-server host 11.11.11.11',
|
|
31
|
+
'radius-server host 12.12.12.12',
|
|
32
|
+
'radius-server host 2005::3',
|
|
33
|
+
'radius-server host 2006::3',
|
|
34
|
+
'radius-server host 2007::3',
|
|
35
|
+
'radius-server host 2008::3')
|
|
36
|
+
no_radiusserver
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def teardown
|
|
40
|
+
# teardown runs at the end of each test
|
|
41
|
+
config('no radius-server host 8.8.8.8',
|
|
42
|
+
'no radius-server host 9.9.9.9',
|
|
43
|
+
'no radius-server host 10.10.10.10',
|
|
44
|
+
'no radius-server host 11.11.11.11',
|
|
45
|
+
'no radius-server host 12.12.12.12',
|
|
46
|
+
'no radius-server host 2005::3',
|
|
47
|
+
'no radius-server host 2006::3',
|
|
48
|
+
'no radius-server host 2007::3',
|
|
49
|
+
'no radius-server host 2008::3')
|
|
50
|
+
no_radiusserver
|
|
51
|
+
super
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def no_radiusserver
|
|
55
|
+
# Turn the feature off for a clean test.
|
|
56
|
+
config('no aaa group server radius red',
|
|
57
|
+
'no aaa group server radius blue')
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# TESTS
|
|
61
|
+
|
|
62
|
+
def test_create_destroy_single
|
|
63
|
+
id = 'red'
|
|
64
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
65
|
+
|
|
66
|
+
group = Cisco::RadiusServerGroup.new(id, true)
|
|
67
|
+
assert_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
68
|
+
assert_equal(group, Cisco::RadiusServerGroup.radius_server_groups[id])
|
|
69
|
+
|
|
70
|
+
group.servers = ['8.8.8.8', '9.9.9.9']
|
|
71
|
+
assert_equal(['8.8.8.8', '9.9.9.9'],
|
|
72
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
73
|
+
|
|
74
|
+
group.servers = ['8.8.8.8', '10.10.10.10']
|
|
75
|
+
assert_equal(['8.8.8.8', '10.10.10.10'],
|
|
76
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
77
|
+
|
|
78
|
+
group.servers = []
|
|
79
|
+
assert_equal([],
|
|
80
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
81
|
+
|
|
82
|
+
group.destroy
|
|
83
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_create_destroy_single_ipv6
|
|
87
|
+
id = 'red'
|
|
88
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
89
|
+
|
|
90
|
+
group = Cisco::RadiusServerGroup.new(id, true)
|
|
91
|
+
assert_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
92
|
+
assert_equal(group, Cisco::RadiusServerGroup.radius_server_groups[id])
|
|
93
|
+
|
|
94
|
+
group.servers = ['2005::3', '2006::3']
|
|
95
|
+
assert_equal(['2005::3', '2006::3'],
|
|
96
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
97
|
+
|
|
98
|
+
group.servers = ['2005::3', '2007::3']
|
|
99
|
+
assert_equal(['2005::3', '2007::3'],
|
|
100
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
101
|
+
|
|
102
|
+
group.servers = []
|
|
103
|
+
assert_equal([],
|
|
104
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
105
|
+
|
|
106
|
+
group.destroy
|
|
107
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def test_create_destroy_multiple
|
|
111
|
+
id = 'red'
|
|
112
|
+
id2 = 'blue'
|
|
113
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
114
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id2)
|
|
115
|
+
|
|
116
|
+
group = Cisco::RadiusServerGroup.new(id, true)
|
|
117
|
+
group2 = Cisco::RadiusServerGroup.new(id2, true)
|
|
118
|
+
assert_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
119
|
+
assert_equal(group, Cisco::RadiusServerGroup.radius_server_groups[id])
|
|
120
|
+
assert_includes(Cisco::RadiusServerGroup.radius_server_groups, id2)
|
|
121
|
+
assert_equal(group2, Cisco::RadiusServerGroup.radius_server_groups[id2])
|
|
122
|
+
|
|
123
|
+
group.servers = ['8.8.8.8', '9.9.9.9']
|
|
124
|
+
assert_equal(['8.8.8.8', '9.9.9.9'],
|
|
125
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
126
|
+
group2.servers = ['11.11.11.11', '12.12.12.12']
|
|
127
|
+
assert_equal(['11.11.11.11', '12.12.12.12'],
|
|
128
|
+
Cisco::RadiusServerGroup.radius_server_groups[id2].servers)
|
|
129
|
+
|
|
130
|
+
group.servers = ['8.8.8.8', '10.10.10.10']
|
|
131
|
+
assert_equal(['8.8.8.8', '10.10.10.10'],
|
|
132
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
133
|
+
group2.servers = ['11.11.11.11', '2008::3']
|
|
134
|
+
assert_equal(['11.11.11.11', '2008::3'],
|
|
135
|
+
Cisco::RadiusServerGroup.radius_server_groups[id2].servers)
|
|
136
|
+
|
|
137
|
+
group.servers = []
|
|
138
|
+
assert_equal([],
|
|
139
|
+
Cisco::RadiusServerGroup.radius_server_groups[id].servers)
|
|
140
|
+
group2.servers = []
|
|
141
|
+
assert_equal([],
|
|
142
|
+
Cisco::RadiusServerGroup.radius_server_groups[id2].servers)
|
|
143
|
+
|
|
144
|
+
group.destroy
|
|
145
|
+
group2.destroy
|
|
146
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id)
|
|
147
|
+
refute_includes(Cisco::RadiusServerGroup.radius_server_groups, id2)
|
|
148
|
+
end
|
|
149
|
+
end
|
data/tests/test_router_bgp.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#
|
|
4
4
|
# Mike Wiebe, June, 2015
|
|
5
5
|
#
|
|
6
|
-
# Copyright (c) 2015 Cisco and/or its affiliates.
|
|
6
|
+
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
|
|
7
7
|
#
|
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
9
|
# you may not use this file except in compliance with the License.
|
|
@@ -22,11 +22,17 @@ require_relative '../lib/cisco_node_utils/bgp'
|
|
|
22
22
|
|
|
23
23
|
# TestRouterBgp - Minitest for RouterBgp class
|
|
24
24
|
class TestRouterBgp < CiscoTestCase
|
|
25
|
+
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
|
26
|
+
|
|
25
27
|
def setup
|
|
26
|
-
# Disable feature bgp before each test to ensure we
|
|
27
|
-
# are starting with a clean slate for each test.
|
|
28
28
|
super
|
|
29
|
-
|
|
29
|
+
remove_all_bgps if @@pre_clean_needed
|
|
30
|
+
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def teardown
|
|
34
|
+
super
|
|
35
|
+
remove_all_bgps
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
def get_routerbgp_match_line(as_number, vrf='default')
|
|
@@ -39,14 +45,14 @@ class TestRouterBgp < CiscoTestCase
|
|
|
39
45
|
line
|
|
40
46
|
end
|
|
41
47
|
|
|
42
|
-
def
|
|
48
|
+
def test_collection_empty
|
|
43
49
|
config('no feature bgp')
|
|
44
50
|
node.cache_flush
|
|
45
51
|
routers = RouterBgp.routers
|
|
46
52
|
assert_empty(routers, 'RouterBgp collection is not empty')
|
|
47
53
|
end
|
|
48
54
|
|
|
49
|
-
def
|
|
55
|
+
def test_collection_not_empty
|
|
50
56
|
config('feature bgp',
|
|
51
57
|
'router bgp 55',
|
|
52
58
|
'vrf blue',
|
|
@@ -67,15 +73,15 @@ class TestRouterBgp < CiscoTestCase
|
|
|
67
73
|
end
|
|
68
74
|
end
|
|
69
75
|
|
|
70
|
-
def
|
|
71
|
-
['',
|
|
76
|
+
def test_asnum_invalid
|
|
77
|
+
['', 'Fifty_Five'].each do |test|
|
|
72
78
|
assert_raises(ArgumentError, "#{test} not a valid asn") do
|
|
73
79
|
RouterBgp.new(test)
|
|
74
80
|
end
|
|
75
81
|
end
|
|
76
82
|
end
|
|
77
83
|
|
|
78
|
-
def
|
|
84
|
+
def test_vrf_invalid
|
|
79
85
|
['', 55].each do |test|
|
|
80
86
|
assert_raises(ArgumentError, "#{test} not a valid vrf name") do
|
|
81
87
|
RouterBgp.new(88, test)
|
|
@@ -83,14 +89,14 @@ class TestRouterBgp < CiscoTestCase
|
|
|
83
89
|
end
|
|
84
90
|
end
|
|
85
91
|
|
|
86
|
-
def
|
|
92
|
+
def test_create_vrfname_zero_length
|
|
87
93
|
asnum = 55
|
|
88
94
|
assert_raises(ArgumentError) do
|
|
89
95
|
RouterBgp.new(asnum, '')
|
|
90
96
|
end
|
|
91
97
|
end
|
|
92
98
|
|
|
93
|
-
def
|
|
99
|
+
def test_create_valid
|
|
94
100
|
asnum = 55
|
|
95
101
|
bgp = RouterBgp.new(asnum)
|
|
96
102
|
line = get_routerbgp_match_line(asnum)
|
|
@@ -104,26 +110,22 @@ class TestRouterBgp < CiscoTestCase
|
|
|
104
110
|
bgp.destroy
|
|
105
111
|
end
|
|
106
112
|
|
|
107
|
-
def
|
|
113
|
+
def test_valid_asn
|
|
108
114
|
[1, 4_294_967_295, '55', '1.0', '1.65535',
|
|
109
115
|
'65535.0', '65535.65535'].each do |test|
|
|
110
|
-
|
|
111
|
-
test
|
|
112
|
-
|
|
113
|
-
refute_nil(line, "Error: 'router bgp #{test}' not configured")
|
|
114
|
-
bgp.destroy
|
|
116
|
+
rtr_bgp = RouterBgp.new(test)
|
|
117
|
+
assert_equal(test.to_s, RouterBgp.routers.keys[0].to_s)
|
|
118
|
+
rtr_bgp.destroy
|
|
115
119
|
|
|
116
120
|
vrf = 'Duke'
|
|
117
|
-
|
|
118
|
-
test
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"Error: 'router bgp #{test}' vrf '#{vrf}' not configured")
|
|
122
|
-
bgp.destroy
|
|
121
|
+
bgp_vrf = RouterBgp.new(test, vrf)
|
|
122
|
+
assert_equal(test.to_s, RouterBgp.routers.keys[0].to_s)
|
|
123
|
+
bgp_vrf.destroy
|
|
124
|
+
rtr_bgp.destroy
|
|
123
125
|
end
|
|
124
126
|
end
|
|
125
127
|
|
|
126
|
-
def
|
|
128
|
+
def test_create_valid_no_feature
|
|
127
129
|
asnum = 55
|
|
128
130
|
bgp = RouterBgp.new(asnum)
|
|
129
131
|
line = get_routerbgp_match_line(asnum)
|
|
@@ -135,14 +137,14 @@ class TestRouterBgp < CiscoTestCase
|
|
|
135
137
|
assert_nil(line, "Error: 'feature bgp' still configured")
|
|
136
138
|
end
|
|
137
139
|
|
|
138
|
-
def
|
|
140
|
+
def test_create_invalid_multiple
|
|
139
141
|
asnum = 55
|
|
140
142
|
bgp1 = RouterBgp.new(asnum)
|
|
141
143
|
line = get_routerbgp_match_line(asnum)
|
|
142
144
|
refute_nil(line, "Error: 'router bgp #{asnum}' not configured")
|
|
143
145
|
|
|
144
146
|
# Only one bgp instance supported so try to create another.
|
|
145
|
-
assert_raises(
|
|
147
|
+
assert_raises(CliError) do
|
|
146
148
|
bgp2 = RouterBgp.new(88)
|
|
147
149
|
bgp2.destroy unless bgp2.nil?
|
|
148
150
|
end
|
|
@@ -150,17 +152,18 @@ class TestRouterBgp < CiscoTestCase
|
|
|
150
152
|
bgp1.destroy
|
|
151
153
|
end
|
|
152
154
|
|
|
153
|
-
def
|
|
154
|
-
asnum =
|
|
155
|
+
def test_asnum_dot
|
|
156
|
+
asnum = 65_540
|
|
155
157
|
bgp = RouterBgp.new(asnum)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
assert_equal(asnum.to_s, bgp.asnum, 'Error: router asnum incorrect')
|
|
159
|
+
|
|
160
|
+
# Create a new object with the same ASN value but using AS_DOT notation
|
|
161
|
+
assert_raises(CliError) do
|
|
162
|
+
RouterBgp.new('1.4')
|
|
163
|
+
end
|
|
161
164
|
end
|
|
162
165
|
|
|
163
|
-
def
|
|
166
|
+
def test_destroy
|
|
164
167
|
asnum = 55
|
|
165
168
|
bgp = RouterBgp.new(asnum)
|
|
166
169
|
bgp.destroy
|
|
@@ -168,7 +171,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
168
171
|
assert_nil(line, "Error: 'router bgp #{asnum}' not destroyed")
|
|
169
172
|
end
|
|
170
173
|
|
|
171
|
-
def
|
|
174
|
+
def test_bestpath
|
|
172
175
|
%w(test_default test_vrf).each do |t|
|
|
173
176
|
if t == 'test_default'
|
|
174
177
|
asnum = 55
|
|
@@ -226,7 +229,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
226
229
|
end
|
|
227
230
|
end
|
|
228
231
|
|
|
229
|
-
def
|
|
232
|
+
def test_bestpath_not_configured
|
|
230
233
|
%w(test_default test_vrf).each do |t|
|
|
231
234
|
if t == 'test_default'
|
|
232
235
|
asnum = 55
|
|
@@ -255,7 +258,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
255
258
|
end
|
|
256
259
|
end
|
|
257
260
|
|
|
258
|
-
def
|
|
261
|
+
def test_default_bestpath
|
|
259
262
|
asnum = 55
|
|
260
263
|
bgp = RouterBgp.new(asnum)
|
|
261
264
|
refute(bgp.default_bestpath_always_compare_med,
|
|
@@ -275,7 +278,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
275
278
|
bgp.destroy
|
|
276
279
|
end
|
|
277
280
|
|
|
278
|
-
def
|
|
281
|
+
def test_cluster_id
|
|
279
282
|
%w(test_default test_vrf).each do |t|
|
|
280
283
|
if t == 'test_default'
|
|
281
284
|
asnum = 55
|
|
@@ -299,7 +302,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
299
302
|
end
|
|
300
303
|
end
|
|
301
304
|
|
|
302
|
-
def
|
|
305
|
+
def test_cluster_id_not_configured
|
|
303
306
|
asnum = 55
|
|
304
307
|
bgp = RouterBgp.new(asnum)
|
|
305
308
|
assert_empty(bgp.cluster_id,
|
|
@@ -307,7 +310,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
307
310
|
bgp.destroy
|
|
308
311
|
end
|
|
309
312
|
|
|
310
|
-
def
|
|
313
|
+
def test_default_cluster_id
|
|
311
314
|
asnum = 55
|
|
312
315
|
bgp = RouterBgp.new(asnum)
|
|
313
316
|
assert_empty(bgp.default_cluster_id,
|
|
@@ -315,7 +318,67 @@ class TestRouterBgp < CiscoTestCase
|
|
|
315
318
|
bgp.destroy
|
|
316
319
|
end
|
|
317
320
|
|
|
318
|
-
def
|
|
321
|
+
def test_disable_policy_batching
|
|
322
|
+
asnum = 55
|
|
323
|
+
bgp = RouterBgp.new(asnum)
|
|
324
|
+
bgp.disable_policy_batching = true
|
|
325
|
+
assert(bgp.disable_policy_batching,
|
|
326
|
+
'bgp disable-policy-batching should be enabled')
|
|
327
|
+
bgp.disable_policy_batching = false
|
|
328
|
+
refute(bgp.disable_policy_batching,
|
|
329
|
+
'bgp disable-policy-batching should be disabled')
|
|
330
|
+
bgp.destroy
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
def test_default_disable_policy_batching
|
|
334
|
+
asnum = 55
|
|
335
|
+
bgp = RouterBgp.new(asnum)
|
|
336
|
+
refute(bgp.disable_policy_batching,
|
|
337
|
+
'bgp disable-policy-batching value should be false')
|
|
338
|
+
bgp.destroy
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def test_disable_policy_batching_ipv4
|
|
342
|
+
bgp = RouterBgp.new(55)
|
|
343
|
+
bgp.disable_policy_batching_ipv4 = 'xx'
|
|
344
|
+
assert_equal('xx', bgp.disable_policy_batching_ipv4,
|
|
345
|
+
"bgp disable_policy_batching_ipv4 should be set to 'xx'")
|
|
346
|
+
bgp.disable_policy_batching_ipv4 = bgp.default_disable_policy_batching_ipv4
|
|
347
|
+
assert_empty(bgp.disable_policy_batching_ipv4,
|
|
348
|
+
'bgp disable_policy_batching_ipv4 should be empty')
|
|
349
|
+
bgp.destroy
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def test_default_disable_policy_batching_ipv4
|
|
353
|
+
asnum = 55
|
|
354
|
+
bgp = RouterBgp.new(asnum)
|
|
355
|
+
assert_equal(bgp.default_disable_policy_batching_ipv4,
|
|
356
|
+
bgp.disable_policy_batching_ipv4,
|
|
357
|
+
'disable_policy_batching_ipv4 default value should be empty')
|
|
358
|
+
bgp.destroy
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def test_disable_policy_batching_ipv6
|
|
362
|
+
bgp = RouterBgp.new(55)
|
|
363
|
+
bgp.disable_policy_batching_ipv6 = 'xx'
|
|
364
|
+
assert_equal('xx', bgp.disable_policy_batching_ipv6,
|
|
365
|
+
"bgp disable_policy_batching_ipv6 should be set to 'xx'")
|
|
366
|
+
bgp.disable_policy_batching_ipv6 = bgp.default_disable_policy_batching_ipv6
|
|
367
|
+
assert_empty(bgp.disable_policy_batching_ipv6,
|
|
368
|
+
'bgp disable_policy_batching_ipv6 should be empty')
|
|
369
|
+
bgp.destroy
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
def test_default_disable_policy_batching_ipv6
|
|
373
|
+
asnum = 55
|
|
374
|
+
bgp = RouterBgp.new(asnum)
|
|
375
|
+
assert_equal(bgp.default_disable_policy_batching_ipv6,
|
|
376
|
+
bgp.disable_policy_batching_ipv6,
|
|
377
|
+
'disable_policy_batching_ipv6 default value should be empty')
|
|
378
|
+
bgp.destroy
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
def test_enforce_first_as
|
|
319
382
|
asnum = 55
|
|
320
383
|
bgp = RouterBgp.new(asnum)
|
|
321
384
|
bgp.enforce_first_as = true
|
|
@@ -327,7 +390,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
327
390
|
bgp.destroy
|
|
328
391
|
end
|
|
329
392
|
|
|
330
|
-
def
|
|
393
|
+
def test_default_enforce_first_as
|
|
331
394
|
asnum = 55
|
|
332
395
|
bgp = RouterBgp.new(asnum)
|
|
333
396
|
assert(bgp.enforce_first_as,
|
|
@@ -335,7 +398,88 @@ class TestRouterBgp < CiscoTestCase
|
|
|
335
398
|
bgp.destroy
|
|
336
399
|
end
|
|
337
400
|
|
|
338
|
-
def
|
|
401
|
+
def test_event_history
|
|
402
|
+
bgp = RouterBgp.new(55)
|
|
403
|
+
|
|
404
|
+
opts = [:cli, :detail, :events, :periodic]
|
|
405
|
+
opts.each do |opt|
|
|
406
|
+
# Test basic true
|
|
407
|
+
bgp.send("event_history_#{opt}=", 'true')
|
|
408
|
+
set = bgp.send("default_event_history_#{opt}")
|
|
409
|
+
result = bgp.send("event_history_#{opt}")
|
|
410
|
+
assert_equal(set, result,
|
|
411
|
+
"event_history_#{opt}: Failed to set to default state")
|
|
412
|
+
|
|
413
|
+
# Test true with size
|
|
414
|
+
bgp.send("event_history_#{opt}=", 'size_large')
|
|
415
|
+
result = bgp.send("event_history_#{opt}")
|
|
416
|
+
assert_equal('size_large', result,
|
|
417
|
+
"event_history_#{opt}: Failed to set True with Size large")
|
|
418
|
+
|
|
419
|
+
# Test false with size
|
|
420
|
+
bgp.send("event_history_#{opt}=", 'false')
|
|
421
|
+
result = bgp.send("event_history_#{opt}")
|
|
422
|
+
expected = (opt == :detail) ? bgp.default_event_history_detail : 'false'
|
|
423
|
+
assert_equal(expected, result,
|
|
424
|
+
"event_history_#{opt}: Failed to set state to False")
|
|
425
|
+
|
|
426
|
+
# Test true with size, from false
|
|
427
|
+
bgp.send("event_history_#{opt}=", 'size_small')
|
|
428
|
+
result = bgp.send("event_history_#{opt}")
|
|
429
|
+
assert_equal('size_small', result,
|
|
430
|
+
"event_history_#{opt}: Failed to set True with "\
|
|
431
|
+
'Size from false state')
|
|
432
|
+
|
|
433
|
+
# Test default_state
|
|
434
|
+
set = bgp.send("default_event_history_#{opt}")
|
|
435
|
+
bgp.send("event_history_#{opt}=", set)
|
|
436
|
+
result = bgp.send("event_history_#{opt}")
|
|
437
|
+
assert_equal(set, result,
|
|
438
|
+
"event_history_#{opt}: Failed to set state to default")
|
|
439
|
+
end
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
def test_fast_external_fallover
|
|
443
|
+
asnum = 55
|
|
444
|
+
bgp = RouterBgp.new(asnum)
|
|
445
|
+
bgp.fast_external_fallover = true
|
|
446
|
+
assert(bgp.fast_external_fallover,
|
|
447
|
+
'bgp fast-external-fallover should be enabled')
|
|
448
|
+
bgp.fast_external_fallover = false
|
|
449
|
+
refute(bgp.fast_external_fallover,
|
|
450
|
+
'bgp fast-external-fallover should be disabled')
|
|
451
|
+
bgp.destroy
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
def test_default_fast_external_fallover
|
|
455
|
+
asnum = 55
|
|
456
|
+
bgp = RouterBgp.new(asnum)
|
|
457
|
+
assert(bgp.fast_external_fallover,
|
|
458
|
+
'bgp fast-external-fallover default value should be true')
|
|
459
|
+
bgp.destroy
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
def test_flush_routes
|
|
463
|
+
asnum = 55
|
|
464
|
+
bgp = RouterBgp.new(asnum)
|
|
465
|
+
bgp.flush_routes = true
|
|
466
|
+
assert(bgp.flush_routes,
|
|
467
|
+
'bgp flush-routes should be enabled')
|
|
468
|
+
bgp.flush_routes = false
|
|
469
|
+
refute(bgp.flush_routes,
|
|
470
|
+
'bgp flush-routes should be disabled')
|
|
471
|
+
bgp.destroy
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
def test_default_flush_routes
|
|
475
|
+
asnum = 55
|
|
476
|
+
bgp = RouterBgp.new(asnum)
|
|
477
|
+
refute(bgp.flush_routes,
|
|
478
|
+
'bgp flush-routes value default value should be false')
|
|
479
|
+
bgp.destroy
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
def test_graceful_restart
|
|
339
483
|
%w(test_default test_vrf).each do |t|
|
|
340
484
|
if t == 'test_default'
|
|
341
485
|
asnum = 55
|
|
@@ -379,7 +523,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
379
523
|
end
|
|
380
524
|
end
|
|
381
525
|
|
|
382
|
-
def
|
|
526
|
+
def test_default_graceful_restart
|
|
383
527
|
asnum = 55
|
|
384
528
|
bgp = RouterBgp.new(asnum)
|
|
385
529
|
assert(bgp.default_graceful_restart,
|
|
@@ -392,7 +536,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
392
536
|
'graceful restart helper default value should be enabled = false')
|
|
393
537
|
end
|
|
394
538
|
|
|
395
|
-
def
|
|
539
|
+
def test_confederation_id
|
|
396
540
|
%w(test_default test_vrf).each do |t|
|
|
397
541
|
if t == 'test_default'
|
|
398
542
|
asnum = 55
|
|
@@ -413,7 +557,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
413
557
|
end
|
|
414
558
|
end
|
|
415
559
|
|
|
416
|
-
def
|
|
560
|
+
def test_confed_id_uu76828
|
|
417
561
|
asnum = 55
|
|
418
562
|
bgp = RouterBgp.new(asnum)
|
|
419
563
|
bgp.confederation_id = 55.77
|
|
@@ -421,7 +565,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
421
565
|
"bgp confederation_id should be set to '55.77'")
|
|
422
566
|
end
|
|
423
567
|
|
|
424
|
-
def
|
|
568
|
+
def test_confederation_id_not_configured
|
|
425
569
|
asnum = 55
|
|
426
570
|
bgp = RouterBgp.new(asnum)
|
|
427
571
|
assert_empty(bgp.confederation_id,
|
|
@@ -429,7 +573,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
429
573
|
bgp.destroy
|
|
430
574
|
end
|
|
431
575
|
|
|
432
|
-
def
|
|
576
|
+
def test_default_confederation_id
|
|
433
577
|
asnum = 55
|
|
434
578
|
bgp = RouterBgp.new(asnum)
|
|
435
579
|
assert_empty(bgp.default_confederation_id,
|
|
@@ -437,7 +581,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
437
581
|
bgp.destroy
|
|
438
582
|
end
|
|
439
583
|
|
|
440
|
-
def
|
|
584
|
+
def test_confederation_peers
|
|
441
585
|
%w(test_default test_vrf).each do |t|
|
|
442
586
|
if t == 'test_default'
|
|
443
587
|
asnum = 55
|
|
@@ -476,7 +620,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
476
620
|
end
|
|
477
621
|
end
|
|
478
622
|
|
|
479
|
-
def
|
|
623
|
+
def test_confederation_peers_not_configured
|
|
480
624
|
asnum = 55
|
|
481
625
|
bgp = RouterBgp.new(asnum)
|
|
482
626
|
assert_empty(bgp.confederation_peers,
|
|
@@ -484,7 +628,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
484
628
|
bgp.destroy
|
|
485
629
|
end
|
|
486
630
|
|
|
487
|
-
def
|
|
631
|
+
def test_default_confederation_peers
|
|
488
632
|
asnum = 55
|
|
489
633
|
bgp = RouterBgp.new(asnum)
|
|
490
634
|
assert_empty(bgp.default_confederation_peers,
|
|
@@ -492,7 +636,27 @@ class TestRouterBgp < CiscoTestCase
|
|
|
492
636
|
bgp.destroy
|
|
493
637
|
end
|
|
494
638
|
|
|
495
|
-
def
|
|
639
|
+
def test_isolate
|
|
640
|
+
asnum = 55
|
|
641
|
+
bgp = RouterBgp.new(asnum)
|
|
642
|
+
bgp.isolate = true
|
|
643
|
+
assert(bgp.isolate,
|
|
644
|
+
'bgp isolate should be enabled')
|
|
645
|
+
bgp.isolate = false
|
|
646
|
+
refute(bgp.isolate,
|
|
647
|
+
'bgp isolate should be disabled')
|
|
648
|
+
bgp.destroy
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
def test_default_isolate
|
|
652
|
+
asnum = 55
|
|
653
|
+
bgp = RouterBgp.new(asnum)
|
|
654
|
+
refute(bgp.isolate,
|
|
655
|
+
'bgp isolate default value should be false')
|
|
656
|
+
bgp.destroy
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
def test_log_neighbor_changes
|
|
496
660
|
%w(test_default test_vrf).each do |t|
|
|
497
661
|
if t == 'test_default'
|
|
498
662
|
asnum = 55
|
|
@@ -513,7 +677,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
513
677
|
end
|
|
514
678
|
end
|
|
515
679
|
|
|
516
|
-
def
|
|
680
|
+
def test_log_neighbor_changes_not_configured
|
|
517
681
|
asnum = 55
|
|
518
682
|
bgp = RouterBgp.new(asnum)
|
|
519
683
|
refute(bgp.log_neighbor_changes,
|
|
@@ -521,7 +685,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
521
685
|
bgp.destroy
|
|
522
686
|
end
|
|
523
687
|
|
|
524
|
-
def
|
|
688
|
+
def test_default_log_neighbor_changes
|
|
525
689
|
asnum = 55
|
|
526
690
|
bgp = RouterBgp.new(asnum)
|
|
527
691
|
refute(bgp.default_log_neighbor_changes,
|
|
@@ -529,36 +693,24 @@ class TestRouterBgp < CiscoTestCase
|
|
|
529
693
|
bgp.destroy
|
|
530
694
|
end
|
|
531
695
|
|
|
532
|
-
def
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
bgp = RouterBgp.new(asnum, vrf)
|
|
542
|
-
end
|
|
543
|
-
bgp.maxas_limit = 50
|
|
544
|
-
assert_equal(50, bgp.maxas_limit,
|
|
545
|
-
"vrf #{vrf}: bgp maxas-limit should be set to '50'")
|
|
546
|
-
bgp.maxas_limit = bgp.default_maxas_limit
|
|
547
|
-
assert_equal(bgp.default_maxas_limit, bgp.maxas_limit,
|
|
548
|
-
"vrf #{vrf}: bgp maxas-limit should be set to default value")
|
|
549
|
-
bgp.destroy
|
|
550
|
-
end
|
|
696
|
+
def maxas_limit(vrf)
|
|
697
|
+
bgp = RouterBgp.new(55, vrf)
|
|
698
|
+
limit = 20
|
|
699
|
+
bgp.maxas_limit = limit
|
|
700
|
+
assert_equal(limit, bgp.maxas_limit, "vrf #{vrf}: maxas-limit invalid")
|
|
701
|
+
|
|
702
|
+
limit = bgp.default_maxas_limit
|
|
703
|
+
bgp.maxas_limit = limit
|
|
704
|
+
assert_equal(limit, bgp.maxas_limit, "vrf #{vrf}: maxas-limit not default")
|
|
551
705
|
end
|
|
552
706
|
|
|
553
|
-
def
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
'bgp maxas-limit should be default value')
|
|
558
|
-
bgp.destroy
|
|
707
|
+
def test_maxas_limit
|
|
708
|
+
%w(default cyan).each do |vrf|
|
|
709
|
+
maxas_limit(vrf)
|
|
710
|
+
end
|
|
559
711
|
end
|
|
560
712
|
|
|
561
|
-
def
|
|
713
|
+
def test_neighbor_down_fib_accelerate
|
|
562
714
|
%w(test_default test_vrf).each do |t|
|
|
563
715
|
if t == 'test_default'
|
|
564
716
|
asnum = 55
|
|
@@ -569,33 +721,33 @@ class TestRouterBgp < CiscoTestCase
|
|
|
569
721
|
vrf = 'yamllll'
|
|
570
722
|
bgp = RouterBgp.new(asnum, vrf)
|
|
571
723
|
end
|
|
572
|
-
bgp.
|
|
573
|
-
assert(bgp.
|
|
574
|
-
"vrf #{vrf}: bgp
|
|
575
|
-
bgp.
|
|
576
|
-
refute(bgp.
|
|
577
|
-
"vrf #{vrf}: bgp
|
|
724
|
+
bgp.neighbor_down_fib_accelerate = true
|
|
725
|
+
assert(bgp.neighbor_down_fib_accelerate,
|
|
726
|
+
"vrf #{vrf}: bgp neighbor_down_fib_accelerate should be enabled")
|
|
727
|
+
bgp.neighbor_down_fib_accelerate = false
|
|
728
|
+
refute(bgp.neighbor_down_fib_accelerate,
|
|
729
|
+
"vrf #{vrf}: bgp neighbor_down_fib_accelerate should be disabled")
|
|
578
730
|
bgp.destroy
|
|
579
731
|
end
|
|
580
732
|
end
|
|
581
733
|
|
|
582
|
-
def
|
|
734
|
+
def test_neighbor_down_fib_accelerate_not_configured
|
|
583
735
|
asnum = 55
|
|
584
736
|
bgp = RouterBgp.new(asnum)
|
|
585
|
-
refute(bgp.
|
|
586
|
-
'bgp
|
|
737
|
+
refute(bgp.neighbor_down_fib_accelerate,
|
|
738
|
+
'bgp neighbor_down_fib_accelerate should be disabled')
|
|
587
739
|
bgp.destroy
|
|
588
740
|
end
|
|
589
741
|
|
|
590
|
-
def
|
|
742
|
+
def test_default_neighbor_down_fib_accelerate
|
|
591
743
|
asnum = 55
|
|
592
744
|
bgp = RouterBgp.new(asnum)
|
|
593
|
-
refute(bgp.
|
|
594
|
-
'bgp
|
|
745
|
+
refute(bgp.default_neighbor_down_fib_accelerate,
|
|
746
|
+
'bgp neighbor_down_fib_accelerate default value should be false')
|
|
595
747
|
bgp.destroy
|
|
596
748
|
end
|
|
597
749
|
|
|
598
|
-
def
|
|
750
|
+
def test_reconnect_interval
|
|
599
751
|
%w(test_default test_vrf).each do |t|
|
|
600
752
|
if t == 'test_default'
|
|
601
753
|
asnum = 55
|
|
@@ -616,15 +768,34 @@ class TestRouterBgp < CiscoTestCase
|
|
|
616
768
|
end
|
|
617
769
|
end
|
|
618
770
|
|
|
619
|
-
def
|
|
771
|
+
def test_reconnect_interval_default
|
|
620
772
|
asnum = 55
|
|
621
773
|
bgp = RouterBgp.new(asnum)
|
|
622
|
-
assert_equal(
|
|
623
|
-
|
|
774
|
+
assert_equal(bgp.default_reconnect_interval, bgp.reconnect_interval,
|
|
775
|
+
'reconnect_interval should be set to default value')
|
|
776
|
+
bgp.destroy
|
|
777
|
+
end
|
|
778
|
+
|
|
779
|
+
def test_route_distinguisher
|
|
780
|
+
remove_all_vrfs
|
|
781
|
+
|
|
782
|
+
bgp = RouterBgp.new(55, 'blue')
|
|
783
|
+
bgp.route_distinguisher = 'auto'
|
|
784
|
+
assert_equal('auto', bgp.route_distinguisher)
|
|
785
|
+
|
|
786
|
+
bgp.route_distinguisher = '1:1'
|
|
787
|
+
assert_equal('1:1', bgp.route_distinguisher)
|
|
788
|
+
|
|
789
|
+
bgp.route_distinguisher = '2:3'
|
|
790
|
+
assert_equal('2:3', bgp.route_distinguisher)
|
|
791
|
+
|
|
792
|
+
bgp.route_distinguisher = bgp.default_route_distinguisher
|
|
793
|
+
assert_empty(bgp.route_distinguisher,
|
|
794
|
+
'bgp route_distinguisher should *NOT* be configured')
|
|
624
795
|
bgp.destroy
|
|
625
796
|
end
|
|
626
797
|
|
|
627
|
-
def
|
|
798
|
+
def test_router_id
|
|
628
799
|
%w(test_default test_vrf).each do |t|
|
|
629
800
|
if t == 'test_default'
|
|
630
801
|
asnum = 55
|
|
@@ -645,7 +816,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
645
816
|
end
|
|
646
817
|
end
|
|
647
818
|
|
|
648
|
-
def
|
|
819
|
+
def test_router_id_not_configured
|
|
649
820
|
asnum = 55
|
|
650
821
|
bgp = RouterBgp.new(asnum)
|
|
651
822
|
assert_empty(bgp.router_id,
|
|
@@ -653,7 +824,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
653
824
|
bgp.destroy
|
|
654
825
|
end
|
|
655
826
|
|
|
656
|
-
def
|
|
827
|
+
def test_default_router_id
|
|
657
828
|
asnum = 55
|
|
658
829
|
bgp = RouterBgp.new(asnum)
|
|
659
830
|
assert_empty(bgp.default_router_id,
|
|
@@ -661,7 +832,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
661
832
|
bgp.destroy
|
|
662
833
|
end
|
|
663
834
|
|
|
664
|
-
def
|
|
835
|
+
def test_shutdown
|
|
665
836
|
# NOTE: Shutdown command only applies under
|
|
666
837
|
# default vrf
|
|
667
838
|
asnum = 55
|
|
@@ -673,7 +844,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
673
844
|
bgp.destroy
|
|
674
845
|
end
|
|
675
846
|
|
|
676
|
-
def
|
|
847
|
+
def test_shutdown_not_configured
|
|
677
848
|
asnum = 55
|
|
678
849
|
bgp = RouterBgp.new(asnum)
|
|
679
850
|
refute(bgp.shutdown,
|
|
@@ -681,7 +852,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
681
852
|
bgp.destroy
|
|
682
853
|
end
|
|
683
854
|
|
|
684
|
-
def
|
|
855
|
+
def test_default_shutdown
|
|
685
856
|
asnum = 55
|
|
686
857
|
bgp = RouterBgp.new(asnum)
|
|
687
858
|
refute(bgp.default_shutdown,
|
|
@@ -689,7 +860,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
689
860
|
bgp.destroy
|
|
690
861
|
end
|
|
691
862
|
|
|
692
|
-
def
|
|
863
|
+
def test_suppress_fib_pending
|
|
693
864
|
%w(test_default test_vrf).each do |t|
|
|
694
865
|
if t == 'test_default'
|
|
695
866
|
asnum = 55
|
|
@@ -710,7 +881,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
710
881
|
end
|
|
711
882
|
end
|
|
712
883
|
|
|
713
|
-
def
|
|
884
|
+
def test_suppress_fib_pending_not_configured
|
|
714
885
|
asnum = 55
|
|
715
886
|
bgp = RouterBgp.new(asnum)
|
|
716
887
|
refute(bgp.suppress_fib_pending,
|
|
@@ -718,7 +889,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
718
889
|
bgp.destroy
|
|
719
890
|
end
|
|
720
891
|
|
|
721
|
-
def
|
|
892
|
+
def test_default_suppress_fib_pending
|
|
722
893
|
asnum = 55
|
|
723
894
|
bgp = RouterBgp.new(asnum)
|
|
724
895
|
refute(bgp.default_suppress_fib_pending,
|
|
@@ -726,7 +897,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
726
897
|
bgp.destroy
|
|
727
898
|
end
|
|
728
899
|
|
|
729
|
-
def
|
|
900
|
+
def test_timer_bestpath_limit
|
|
730
901
|
%w(test_default test_vrf).each do |t|
|
|
731
902
|
if t == 'test_default'
|
|
732
903
|
asnum = 55
|
|
@@ -747,7 +918,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
747
918
|
end
|
|
748
919
|
end
|
|
749
920
|
|
|
750
|
-
def
|
|
921
|
+
def test_timer_bestpath_limit_default
|
|
751
922
|
asnum = 55
|
|
752
923
|
bgp = RouterBgp.new(asnum)
|
|
753
924
|
assert_equal(300, bgp.timer_bestpath_limit,
|
|
@@ -755,7 +926,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
755
926
|
bgp.destroy
|
|
756
927
|
end
|
|
757
928
|
|
|
758
|
-
def
|
|
929
|
+
def test_timer_bestpath_limit_always
|
|
759
930
|
%w(test_default test_vrf).each do |t|
|
|
760
931
|
if t == 'test_default'
|
|
761
932
|
asnum = 55
|
|
@@ -776,7 +947,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
776
947
|
end
|
|
777
948
|
end
|
|
778
949
|
|
|
779
|
-
def
|
|
950
|
+
def test_timer_bestpath_limit_always_not_configured
|
|
780
951
|
asnum = 55
|
|
781
952
|
bgp = RouterBgp.new(asnum)
|
|
782
953
|
refute(bgp.timer_bestpath_limit_always,
|
|
@@ -784,7 +955,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
784
955
|
bgp.destroy
|
|
785
956
|
end
|
|
786
957
|
|
|
787
|
-
def
|
|
958
|
+
def test_default_timer_bestpath_limit_always
|
|
788
959
|
asnum = 55
|
|
789
960
|
bgp = RouterBgp.new(asnum)
|
|
790
961
|
refute(bgp.default_timer_bestpath_limit_always,
|
|
@@ -792,7 +963,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
792
963
|
bgp.destroy
|
|
793
964
|
end
|
|
794
965
|
|
|
795
|
-
def
|
|
966
|
+
def test_timer_bgp_keepalive_hold
|
|
796
967
|
%w(test_default test_vrf).each do |t|
|
|
797
968
|
if t == 'test_default'
|
|
798
969
|
asnum = 55
|
|
@@ -824,7 +995,7 @@ class TestRouterBgp < CiscoTestCase
|
|
|
824
995
|
end
|
|
825
996
|
end
|
|
826
997
|
|
|
827
|
-
def
|
|
998
|
+
def test_default_timer_keepalive_hold_default
|
|
828
999
|
asnum = 55
|
|
829
1000
|
bgp = RouterBgp.new(asnum)
|
|
830
1001
|
assert_equal(%w(60 180), bgp.default_timer_bgp_keepalive_hold,
|