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'
@@ -24,7 +23,7 @@ require_relative 'rest_utils'
24
23
  ##
25
24
 
26
25
  class Lacp
27
- @cfg = '/nos/api/cfg/lacp'
26
+ @@cfg = '/nos/api/cfg/lacp'
28
27
  # This API gets the LACP properties of the system.
29
28
  #
30
29
  #
@@ -33,7 +32,7 @@ class Lacp
33
32
  #
34
33
  # return: JSON response
35
34
  def self.get_lacp(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
@@ -54,7 +53,7 @@ class Lacp
54
53
  #
55
54
  # return: JSON response
56
55
  def self.update_lacp(conn, params)
57
- url = form_url(conn, @cfg)
56
+ url = form_url(conn, @@cfg)
58
57
  hdr = form_hdr(conn)
59
58
  params = params.to_json
60
59
  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 Lag
27
- @cfg = '/nos/api/cfg/lag'
26
+ @@cfg = '/nos/api/cfg/lag'
28
27
 
29
28
  # This API gets the properties of all LAG's.
30
29
  #
@@ -34,7 +33,7 @@ class Lag
34
33
  #
35
34
  # return: JSON response
36
35
  def self.get_all_lag(conn)
37
- url = form_url(conn, @cfg)
36
+ url = form_url(conn, @@cfg)
38
37
  hdr = form_hdr(conn)
39
38
  Rest.get(conn, url, hdr)
40
39
  end
@@ -69,7 +68,7 @@ class Lag
69
68
  #
70
69
  # return: JSON response
71
70
  def self.create_lag(conn, lag_id, interfaces = [])
72
- url = form_url(conn, @cfg)
71
+ url = form_url(conn, @@cfg)
73
72
  hdr = form_hdr(conn)
74
73
  params = {"lag_id" => lag_id, "interfaces" => interfaces}.to_json
75
74
  Rest.post(conn, url, hdr, params)
@@ -83,7 +82,7 @@ class Lag
83
82
  #
84
83
  # return: JSON response
85
84
  def self.get_lag_prop(conn, lag_id)
86
- url = form_url(conn, @cfg + '/' + lag_id.to_s)
85
+ url = form_url(conn, @@cfg + '/' + lag_id.to_s)
87
86
  hdr = form_hdr(conn)
88
87
  Rest.get(conn, url, hdr)
89
88
  end
@@ -134,7 +133,7 @@ class Lag
134
133
  #
135
134
  # return: JSON response
136
135
  def self.update_lag(conn, lag_id, params)
137
- url = form_url(conn, @cfg + '/' + lag_id.to_s)
136
+ url = form_url(conn, @@cfg + '/' + lag_id.to_s)
138
137
  hdr = form_hdr(conn)
139
138
  params = params.to_json
140
139
  Rest.put(conn, url, hdr, params)
@@ -148,7 +147,7 @@ class Lag
148
147
  #
149
148
  # return: JSON response
150
149
  def self.get_load_balance(conn)
151
- url = form_url(conn, @cfg + '/load_balance')
150
+ url = form_url(conn, @@cfg + '/load_balance')
152
151
  hdr = form_hdr(conn)
153
152
  Rest.get(conn, url, hdr)
154
153
  end
@@ -185,7 +184,7 @@ class Lag
185
184
  #
186
185
  # return: JSON response
187
186
  def self.update_lag_load_balance(conn, params)
188
- url = form_url(conn, @cfg + '/load_balance')
187
+ url = form_url(conn, @@cfg + '/load_balance')
189
188
  hdr = form_hdr(conn)
190
189
  params = params.to_json
191
190
  Rest.put(conn, url, hdr, params)
@@ -199,7 +198,7 @@ class Lag
199
198
  #
200
199
  # return:
201
200
  def self.delete_lag(conn, lag_id)
202
- url = form_url(conn, @cfg + '/' + lag_id.to_s)
201
+ url = form_url(conn, @@cfg + '/' + lag_id.to_s)
203
202
  hdr = form_hdr(conn)
204
203
  Rest.delete(conn, url, hdr)
205
204
  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 Lldp
27
- @cfg = '/nos/api/cfg/lldp'
26
+ @@cfg = '/nos/api/cfg/lldp'
28
27
 
29
28
  # This API gets global LLDP properties of the system
30
29
  #
@@ -34,7 +33,7 @@ class Lldp
34
33
  #
35
34
  # return: JSON response
36
35
  def self.get_lldp_prop(conn)
37
- url = form_url(conn, @cfg)
36
+ url = form_url(conn, @@cfg)
38
37
  hdr = form_hdr(conn)
39
38
  Rest.get(conn, url, hdr)
40
39
  end
@@ -60,7 +59,7 @@ class Lldp
60
59
  #
61
60
  # return: JSON response
62
61
  def self.update_lldp_prop(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.put(conn, url, hdr, params)
@@ -75,7 +74,7 @@ class Lldp
75
74
  #
76
75
  # return: JSON response
77
76
  def self.get_lldp_all_intf(conn)
78
- url = form_url(conn, @cfg + '/lldp_interface')
77
+ url = form_url(conn, @@cfg + '/lldp_interface')
79
78
  hdr = form_hdr(conn)
80
79
  Rest.get(conn, url, hdr)
81
80
  end
@@ -90,7 +89,7 @@ class Lldp
90
89
  # return: JSON response
91
90
  def self.get_lldp_intf(conn, intf)
92
91
  intf.sub! '/', '%2F'
93
- url = form_url(conn, @cfg + '/lldp_interface/' + intf)
92
+ url = form_url(conn, @@cfg + '/lldp_interface/' + intf)
94
93
  hdr = form_hdr(conn)
95
94
  Rest.get(conn, url, hdr)
96
95
  end
@@ -119,7 +118,7 @@ class Lldp
119
118
  # return: JSON response
120
119
  def self.update_lldp_intf(conn, intf, params)
121
120
  intf.sub! '/', '%2F'
122
- url = form_url(conn, @cfg + '/lldp_interface/' + intf)
121
+ url = form_url(conn, @@cfg + '/lldp_interface/' + intf)
123
122
  hdr = form_hdr(conn)
124
123
  params = params.to_json
125
124
  Rest.put(conn, url, hdr, params)
@@ -135,7 +134,7 @@ class Lldp
135
134
  # return: JSON response
136
135
  def self.get_lldp_intf_stats(conn, intf)
137
136
  intf.sub! '/', '%2F'
138
- url = form_url(conn, @cfg + '/lldp_interface/statistics/' + intf)
137
+ url = form_url(conn, @@cfg + '/lldp_interface/statistics/' + intf)
139
138
  hdr = form_hdr(conn)
140
139
  Rest.get(conn, url, hdr)
141
140
  end
@@ -150,7 +149,7 @@ class Lldp
150
149
  # return: JSON response
151
150
  def self.get_lldp_intf_neighbor(conn, intf)
152
151
  intf.sub! '/', '%2F'
153
- url = form_url(conn, @cfg + '/lldp_interface/neighbor/' + intf)
152
+ url = form_url(conn, @@cfg + '/lldp_interface/neighbor/' + intf)
154
153
  hdr = form_hdr(conn)
155
154
  Rest.get(conn, url, hdr)
156
155
  end
@@ -163,7 +162,7 @@ class Lldp
163
162
  #
164
163
  # return: JSON response
165
164
  def self.get_lldp_intf_neighbor_all(conn)
166
- url = form_url(conn, @cfg + '/lldp_interface/neighbor')
165
+ url = form_url(conn, @@cfg + '/lldp_interface/neighbor')
167
166
  hdr = form_hdr(conn)
168
167
  Rest.get(conn, url, hdr)
169
168
  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'
@@ -25,7 +24,7 @@ require_relative 'rest_utils'
25
24
  ##
26
25
 
27
26
  class Mstp
28
- @cfg = '/nos/api/cfg/mstp'
27
+ @@cfg = '/nos/api/cfg/mstp'
29
28
  # This API gets global MSTP properties of the system
30
29
  #
31
30
  #
@@ -34,7 +33,7 @@ class Mstp
34
33
  #
35
34
  # return: JSON response
36
35
  def self.get_mstp_sys_prop(conn)
37
- url = form_url(conn, @cfg)
36
+ url = form_url(conn, @@cfg)
38
37
  hdr = form_hdr(conn)
39
38
  Rest.get(conn, url, hdr)
40
39
  end
@@ -55,7 +54,7 @@ class Mstp
55
54
  #
56
55
  # return: JSON response
57
56
  def self.update_mstp_sys_prop(conn, params)
58
- url = form_url(conn, @cfg)
57
+ url = form_url(conn, @@cfg)
59
58
  hdr = form_hdr(conn)
60
59
  params = params.to_json
61
60
  Rest.put(conn, url, hdr, params)
@@ -70,7 +69,7 @@ class Mstp
70
69
  #
71
70
  # return: JSON response
72
71
  def self.get_mstp_inst_all(conn)
73
- url = form_url(conn, @cfg + '_instance')
72
+ url = form_url(conn, @@cfg + '_instance')
74
73
  hdr = form_hdr(conn)
75
74
  Rest.get(conn, url, hdr)
76
75
  end
@@ -100,7 +99,7 @@ class Mstp
100
99
  #
101
100
  # return: JSON response
102
101
  def self.create_mstp_inst(conn, params)
103
- url = form_url(conn, @cfg + '_instance')
102
+ url = form_url(conn, @@cfg + '_instance')
104
103
  hdr = form_hdr(conn)
105
104
  params = params.to_json
106
105
  Rest.post(conn, url, hdr, params)
@@ -114,7 +113,7 @@ class Mstp
114
113
  #
115
114
  # return: JSON response
116
115
  def self.get_mstp_inst(conn, inst_id)
117
- url = form_url(conn, @cfg + '_instance/' + inst_id.to_s)
116
+ url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s)
118
117
  hdr = form_hdr(conn)
119
118
  Rest.get(conn, url, hdr)
120
119
  end
@@ -144,7 +143,7 @@ class Mstp
144
143
  #
145
144
  # return : JSON response
146
145
  def self.update_mstp_inst(conn, inst_id, params)
147
- url = form_url(conn, @cfg + '_instance/' + inst_id.to_s)
146
+ url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s)
148
147
  hdr = form_hdr(conn)
149
148
  params = params.to_json
150
149
  Rest.post(conn, url, hdr, params)
@@ -159,7 +158,7 @@ class Mstp
159
158
  #
160
159
  # return: JSON response
161
160
  def self.del_mstp_inst(conn, inst_id)
162
- url = form_url(conn, @cfg + '_instance/' + inst_id.to_s)
161
+ url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s)
163
162
  hdr = form_hdr(conn)
164
163
  Rest.delete(conn, url, hdr)
165
164
  end
@@ -175,7 +174,7 @@ class Mstp
175
174
  # return: JSON response
176
175
  def self.get_mstp_inst_intf(conn, inst_id, intf)
177
176
  intf.sub! '/', '%2F'
178
- url = form_url(conn, @cfg + '_instance/' + inst_id.to_s + '/' + intf )
177
+ url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s + '/' + intf )
179
178
  hdr = form_hdr(conn)
180
179
  Rest.get(conn, url, hdr)
181
180
  end
@@ -203,7 +202,7 @@ class Mstp
203
202
  # return: JSON response
204
203
  def self.update_mstp_inst_intf(conn, inst_id, intf, params)
205
204
  intf.sub! '/', '%2F'
206
- url = form_url(conn, @cfg + '_instance/' + inst_id.to_s + '/' + intf )
205
+ url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s + '/' + intf )
207
206
  hdr = form_hdr(conn)
208
207
  params = params.to_json
209
208
  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'
@@ -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 Stp
27
- @cfg = '/nos/api/cfg/stp/interface'
26
+ @@cfg = '/nos/api/cfg/stp/interface'
28
27
  # This API gets STP properties of all interfaces.
29
28
  #
30
29
  #
@@ -33,7 +32,7 @@ class Stp
33
32
  #
34
33
  # return: JSON response
35
34
  def self.get_all_stp(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
@@ -48,7 +47,7 @@ class Stp
48
47
  # return: JSON response
49
48
  def self.get_stp_intf(conn, intf)
50
49
  intf.sub! '/', '%2F'
51
- url = form_url(conn, @cfg + '/' + intf)
50
+ url = form_url(conn, @@cfg + '/' + intf)
52
51
  hdr = form_hdr(conn)
53
52
  Rest.get(conn, url, hdr)
54
53
  end
@@ -85,7 +84,7 @@ class Stp
85
84
  # return: JSON response
86
85
  def self.update_stp(conn, intf, params)
87
86
  intf.sub! '/', '%2F'
88
- url = form_url(conn, @cfg + '/' + intf)
87
+ url = form_url(conn, @@cfg + '/' + intf)
89
88
  hdr = form_hdr(conn)
90
89
  params = params.to_json
91
90
  Rest.put(conn, url, hdr, params)