lenovo-rbapi 0.0.2 → 0.0.3

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.
@@ -1,16 +1,15 @@
1
1
  ##
2
- ## Copyright (c) 2017, Lenovo. All rights reserved.
2
+ ## Copyright (C) 2017 Lenovo, Inc.
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
+ ## http://www.apache.org/licenses/LICENSE-2.0
3
7
  ##
4
- ## This program and the accompanying materials are licensed and made available
5
- ## under the terms and conditions of the 3-clause BSD License that accompanies
6
- ## this distribution.
7
- ##
8
- ## The full text of the license may be found at
9
- ##
10
- ## https://opensource.org/licenses/BSD-3-Clause
11
- ##
12
- ## THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
- ## WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
8
+ ## Unless required by applicable law or agreed to in writing, software
9
+ ## distributed under the License is distributed on an "AS IS" BASIS,
10
+ ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ ## See the License for the specific language governing permissions and
12
+ ## limitations under the License.
14
13
  ##
15
14
  require 'rest-client'
16
15
  require 'json'
@@ -26,7 +25,7 @@ require_relative 'rest_utils'
26
25
  #
27
26
 
28
27
  class Vlan
29
- @cfg = '/nos/api/cfg/vlan'
28
+ @@cfg = '/nos/api/cfg/vlan'
30
29
 
31
30
  # This API gets properties of all VLANS.
32
31
  #
@@ -36,7 +35,7 @@ class Vlan
36
35
  #
37
36
  # return: JSON response
38
37
  def self.get_all_vlan(conn)
39
- url = form_url(conn, @cfg)
38
+ url = form_url(conn, @@cfg)
40
39
  hdr = form_hdr(conn)
41
40
  Rest.get(conn, url, hdr)
42
41
  end
@@ -60,7 +59,7 @@ class Vlan
60
59
  #
61
60
  # return: JSON response
62
61
  def self.create_vlan(conn, params)
63
- url = form_url(conn, @cfg)
62
+ url = form_url(conn, @@cfg)
64
63
  hdr = form_hdr(conn)
65
64
  params = params.to_json
66
65
  Rest.post(conn, url, hdr, params)
@@ -76,7 +75,7 @@ class Vlan
76
75
  #
77
76
  # return: JSON response
78
77
  def self.get_vlan_prop(conn, vlan_id)
79
- url = form_url(conn, @cfg + '/' + vlan_id.to_s)
78
+ url = form_url(conn, @@cfg + '/' + vlan_id.to_s)
80
79
  hdr = form_hdr(conn)
81
80
  Rest.get(conn, url, hdr)
82
81
  end
@@ -99,7 +98,7 @@ class Vlan
99
98
  #
100
99
  # return: JSON response
101
100
  def self.update_vlan(conn, vlan_id, params)
102
- url = form_url(conn, @cfg + '/' + vlan_id.to_s)
101
+ url = form_url(conn, @@cfg + '/' + vlan_id.to_s)
103
102
  hdr = form_hdr(conn)
104
103
  params = params.to_json
105
104
  Rest.put(conn, url, hdr, params)
@@ -116,7 +115,7 @@ class Vlan
116
115
  #
117
116
  # return:
118
117
  def self.delete_vlan(conn, vlan_id)
119
- url = form_url(conn, @cfg + '/' + vlan_id.to_s)
118
+ url = form_url(conn, @@cfg + '/' + vlan_id.to_s)
120
119
  hdr = form_hdr(conn)
121
120
  Rest.delete(conn, url, hdr)
122
121
  end
@@ -1,16 +1,15 @@
1
1
  ##
2
- ## Copyright (c) 2017, Lenovo. All rights reserved.
2
+ ## Copyright (C) 2017 Lenovo, Inc.
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
+ ## http://www.apache.org/licenses/LICENSE-2.0
3
7
  ##
4
- ## This program and the accompanying materials are licensed and made available
5
- ## under the terms and conditions of the 3-clause BSD License that accompanies
6
- ## this distribution.
7
- ##
8
- ## The full text of the license may be found at
9
- ##
10
- ## https://opensource.org/licenses/BSD-3-Clause
11
- ##
12
- ## THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
- ## WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
8
+ ## Unless required by applicable law or agreed to in writing, software
9
+ ## distributed under the License is distributed on an "AS IS" BASIS,
10
+ ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ ## See the License for the specific language governing permissions and
12
+ ## limitations under the License.
14
13
  ##
15
14
  require 'rest-client'
16
15
  require 'json'
@@ -24,7 +23,7 @@ require_relative 'rest_utils'
24
23
 
25
24
 
26
25
  class VlanIntf
27
- @cfg = '/nos/api/cfg/vlan_interface'
26
+ @@cfg = '/nos/api/cfg/vlan_interface'
28
27
  # This API gets VLAN properties of all Ethernet interfaces.
29
28
  #
30
29
  #
@@ -33,7 +32,7 @@ class VlanIntf
33
32
  #
34
33
  # return: JSON response
35
34
  def self.get_all_vlan_intf(conn)
36
- url = form_url(conn, @cfg)
35
+ url = form_url(conn, @@cfg)
37
36
  hdr = form_hdr(conn)
38
37
  Rest.get(conn, url, hdr)
39
38
  end
@@ -49,7 +48,7 @@ class VlanIntf
49
48
  def self.get_vlan_prop_intf(conn, vlan_intf)
50
49
  temp = vlan_intf.dup
51
50
  temp.sub! '/', '%2F'
52
- url = form_url(conn, @cfg + '/' + temp)
51
+ url = form_url(conn, @@cfg + '/' + temp)
53
52
  hdr = form_hdr(conn)
54
53
  Rest.get(conn, url, hdr)
55
54
  end
@@ -80,7 +79,7 @@ class VlanIntf
80
79
  def self.update_vlan_intf(conn, vlan_intf, params)
81
80
  temp = vlan_intf.dup
82
81
  temp.sub! '/', '%2F'
83
- url = form_url(conn, @cfg + '/' + temp)
82
+ url = form_url(conn, @@cfg + '/' + temp)
84
83
  hdr = form_hdr(conn)
85
84
  params = params.to_json
86
85
  Rest.put(conn, url, hdr, params)
@@ -1,16 +1,15 @@
1
1
  ##
2
- ## Copyright (c) 2017, Lenovo. All rights reserved.
2
+ ## Copyright (C) 2017 Lenovo, Inc.
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
+ ## http://www.apache.org/licenses/LICENSE-2.0
3
7
  ##
4
- ## This program and the accompanying materials are licensed and made available
5
- ## under the terms and conditions of the 3-clause BSD License that accompanies
6
- ## this distribution.
7
- ##
8
- ## The full text of the license may be found at
9
- ##
10
- ## https://opensource.org/licenses/BSD-3-Clause
11
- ##
12
- ## THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
- ## WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
8
+ ## Unless required by applicable law or agreed to in writing, software
9
+ ## distributed under the License is distributed on an "AS IS" BASIS,
10
+ ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ ## See the License for the specific language governing permissions and
12
+ ## limitations under the License.
14
13
  ##
15
14
  require 'rest-client'
16
15
  require 'json'
@@ -24,7 +23,7 @@ require_relative 'rest_utils'
24
23
  ##
25
24
 
26
25
  class Vrrp
27
- @cfg = '/nos/api/cfg/vrrp'
26
+ @@cfg = '/nos/api/cfg/vrrp'
28
27
  # This API gets properties of all VRRP VRs of all interfaces.
29
28
  #
30
29
  #
@@ -33,7 +32,7 @@ class Vrrp
33
32
  #
34
33
  # return: JSON response
35
34
  def self.get_vrrp_prop_all(conn)
36
- url = form_url(conn, @cfg)
35
+ url = form_url(conn, @@cfg)
37
36
  hdr = form_hdr(conn)
38
37
  Rest.get(conn, url, hdr)
39
38
  end
@@ -49,7 +48,7 @@ class Vrrp
49
48
  def self.get_vrrp_intf(conn, intf)
50
49
  temp = intf.dup
51
50
  temp.sub! '/', '%2F'
52
- url = form_url(conn, @cfg + '/' + temp)
51
+ url = form_url(conn, @@cfg + '/' + temp)
53
52
  hdr = form_hdr(conn)
54
53
  Rest.get(conn, url, hdr)
55
54
  end
@@ -100,7 +99,7 @@ class Vrrp
100
99
  def self.create_vrrp_intf(conn, intf, params)
101
100
  temp = intf.dup
102
101
  temp.sub! '/', '%2F'
103
- url = form_url(conn, @cfg + '/' + temp)
102
+ url = form_url(conn, @@cfg + '/' + temp)
104
103
  hdr = form_hdr(conn)
105
104
  params = params.to_json
106
105
  Rest.post(conn, url, hdr, params)
@@ -118,7 +117,7 @@ class Vrrp
118
117
  def self.get_vrrp_intf_vrid(conn, intf, vrid)
119
118
  temp = intf.dup
120
119
  temp.sub! '/', '%2F'
121
- url = form_url(conn, @cfg + '/' + temp + '/' + vrid.to_s)
120
+ url = form_url(conn, @@cfg + '/' + temp + '/' + vrid.to_s)
122
121
  hdr = form_hdr(conn)
123
122
  Rest.get(conn, url, hdr)
124
123
  end
@@ -172,7 +171,7 @@ class Vrrp
172
171
  def self.update_vrrp_intf_vrid(conn, intf, vrid, params)
173
172
  temp = intf.dup
174
173
  temp.sub! '/', '%2F'
175
- url = form_url(conn, @cfg + '/' + temp + '/' + vrid.to_s)
174
+ url = form_url(conn, @@cfg + '/' + temp + '/' + vrid.to_s)
176
175
  hdr = form_hdr(conn)
177
176
  params = params.to_json
178
177
  Rest.put(conn, url, hdr, params)
@@ -190,7 +189,7 @@ class Vrrp
190
189
  def self.del_vrrp_intf_vrid(conn, intf, vrid)
191
190
  temp = intf.dup
192
191
  temp.sub! '/', '%2F'
193
- url = form_url(conn, @cfg + '/' + temp + '/' + vrid.to_s)
192
+ url = form_url(conn, @@cfg + '/' + temp + '/' + vrid.to_s)
194
193
  hdr = form_hdr(conn)
195
194
  Rest.delete(conn, url, hdr)
196
195
  end
data/test/jupiter.yml ADDED
@@ -0,0 +1,6 @@
1
+ transport : 'http'
2
+ port : '8090'
3
+ ip : '10.240.177.121'
4
+ user : 'admin'
5
+ password : 'admin'
6
+ image : 'G8296-CNOS-10.6.0.59.img'
data/test/mars.yml ADDED
@@ -0,0 +1,6 @@
1
+ transport : 'http'
2
+ port : '8090'
3
+ ip : '10.240.176.141'
4
+ user : 'admin'
5
+ password : 'admin'
6
+ image : 'G8272-CNOS-10.6.0.59.img'
data/test/mytest.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'lenovo-rbapi'
2
+
3
+ LenovoGem::Cnos.lenovo?
data/test/neptune.yml ADDED
@@ -0,0 +1,6 @@
1
+ transport : 'https'
2
+ port : '443'
3
+ ip : '10.240.177.241'
4
+ user : 'admin'
5
+ password : 'admin'
6
+ image : 'NE1032-CNOS-10.6.0.59.img'
data/test/voyager.yml ADDED
@@ -0,0 +1,6 @@
1
+ transport : 'https'
2
+ port : '443'
3
+ ip : '10.240.177.152'
4
+ user : 'admin'
5
+ password : 'admin'
6
+ image : 'NE10032-CNOS-10.6.0.59.img'
metadata CHANGED
@@ -1,20 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lenovo-rbapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coleen Quadros
8
8
  - Arun Lankalapalli
9
+ - Anil Kumar M
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2018-01-08 00:00:00.000000000 Z
13
+ date: 2018-01-23 00:00:00.000000000 Z
13
14
  dependencies: []
14
- description: Lib for CNOS REST API's using Ruby
15
+ description: Lib for REST API's using Ruby
15
16
  email:
16
17
  - cquadros@lenovo.com
17
18
  - alankalapall@lenovo.com
19
+ - amuraleedhar@lenovo.com
18
20
  executables: []
19
21
  extensions: []
20
22
  extra_rdoc_files:
@@ -36,13 +38,17 @@ files:
36
38
  - lib/cnos-rbapi/stp.rb
37
39
  - lib/cnos-rbapi/system.rb
38
40
  - lib/cnos-rbapi/telemetry.rb
39
- - lib/cnos-rbapi/valn_intf.rb
40
41
  - lib/cnos-rbapi/vlag.rb
41
42
  - lib/cnos-rbapi/vlan.rb
42
43
  - lib/cnos-rbapi/vlan_intf.rb
43
44
  - lib/cnos-rbapi/vrrp.rb
45
+ - test/jupiter.yml
46
+ - test/mars.yml
47
+ - test/mytest.rb
48
+ - test/neptune.yml
44
49
  - test/rbapi_test.rb
45
- homepage: http://rubygems.org/gems/lenovo-rbapi
50
+ - test/voyager.yml
51
+ homepage: http://rubygems.org/gems/lenovo-cnos-rbapi
46
52
  licenses:
47
53
  - BSD-3-Clause
48
54
  metadata: {}
@@ -50,6 +56,7 @@ post_install_message:
50
56
  rdoc_options: []
51
57
  require_paths:
52
58
  - lib
59
+ - lib/cnos-rbapi
53
60
  required_ruby_version: !ruby/object:Gem::Requirement
54
61
  requirements:
55
62
  - - ">="
@@ -62,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
69
  version: '0'
63
70
  requirements: []
64
71
  rubyforge_project:
65
- rubygems_version: 2.7.4
72
+ rubygems_version: 2.6.12
66
73
  signing_key:
67
74
  specification_version: 4
68
- summary: Library Implementation for CNOS REST API's
75
+ summary: Library Implementation for REST APIs
69
76
  test_files: []
File without changes