cisco_node_utils 1.3.0 → 1.4.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 +1 -0
- data/CHANGELOG.md +66 -0
- data/Gemfile +1 -0
- data/README.md +44 -43
- data/bin/.rubocop.yml +18 -0
- data/bin/show_running_yang.rb +233 -0
- data/cisco_node_utils.gemspec +1 -1
- data/docs/README-maintainers.md +1 -0
- data/docs/README-utilities.md +14 -0
- data/lib/.rubocop.yml +1 -1
- data/lib/cisco_node_utils/aaa_authentication_login_service.rb +8 -3
- data/lib/cisco_node_utils/aaa_authorization_service.rb +6 -0
- data/lib/cisco_node_utils/bfd_global.rb +300 -0
- data/lib/cisco_node_utils/bgp.rb +6 -4
- data/lib/cisco_node_utils/bgp_af.rb +2 -0
- data/lib/cisco_node_utils/bgp_neighbor.rb +14 -0
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +4 -1
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +126 -0
- data/lib/cisco_node_utils/client/client.rb +6 -2
- data/lib/cisco_node_utils/client/grpc/client.rb +120 -36
- data/lib/cisco_node_utils/client/nxapi/client.rb +6 -2
- data/lib/cisco_node_utils/cmd_ref/DEPRECATED.yaml +118 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +14 -0
- data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +117 -0
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +7 -7
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +125 -0
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +141 -49
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +44 -0
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +6 -0
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +6 -0
- data/lib/cisco_node_utils/cmd_ref/ospf_area.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/ospf_area_vlink.yaml +88 -0
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +0 -3
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +3 -3
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +39 -15
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +43 -21
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +48 -19
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +0 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_global.yaml +30 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +18 -6
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +4 -0
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +1 -0
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +23 -10
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +8 -2
- data/lib/cisco_node_utils/cmd_ref/yang.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +10 -1
- data/lib/cisco_node_utils/constants.rb +8 -1
- data/lib/cisco_node_utils/dhcp_relay_global.rb +302 -0
- data/lib/cisco_node_utils/exceptions.rb +29 -0
- data/lib/cisco_node_utils/feature.rb +28 -0
- data/lib/cisco_node_utils/interface.rb +493 -402
- data/lib/cisco_node_utils/interface_DEPRECATED.rb +513 -0
- data/lib/cisco_node_utils/interface_ospf.rb +126 -0
- data/lib/cisco_node_utils/interface_portchannel.rb +16 -0
- data/lib/cisco_node_utils/logger.rb +3 -0
- data/lib/cisco_node_utils/node.rb +29 -1
- data/lib/cisco_node_utils/overlay_global.rb +1 -12
- data/lib/cisco_node_utils/pim.rb +1 -0
- data/lib/cisco_node_utils/pim_group_list.rb +1 -0
- data/lib/cisco_node_utils/pim_rp_address.rb +1 -0
- data/lib/cisco_node_utils/platform.rb +9 -2
- data/lib/cisco_node_utils/router_ospf.rb +1 -1
- data/lib/cisco_node_utils/router_ospf_area.rb +416 -0
- data/lib/cisco_node_utils/router_ospf_area_vlink.rb +313 -0
- data/lib/cisco_node_utils/router_ospf_vrf.rb +17 -0
- data/lib/cisco_node_utils/snmp_notification_receiver.rb +27 -9
- data/lib/cisco_node_utils/snmpcommunity.rb +34 -8
- data/lib/cisco_node_utils/snmpserver.rb +4 -4
- data/lib/cisco_node_utils/snmpuser.rb +0 -0
- data/lib/cisco_node_utils/tacacs_global.rb +102 -0
- data/lib/cisco_node_utils/tacacs_server.rb +8 -7
- data/lib/cisco_node_utils/vdc.rb +25 -7
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +30 -56
- data/lib/cisco_node_utils/vlan_DEPRECATED.rb +108 -0
- data/lib/cisco_node_utils/yang.rb +160 -0
- data/lib/cisco_node_utils/yum.rb +25 -32
- data/tests/.rubocop.yml +3 -0
- data/tests/ciscotest.rb +136 -19
- data/tests/cmd_config_invalid.yaml +1 -1
- data/tests/noop.rb +7 -0
- data/tests/tacacs_server.yaml.example +6 -0
- data/tests/test_aaa_authentication_login.rb +24 -1
- data/tests/test_aaa_authentication_login_service.rb +9 -16
- data/tests/test_aaa_authorization_service.rb +111 -84
- data/tests/test_bfd_global.rb +278 -0
- data/tests/test_bgp_neighbor.rb +20 -0
- data/tests/test_bridge_domain_vni.rb +2 -9
- data/tests/test_cmn_utils.rb +76 -0
- data/tests/test_dhcp_relay_global.rb +284 -0
- data/tests/test_dns_domain.rb +4 -4
- data/tests/test_domain_name.rb +2 -2
- data/tests/test_encapsulation.rb +2 -4
- data/tests/test_evpn_vni.rb +14 -7
- data/tests/test_fabricpath_global.rb +12 -13
- data/tests/test_feature.rb +35 -17
- data/tests/test_interface.rb +352 -127
- data/tests/test_interface_bdi.rb +2 -2
- data/tests/test_interface_channel_group.rb +1 -1
- data/tests/test_interface_ospf.rb +153 -23
- data/tests/test_interface_portchannel.rb +15 -6
- data/tests/test_interface_private_vlan.rb +200 -576
- data/tests/test_interface_svi.rb +5 -52
- data/tests/test_interface_switchport.rb +80 -240
- data/tests/test_itd_device_group.rb +2 -2
- data/tests/test_itd_device_group_node.rb +2 -2
- data/tests/test_itd_service.rb +1 -1
- data/tests/test_name_server.rb +3 -3
- data/tests/test_node_ext.rb +15 -17
- data/tests/test_ntp_config.rb +1 -1
- data/tests/test_ntp_server.rb +3 -3
- data/tests/test_nxapi.rb +1 -0
- data/tests/test_overlay_global.rb +15 -19
- data/tests/test_pim.rb +5 -5
- data/tests/test_pim_group_list.rb +1 -37
- data/tests/test_pim_rp_address.rb +1 -1
- data/tests/test_platform.rb +9 -11
- data/tests/test_portchannel_global.rb +43 -3
- data/tests/test_radius_server.rb +1 -1
- data/tests/test_radius_server_group.rb +1 -1
- data/tests/test_router_bgp.rb +17 -30
- data/tests/test_router_ospf_area.rb +433 -0
- data/tests/test_router_ospf_area_vlink.rb +298 -0
- data/tests/test_router_ospf_vrf.rb +17 -0
- data/tests/test_snmp_notification_receiver.rb +11 -11
- data/tests/test_snmpcommunity.rb +177 -69
- data/tests/test_snmpgroup.rb +7 -7
- data/tests/test_snmpserver.rb +164 -253
- data/tests/test_snmpuser.rb +73 -69
- data/tests/test_stp_global.rb +15 -15
- data/tests/test_syslog_settings.rb +1 -1
- data/tests/test_tacacs_global.rb +80 -0
- data/tests/test_tacacs_server.rb +129 -51
- data/tests/test_tacacs_server_group.rb +3 -29
- data/tests/test_tacacs_server_host.rb +24 -27
- data/tests/test_vlan.rb +57 -59
- data/tests/test_vlan_private.rb +271 -284
- data/tests/test_vpc.rb +10 -4
- data/tests/test_vrf.rb +2 -0
- data/tests/test_vrf_af.rb +2 -5
- data/tests/test_vtp.rb +5 -2
- data/tests/test_vxlan_vtep.rb +20 -44
- data/tests/test_vxlan_vtep_vni.rb +23 -16
- data/tests/test_yang.rb +369 -0
- data/tests/test_yum.rb +34 -42
- data/tests/yum_package.yaml +35 -0
- metadata +31 -4
- data/tests/test_vlan_mt_full.rb +0 -85
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
# snmp_server
|
|
2
2
|
---
|
|
3
|
-
_exclude: [ios_xr]
|
|
4
3
|
|
|
5
4
|
aaa_user_cache_timeout:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
_exclude: [ios_xr]
|
|
6
|
+
kind: int
|
|
7
|
+
get_command: "show snmp internal globals"
|
|
8
|
+
get_value: '/AAA Cache Timeout :(\d+)/'
|
|
9
|
+
set_value: "%s snmp-server aaa-user cache-timeout %d"
|
|
10
|
+
default_value: 3600
|
|
12
11
|
|
|
13
12
|
contact:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
nexus:
|
|
14
|
+
get_data_format: nxapi_structured
|
|
15
|
+
get_command: "show snmp"
|
|
16
|
+
get_value: "sys_contact"
|
|
17
|
+
set_value: "<state> snmp-server contact <contact>"
|
|
18
|
+
default_value: ""
|
|
19
|
+
ios_xr:
|
|
20
|
+
get_command: 'show running-config snmp'
|
|
21
|
+
get_value: '/^snmp-server contact (\S+)$/'
|
|
22
|
+
set_value: "<state> snmp-server contact <contact>"
|
|
23
|
+
default_value: ""
|
|
19
24
|
|
|
20
25
|
global_enforce_priv:
|
|
26
|
+
_exclude: [ios_xr]
|
|
21
27
|
kind: boolean
|
|
22
28
|
get_command: "show run snmp all"
|
|
23
29
|
get_value: '/^(?:no )?snmp-server globalEnforcePriv/'
|
|
@@ -25,28 +31,51 @@ global_enforce_priv:
|
|
|
25
31
|
default_value: false
|
|
26
32
|
|
|
27
33
|
location:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
nexus:
|
|
35
|
+
get_data_format: nxapi_structured
|
|
36
|
+
get_command: "show snmp"
|
|
37
|
+
get_value: "sys_location"
|
|
38
|
+
set_value: "<state> snmp-server location <location>"
|
|
39
|
+
default_value: ""
|
|
40
|
+
ios_xr:
|
|
41
|
+
get_command: 'show running-config snmp'
|
|
42
|
+
get_value: '/^snmp-server location (\S+)$/'
|
|
43
|
+
set_value: "<state> snmp-server location <location>"
|
|
44
|
+
default_value: ""
|
|
33
45
|
|
|
34
46
|
packet_size:
|
|
47
|
+
_exclude: [ios_xr]
|
|
35
48
|
kind: int
|
|
36
49
|
get_command: "show snmp internal globals"
|
|
37
50
|
get_value: '/SNMP Max packet size :(\d+)/'
|
|
38
51
|
set_value: "%s snmp-server packetsize %d"
|
|
39
|
-
|
|
52
|
+
N3k: &n3k_default_packet_size
|
|
53
|
+
# Prior to the 7.0(3)I4(1) release, the default packet size
|
|
54
|
+
# was incorrectly displayed as 0. CSCuz14217 fixed this to
|
|
55
|
+
# corectly display 1500.
|
|
56
|
+
default_value: 1500
|
|
57
|
+
N9k: *n3k_default_packet_size
|
|
58
|
+
N5k: &n5k_default_packet_size
|
|
59
|
+
# N5|6|7k platforms still incorrectly display the packet
|
|
60
|
+
# size as 0. This value is therefore still used as the
|
|
61
|
+
# default. This yaml entry will be changed to match
|
|
62
|
+
# the n3|9k behavior when the issue is resolved.
|
|
63
|
+
default_value: 0
|
|
64
|
+
N6k: *n5k_default_packet_size
|
|
65
|
+
N7k: *n5k_default_packet_size
|
|
66
|
+
N8k: *n5k_default_packet_size
|
|
40
67
|
|
|
41
68
|
protocol:
|
|
69
|
+
_exclude: [ios_xr]
|
|
42
70
|
kind: boolean
|
|
43
71
|
auto_default: false
|
|
44
|
-
get_command:
|
|
72
|
+
get_command: 'show running-config snmp all'
|
|
45
73
|
get_value: '/^snmp.server protocol enable/'
|
|
46
74
|
set_value: "%s snmp-server protocol enable"
|
|
47
75
|
default_value: true
|
|
48
76
|
|
|
49
77
|
tcp_session_auth:
|
|
78
|
+
_exclude: [ios_xr]
|
|
50
79
|
kind: boolean
|
|
51
80
|
auto_default: false
|
|
52
81
|
get_command: "show running-config snmp all"
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# tacacs_global.yaml
|
|
2
|
+
---
|
|
3
|
+
encryption:
|
|
4
|
+
set_value: "<state> tacacs-server key <option> <key>"
|
|
5
|
+
|
|
6
|
+
key:
|
|
7
|
+
get_value: '/^tacacs-server key (\d+)\s+(\S+)/'
|
|
8
|
+
default_value: ""
|
|
9
|
+
nexus:
|
|
10
|
+
get_command: "show run tacacs all"
|
|
11
|
+
ios_xr:
|
|
12
|
+
get_command: "show running-config tacacs-server"
|
|
13
|
+
|
|
14
|
+
key_format:
|
|
15
|
+
get_value: '/^tacacs-server key (\d+)\s+(\S+)/'
|
|
16
|
+
default_value: 0
|
|
17
|
+
nexus:
|
|
18
|
+
get_command: "show run tacacs all"
|
|
19
|
+
ios_xr:
|
|
20
|
+
get_command: "show running-config tacacs-server"
|
|
21
|
+
|
|
22
|
+
timeout:
|
|
23
|
+
kind: int
|
|
24
|
+
get_value: '/tacacs-server timeout\s+(\d+)/'
|
|
25
|
+
set_value: "<state> tacacs-server timeout <timeout>"
|
|
26
|
+
default_value: 5
|
|
27
|
+
nexus:
|
|
28
|
+
get_command: "show run tacacs all"
|
|
29
|
+
ios_xr:
|
|
30
|
+
get_command: "show running-config tacacs-server"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# tacacs_server
|
|
2
2
|
---
|
|
3
|
-
_exclude: [ios_xr]
|
|
4
3
|
|
|
5
4
|
deadtime:
|
|
5
|
+
_exclude: [ios_xr]
|
|
6
6
|
kind: int
|
|
7
7
|
get_command: "show run tacacs all"
|
|
8
8
|
get_value: '/^tacacs-server deadtime\s+(\d+)/'
|
|
@@ -10,6 +10,7 @@ deadtime:
|
|
|
10
10
|
default_value: 0
|
|
11
11
|
|
|
12
12
|
directed_request:
|
|
13
|
+
_exclude: [ios_xr]
|
|
13
14
|
kind: boolean
|
|
14
15
|
# oddly, directed request must be retrieved from aaa output
|
|
15
16
|
get_command: "show running aaa all"
|
|
@@ -18,26 +19,34 @@ directed_request:
|
|
|
18
19
|
default_value: false
|
|
19
20
|
|
|
20
21
|
encryption:
|
|
21
|
-
set_value: "
|
|
22
|
+
set_value: "<state> tacacs-server key <option> <key>"
|
|
22
23
|
|
|
23
24
|
encryption_password:
|
|
24
|
-
get_command: "show run tacacs all"
|
|
25
25
|
get_value: '/^tacacs-server key (\d+)\s+(\S+)/'
|
|
26
26
|
default_value: ""
|
|
27
|
+
nexus:
|
|
28
|
+
get_command: "show run tacacs all"
|
|
29
|
+
ios_xr:
|
|
30
|
+
get_command: "show running-config tacacs-server"
|
|
27
31
|
|
|
28
32
|
encryption_type:
|
|
29
33
|
auto_default: false
|
|
30
|
-
get_command: "show run tacacs all"
|
|
31
34
|
get_value: '/^tacacs-server key (\d+)\s+(\S+)/'
|
|
32
35
|
default_value: 0
|
|
36
|
+
nexus:
|
|
37
|
+
get_command: "show run tacacs all"
|
|
38
|
+
ios_xr:
|
|
39
|
+
get_command: "show running-config tacacs-server"
|
|
33
40
|
|
|
34
41
|
feature:
|
|
42
|
+
_exclude: [ios_xr]
|
|
35
43
|
kind: boolean
|
|
36
44
|
get_command: "show run tacacs all"
|
|
37
45
|
get_value: '/^feature tacacs/'
|
|
38
46
|
set_value: "%s feature tacacs+"
|
|
39
47
|
|
|
40
48
|
source_interface:
|
|
49
|
+
_exclude: [ios_xr]
|
|
41
50
|
get_command: "show run tacacs all"
|
|
42
51
|
get_value: '/(no)?\s*ip tacacs source-interface\s+(\S+)?/'
|
|
43
52
|
set_value: "%s ip tacacs source-interface %s"
|
|
@@ -45,7 +54,10 @@ source_interface:
|
|
|
45
54
|
|
|
46
55
|
timeout:
|
|
47
56
|
kind: int
|
|
48
|
-
get_command: "show run tacacs all"
|
|
49
57
|
get_value: '/tacacs-server timeout\s+(\d+)/'
|
|
50
|
-
set_value: "
|
|
58
|
+
set_value: "<state> tacacs-server timeout <timeout>"
|
|
51
59
|
default_value: 5
|
|
60
|
+
nexus:
|
|
61
|
+
get_command: "show run tacacs all"
|
|
62
|
+
ios_xr:
|
|
63
|
+
get_command: "show running-config tacacs-server"
|
|
@@ -16,6 +16,10 @@ all_vdcs:
|
|
|
16
16
|
get_context: ~
|
|
17
17
|
get_value: '/^vdc (\S+) id/'
|
|
18
18
|
|
|
19
|
+
allocate_interface:
|
|
20
|
+
get_value: '/^allocate interface (.*)/'
|
|
21
|
+
default_value: ~
|
|
22
|
+
|
|
19
23
|
allocate_interface_unallocated:
|
|
20
24
|
kind: boolean
|
|
21
25
|
set_value: 'allocate interface unallocated-interfaces'
|
|
@@ -24,15 +24,28 @@ fabric_control:
|
|
|
24
24
|
default_value: false
|
|
25
25
|
|
|
26
26
|
mapped_vni:
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
_exclude: [N7k]
|
|
28
|
+
N3k: &mapped_vni_n3_8_9k
|
|
29
29
|
get_command: 'show running vlan'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
N8k: *mapped_vni_n3_8_9k
|
|
31
|
+
N9k: *mapped_vni_n3_8_9k
|
|
32
|
+
N5k: &mapped_vni_n5_6k
|
|
33
|
+
get_command: 'show running vlan 1-4094'
|
|
34
|
+
N6k: *mapped_vni_n5_6k
|
|
35
|
+
kind: int
|
|
36
|
+
get_context: ['/^vlan <vlan>$/']
|
|
37
|
+
get_value: '/^vn-segment (\d+)$/'
|
|
38
|
+
set_context: ['vlan <vlan>']
|
|
39
|
+
set_value: '<state> vn-segment <vni> ; end'
|
|
40
|
+
default_value: ''
|
|
41
|
+
|
|
42
|
+
mapped_vni_requires_nv_overlay:
|
|
43
|
+
kind: boolean
|
|
44
|
+
N5k: &requires_nv_overlay_true
|
|
45
|
+
default_only: true
|
|
46
|
+
N6k: *requires_nv_overlay_true
|
|
47
|
+
else:
|
|
48
|
+
default_only: false
|
|
36
49
|
|
|
37
50
|
mode:
|
|
38
51
|
_exclude: [N3k, N9k]
|
|
@@ -51,7 +64,7 @@ name:
|
|
|
51
64
|
set_context: ["vlan %d"]
|
|
52
65
|
set_value: "%s name %s ; end"
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
pvlan_association:
|
|
55
68
|
_exclude: [N8k]
|
|
56
69
|
multiple: true
|
|
57
70
|
get_command: "show vlan private-vlan"
|
|
@@ -60,7 +73,7 @@ private_vlan_association:
|
|
|
60
73
|
set_value: "<state> private-vlan association <vlans> ; end"
|
|
61
74
|
default_value: []
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
pvlan_type:
|
|
64
77
|
_exclude: [N8k]
|
|
65
78
|
kind: string
|
|
66
79
|
get_command: 'show vlan private-vlan type'
|
|
@@ -50,11 +50,17 @@ source_intf:
|
|
|
50
50
|
default_value: ''
|
|
51
51
|
|
|
52
52
|
source_intf_hold_down_time:
|
|
53
|
-
_exclude: [N5k, N6k, N7k
|
|
53
|
+
_exclude: [N5k, N6k, N7k]
|
|
54
54
|
kind: int
|
|
55
55
|
get_value: '/^source-interface hold-down-time (\d+)$/'
|
|
56
56
|
set_value: '<state> source-interface hold-down-time <time>'
|
|
57
|
-
|
|
57
|
+
# This property is dependent on 'source-intf' and will not nvgen unless that
|
|
58
|
+
# command is also present. In I4 and older images the default_value was ''
|
|
59
|
+
# because the command did not nvgen with 'sh run int nve1 all'; in I4+ images
|
|
60
|
+
# this was changed and now the command appears (with 'show run all') with
|
|
61
|
+
# a value of 180. This is the correct behavior but it means that I4 and older
|
|
62
|
+
# images may experience an idempotence problem.
|
|
63
|
+
default_value: 180
|
|
58
64
|
|
|
59
65
|
vni:
|
|
60
66
|
set_value: '<state> member vni <vni> <assoc_vrf>'
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
---
|
|
3
3
|
_exclude: [ios_xr]
|
|
4
4
|
|
|
5
|
+
deactivate:
|
|
6
|
+
set_value: "install deactivate %s"
|
|
7
|
+
|
|
5
8
|
install:
|
|
6
9
|
set_value: "install add %s %s activate"
|
|
7
10
|
|
|
@@ -11,5 +14,11 @@ query:
|
|
|
11
14
|
# pass in the pkg name, retrieve version
|
|
12
15
|
get_value: '/^%s\S*\s+(\S+)\s+(?:installed|@\S+)/'
|
|
13
16
|
|
|
17
|
+
query_all:
|
|
18
|
+
multiple: true
|
|
19
|
+
get_command: "show install packages"
|
|
20
|
+
get_value: '/^(\S+)\s+(\S+)\s+(\S+)$/'
|
|
21
|
+
default_value: []
|
|
22
|
+
|
|
14
23
|
remove:
|
|
15
|
-
set_value: "install
|
|
24
|
+
set_value: "install remove %s forced"
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# September 2016, Sai Chintalapudi
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
require_relative 'node_util'
|
|
18
|
+
|
|
19
|
+
module Cisco
|
|
20
|
+
# node_utils class for dhcp_relay_global
|
|
21
|
+
class DhcpRelayGlobal < NodeUtil
|
|
22
|
+
attr_reader :name
|
|
23
|
+
|
|
24
|
+
def initialize(instantiate=true)
|
|
25
|
+
Feature.dhcp_enable if instantiate
|
|
26
|
+
set_args_keys_default
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.globals
|
|
30
|
+
hash = {}
|
|
31
|
+
hash['default'] = DhcpRelayGlobal.new(false) if Feature.dhcp_enabled?
|
|
32
|
+
hash
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Helper method to delete @set_args hash keys
|
|
36
|
+
def set_args_keys_default
|
|
37
|
+
@set_args = {}
|
|
38
|
+
@get_args = @set_args
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# rubocop:disable Style/AccessorMethodName
|
|
42
|
+
def set_args_keys(hash={})
|
|
43
|
+
set_args_keys_default
|
|
44
|
+
@set_args = @get_args.merge!(hash) unless hash.empty?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def destroy
|
|
48
|
+
return unless Feature.dhcp_enabled?
|
|
49
|
+
[:ipv4_information_option,
|
|
50
|
+
:ipv4_information_option_trust,
|
|
51
|
+
:ipv4_information_option_vpn,
|
|
52
|
+
:ipv4_information_trust_all,
|
|
53
|
+
:ipv4_relay,
|
|
54
|
+
:ipv4_smart_relay,
|
|
55
|
+
:ipv4_src_addr_hsrp,
|
|
56
|
+
:ipv4_src_intf,
|
|
57
|
+
:ipv4_sub_option_circuit_id_custom,
|
|
58
|
+
:ipv4_sub_option_circuit_id_string,
|
|
59
|
+
:ipv4_sub_option_cisco,
|
|
60
|
+
:ipv6_option_cisco,
|
|
61
|
+
:ipv6_option_vpn,
|
|
62
|
+
:ipv6_relay,
|
|
63
|
+
:ipv6_src_intf,
|
|
64
|
+
].each do |prop|
|
|
65
|
+
send("#{prop}=", send("default_#{prop}")) if send prop
|
|
66
|
+
end
|
|
67
|
+
set_args_keys_default
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
########################################################
|
|
71
|
+
# PROPERTIES #
|
|
72
|
+
########################################################
|
|
73
|
+
|
|
74
|
+
def ipv4_information_option
|
|
75
|
+
config_get('dhcp_relay_global', 'ipv4_information_option')
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def ipv4_information_option=(val)
|
|
79
|
+
state = val ? '' : 'no'
|
|
80
|
+
set_args_keys(state: state)
|
|
81
|
+
config_set('dhcp_relay_global', 'ipv4_information_option', @set_args)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def default_ipv4_information_option
|
|
85
|
+
config_get_default('dhcp_relay_global', 'ipv4_information_option')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def ipv4_information_option_trust
|
|
89
|
+
config_get('dhcp_relay_global', 'ipv4_information_option_trust')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def ipv4_information_option_trust=(val)
|
|
93
|
+
state = val ? '' : 'no'
|
|
94
|
+
set_args_keys(state: state)
|
|
95
|
+
config_set('dhcp_relay_global', 'ipv4_information_option_trust',
|
|
96
|
+
@set_args)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def default_ipv4_information_option_trust
|
|
100
|
+
config_get_default('dhcp_relay_global', 'ipv4_information_option_trust')
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def ipv4_information_option_vpn
|
|
104
|
+
config_get('dhcp_relay_global', 'ipv4_information_option_vpn')
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def ipv4_information_option_vpn=(val)
|
|
108
|
+
state = val ? '' : 'no'
|
|
109
|
+
set_args_keys(state: state)
|
|
110
|
+
config_set('dhcp_relay_global', 'ipv4_information_option_vpn', @set_args)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def default_ipv4_information_option_vpn
|
|
114
|
+
config_get_default('dhcp_relay_global', 'ipv4_information_option_vpn')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def ipv4_information_trust_all
|
|
118
|
+
config_get('dhcp_relay_global', 'ipv4_information_trust_all')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def ipv4_information_trust_all=(val)
|
|
122
|
+
state = val ? '' : 'no'
|
|
123
|
+
set_args_keys(state: state)
|
|
124
|
+
config_set('dhcp_relay_global', 'ipv4_information_trust_all', @set_args)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def default_ipv4_information_trust_all
|
|
128
|
+
config_get_default('dhcp_relay_global', 'ipv4_information_trust_all')
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def ipv4_relay
|
|
132
|
+
config_get('dhcp_relay_global', 'ipv4_relay')
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def ipv4_relay=(val)
|
|
136
|
+
state = val ? '' : 'no'
|
|
137
|
+
set_args_keys(state: state)
|
|
138
|
+
config_set('dhcp_relay_global', 'ipv4_relay', @set_args)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def default_ipv4_relay
|
|
142
|
+
config_get_default('dhcp_relay_global', 'ipv4_relay')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def ipv4_smart_relay
|
|
146
|
+
config_get('dhcp_relay_global', 'ipv4_smart_relay')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def ipv4_smart_relay=(val)
|
|
150
|
+
state = val ? '' : 'no'
|
|
151
|
+
set_args_keys(state: state)
|
|
152
|
+
config_set('dhcp_relay_global', 'ipv4_smart_relay', @set_args)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def default_ipv4_smart_relay
|
|
156
|
+
config_get_default('dhcp_relay_global', 'ipv4_smart_relay')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def ipv4_src_addr_hsrp
|
|
160
|
+
config_get('dhcp_relay_global', 'ipv4_src_addr_hsrp')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def ipv4_src_addr_hsrp=(val)
|
|
164
|
+
state = val ? '' : 'no'
|
|
165
|
+
set_args_keys(state: state)
|
|
166
|
+
config_set('dhcp_relay_global', 'ipv4_src_addr_hsrp', @set_args)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def default_ipv4_src_addr_hsrp
|
|
170
|
+
config_get_default('dhcp_relay_global', 'ipv4_src_addr_hsrp')
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def ipv4_src_intf
|
|
174
|
+
intf = config_get('dhcp_relay_global', 'ipv4_src_intf')
|
|
175
|
+
# Normalize by downcasing and removing white space
|
|
176
|
+
intf = intf.downcase.delete(' ') if intf
|
|
177
|
+
intf
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def ipv4_src_intf=(val)
|
|
181
|
+
state = val == default_ipv4_src_intf ? 'no' : ''
|
|
182
|
+
intf = val == default_ipv4_src_intf ? '' : val
|
|
183
|
+
set_args_keys(state: state, intf: intf)
|
|
184
|
+
config_set('dhcp_relay_global', 'ipv4_src_intf', @set_args)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def default_ipv4_src_intf
|
|
188
|
+
config_get_default('dhcp_relay_global', 'ipv4_src_intf')
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def ipv4_sub_option_circuit_id_custom
|
|
192
|
+
config_get('dhcp_relay_global', 'ipv4_sub_option_circuit_id_custom')
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def ipv4_sub_option_circuit_id_custom=(val)
|
|
196
|
+
state = val ? '' : 'no'
|
|
197
|
+
set_args_keys(state: state)
|
|
198
|
+
config_set('dhcp_relay_global', 'ipv4_sub_option_circuit_id_custom',
|
|
199
|
+
@set_args)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def default_ipv4_sub_option_circuit_id_custom
|
|
203
|
+
config_get_default('dhcp_relay_global',
|
|
204
|
+
'ipv4_sub_option_circuit_id_custom')
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def ipv4_sub_option_circuit_id_string
|
|
208
|
+
str = config_get('dhcp_relay_global', 'ipv4_sub_option_circuit_id_string')
|
|
209
|
+
# Normalize by removing white space
|
|
210
|
+
str.strip! if str
|
|
211
|
+
str
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def ipv4_sub_option_circuit_id_string=(val)
|
|
215
|
+
state = val == default_ipv4_sub_option_circuit_id_string ? 'no' : ''
|
|
216
|
+
format = val == default_ipv4_sub_option_circuit_id_string ? '' : 'format'
|
|
217
|
+
word = val == default_ipv4_sub_option_circuit_id_string ? '' : val
|
|
218
|
+
set_args_keys(state: state, format: format, word: word)
|
|
219
|
+
config_set('dhcp_relay_global', 'ipv4_sub_option_circuit_id_string',
|
|
220
|
+
@set_args)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def default_ipv4_sub_option_circuit_id_string
|
|
224
|
+
config_get_default('dhcp_relay_global',
|
|
225
|
+
'ipv4_sub_option_circuit_id_string')
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
def ipv4_sub_option_cisco
|
|
229
|
+
config_get('dhcp_relay_global', 'ipv4_sub_option_cisco')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def ipv4_sub_option_cisco=(val)
|
|
233
|
+
state = val ? '' : 'no'
|
|
234
|
+
set_args_keys(state: state)
|
|
235
|
+
config_set('dhcp_relay_global', 'ipv4_sub_option_cisco', @set_args)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def default_ipv4_sub_option_cisco
|
|
239
|
+
config_get_default('dhcp_relay_global', 'ipv4_sub_option_cisco')
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def ipv6_option_cisco
|
|
243
|
+
config_get('dhcp_relay_global', 'ipv6_option_cisco')
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def ipv6_option_cisco=(val)
|
|
247
|
+
state = val ? '' : 'no'
|
|
248
|
+
set_args_keys(state: state)
|
|
249
|
+
config_set('dhcp_relay_global', 'ipv6_option_cisco', @set_args)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def default_ipv6_option_cisco
|
|
253
|
+
config_get_default('dhcp_relay_global', 'ipv6_option_cisco')
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def ipv6_option_vpn
|
|
257
|
+
config_get('dhcp_relay_global', 'ipv6_option_vpn')
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def ipv6_option_vpn=(val)
|
|
261
|
+
state = val ? '' : 'no'
|
|
262
|
+
set_args_keys(state: state)
|
|
263
|
+
config_set('dhcp_relay_global', 'ipv6_option_vpn', @set_args)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def default_ipv6_option_vpn
|
|
267
|
+
config_get_default('dhcp_relay_global', 'ipv6_option_vpn')
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def ipv6_relay
|
|
271
|
+
config_get('dhcp_relay_global', 'ipv6_relay')
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def ipv6_relay=(val)
|
|
275
|
+
state = val ? '' : 'no'
|
|
276
|
+
set_args_keys(state: state)
|
|
277
|
+
config_set('dhcp_relay_global', 'ipv6_relay', @set_args)
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def default_ipv6_relay
|
|
281
|
+
config_get_default('dhcp_relay_global', 'ipv6_relay')
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def ipv6_src_intf
|
|
285
|
+
intf = config_get('dhcp_relay_global', 'ipv6_src_intf')
|
|
286
|
+
# Normalize by downcasing and removing white space
|
|
287
|
+
intf = intf.downcase.delete(' ') if intf
|
|
288
|
+
intf
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def ipv6_src_intf=(val)
|
|
292
|
+
state = val == default_ipv6_src_intf ? 'no' : ''
|
|
293
|
+
intf = val == default_ipv6_src_intf ? '' : val
|
|
294
|
+
set_args_keys(state: state, intf: intf)
|
|
295
|
+
config_set('dhcp_relay_global', 'ipv6_src_intf', @set_args)
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
def default_ipv6_src_intf
|
|
299
|
+
config_get_default('dhcp_relay_global', 'ipv6_src_intf')
|
|
300
|
+
end
|
|
301
|
+
end # class
|
|
302
|
+
end # module
|