Class: Vlag

Inherits:
Object
  • Object
show all
Defined in:
lib/cnos-rbapi/vlag.rb

Overview

The Vlag class provides a class implementation and methods for managing the Vlags on the node. This class presents an abstraction

Constant Summary collapse

@@cfg =
'/nos/api/cfg/vlag'

Class Method Summary collapse

Class Method Details

.create_vlag_inst(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
		{
			  "inst_id": "<inst_id>",
			  "port_aggregator": "<port_aggregator>",
			  "status": "<status>",
		}
description -
inst_id          :vLAG instance ID number; an integer from 1‐64.
port_ aggregator :LAG identifier; an integer from 1‐4096.
status           : vLAG status; one of enable, disable. Default value: disable.

return: JSON response


185
186
187
188
189
190
191
# File 'lib/cnos-rbapi/vlag.rb', line 185

def self.create_vlag_inst(conn, params)
        url = form_url(conn, @@cfg + '/instance')
        hdr = form_hdr(conn)
        params = params.to_json
		Rest.post(conn, url, hdr, params)

end

.delete_vlag_inst(conn, inst_id) ⇒ Object

parameters:

conn - connection object to the node
inst_id - Vlag instance ID number

return: JSON response



225
226
227
228
229
# File 'lib/cnos-rbapi/vlag.rb', line 225

def self.delete_vlag_inst(conn, inst_id)
		url = form_url(conn, @@cfg + '/instance/' + inst_id.to_s)
		hdr = form_hdr(conn)
		Rest.delete(conn, url, hdr)
end

.get_all_vlag(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


252
253
254
255
256
# File 'lib/cnos-rbapi/vlag.rb', line 252

def self.get_all_vlag(conn)
        url = form_url(conn, @@cfg + '/instance')
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.get_global_vlag(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


79
80
81
82
83
84
85
# File 'lib/cnos-rbapi/vlag.rb', line 79

def self.get_global_vlag(conn)
		temp = @@cfg.dup
		temp.sub! 'cfg' , 'info'
        url = form_url(conn, temp)
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.get_vlag_conf(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


36
37
38
39
40
# File 'lib/cnos-rbapi/vlag.rb', line 36

def self.get_vlag_conf(conn)
        url = form_url(conn, @@cfg)
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.get_vlag_health(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


129
130
131
132
133
134
135
# File 'lib/cnos-rbapi/vlag.rb', line 129

def self.get_vlag_health(conn)
        temp = @@cfg.dup
        temp.sub! 'cfg' , 'info'
        url = form_url(conn, temp + '/health_check')
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.get_vlag_inst_confg(conn, inst_id) ⇒ Object

parameters:

conn - connection object to the node
inst_id - Vlag instance ID number

return: JSON response


239
240
241
242
243
# File 'lib/cnos-rbapi/vlag.rb', line 239

def self.get_vlag_inst_confg(conn, inst_id)
        url = form_url(conn, @@cfg + '/instance/' + inst_id.to_s)
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.get_vlag_inst_info(conn, inst_id) ⇒ Object

parameters:

conn - connection object to the node
inst_id - Vlag instance ID number

return: JSON response


266
267
268
269
270
271
272
# File 'lib/cnos-rbapi/vlag.rb', line 266

def self.get_vlag_inst_info(conn, inst_id)
		temp = @@cfg.dup
        temp.sub! 'cfg' , 'info'
		url = form_url(conn, temp + '/instance/' + inst_id.to_s)
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.get_vlag_isl(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


94
95
96
97
98
99
100
# File 'lib/cnos-rbapi/vlag.rb', line 94

def self.get_vlag_isl(conn)
		temp = @@cfg.dup
		temp.sub! 'cfg' , 'info'
        url = form_url(conn, temp + '/isl')
        hdr = form_hdr(conn)
		Rest.get(conn, url, hdr)
end

.update_vlag_conf(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
		{
		 	"status": "<status>",
		  	"tier_id": "<tier_id>",
		  	"priority": "<priority>",
		  	"auto_recover" : "<auto_recover>",
		  	"startup_delay": "<startup_delay>",
		}
description - 
status        :Whether the vLAG is enabled or disabled; one of enable, disable.
	          Default value; disable
tier_id       :vLAG tier ID value; an intger from 1‐512. Default value: 0.
priority      :vLAG priority value; an integer from 0‐65535. Default value: 0.
auto_recover  :Time interval, in seconds; an integer from 240‐3600. Default
		  value: 300.
startup_delay :Delay time, in seconds; an integer from 0‐3600. Default value: 120	

return: JSON response


65
66
67
68
69
70
# File 'lib/cnos-rbapi/vlag.rb', line 65

def self.update_vlag_conf(conn, params)
        url = form_url(conn, @@cfg)
        hdr = form_hdr(conn)
        params = params.to_json
		Rest.put(conn, url, hdr, params)
end

.update_vlag_health(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
		{
			  "peer_ip": "<peer_ip>",
			  "vrf": "<vrf>",
			  “retry_interval": "<retry_interval>",
			  "keepalive_attempts" : "<keepalive_attempts>",
			  "keepalive_interval" : "<keepalive_interval>",ʺ
		}
description -
peer_ip            :IP address of peer switch. This can be the management IP address
		       of the peer switch.
vrf                :VRF context string.
retry_interval     :Time interval, in seconds; an integer from 1‐300. Default value:

30.

keepalive_attempts :Number of keepalive attempts made before declaring the peer is
		       down; an integer from 1‐24. Default value: 3.
keepalive_interval :Time interval, in seconds; an integer from 2‐300. Default value: 5	

return: JSON response


161
162
163
164
165
166
# File 'lib/cnos-rbapi/vlag.rb', line 161

def self.update_vlag_health(conn, params)
        url = form_url(conn, @@cfg + '/health_check')
        hdr = form_hdr(conn)
        params = params.to_json
		Rest.put(conn, url, hdr, params)
end

.update_vlag_inst(conn, inst_id, params) ⇒ Object

parameters:

conn - connection object to the node
inst_id - Vlan instance ID number 
params - dictionary that requires the following format of key-value pairs
		{
			  "port_aggregator": "<port_aggregator>",
			  "status": "<status>",
		}
description -
port_ aggregator :LAG identifier; an integer from 1‐4096.
status           : vLAG status; one of enable, disable. Default value: disable.

return: JSON response


209
210
211
212
213
214
215
# File 'lib/cnos-rbapi/vlag.rb', line 209

def self.update_vlag_inst(conn, inst_id, params)
        url = form_url(conn, @@cfg + '/instance/' + inst_id.to_s)
        hdr = form_hdr(conn)
        params = params.to_json
		Rest.post(conn, url, hdr, params)

end

.update_vlag_isl(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
		{
			 "port_aggregator": ʺ<port_aggregator>ʺ
		}
description -
port_aggregator :Port aggregator for the vLAG ISL. 

return: JSON response


115
116
117
118
119
120
# File 'lib/cnos-rbapi/vlag.rb', line 115

def self.update_vlag_isl(conn, params)
        url = form_url(conn, @@cfg + '/isl')
        hdr = form_hdr(conn)
        params = params.to_json
		Rest.put(conn, url, hdr, params)
end