lenovo-rbapi 0.0.1
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 +7 -0
- data/LICENSE.md +25 -0
- data/README.md +76 -0
- data/lib/cnos-rbapi.rb +16 -0
- data/lib/cnos-rbapi/arp.rb +115 -0
- data/lib/cnos-rbapi/connect.rb +146 -0
- data/lib/cnos-rbapi/igmp.rb +117 -0
- data/lib/cnos-rbapi/ip_intf.rb +93 -0
- data/lib/cnos-rbapi/lacp.rb +64 -0
- data/lib/cnos-rbapi/lag.rb +207 -0
- data/lib/cnos-rbapi/lldp.rb +173 -0
- data/lib/cnos-rbapi/mstp.rb +214 -0
- data/lib/cnos-rbapi/rest_utils.rb +111 -0
- data/lib/cnos-rbapi/stp.rb +93 -0
- data/lib/cnos-rbapi/system.rb +523 -0
- data/lib/cnos-rbapi/telemetry.rb +285 -0
- data/lib/cnos-rbapi/valn_intf.rb +0 -0
- data/lib/cnos-rbapi/vlag.rb +275 -0
- data/lib/cnos-rbapi/vlan.rb +124 -0
- data/lib/cnos-rbapi/vlan_intf.rb +89 -0
- data/lib/cnos-rbapi/vrrp.rb +198 -0
- data/test/rbapi_test.rb +1046 -0
- metadata +69 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
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.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'json'
|
17
|
+
require_relative 'connect'
|
18
|
+
require_relative 'rest_utils'
|
19
|
+
|
20
|
+
|
21
|
+
##
|
22
|
+
## The Ipintf class provides a class implementation and methods for managing the Ip Interfaces
|
23
|
+
## on the node. This class presents an abstraction
|
24
|
+
##
|
25
|
+
|
26
|
+
class Ipintf
|
27
|
+
@cfg = '/nos/api/cfg/ip_interface'
|
28
|
+
# This API gets the IP properties of all interface.
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# parameters:
|
32
|
+
# conn - connection object to the node
|
33
|
+
#
|
34
|
+
# return: JSON response
|
35
|
+
def self.get_ip_prop_all(conn)
|
36
|
+
url = form_url(conn, @cfg)
|
37
|
+
hdr = form_hdr(conn)
|
38
|
+
Rest.get(conn, url, hdr)
|
39
|
+
end
|
40
|
+
|
41
|
+
# This API gets the IP properties of one interface.
|
42
|
+
#
|
43
|
+
#
|
44
|
+
# parameters:
|
45
|
+
# conn - connection object to the node
|
46
|
+
# intf - Interface name
|
47
|
+
#
|
48
|
+
# return: JSON response
|
49
|
+
def self.get_ip_prop_intf(conn, intf)
|
50
|
+
temp = intf.dup
|
51
|
+
temp.sub! '/', '%2F'
|
52
|
+
url = form_url(conn, @cfg + '/' + temp)
|
53
|
+
hdr = form_hdr(conn)
|
54
|
+
Rest.get(conn, url, hdr)
|
55
|
+
end
|
56
|
+
|
57
|
+
# This API updates the IP properties of one interface.
|
58
|
+
#
|
59
|
+
#
|
60
|
+
# parameters:
|
61
|
+
# conn - connection object to the node
|
62
|
+
# intf - Interface name
|
63
|
+
# params - dictionary that requires the following format of key-value pairs
|
64
|
+
# {
|
65
|
+
# "if_name": "<if_name>",
|
66
|
+
# "bridge_port": "<bridge_port>",
|
67
|
+
# "mtu": "<mtu>",
|
68
|
+
# "ip_addr": "<ip_addr>",
|
69
|
+
# "ip_prefix_len": "<ip_prefix_len>",
|
70
|
+
# "vrf_name": "<vrf_name>",
|
71
|
+
# "admin_state": "<admin_state>"
|
72
|
+
# }
|
73
|
+
# description -
|
74
|
+
# if_name :IP interface name (String).Note: The interface must exist.
|
75
|
+
# bridge_port :Whether or not the port is a bridge port; one of yes (default), no.
|
76
|
+
# mtu :The maximum transmission unit, in bytes; an integer from
|
77
|
+
# 64‐9216. Default value: 1500.
|
78
|
+
# ip_addr :IP address for the interface.
|
79
|
+
# ip_prefix_len:IP address mask; a positive integer from 1‐32.
|
80
|
+
# vrf_name :The name of the VRF to which the interface belongs. Note: The named VRF must exist.
|
81
|
+
# admin_state :The admin status; one of up, down
|
82
|
+
#
|
83
|
+
# return: JSON response
|
84
|
+
def self.update_ip_prop_intf(conn, intf, params)
|
85
|
+
temp = intf.dup
|
86
|
+
temp.sub! '/', '%2F'
|
87
|
+
url = form_url(conn, @cfg + '/' + temp)
|
88
|
+
hdr = form_hdr(conn)
|
89
|
+
params = params.to_json
|
90
|
+
Rest.put(conn, url, hdr, params)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
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.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'json'
|
17
|
+
require_relative 'connect'
|
18
|
+
require_relative 'rest_utils'
|
19
|
+
|
20
|
+
|
21
|
+
##
|
22
|
+
## The Lacp class provides a class implementation and methods for managing Lacp
|
23
|
+
## on the node. This class presents an abstraction
|
24
|
+
##
|
25
|
+
|
26
|
+
class Lacp
|
27
|
+
@cfg = '/nos/api/cfg/lacp'
|
28
|
+
# This API gets the LACP properties of the system.
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# parameters:
|
32
|
+
# conn - connection object to the node
|
33
|
+
#
|
34
|
+
# return: JSON response
|
35
|
+
def self.get_lacp(conn)
|
36
|
+
url = form_url(conn, @cfg)
|
37
|
+
hdr = form_hdr(conn)
|
38
|
+
Rest.get(conn, url ,hdr)
|
39
|
+
end
|
40
|
+
|
41
|
+
# This API updates the LACP properties of the system.
|
42
|
+
#
|
43
|
+
#
|
44
|
+
# parameters:
|
45
|
+
# conn - connection object to the node
|
46
|
+
# sys_prio - System Priority
|
47
|
+
# params - dictionary that requires the following format of key-value pairs
|
48
|
+
# {
|
49
|
+
# "sys_prio": "<sys_prio>",
|
50
|
+
# }
|
51
|
+
# description -
|
52
|
+
# sys_prio :LACP system priority; a positive integer from 1‐65535. Default
|
53
|
+
# value: 32768.
|
54
|
+
#
|
55
|
+
# return: JSON response
|
56
|
+
def self.update_lacp(conn, params)
|
57
|
+
url = form_url(conn, @cfg)
|
58
|
+
hdr = form_hdr(conn)
|
59
|
+
params = params.to_json
|
60
|
+
Rest.put(conn, url, hdr, params)
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,207 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
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.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'json'
|
17
|
+
require_relative 'connect'
|
18
|
+
require_relative 'rest_utils'
|
19
|
+
|
20
|
+
|
21
|
+
##
|
22
|
+
## The Lag class provides a class implementation and methods for managing Lag
|
23
|
+
## on the node. This class presents an abstraction
|
24
|
+
##
|
25
|
+
|
26
|
+
class Lag
|
27
|
+
@cfg = '/nos/api/cfg/lag'
|
28
|
+
|
29
|
+
# This API gets the properties of all LAG's.
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# parameters:
|
33
|
+
# conn - connection object to the node
|
34
|
+
#
|
35
|
+
# return: JSON response
|
36
|
+
def self.get_all_lag(conn)
|
37
|
+
url = form_url(conn, @cfg)
|
38
|
+
hdr = form_hdr(conn)
|
39
|
+
Rest.get(conn, url, hdr)
|
40
|
+
end
|
41
|
+
|
42
|
+
# This API creates a Lag.
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# parameters:
|
46
|
+
# conn - connection object to the node
|
47
|
+
# params - dictionary that requires the following format of key-value pairs
|
48
|
+
# {
|
49
|
+
# "lag_id": "<lag_id>",
|
50
|
+
# "interfaces": [
|
51
|
+
# {
|
52
|
+
# "if_name": "<if_name>",
|
53
|
+
# "lag_mode": "<lag_mode>",
|
54
|
+
# "lacp_prio": "<lacp_prio>",
|
55
|
+
# "lacp_timeout": "<lacp_timeout>"
|
56
|
+
# }
|
57
|
+
# ]
|
58
|
+
# }
|
59
|
+
# description -
|
60
|
+
# lag_id :LAG identifier; a positive integer from 1‐4096.
|
61
|
+
# interfaces :Physical interface members of the LAG. Up to 32 interfaces can be
|
62
|
+
# added.
|
63
|
+
# if_name :Ethernet interface name (String).Note: The interface must exist.
|
64
|
+
# lag_mode :LAG mode; one of lacp_active, lacp_passive, no_lacp.
|
65
|
+
# lacp_prio :(Optional) LACP priority for the physical port; a positive integer
|
66
|
+
# from 1‐65535. Default value: 32768.
|
67
|
+
# lacp_timeout :(Optional) LACP timeout for the physical port; one of short,
|
68
|
+
# long. Default value: long.
|
69
|
+
#
|
70
|
+
# return: JSON response
|
71
|
+
def self.create_lag(conn, lag_id, interfaces = [])
|
72
|
+
url = form_url(conn, @cfg)
|
73
|
+
hdr = form_hdr(conn)
|
74
|
+
params = {"lag_id" => lag_id, "interfaces" => interfaces}.to_json
|
75
|
+
Rest.post(conn, url, hdr, params)
|
76
|
+
end
|
77
|
+
|
78
|
+
# This API gets properties of the specified LAG.
|
79
|
+
#
|
80
|
+
#
|
81
|
+
# parameters:
|
82
|
+
# conn - connection object to the node
|
83
|
+
#
|
84
|
+
# return: JSON response
|
85
|
+
def self.get_lag_prop(conn, lag_id)
|
86
|
+
url = form_url(conn, @cfg + '/' + lag_id.to_s)
|
87
|
+
hdr = form_hdr(conn)
|
88
|
+
Rest.get(conn, url, hdr)
|
89
|
+
end
|
90
|
+
|
91
|
+
# This API updates properties of a Lag.
|
92
|
+
#
|
93
|
+
#
|
94
|
+
# parameters:
|
95
|
+
# conn - connection object to the node
|
96
|
+
# params - dictionary that requires the following format of key-value pairs
|
97
|
+
# {
|
98
|
+
#
|
99
|
+
# {
|
100
|
+
# "lag_name": "<lag_name>",
|
101
|
+
# "lag_id": "<lag_id>",
|
102
|
+
# "interfaces": [
|
103
|
+
# {
|
104
|
+
# "if_name": "<if_name>",
|
105
|
+
# "lag_mode": "<lag_mode>",
|
106
|
+
# "lacp_prio": "<lacp_prio>",
|
107
|
+
# "lacp_timeout": "<lacp_timeout>"
|
108
|
+
# }
|
109
|
+
# ],
|
110
|
+
# "suspend_individual": "<status>",
|
111
|
+
# "min_links": "<min_links>",
|
112
|
+
# }
|
113
|
+
#
|
114
|
+
# }
|
115
|
+
# description -
|
116
|
+
# lag_name :The name of the LAG; a string.
|
117
|
+
# lag_id :LAG identifier; an integer from 1‐65535
|
118
|
+
# interfaces :Physical interface members of the LAG; an integer from 1‐32.
|
119
|
+
# if_name :Ethernet interface name.
|
120
|
+
# Note: The interface must exist.
|
121
|
+
# lag_mode :LAG mode; one of lacp_active, lacp_passive, no_lacp.
|
122
|
+
# lacp_prio :LACP priority for the physical port; an integer from 1‐65535.
|
123
|
+
# Default value : 32768.
|
124
|
+
# lacp_timeout :LACP timeout for the physical port; one of short, long. Default
|
125
|
+
# value: long.
|
126
|
+
# suspend_individual :If the LAG does not get the LACP BPUD from peer ports the port
|
127
|
+
# aggregation, the result is one of the following:
|
128
|
+
# Yes ‐ LACP on the the ports is suspended rather than put into
|
129
|
+
# individual state.
|
130
|
+
# No - LAG on the ports is put into individual state.
|
131
|
+
# Default value :No.
|
132
|
+
# min_links :LACP minimum links number; an integer from 1‐65535.
|
133
|
+
# Default value: 1.
|
134
|
+
#
|
135
|
+
# return: JSON response
|
136
|
+
def self.update_lag(conn, lag_id, params)
|
137
|
+
url = form_url(conn, @cfg + '/' + lag_id.to_s)
|
138
|
+
hdr = form_hdr(conn)
|
139
|
+
params = params.to_json
|
140
|
+
Rest.put(conn, url, hdr, params)
|
141
|
+
end
|
142
|
+
|
143
|
+
# This API gets load balance properties for port agregations.
|
144
|
+
#
|
145
|
+
#
|
146
|
+
# parameters:
|
147
|
+
# conn - connection object to the node
|
148
|
+
#
|
149
|
+
# return: JSON response
|
150
|
+
def self.get_load_balance(conn)
|
151
|
+
url = form_url(conn, @cfg + '/load_balance')
|
152
|
+
hdr = form_hdr(conn)
|
153
|
+
Rest.get(conn, url, hdr)
|
154
|
+
end
|
155
|
+
|
156
|
+
# This API updates the load balance properties for port aggregations.
|
157
|
+
#
|
158
|
+
#
|
159
|
+
# parameters:
|
160
|
+
# conn - connection object to the node
|
161
|
+
# params - dictionary that requires the following format of key-value pairs
|
162
|
+
# {
|
163
|
+
# "destinationip" : "<destination‐ip>"
|
164
|
+
# "destinationmac" : "<destination‐mac>"
|
165
|
+
# "destinationport" : "<destination‐port>"
|
166
|
+
# "sourcedestip" : "<source‐dest‐ip>"
|
167
|
+
# "sourcedestmac" : "<source‐dest‐mac>"
|
168
|
+
# "sourcedestport" : "<source‐dest‐port>"
|
169
|
+
# "sourceinterface" : "<source‐interface>"
|
170
|
+
# "sourceip" : "<source‐ip>"
|
171
|
+
# "sourcemac" : "<source‐mac>"
|
172
|
+
# "sourceport” : "<source‐port>"
|
173
|
+
# }
|
174
|
+
# description -
|
175
|
+
# destination‐ip :Load distribution on the destination IP address.
|
176
|
+
# destination‐mac :Load distribution on the destination MAC address.
|
177
|
+
# destination‐port :Load distribution on the destination TCP/UDP port.
|
178
|
+
# source‐dest‐ip :Load distribution on the source and destination IP address.
|
179
|
+
# source‐dest‐mac :Load distribution on the source and destination MAC address.
|
180
|
+
# source‐dest‐ port :Load distribution on the source and destination TCP/UDP port.
|
181
|
+
# source‐ interface :Load distribution on the source ethernet interface.
|
182
|
+
# source‐ip :Load distribution on the source IP address.
|
183
|
+
# source‐mac :Load distribution on the source MAC address.
|
184
|
+
# source‐port :Load distribution on the source TCP/UDP port.
|
185
|
+
#
|
186
|
+
# return: JSON response
|
187
|
+
def self.update_lag_load_balance(conn, params)
|
188
|
+
url = form_url(conn, @cfg + '/load_balance')
|
189
|
+
hdr = form_hdr(conn)
|
190
|
+
params = params.to_json
|
191
|
+
Rest.put(conn, url, hdr, params)
|
192
|
+
end
|
193
|
+
|
194
|
+
# This API deletes specified LAG.
|
195
|
+
#
|
196
|
+
#
|
197
|
+
# parameters:
|
198
|
+
# conn - connection object to the node
|
199
|
+
#
|
200
|
+
# return:
|
201
|
+
def self.delete_lag(conn, lag_id)
|
202
|
+
url = form_url(conn, @cfg + '/' + lag_id.to_s)
|
203
|
+
hdr = form_hdr(conn)
|
204
|
+
Rest.delete(conn, url, hdr)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
@@ -0,0 +1,173 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
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.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'json'
|
17
|
+
require_relative 'connect'
|
18
|
+
require_relative 'rest_utils'
|
19
|
+
|
20
|
+
|
21
|
+
##
|
22
|
+
## The Lldp class provides a class implementation and methods for managing LLdp
|
23
|
+
## on the node. This class presents an abstraction
|
24
|
+
##
|
25
|
+
|
26
|
+
class Lldp
|
27
|
+
@cfg = '/nos/api/cfg/lldp'
|
28
|
+
|
29
|
+
# This API gets global LLDP properties of the system
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# parameters:
|
33
|
+
# conn - connection object to the node
|
34
|
+
#
|
35
|
+
# return: JSON response
|
36
|
+
def self.get_lldp_prop(conn)
|
37
|
+
url = form_url(conn, @cfg)
|
38
|
+
hdr = form_hdr(conn)
|
39
|
+
Rest.get(conn, url, hdr)
|
40
|
+
end
|
41
|
+
|
42
|
+
# This API updates the global LLDP properties of the system.
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# parameters:
|
46
|
+
# conn - connection object to the node
|
47
|
+
# params - dictionary that requires the following format of key-value pairs
|
48
|
+
# {
|
49
|
+
# "reinit delay": "<reinit delay>",
|
50
|
+
# "transit interval": "<transmit interval>",
|
51
|
+
# "transmit delay": "<transmit delay>"
|
52
|
+
# }
|
53
|
+
# description -
|
54
|
+
# reinit delay :The number of seconds until LLDP re‐initialization is attempted
|
55
|
+
# on an interface; an integer from 1‐10. Default value: 2 seconds.
|
56
|
+
# transmit interval :The time interval, in seconds, between transmissions of LLDP
|
57
|
+
# messages; an integer from 5‐32768.. Default value: 30 seconds.
|
58
|
+
# transmit delay :The number of seconds for transmission delay; an integer from
|
59
|
+
# 1‐8192. Default value: 2 seconds.
|
60
|
+
#
|
61
|
+
# return: JSON response
|
62
|
+
def self.update_lldp_prop(conn, params)
|
63
|
+
url = form_url(conn, @cfg)
|
64
|
+
hdr = form_hdr(conn)
|
65
|
+
params = params.to_json
|
66
|
+
Rest.put(conn, url, hdr, params)
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
# This API gets global LLDP properties of all interfaces
|
71
|
+
#
|
72
|
+
#
|
73
|
+
# parameters:
|
74
|
+
# conn - connection object to the node
|
75
|
+
#
|
76
|
+
# return: JSON response
|
77
|
+
def self.get_lldp_all_intf(conn)
|
78
|
+
url = form_url(conn, @cfg + '/lldp_interface')
|
79
|
+
hdr = form_hdr(conn)
|
80
|
+
Rest.get(conn, url, hdr)
|
81
|
+
end
|
82
|
+
|
83
|
+
# This API gets global LLDP properties of the system
|
84
|
+
#
|
85
|
+
#
|
86
|
+
# parameters:
|
87
|
+
# conn - connection object to the node
|
88
|
+
# intf - Interface name
|
89
|
+
#
|
90
|
+
# return: JSON response
|
91
|
+
def self.get_lldp_intf(conn, intf)
|
92
|
+
intf.sub! '/', '%2F'
|
93
|
+
url = form_url(conn, @cfg + '/lldp_interface/' + intf)
|
94
|
+
hdr = form_hdr(conn)
|
95
|
+
Rest.get(conn, url, hdr)
|
96
|
+
end
|
97
|
+
|
98
|
+
# This API updates the LLDP properties of one interface
|
99
|
+
#
|
100
|
+
#
|
101
|
+
# parameters:
|
102
|
+
# conn - connection object to the node
|
103
|
+
# intf - Interface name
|
104
|
+
# params - dictionary that requires the following format of key-value pairs
|
105
|
+
# {
|
106
|
+
# "if_name": "<if_name>",
|
107
|
+
# "ena_lldp_rx": "<ena_lldp_rx>",
|
108
|
+
# "ena_lldp_tx": "<ena_lldp_tx>"
|
109
|
+
# }
|
110
|
+
# description -
|
111
|
+
#
|
112
|
+
# if_name :Ethernet interface name (String).Note: The Ethernet interface must exist.
|
113
|
+
# ena_lldp_rx :Enables or disables LLDP frame reception on a physical interface;
|
114
|
+
# one of yes (default), no.
|
115
|
+
# ena_lldp_tx :Enables or disable sLLDP frame transmission on a physical
|
116
|
+
# interface; one of yes (default), no.
|
117
|
+
#
|
118
|
+
#
|
119
|
+
# return: JSON response
|
120
|
+
def self.update_lldp_intf(conn, intf, params)
|
121
|
+
intf.sub! '/', '%2F'
|
122
|
+
url = form_url(conn, @cfg + '/lldp_interface/' + intf)
|
123
|
+
hdr = form_hdr(conn)
|
124
|
+
params = params.to_json
|
125
|
+
Rest.put(conn, url, hdr, params)
|
126
|
+
end
|
127
|
+
|
128
|
+
# This API gets LLDP interface statistics per interface
|
129
|
+
#
|
130
|
+
#
|
131
|
+
# parameters:
|
132
|
+
# conn - connection object to the node
|
133
|
+
# intf - Interface name
|
134
|
+
#
|
135
|
+
# return: JSON response
|
136
|
+
def self.get_lldp_intf_stats(conn, intf)
|
137
|
+
intf.sub! '/', '%2F'
|
138
|
+
url = form_url(conn, @cfg + '/lldp_interface/statistics/' + intf)
|
139
|
+
hdr = form_hdr(conn)
|
140
|
+
Rest.get(conn, url, hdr)
|
141
|
+
end
|
142
|
+
|
143
|
+
# This API gets LLDP interface neighbour information
|
144
|
+
#
|
145
|
+
#
|
146
|
+
# parameters:
|
147
|
+
# conn - connection object to the node
|
148
|
+
# intf - Interface name
|
149
|
+
#
|
150
|
+
# return: JSON response
|
151
|
+
def self.get_lldp_intf_neighbor(conn, intf)
|
152
|
+
intf.sub! '/', '%2F'
|
153
|
+
url = form_url(conn, @cfg + '/lldp_interface/neighbor/' + intf)
|
154
|
+
hdr = form_hdr(conn)
|
155
|
+
Rest.get(conn, url, hdr)
|
156
|
+
end
|
157
|
+
|
158
|
+
# This API gets LLDP neighbour information for all interfaces
|
159
|
+
#
|
160
|
+
#
|
161
|
+
# parameters:
|
162
|
+
# conn - connection object to the node
|
163
|
+
#
|
164
|
+
# return: JSON response
|
165
|
+
def self.get_lldp_intf_neighbor_all(conn)
|
166
|
+
url = form_url(conn, @cfg + '/lldp_interface/neighbor')
|
167
|
+
hdr = form_hdr(conn)
|
168
|
+
Rest.get(conn, url, hdr)
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
|