Class: Lag
- Inherits:
-
Object
- Object
- Lag
- Defined in:
- lib/cnos-rbapi/lag.rb
Overview
The Lag class provides a class implementation and methods for managing Lag on the node. This class presents an abstraction
Constant Summary collapse
- @@cfg =
'/nos/api/cfg/lag'
Class Method Summary collapse
-
.create_lag(conn, lag_id, interfaces = []) ⇒ Object
parameters: conn - connection object to the node params - dictionary that requires the following format of key-value pairs { “lag_id”: “<lag_id>”, “interfaces”: [ { “if_name”: “<if_name>”, “lag_mode”: “<lag_mode>”, “lacp_prio”: “<lacp_prio>”, “lacp_timeout”: “<lacp_timeout>” } ] } description - lag_id :LAG identifier; a positive integer from 1‐4096.
-
.delete_lag(conn, lag_id) ⇒ Object
parameters: conn - connection object to the node.
-
.get_all_lag(conn) ⇒ Object
parameters: conn - connection object to the node.
-
.get_lag_prop(conn, lag_id) ⇒ Object
parameters: conn - connection object to the node.
-
.get_load_balance(conn) ⇒ Object
parameters: conn - connection object to the node.
-
.update_lag(conn, lag_id, params) ⇒ Object
parameters: conn - connection object to the node params - dictionary that requires the following format of key-value pairs { { “lag_name”: “<lag_name>”, “lag_id”: “<lag_id>”, “interfaces”: [ { “if_name”: “<if_name>”, “lag_mode”: “<lag_mode>”, “lacp_prio”: “<lacp_prio>”, “lacp_timeout”: “<lacp_timeout>” } ], “suspend_individual”: “<status>”, “min_links”: “<min_links>”, } } description - lag_name :The name of the LAG; a string.
-
.update_lag_load_balance(conn, params) ⇒ Object
parameters: conn - connection object to the node params - dictionary that requires the following format of key-value pairs { “destinationip” : “<destination‐ip>” “destinationmac” : “<destination‐mac>” “destinationport” : “<destination‐port>” “sourcedestip” : “<source‐dest‐ip>” “sourcedestmac” : “<source‐dest‐mac>” “sourcedestport” : “<source‐dest‐port>” “sourceinterface” : “<source‐interface>” “sourceip” : “<source‐ip>” “sourcemac” : “<source‐mac>” “sourceport” : ”<source‐port>“ } description - destination‐ip :Load distribution on the destination IP address.
Class Method Details
.create_lag(conn, lag_id, interfaces = []) ⇒ Object
parameters:
conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
{
"lag_id": "<lag_id>",
"interfaces": [
}
description -
lag_id :LAG identifier; a positive integer from 1
70 71 72 73 74 75 |
# File 'lib/cnos-rbapi/lag.rb', line 70 def self.create_lag(conn, lag_id, interfaces = []) url = form_url(conn, @@cfg) hdr = form_hdr(conn) params = {"lag_id" => lag_id, "interfaces" => interfaces}.to_json Rest.post(conn, url, hdr, params) end |
.delete_lag(conn, lag_id) ⇒ Object
parameters:
conn - connection object to the node
return:
200 201 202 203 204 |
# File 'lib/cnos-rbapi/lag.rb', line 200 def self.delete_lag(conn, lag_id) url = form_url(conn, @@cfg + '/' + lag_id.to_s) hdr = form_hdr(conn) Rest.delete(conn, url, hdr) end |
.get_all_lag(conn) ⇒ Object
parameters:
conn - connection object to the node
return: JSON response
35 36 37 38 39 |
# File 'lib/cnos-rbapi/lag.rb', line 35 def self.get_all_lag(conn) url = form_url(conn, @@cfg) hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.get_lag_prop(conn, lag_id) ⇒ Object
parameters:
conn - connection object to the node
return: JSON response
84 85 86 87 88 |
# File 'lib/cnos-rbapi/lag.rb', line 84 def self.get_lag_prop(conn, lag_id) url = form_url(conn, @@cfg + '/' + lag_id.to_s) hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.get_load_balance(conn) ⇒ Object
parameters:
conn - connection object to the node
return: JSON response
149 150 151 152 153 |
# File 'lib/cnos-rbapi/lag.rb', line 149 def self.get_load_balance(conn) url = form_url(conn, @@cfg + '/load_balance') hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.update_lag(conn, lag_id, params) ⇒ Object
parameters:
conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
{
{
135 136 137 138 139 140 |
# File 'lib/cnos-rbapi/lag.rb', line 135 def self.update_lag(conn, lag_id, params) url = form_url(conn, @@cfg + '/' + lag_id.to_s) hdr = form_hdr(conn) params = params.to_json Rest.put(conn, url, hdr, params) end |
.update_lag_load_balance(conn, params) ⇒ Object
parameters:
conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
{
186 187 188 189 190 191 |
# File 'lib/cnos-rbapi/lag.rb', line 186 def self.update_lag_load_balance(conn, params) url = form_url(conn, @@cfg + '/load_balance') hdr = form_hdr(conn) params = params.to_json Rest.put(conn, url, hdr, params) end |