cisco_node_utils 1.2.0 → 1.3.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 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +81 -2
- data/CONTRIBUTING.md +2 -17
- data/Gemfile +5 -0
- data/README.md +92 -47
- data/Rakefile +23 -1
- data/bin/git/hooks/hook_lib +7 -0
- data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
- data/bin/git/hooks/pre-commit/rubocop +7 -2
- data/bin/git/hooks/pre-commit/validate-diffs +18 -4
- data/bin/git/hooks/pre-commit/validate-yaml +18 -0
- data/bin/git/update-hooks +64 -6
- data/cisco_node_utils.gemspec +9 -6
- data/docs/README-develop-best-practices.md +149 -50
- data/docs/README-develop-node-utils-APIs.md +92 -42
- data/docs/README-maintainers.md +7 -4
- data/docs/README-test-execution.md +57 -0
- data/docs/cisco_node_utils.yaml.example +30 -0
- data/docs/template-router.rb +4 -0
- data/ext/mkrf_conf.rb +63 -0
- data/lib/.rubocop.yml +2 -2
- data/lib/cisco_node_utils.rb +5 -0
- data/lib/cisco_node_utils/aaa_authentication_login.rb +5 -6
- data/lib/cisco_node_utils/aaa_authorization_service.rb +1 -1
- data/lib/cisco_node_utils/ace.rb +165 -12
- data/lib/cisco_node_utils/acl.rb +2 -1
- data/lib/cisco_node_utils/bgp.rb +184 -21
- data/lib/cisco_node_utils/bgp_af.rb +94 -249
- data/lib/cisco_node_utils/bgp_neighbor.rb +94 -14
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +75 -8
- data/lib/cisco_node_utils/bridge_domain.rb +183 -0
- data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +85 -2
- data/lib/cisco_node_utils/client.rb +35 -0
- data/lib/cisco_node_utils/client/client.rb +234 -0
- data/lib/cisco_node_utils/client/grpc.rb +33 -0
- data/lib/cisco_node_utils/client/grpc/client.rb +311 -0
- data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
- data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
- data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
- data/lib/cisco_node_utils/client/nxapi.rb +31 -0
- data/lib/cisco_node_utils/client/nxapi/client.rb +305 -0
- data/lib/cisco_node_utils/client/utils.rb +164 -0
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +222 -254
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +22 -15
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +21 -16
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +239 -109
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +114 -55
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +76 -52
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +106 -62
- data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +71 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +35 -14
- data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +23 -17
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +94 -83
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +22 -17
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +76 -26
- data/lib/cisco_node_utils/cmd_ref/images.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +381 -153
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +21 -21
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +30 -21
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +18 -13
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +26 -31
- data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
- data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +17 -6
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +10 -3
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +17 -5
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +33 -29
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +12 -10
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +16 -19
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +40 -25
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +17 -12
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +71 -35
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +10 -5
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +6 -2
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +47 -43
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +13 -11
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +4 -2
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +23 -21
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +26 -22
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +19 -17
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +18 -6
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +234 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +24 -9
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +5 -3
- data/lib/cisco_node_utils/cmd_ref/system.yaml +4 -3
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +22 -20
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +27 -15
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +45 -16
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +60 -32
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +118 -101
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +54 -58
- data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +118 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +19 -25
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +28 -18
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +34 -17
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +6 -4
- data/lib/cisco_node_utils/command_reference.rb +261 -142
- data/lib/cisco_node_utils/constants.rb +33 -0
- data/lib/cisco_node_utils/encapsulation.rb +112 -0
- data/lib/cisco_node_utils/environment.rb +102 -0
- data/lib/cisco_node_utils/evpn_vni.rb +5 -3
- data/lib/cisco_node_utils/exceptions.rb +111 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +52 -35
- data/lib/cisco_node_utils/fabricpath_topology.rb +44 -57
- data/lib/cisco_node_utils/feature.rb +165 -3
- data/lib/cisco_node_utils/interface.rb +1051 -260
- data/lib/cisco_node_utils/interface_channel_group.rb +11 -10
- data/lib/cisco_node_utils/interface_ospf.rb +1 -2
- data/lib/cisco_node_utils/interface_portchannel.rb +4 -12
- data/lib/cisco_node_utils/interface_service_vni.rb +7 -7
- data/lib/cisco_node_utils/itd_device_group.rb +248 -0
- data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
- data/lib/cisco_node_utils/itd_service.rb +523 -0
- data/lib/cisco_node_utils/logger.rb +75 -0
- data/lib/cisco_node_utils/node.rb +62 -192
- data/lib/cisco_node_utils/node_util.rb +56 -10
- data/lib/cisco_node_utils/overlay_global.rb +2 -2
- data/lib/cisco_node_utils/pim.rb +2 -13
- data/lib/cisco_node_utils/pim_group_list.rb +1 -1
- data/lib/cisco_node_utils/pim_rp_address.rb +1 -1
- data/lib/cisco_node_utils/platform.rb +52 -21
- data/lib/cisco_node_utils/portchannel_global.rb +89 -19
- data/lib/cisco_node_utils/radius_server.rb +168 -37
- data/lib/cisco_node_utils/router_ospf.rb +20 -35
- data/lib/cisco_node_utils/router_ospf_vrf.rb +4 -4
- data/lib/cisco_node_utils/snmpserver.rb +1 -6
- data/lib/cisco_node_utils/snmpuser.rb +6 -4
- data/lib/cisco_node_utils/stp_global.rb +676 -0
- data/lib/cisco_node_utils/syslog_server.rb +77 -18
- data/lib/cisco_node_utils/syslog_settings.rb +1 -1
- data/lib/cisco_node_utils/tacacs_server_group.rb +8 -4
- data/lib/cisco_node_utils/tacacs_server_host.rb +115 -25
- data/lib/cisco_node_utils/vdc.rb +12 -0
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +147 -29
- data/lib/cisco_node_utils/vpc.rb +55 -3
- data/lib/cisco_node_utils/vrf.rb +72 -11
- data/lib/cisco_node_utils/vrf_af.rb +114 -29
- data/lib/cisco_node_utils/vtp.rb +34 -52
- data/lib/cisco_node_utils/vxlan_vtep.rb +34 -8
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +36 -4
- data/lib/minitest/environment_plugin.rb +31 -0
- data/lib/minitest/log_level_plugin.rb +41 -0
- data/spec/client_spec.rb +7 -0
- data/spec/environment_spec.rb +263 -0
- data/spec/grpc_client_spec.rb +23 -0
- data/spec/isolate/all_clients_spec.rb +9 -0
- data/spec/isolate/grpc_only_spec.rb +16 -0
- data/spec/isolate/no_clients_spec.rb +26 -0
- data/spec/isolate/nxapi_only_spec.rb +16 -0
- data/spec/nxapi_client_spec.rb +42 -0
- data/spec/schema.yaml +75 -0
- data/spec/shared_examples_for_clients.rb +14 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/whitespace_spec.rb +10 -0
- data/spec/yaml_spec.rb +42 -0
- data/tests/.rubocop.yml +2 -2
- data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
- data/tests/basetest.rb +96 -36
- data/tests/ciscotest.rb +220 -12
- data/tests/cmd_config.yaml +71 -49
- data/tests/cmd_config_invalid.yaml +1 -1
- data/tests/test_aaa_authentication_login.rb +1 -0
- data/tests/test_aaa_authentication_login_service.rb +9 -0
- data/tests/test_aaa_authorization_service.rb +173 -367
- data/tests/test_ace.rb +171 -100
- data/tests/test_acl.rb +10 -1
- data/tests/test_bgp_af.rb +395 -728
- data/tests/test_bgp_neighbor.rb +274 -115
- data/tests/test_bgp_neighbor_af.rb +178 -77
- data/tests/test_bridge_domain.rb +191 -0
- data/tests/test_bridge_domain_vni.rb +116 -0
- data/tests/test_client_utils.rb +111 -0
- data/tests/test_command_config.rb +9 -5
- data/tests/test_command_reference.rb +380 -102
- data/tests/test_dns_domain.rb +13 -3
- data/tests/test_domain_name.rb +13 -3
- data/tests/test_encapsulation.rb +77 -0
- data/tests/test_evpn_vni.rb +25 -7
- data/tests/test_fabricpath_global.rb +167 -163
- data/tests/test_fabricpath_topology.rb +12 -33
- data/tests/test_feature.rb +215 -0
- data/tests/test_grpc.rb +166 -0
- data/tests/test_interface.rb +585 -344
- data/tests/test_interface_bdi.rb +80 -0
- data/tests/test_interface_channel_group.rb +6 -3
- data/tests/test_interface_ospf.rb +26 -24
- data/tests/test_interface_portchannel.rb +1 -0
- data/tests/test_interface_private_vlan.rb +724 -0
- data/tests/test_interface_service_vni.rb +37 -66
- data/tests/test_interface_svi.rb +98 -101
- data/tests/test_interface_switchport.rb +419 -549
- data/tests/test_itd_device_group.rb +145 -0
- data/tests/test_itd_device_group_node.rb +199 -0
- data/tests/test_itd_service.rb +298 -0
- data/tests/test_logger.rb +43 -0
- data/tests/test_name_server.rb +11 -2
- data/tests/test_node.rb +16 -75
- data/tests/test_node_ext.rb +174 -163
- data/tests/test_node_util.rb +119 -0
- data/tests/test_ntp_config.rb +5 -1
- data/tests/test_ntp_server.rb +2 -2
- data/tests/test_nxapi.rb +221 -0
- data/tests/test_overlay_global.rb +47 -38
- data/tests/test_pim.rb +2 -0
- data/tests/test_pim_group_list.rb +2 -0
- data/tests/test_pim_rp_address.rb +2 -0
- data/tests/test_platform.rb +86 -39
- data/tests/test_portchannel_global.rb +211 -135
- data/tests/test_radius_global.rb +13 -5
- data/tests/test_radius_server.rb +256 -104
- data/tests/test_radius_server_group.rb +2 -0
- data/tests/test_router_bgp.rb +781 -485
- data/tests/test_router_ospf.rb +26 -103
- data/tests/test_router_ospf_vrf.rb +52 -57
- data/tests/test_snmp_notification_receiver.rb +2 -0
- data/tests/test_snmpcommunity.rb +2 -0
- data/tests/test_snmpgroup.rb +2 -0
- data/tests/test_snmpnotification.rb +40 -21
- data/tests/test_snmpserver.rb +2 -0
- data/tests/test_snmpuser.rb +2 -0
- data/tests/test_stp_global.rb +563 -0
- data/tests/test_syslog_server.rb +32 -8
- data/tests/test_syslog_settings.rb +22 -9
- data/tests/test_tacacs_server.rb +32 -27
- data/tests/test_tacacs_server_group.rb +100 -45
- data/tests/test_tacacs_server_host.rb +135 -43
- data/tests/test_vdc.rb +2 -16
- data/tests/test_vlan.rb +106 -54
- data/tests/test_vlan_mt_full.rb +11 -21
- data/tests/test_vlan_private.rb +669 -0
- data/tests/test_vpc.rb +312 -159
- data/tests/test_vrf.rb +122 -113
- data/tests/test_vrf_af.rb +238 -0
- data/tests/test_vtp.rb +58 -102
- data/tests/test_vxlan_vtep.rb +38 -17
- data/tests/test_vxlan_vtep_vni.rb +61 -9
- data/tests/test_yum.rb +49 -25
- metadata +122 -36
- data/lib/cisco_node_utils/cmd_ref/fex.yaml +0 -9
- data/lib/cisco_node_utils/cmd_ref/vni.yaml +0 -76
- data/lib/cisco_node_utils/vni.rb +0 -227
- data/tests/test_vni.rb +0 -106
|
@@ -22,7 +22,6 @@ require_relative '../lib/cisco_node_utils/cisco_cmn_utils'
|
|
|
22
22
|
require_relative '../lib/cisco_node_utils/bgp'
|
|
23
23
|
require_relative '../lib/cisco_node_utils/bgp_neighbor'
|
|
24
24
|
require_relative '../lib/cisco_node_utils/bgp_neighbor_af'
|
|
25
|
-
require_relative '../lib/cisco_node_utils/feature'
|
|
26
25
|
|
|
27
26
|
# TestBgpNeighborAF - Minitest for RouterBgpNeighborAF class
|
|
28
27
|
class TestBgpNeighborAF < CiscoTestCase
|
|
@@ -35,12 +34,16 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
35
34
|
super
|
|
36
35
|
remove_all_bgps if @@pre_clean_needed
|
|
37
36
|
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
|
38
|
-
|
|
37
|
+
if platform == :nexus
|
|
38
|
+
setup_nv_overlay_evpn
|
|
39
|
+
else
|
|
40
|
+
setup_ios_xr
|
|
41
|
+
end
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
def teardown
|
|
42
|
-
super
|
|
43
45
|
remove_all_bgps
|
|
46
|
+
super
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def setup_nv_overlay_evpn
|
|
@@ -72,6 +75,58 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
72
75
|
[obj_af, dbg]
|
|
73
76
|
end
|
|
74
77
|
|
|
78
|
+
# One time setup for XR
|
|
79
|
+
# this doesn't support the matrix very well but
|
|
80
|
+
# really only need to test 3 cases (ipv4 uni, l2vpn and a vrf)
|
|
81
|
+
def setup_ios_xr
|
|
82
|
+
return if platform == :nexus
|
|
83
|
+
asn = 1
|
|
84
|
+
vrf = 'aa'
|
|
85
|
+
nbr = '1.1.1.1'
|
|
86
|
+
af_v4 = 'ipv4 unicast'
|
|
87
|
+
af_v6 = 'ipv6 unicast'
|
|
88
|
+
vpn = 'vpnv4 unicast'
|
|
89
|
+
evpn = 'l2vpn evpn'
|
|
90
|
+
|
|
91
|
+
cfg = []
|
|
92
|
+
|
|
93
|
+
# Global requirements
|
|
94
|
+
# route policies
|
|
95
|
+
str1 = 'route-map-in-name'
|
|
96
|
+
str2 = 'route-map-out-name'
|
|
97
|
+
cfg << "route-policy #{str1}" << 'end-policy'
|
|
98
|
+
cfg << "route-policy #{str2}" << 'end-policy'
|
|
99
|
+
cfg << "route-policy #{str1.reverse}" << 'end-policy'
|
|
100
|
+
cfg << "route-policy #{str2.reverse}" << 'end-policy'
|
|
101
|
+
cfg << 'route-policy foo_bar' << 'end-policy'
|
|
102
|
+
cfg << 'route-policy baz_inga' << 'end-policy'
|
|
103
|
+
cfg << 'rd-set auto' << 'end-set'
|
|
104
|
+
|
|
105
|
+
# If any of the above config already exists, we will get a
|
|
106
|
+
# CLI warning message about replacing existing configuration.
|
|
107
|
+
# Ignore these warnings, as they're intentional.
|
|
108
|
+
config_no_warn(*cfg)
|
|
109
|
+
|
|
110
|
+
cfg = []
|
|
111
|
+
|
|
112
|
+
# router-id and address-family under the global bgp
|
|
113
|
+
# remote-as under the neighbor
|
|
114
|
+
# VRF statements
|
|
115
|
+
cfg << "router bgp #{asn}"
|
|
116
|
+
cfg << "router bgp #{asn} bgp router-id 1.1.1.1"
|
|
117
|
+
cfg << "router bgp #{asn} neighbor #{nbr} remote-as #{asn}"
|
|
118
|
+
cfg << "router bgp #{asn} address-family #{af_v4}"
|
|
119
|
+
cfg << "router bgp #{asn} address-family #{af_v6}"
|
|
120
|
+
cfg << "router bgp #{asn} address-family #{vpn}"
|
|
121
|
+
cfg << "router bgp #{asn} address-family vpnv6 unicast"
|
|
122
|
+
cfg << "router bgp #{asn} address-family #{evpn}"
|
|
123
|
+
cfg << "router bgp #{asn} vrf #{vrf} rd auto"
|
|
124
|
+
cfg << "router bgp #{asn} vrf #{vrf} address-family #{af_v4}"
|
|
125
|
+
cfg << "router bgp #{asn} vrf #{vrf} neighbor #{nbr} remote-as #{asn}"
|
|
126
|
+
|
|
127
|
+
config(*cfg)
|
|
128
|
+
end
|
|
129
|
+
|
|
75
130
|
# def test_foo
|
|
76
131
|
# af, dbg = clean_af([2, 'red', '1.1.1.1', %w(ipv4 unicast)])
|
|
77
132
|
# foo(af, dbg)
|
|
@@ -80,7 +135,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
80
135
|
# AF test matrix
|
|
81
136
|
@@matrix = { # rubocop:disable Style/ClassVars
|
|
82
137
|
# 1 => [1, 'default', '10:1::1', %w(ipv4 multicast)], # UNSUPPORTED
|
|
83
|
-
# 2 => [1, 'default', '10:1::1', %w(ipv4 unicast)],
|
|
138
|
+
# 2 => [1, 'default', '10:1::1', %w(ipv4 unicast)], # UNSUPPORTED in XR
|
|
84
139
|
# 3 => [1, 'default', '10:1::1', %w(ipv6 multicast)],
|
|
85
140
|
# 4 => [1, 'default', '10:1::1', %w(ipv6 unicast)],
|
|
86
141
|
# 5 => [1, 'default', '1.1.1.1', %w(ipv4 multicast)],
|
|
@@ -88,7 +143,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
88
143
|
# 7 => [1, 'default', '1.1.1.1', %w(ipv6 multicast)],
|
|
89
144
|
8 => [1, 'default', '1.1.1.1', %w(ipv6 unicast)],
|
|
90
145
|
# 9 => [1, 'aa', '2.2.2.2', %w(ipv4 multicast)],
|
|
91
|
-
|
|
146
|
+
10 => [1, 'aa', '1.1.1.1', %w(ipv4 unicast)],
|
|
92
147
|
# 11 => [1, 'bb', '2.2.2.2', %w(ipv6 multicast)],
|
|
93
148
|
# 12 => [1, 'bb', '2.2.2.2', %w(ipv6 unicast)],
|
|
94
149
|
# 13 => [1, 'cc', '10:1::2', %w(ipv4 multicast)], # UNSUPPORTED
|
|
@@ -100,14 +155,16 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
100
155
|
|
|
101
156
|
# ---------------------------------
|
|
102
157
|
def test_nbr_af_create_destroy
|
|
103
|
-
config('no feature bgp', 'feature bgp')
|
|
104
|
-
|
|
105
158
|
# Creates
|
|
106
159
|
obj = {}
|
|
107
160
|
@@matrix.each do |k, v|
|
|
108
161
|
asn, vrf, nbr, af = v
|
|
109
162
|
dbg = sprintf('[VRF %s NBR %s AF %s]', vrf, nbr, af)
|
|
110
163
|
obj[k] = RouterBgpNeighborAF.new(asn, vrf, nbr, af, true)
|
|
164
|
+
# TBD: This flush should not be needed but we see an intermittent problem
|
|
165
|
+
# with certain rake test seed values, where 'afs' below is not detecting
|
|
166
|
+
# vrf 'aa' AF.
|
|
167
|
+
node.cache_flush
|
|
111
168
|
afs = RouterBgpNeighborAF.afs
|
|
112
169
|
assert(afs[asn][vrf][nbr].key?(af),
|
|
113
170
|
"#{dbg} Failed to create AF")
|
|
@@ -126,16 +183,28 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
126
183
|
|
|
127
184
|
# ---------------------------------
|
|
128
185
|
def test_nbrs_with_masks
|
|
129
|
-
config('no feature bgp', 'feature bgp')
|
|
130
|
-
|
|
131
186
|
# Creates
|
|
132
187
|
obj = {}
|
|
133
188
|
@@matrix.each do |k, v|
|
|
134
189
|
asn, vrf, nbr, af = v
|
|
135
190
|
nbr += (nbr[/:/]) ? '/64' : '/16'
|
|
191
|
+
if platform == :ios_xr
|
|
192
|
+
# XR does not do slash masks and neighbors
|
|
193
|
+
# so make sure to catch the error
|
|
194
|
+
assert_raises(UnsupportedError,
|
|
195
|
+
'Neighbors do not support slash notation') do
|
|
196
|
+
RouterBgpNeighborAF.new(asn, vrf, nbr, af, true)
|
|
197
|
+
end
|
|
198
|
+
next
|
|
199
|
+
end
|
|
200
|
+
next if platform == :ios_xr
|
|
136
201
|
dbg = sprintf('[VRF %s NBR %s AF %s]', vrf, nbr, af.join('/'))
|
|
137
202
|
obj[k] = RouterBgpNeighborAF.new(asn, vrf, nbr, af, true)
|
|
138
203
|
nbr_munged = Utils.process_network_mask(nbr)
|
|
204
|
+
# TBD: This flush should not be needed but we see an intermittent problem
|
|
205
|
+
# with certain rake test seed values, where 'afs' below is not detecting
|
|
206
|
+
# vrf 'aa' AF.
|
|
207
|
+
node.cache_flush
|
|
139
208
|
afs = RouterBgpNeighborAF.afs
|
|
140
209
|
assert(afs[asn][vrf][nbr_munged].key?(af),
|
|
141
210
|
"#{dbg} Failed to create AF")
|
|
@@ -145,6 +214,13 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
145
214
|
@@matrix.each do |k, v|
|
|
146
215
|
asn, vrf, nbr, af = v
|
|
147
216
|
nbr += (nbr[/:/]) ? '/64' : '/16'
|
|
217
|
+
if platform == :ios_xr
|
|
218
|
+
assert_raises(UnsupportedError,
|
|
219
|
+
'Neighbors do not support slash notation') do
|
|
220
|
+
RouterBgpNeighborAF.new(asn, vrf, nbr, af, true)
|
|
221
|
+
end
|
|
222
|
+
next
|
|
223
|
+
end
|
|
148
224
|
dbg = sprintf('[VRF %s NBR %s AF %s]', vrf, nbr, af.join('/'))
|
|
149
225
|
obj[k].destroy
|
|
150
226
|
nbr_munged = Utils.process_network_mask(nbr)
|
|
@@ -166,15 +242,21 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
166
242
|
def props_bool(af, dbg)
|
|
167
243
|
# These properties have simple boolean states. As such we can use a common
|
|
168
244
|
# set of tests to validate each property.
|
|
245
|
+
# XR the only properties supported (under all af's) are:
|
|
246
|
+
# :as_override,
|
|
247
|
+
# :next_hop_self,
|
|
248
|
+
# Nexus they are all supported, except when a l2vpn, in which case
|
|
249
|
+
# only disable_peer_as_check is supported.
|
|
169
250
|
props = [
|
|
170
251
|
:as_override,
|
|
171
|
-
:disable_peer_as_check,
|
|
172
252
|
:next_hop_self,
|
|
173
|
-
:next_hop_third_party,
|
|
174
|
-
:suppress_inactive,
|
|
175
253
|
]
|
|
176
254
|
|
|
177
|
-
|
|
255
|
+
if platform == :nexus
|
|
256
|
+
props << :next_hop_third_party
|
|
257
|
+
props << :suppress_inactive
|
|
258
|
+
props = [:disable_peer_as_check] if dbg.include?('l2vpn/evpn')
|
|
259
|
+
end
|
|
178
260
|
|
|
179
261
|
# Call setter to false, then validate with getter
|
|
180
262
|
props.each { |k| af.send("#{k}=", false) }
|
|
@@ -207,19 +289,23 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
207
289
|
end
|
|
208
290
|
|
|
209
291
|
def props_string(af, dbg)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
292
|
+
if platform == :nexus
|
|
293
|
+
props = {
|
|
294
|
+
filter_list_in: 'filt-in-name',
|
|
295
|
+
filter_list_out: 'filt-out-name',
|
|
296
|
+
prefix_list_in: 'pref-in-name',
|
|
297
|
+
prefix_list_out: 'pref-out-name',
|
|
298
|
+
route_map_in: 'route-map-in-name',
|
|
299
|
+
route_map_out: 'route-map-out-name',
|
|
300
|
+
unsuppress_map: 'unsupp-map-name',
|
|
301
|
+
}
|
|
302
|
+
props.delete(:unsuppress_map) if dbg.include?('l2vpn/evpn')
|
|
303
|
+
else
|
|
304
|
+
props = {
|
|
305
|
+
route_map_in: 'route-map-in-name',
|
|
306
|
+
route_map_out: 'route-map-out-name',
|
|
307
|
+
}
|
|
308
|
+
end
|
|
223
309
|
|
|
224
310
|
props.each do |k, v|
|
|
225
311
|
# Call setter.
|
|
@@ -247,32 +333,36 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
247
333
|
# soft_reconfiguration_in
|
|
248
334
|
|
|
249
335
|
def supports_soft_reconfig_always?
|
|
250
|
-
|
|
251
|
-
|
|
336
|
+
str = node.cmd_ref.lookup('bgp_neighbor_af',
|
|
337
|
+
'soft_reconfiguration_in').set_value
|
|
338
|
+
str.to_s[/always/]
|
|
252
339
|
end
|
|
253
340
|
|
|
254
341
|
def test_tri_states
|
|
255
342
|
@@matrix.values.each do |af_args|
|
|
256
343
|
af, dbg = clean_af(af_args)
|
|
257
|
-
|
|
258
344
|
next if dbg.include?('l2vpn/evpn')
|
|
259
345
|
%w(additional_paths_receive additional_paths_send).each do |k|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
346
|
+
if validate_property_excluded?('bgp_neighbor_af', k)
|
|
347
|
+
assert_raises(UnsupportedError) { af.send("#{k}=", 'enable') }
|
|
348
|
+
else
|
|
349
|
+
[:enable, :disable, :inherit,
|
|
350
|
+
'enable', 'disable', 'inherit',
|
|
351
|
+
af.send("default_#{k}")
|
|
352
|
+
].each do |val|
|
|
353
|
+
af.send("#{k}=", val)
|
|
354
|
+
assert_equal(val.to_sym, af.send(k), "#{dbg} Error: #{k}")
|
|
355
|
+
end
|
|
265
356
|
end
|
|
266
357
|
end
|
|
267
358
|
|
|
268
|
-
# The 'always' keyword is not supported on N6K / N7K
|
|
269
359
|
%w(soft_reconfiguration_in).each do |k|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
array
|
|
275
|
-
|
|
360
|
+
array = [:enable, :always, :inherit,
|
|
361
|
+
'enable', 'always', 'inherit',
|
|
362
|
+
af.send("default_#{k}")]
|
|
363
|
+
unless supports_soft_reconfig_always?
|
|
364
|
+
array.delete(:always)
|
|
365
|
+
array.delete('always')
|
|
276
366
|
end
|
|
277
367
|
|
|
278
368
|
array.each do |val|
|
|
@@ -287,7 +377,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
287
377
|
def test_advertise_map
|
|
288
378
|
@@matrix.values.each do |af_args|
|
|
289
379
|
af, dbg = clean_af(af_args)
|
|
290
|
-
next if dbg.include?('l2vpn/evpn')
|
|
380
|
+
next if dbg.include?('l2vpn/evpn') && platform == :nexus
|
|
291
381
|
advertise_map(af, dbg)
|
|
292
382
|
end
|
|
293
383
|
end
|
|
@@ -295,6 +385,12 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
295
385
|
def advertise_map(af, dbg)
|
|
296
386
|
%w(advertise_map_exist advertise_map_non_exist).each do |k|
|
|
297
387
|
v = %w(foo bar)
|
|
388
|
+
if platform == :ios_xr
|
|
389
|
+
assert_raises(UnsupportedError) do
|
|
390
|
+
af.send("#{k}=", v)
|
|
391
|
+
end
|
|
392
|
+
next
|
|
393
|
+
end
|
|
298
394
|
af.send("#{k}=", v)
|
|
299
395
|
assert_equal(v, af.send(k),
|
|
300
396
|
"Test 1. #{dbg} [#{k}=] did not set strings '#{v}'")
|
|
@@ -367,7 +463,6 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
367
463
|
af.default_originate_set(true)
|
|
368
464
|
assert(af.default_originate,
|
|
369
465
|
"Test 1. #{dbg} Failed to set state to True")
|
|
370
|
-
|
|
371
466
|
# Test true with route-map
|
|
372
467
|
af.default_originate_set(true, 'foo_bar')
|
|
373
468
|
assert_equal('foo_bar', af.default_originate_route_map,
|
|
@@ -388,8 +483,6 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
388
483
|
af.default_originate_set(true, af.default_default_originate_route_map)
|
|
389
484
|
refute(af.default_originate_route_map,
|
|
390
485
|
"Test 5. #{dbg} Failed to set default route-map from existing")
|
|
391
|
-
|
|
392
|
-
# Test default_state
|
|
393
486
|
af.default_originate_set(af.default_default_originate)
|
|
394
487
|
refute(af.default_originate,
|
|
395
488
|
"Test 6. #{dbg} Failed to set state to default")
|
|
@@ -430,7 +523,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
430
523
|
"Test 3c. #{dbg} Failed to set interval to '#{interval}'")
|
|
431
524
|
|
|
432
525
|
limit = 97
|
|
433
|
-
threshold = nil
|
|
526
|
+
threshold = platform == :nexus ? nil : 75
|
|
434
527
|
warning = true
|
|
435
528
|
af.max_prefix_set(limit, threshold, warning)
|
|
436
529
|
assert_equal(limit, af.max_prefix_limit,
|
|
@@ -441,7 +534,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
441
534
|
"Test 4c. #{dbg} Failed to set warning to '#{warning}'")
|
|
442
535
|
|
|
443
536
|
limit = 96
|
|
444
|
-
threshold = nil
|
|
537
|
+
threshold = platform == :nexus ? nil : 75
|
|
445
538
|
interval = 26
|
|
446
539
|
af.max_prefix_set(limit, threshold, interval)
|
|
447
540
|
assert_equal(limit, af.max_prefix_limit,
|
|
@@ -487,7 +580,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
487
580
|
"Test 9a. #{dbg} Failed to set limit to '#{limit}'")
|
|
488
581
|
assert_equal(threshold, af.max_prefix_threshold,
|
|
489
582
|
"Test 9b. #{dbg} Failed to set threshold to '#{threshold}'")
|
|
490
|
-
assert_equal(warning, af.max_prefix_warning,
|
|
583
|
+
assert_equal((platform == :nexus ? warning : nil), af.max_prefix_warning,
|
|
491
584
|
"Test 9c. #{dbg} Failed to set warning to '#{warning}'")
|
|
492
585
|
|
|
493
586
|
af.max_prefix_set(nil)
|
|
@@ -522,16 +615,14 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
522
615
|
|
|
523
616
|
# ---------------------------------
|
|
524
617
|
def test_send_community
|
|
525
|
-
# iBGP only, do extra cleanup
|
|
526
|
-
config('no feature bgp', 'feature bgp')
|
|
527
618
|
@@matrix.values.each do |af_args|
|
|
528
619
|
af, dbg = clean_af(af_args)
|
|
529
|
-
|
|
620
|
+
send_comm(af, dbg)
|
|
530
621
|
end
|
|
531
622
|
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
|
532
623
|
end
|
|
533
624
|
|
|
534
|
-
def
|
|
625
|
+
def send_comm(af, dbg)
|
|
535
626
|
v = 'both'
|
|
536
627
|
af.send_community = v
|
|
537
628
|
assert_equal(v, af.send_community,
|
|
@@ -553,7 +644,6 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
553
644
|
af.send_community = v
|
|
554
645
|
assert_equal(v, af.send_community,
|
|
555
646
|
"Test 3b. #{dbg} Failed to set '#{v}' from 'standard'")
|
|
556
|
-
|
|
557
647
|
v = 'extended'
|
|
558
648
|
af.send_community = v
|
|
559
649
|
assert_equal(v, af.send_community,
|
|
@@ -563,7 +653,6 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
563
653
|
af.send_community = v
|
|
564
654
|
assert_equal(v, af.send_community,
|
|
565
655
|
"Test 5. #{dbg} Failed to set '#{v}' from 'extended'")
|
|
566
|
-
|
|
567
656
|
v = 'standard'
|
|
568
657
|
af.send_community = v
|
|
569
658
|
assert_equal(v, af.send_community,
|
|
@@ -572,7 +661,6 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
572
661
|
af.send_community = v
|
|
573
662
|
assert_equal(v, af.send_community,
|
|
574
663
|
"Test 7. #{dbg} Failed to set '#{v}' from 'standard'")
|
|
575
|
-
|
|
576
664
|
v = 'none'
|
|
577
665
|
af.send_community = v
|
|
578
666
|
assert_equal(v, af.send_community,
|
|
@@ -580,7 +668,7 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
580
668
|
|
|
581
669
|
v = 'both'
|
|
582
670
|
af.send_community = v
|
|
583
|
-
assert_equal(
|
|
671
|
+
assert_equal('both', af.send_community,
|
|
584
672
|
"Test 9. #{dbg} Failed to set '#{v}' from None")
|
|
585
673
|
|
|
586
674
|
v = af.default_send_community
|
|
@@ -600,37 +688,50 @@ class TestBgpNeighborAF < CiscoTestCase
|
|
|
600
688
|
def soo(af, dbg)
|
|
601
689
|
val = '1.1.1.1:1'
|
|
602
690
|
|
|
603
|
-
if
|
|
604
|
-
assert_raises(
|
|
691
|
+
if platform == :ios_xr
|
|
692
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
605
693
|
af.soo = val
|
|
606
694
|
end
|
|
607
|
-
|
|
608
|
-
|
|
695
|
+
else
|
|
696
|
+
if dbg.include?('default')
|
|
697
|
+
str = "Test 1. #{dbg}[soo=] did not raise CliError"
|
|
698
|
+
assert_raises(CliError, str) do
|
|
699
|
+
af.soo = val
|
|
700
|
+
end
|
|
701
|
+
# SOO is only allowed in non-default VRF
|
|
702
|
+
return
|
|
703
|
+
end
|
|
609
704
|
end
|
|
610
705
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
706
|
+
if platform == :nexus
|
|
707
|
+
# Set initial
|
|
708
|
+
af.soo = val
|
|
709
|
+
assert_equal(val, af.soo,
|
|
710
|
+
"Test 2. #{dbg} Failed to set '#{val}'")
|
|
711
|
+
|
|
712
|
+
# Change to new string
|
|
713
|
+
val = '2:2'
|
|
714
|
+
af.soo = val
|
|
715
|
+
assert_equal(val, af.soo,
|
|
716
|
+
"Test 3. #{dbg} Failed to change to '#{val}'")
|
|
717
|
+
|
|
718
|
+
# Set to default
|
|
719
|
+
val = af.default_soo
|
|
720
|
+
af.soo = val
|
|
721
|
+
assert_empty(af.soo,
|
|
722
|
+
"Test 4. #{dbg} Failed to set default '#{val}'")
|
|
723
|
+
else
|
|
724
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
725
|
+
af.soo = val
|
|
726
|
+
end
|
|
727
|
+
end
|
|
627
728
|
end
|
|
628
729
|
|
|
629
730
|
# --------------------------------
|
|
630
731
|
def test_weight
|
|
631
732
|
@@matrix.values.each do |af_args|
|
|
632
733
|
af, dbg = clean_af(af_args)
|
|
633
|
-
weight(af, dbg) unless dbg.include?('l2vpn/evpn')
|
|
734
|
+
weight(af, dbg) unless dbg.include?('l2vpn/evpn') && platform == :nexus
|
|
634
735
|
end
|
|
635
736
|
end
|
|
636
737
|
|