cisco_node_utils 0.9.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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +293 -0
  5. data/CHANGELOG.md +5 -0
  6. data/CONTRIBUTING.md +31 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +201 -0
  9. data/README.md +113 -0
  10. data/Rakefile +4 -0
  11. data/cisco_node_utils.gemspec +30 -0
  12. data/lib/cisco_node_utils.rb +33 -0
  13. data/lib/cisco_node_utils/README_YAML.md +333 -0
  14. data/lib/cisco_node_utils/cisco_cmn_utils.rb +92 -0
  15. data/lib/cisco_node_utils/command_reference.rb +415 -0
  16. data/lib/cisco_node_utils/command_reference_common.yaml +845 -0
  17. data/lib/cisco_node_utils/command_reference_n3064.yaml +13 -0
  18. data/lib/cisco_node_utils/command_reference_n7k.yaml +48 -0
  19. data/lib/cisco_node_utils/command_reference_n9k.yaml +35 -0
  20. data/lib/cisco_node_utils/configparser_lib.rb +196 -0
  21. data/lib/cisco_node_utils/interface.rb +501 -0
  22. data/lib/cisco_node_utils/interface_ospf.rb +241 -0
  23. data/lib/cisco_node_utils/node.rb +673 -0
  24. data/lib/cisco_node_utils/platform.rb +184 -0
  25. data/lib/cisco_node_utils/platform_info.rb +58 -0
  26. data/lib/cisco_node_utils/platform_info.yaml +10 -0
  27. data/lib/cisco_node_utils/router_ospf.rb +96 -0
  28. data/lib/cisco_node_utils/router_ospf_vrf.rb +258 -0
  29. data/lib/cisco_node_utils/snmpcommunity.rb +91 -0
  30. data/lib/cisco_node_utils/snmpgroup.rb +55 -0
  31. data/lib/cisco_node_utils/snmpserver.rb +150 -0
  32. data/lib/cisco_node_utils/snmpuser.rb +342 -0
  33. data/lib/cisco_node_utils/tacacs_server.rb +175 -0
  34. data/lib/cisco_node_utils/tacacs_server_host.rb +128 -0
  35. data/lib/cisco_node_utils/version.rb +17 -0
  36. data/lib/cisco_node_utils/vlan.rb +153 -0
  37. data/lib/cisco_node_utils/vtp.rb +127 -0
  38. data/lib/cisco_node_utils/yum.rb +84 -0
  39. data/tests/basetest.rb +93 -0
  40. data/tests/ciscotest.rb +136 -0
  41. data/tests/cmd_config.yaml +51 -0
  42. data/tests/cmd_config_invalid.yaml +16 -0
  43. data/tests/test_all_cisco.rb +46 -0
  44. data/tests/test_command_config.rb +192 -0
  45. data/tests/test_command_reference.rb +222 -0
  46. data/tests/test_interface.rb +1017 -0
  47. data/tests/test_interface_ospf.rb +763 -0
  48. data/tests/test_interface_svi.rb +267 -0
  49. data/tests/test_interface_switchport.rb +722 -0
  50. data/tests/test_node.rb +108 -0
  51. data/tests/test_node_ext.rb +450 -0
  52. data/tests/test_platform.rb +188 -0
  53. data/tests/test_router_ospf.rb +164 -0
  54. data/tests/test_router_ospf_vrf.rb +753 -0
  55. data/tests/test_snmpcommunity.rb +344 -0
  56. data/tests/test_snmpgroup.rb +71 -0
  57. data/tests/test_snmpserver.rb +443 -0
  58. data/tests/test_snmpuser.rb +803 -0
  59. data/tests/test_tacacs_server.rb +388 -0
  60. data/tests/test_tacacs_server_host.rb +391 -0
  61. data/tests/test_vlan.rb +264 -0
  62. data/tests/test_vtp.rb +319 -0
  63. data/tests/test_yum.rb +106 -0
  64. metadata +188 -0
@@ -0,0 +1,106 @@
1
+ # Copyright (c) 2015 Cisco and/or its affiliates.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require File.expand_path("../ciscotest", __FILE__)
16
+ require File.expand_path("../../lib/cisco_node_utils/yum", __FILE__)
17
+
18
+ class TestYum < CiscoTestCase
19
+ @@skip = false
20
+ @@run_setup = true
21
+ @@pkg = 'n9000_sample'
22
+ @@pkg_ver = '1.0.0-7.0.3'
23
+ @@pkg_filename = 'n9000_sample-1.0.0-7.0.3.x86_64.rpm'
24
+
25
+ def setup
26
+ super
27
+ # only run check once (can't use initialize because @device isn't ready)
28
+ if @@run_setup
29
+ s = @device.cmd("show file bootflash:#{@@pkg_filename} cksum")
30
+ if s[/No such file/]
31
+ @@skip = true
32
+ else
33
+ # add pkg to the repo
34
+ # normally this could be accomplished by first installing via full path
35
+ # but that would make these tests order dependent
36
+ unless @device.cmd("show install package | include #{@@pkg}")[/@patching/]
37
+ @device.cmd("install add bootflash:#{@@pkg_filename}")
38
+ # Wait for install to complete
39
+ sleep 30
40
+ end
41
+ end
42
+ @@run_setup = false
43
+ end
44
+ end
45
+
46
+ def skip?
47
+ skip "file bootflash:#{@@pkg_filename} is required. " +
48
+ "this file can be downloaded from /auto/rtp-core-tftpboot/repo" if @@skip
49
+ end
50
+
51
+ def test_install
52
+ begin
53
+ skip?
54
+ if @device.cmd("show install package | include #{@@pkg}")[/@patching/]
55
+ @device.cmd("install deactivate #{@@pkg}")
56
+ node.cache_flush
57
+ sleep 20
58
+ end
59
+ Yum.install(@@pkg)
60
+ sleep 20
61
+ s = @device.cmd("show install package | include #{@@pkg}")[/@patching/]
62
+ assert(s, "failed to find installed package #{@@pkg}")
63
+ rescue RuntimeError => e
64
+ assert(false, e.message)
65
+ end
66
+ end
67
+
68
+ def test_remove
69
+ skip?
70
+ unless @device.cmd("show install package | include #{@@pkg}")[/@patching/]
71
+ @device.cmd("install add #{@@pkg} activate")
72
+ node.cache_flush
73
+ sleep 20
74
+ end
75
+ Yum.remove(@@pkg)
76
+ sleep 20
77
+ s = @device.cmd("show install package | include #{@@pkg}")[/@patching/]
78
+ assert_nil(s)
79
+ end
80
+
81
+ def test_ambiguous_package_error
82
+ skip?
83
+ assert_raises(RuntimeError) { Yum.query("busybox") }
84
+ end
85
+
86
+ def test_package_does_not_exist_error
87
+ assert_raises(RuntimeError) { Yum.install("bootflash:this_is_not_real.rpm") }
88
+ assert_raises(RuntimeError) { Yum.install("also_not_real") }
89
+ end
90
+
91
+ def test_query
92
+ skip?
93
+ unless @device.cmd("show install package | include #{@@pkg}")[/@patching/]
94
+ @device.cmd("install activate #{@@pkg}")
95
+ node.cache_flush
96
+ sleep 20
97
+ end
98
+ ver = Yum.query(@@pkg)
99
+ assert_equal(ver, @@pkg_ver)
100
+ @device.cmd("install deactivate #{@@pkg}")
101
+ node.cache_flush
102
+ sleep 20
103
+ ver = Yum.query(@@pkg)
104
+ assert_nil(ver)
105
+ end
106
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cisco_node_utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Hunsberger
8
+ - Glenn Matthews
9
+ - Chris Van Heuveln
10
+ - Mike Wiebe
11
+ - Jie Yang
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2015-07-16 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: minitest
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.5.1
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.0
27
+ type: :development
28
+ prerelease: false
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.5.1
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 5.0.0
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.7'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '1.7'
51
+ - !ruby/object:Gem::Dependency
52
+ name: rake
53
+ requirement: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '10.0'
58
+ type: :development
59
+ prerelease: false
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - "~>"
63
+ - !ruby/object:Gem::Version
64
+ version: '10.0'
65
+ - !ruby/object:Gem::Dependency
66
+ name: rubocop
67
+ requirement: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0.32'
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0.32'
79
+ - !ruby/object:Gem::Dependency
80
+ name: cisco_nxapi
81
+ requirement: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0.9'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0.9'
93
+ description: |
94
+ Utilities for management of Cisco network nodes.
95
+ Designed to work with Puppet and Chef.
96
+ Currently supports NX-OS nodes.
97
+ email: cisco_agent_gem@cisco.com
98
+ executables: []
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - ".gitignore"
103
+ - ".rubocop.yml"
104
+ - ".rubocop_todo.yml"
105
+ - CHANGELOG.md
106
+ - CONTRIBUTING.md
107
+ - Gemfile
108
+ - LICENSE
109
+ - README.md
110
+ - Rakefile
111
+ - cisco_node_utils.gemspec
112
+ - lib/cisco_node_utils.rb
113
+ - lib/cisco_node_utils/README_YAML.md
114
+ - lib/cisco_node_utils/cisco_cmn_utils.rb
115
+ - lib/cisco_node_utils/command_reference.rb
116
+ - lib/cisco_node_utils/command_reference_common.yaml
117
+ - lib/cisco_node_utils/command_reference_n3064.yaml
118
+ - lib/cisco_node_utils/command_reference_n7k.yaml
119
+ - lib/cisco_node_utils/command_reference_n9k.yaml
120
+ - lib/cisco_node_utils/configparser_lib.rb
121
+ - lib/cisco_node_utils/interface.rb
122
+ - lib/cisco_node_utils/interface_ospf.rb
123
+ - lib/cisco_node_utils/node.rb
124
+ - lib/cisco_node_utils/platform.rb
125
+ - lib/cisco_node_utils/platform_info.rb
126
+ - lib/cisco_node_utils/platform_info.yaml
127
+ - lib/cisco_node_utils/router_ospf.rb
128
+ - lib/cisco_node_utils/router_ospf_vrf.rb
129
+ - lib/cisco_node_utils/snmpcommunity.rb
130
+ - lib/cisco_node_utils/snmpgroup.rb
131
+ - lib/cisco_node_utils/snmpserver.rb
132
+ - lib/cisco_node_utils/snmpuser.rb
133
+ - lib/cisco_node_utils/tacacs_server.rb
134
+ - lib/cisco_node_utils/tacacs_server_host.rb
135
+ - lib/cisco_node_utils/version.rb
136
+ - lib/cisco_node_utils/vlan.rb
137
+ - lib/cisco_node_utils/vtp.rb
138
+ - lib/cisco_node_utils/yum.rb
139
+ - tests/basetest.rb
140
+ - tests/ciscotest.rb
141
+ - tests/cmd_config.yaml
142
+ - tests/cmd_config_invalid.yaml
143
+ - tests/test_all_cisco.rb
144
+ - tests/test_command_config.rb
145
+ - tests/test_command_reference.rb
146
+ - tests/test_interface.rb
147
+ - tests/test_interface_ospf.rb
148
+ - tests/test_interface_svi.rb
149
+ - tests/test_interface_switchport.rb
150
+ - tests/test_node.rb
151
+ - tests/test_node_ext.rb
152
+ - tests/test_platform.rb
153
+ - tests/test_router_ospf.rb
154
+ - tests/test_router_ospf_vrf.rb
155
+ - tests/test_snmpcommunity.rb
156
+ - tests/test_snmpgroup.rb
157
+ - tests/test_snmpserver.rb
158
+ - tests/test_snmpuser.rb
159
+ - tests/test_tacacs_server.rb
160
+ - tests/test_tacacs_server_host.rb
161
+ - tests/test_vlan.rb
162
+ - tests/test_vtp.rb
163
+ - tests/test_yum.rb
164
+ homepage:
165
+ licenses:
166
+ - Apache-2.0
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubyforge_project:
184
+ rubygems_version: 2.2.2
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: Utilities for management of Cisco network nodes
188
+ test_files: []