Class: Vrrp
- Inherits:
-
Object
- Object
- Vrrp
- Defined in:
- lib/cnos-rbapi/vrrp.rb
Overview
The Vrrp class provides a class implementation and methods for managing Vrrp on the node. This class presents an abstraction
Constant Summary collapse
- @@cfg =
'/nos/api/cfg/vrrp'
Class Method Summary collapse
-
.create_vrrp_intf(conn, intf, params) ⇒ Object
parameters: conn - connection object to the node intf - Interface on switch params - dictionary that requires the following format of key-value pairs { “if_name”: “<if_name>”, “vr_id”: “<vr_id>”, “ip_addr”: “<ip_addr>”, “ad_intvl”: “<ad_intvl>”, “preempt”: “<preempt>”, “prio”: “<prio>”, “admin_state”: “<admin_state>”, “track_if”: “<track_if>”, “accept_mode”: “<accept_mode>”, “switch_back_delay”: “<switch_back_delay>”, “v2_compt”: “<v2_compt>” } description - if_name :Interface name.Note: The interface must exist.
-
.del_vrrp_intf_vrid(conn, intf, vrid) ⇒ Object
parameters: conn - connection object to the node intf - Interface on switch vrid - Virtual Router Identifier 1-255.
-
.get_vrrp_intf(conn, intf) ⇒ Object
parameters: conn - connection object to the node intf - Interface on switch.
-
.get_vrrp_intf_vrid(conn, intf, vrid) ⇒ Object
parameters: conn - connection object to the node intf - Interface on switch vrid - Virtual Router Identifier 1-255.
-
.get_vrrp_prop_all(conn) ⇒ Object
parameters: conn - connection object to the node.
-
.update_vrrp_intf_vrid(conn, intf, vrid, params) ⇒ Object
{ “if_name”: “<if_name>”, “vr_id”: “<vr_id>”, “ip_addr”: “<ip_addr>”, “ad_intvl”: “<ad_intvl>”, “preempt”: “<preempt>”, “prio”: “<prio>”, “admin_state”: “<admin_state>”, “track_if”: “<track_if>”, “accept_mode”: “<accept_mode>”, “switch_back_delay”: “<switch_back_delay>”, “v2_compt”: “<v2_compt>” } description - if_name :Interface name.Note: The interface must exist.
Class Method Details
.create_vrrp_intf(conn, intf, params) ⇒ Object
parameters:
conn - connection object to the node
intf - Interface on switch
params - dictionary that requires the following format of key-value pairs
{
"if_name": "<if_name>",
"vr_id": "<vr_id>",
"ip_addr": "<ip_addr>",
"ad_intvl": "<ad_intvl>",
"preempt": "<preempt>",
"prio": "<prio>",
"admin_state": "<admin_state>",
"track_if": "<track_if>",
"accept_mode": "<accept_mode>",
"switch_back_delay": "<switch_back_delay>",
"v2_compt": "<v2_compt>"
}
description -
if_name :Interface name.Note: The interface must exist.
vr_id :Virtual Router (VR) identifier; an integer from 1‐255.
ip_addr :The IP address of the VR; a valid IPv4 address.
ad_intvl :Advertisement interval (The number of centi‐seconds between
advertisements for VRRPv3); a multiple of 5 from 5‐4095. Default
value: 100 centi‐seconds.
preempt :Enable the preemption of a lower priority master; one of yes
(default) , no.
prio :The priority of the VR on the switch; an integer from 1‐254.
Default value: 100.
admin_state :Enable the VR one of up (default), down.
oper_state :The operation state of the VR; one of master, backup, init.
track_if :The interface to track by this VR. Default value: noneNote: If an interface is specified, it must exist.
accept_mode Enables or disables the accept mode for this session; one of yes
(default), no.
switch_back_delay :The switch back delay interval; an integer from 1‐500000, or 0 to
disable (default).
v2_compt :Enables backward compatibility for VRRPv2 for the VR; one of
yes, no (default).
return: JSON response
99 100 101 102 103 104 105 106 |
# File 'lib/cnos-rbapi/vrrp.rb', line 99 def self.create_vrrp_intf(conn, intf, params) temp = intf.dup temp.sub! '/', '%2F' url = form_url(conn, @@cfg + '/' + temp) hdr = form_hdr(conn) params = params.to_json Rest.post(conn, url, hdr, params) end |
.del_vrrp_intf_vrid(conn, intf, vrid) ⇒ Object
parameters:
conn - connection object to the node
intf - Interface on switch
vrid - Virtual Router Identifier 1-255
return:
189 190 191 192 193 194 195 |
# File 'lib/cnos-rbapi/vrrp.rb', line 189 def self.del_vrrp_intf_vrid(conn, intf, vrid) temp = intf.dup temp.sub! '/', '%2F' url = form_url(conn, @@cfg + '/' + temp + '/' + vrid.to_s) hdr = form_hdr(conn) Rest.delete(conn, url, hdr) end |
.get_vrrp_intf(conn, intf) ⇒ Object
parameters:
conn - connection object to the node
intf - Interface on switch
return: JSON response
48 49 50 51 52 53 54 |
# File 'lib/cnos-rbapi/vrrp.rb', line 48 def self.get_vrrp_intf(conn, intf) temp = intf.dup temp.sub! '/', '%2F' url = form_url(conn, @@cfg + '/' + temp) hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.get_vrrp_intf_vrid(conn, intf, vrid) ⇒ Object
parameters:
conn - connection object to the node
intf - Interface on switch
vrid - Virtual Router Identifier 1-255
return: JSON response
117 118 119 120 121 122 123 |
# File 'lib/cnos-rbapi/vrrp.rb', line 117 def self.get_vrrp_intf_vrid(conn, intf, vrid) temp = intf.dup temp.sub! '/', '%2F' url = form_url(conn, @@cfg + '/' + temp + '/' + vrid.to_s) hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.get_vrrp_prop_all(conn) ⇒ Object
parameters:
conn - connection object to the node
return: JSON response
34 35 36 37 38 |
# File 'lib/cnos-rbapi/vrrp.rb', line 34 def self.get_vrrp_prop_all(conn) url = form_url(conn, @@cfg) hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.update_vrrp_intf_vrid(conn, intf, vrid, params) ⇒ Object
{
"if_name": "<if_name>",
"vr_id": "<vr_id>",
"ip_addr": "<ip_addr>",
"ad_intvl": "<ad_intvl>",
"preempt": "<preempt>",
"prio": "<prio>",
"admin_state": "<admin_state>",
"track_if": "<track_if>",
"accept_mode": "<accept_mode>",
"switch_back_delay": "<switch_back_delay>",
"v2_compt": "<v2_compt>"
}
description -
if_name :Interface name.Note: The interface must exist.
vr_id :Virtual Router (VR) identifier; an integer from 1‐255.
ip_addr :The IP address of the VR; a valid IPv4 address.
ad_intvl :Advertisement interval (The number of centi‐seconds between
advertisements for VRRPv3); a multiple of 5 from 5‐4095. Default
value: 100 centi‐seconds.
preempt :Enable the preemption of a lower priority master; one of yes
(default) , no.
prio :The priority of the VR on the switch; an integer from 1‐254.
Default value: 100.
admin_state :Enable the VR one of up (default), down.
oper_state :The operation state of the VR; one of master, backup, init.
track_if :The interface to track by this VR. Default value: noneNote: If an interface is specified, it must exist.
accept_mode Enables or disables the accept mode for this session; one of yes
(default), no.
switch_back_delay :The switch back delay interval; an integer from 1‐500000, or 0 to
disable (default).
v2_compt :Enables backward compatibility for VRRPv2 for the VR; one of
yes, no (default).
return: JSON response
171 172 173 174 175 176 177 178 |
# File 'lib/cnos-rbapi/vrrp.rb', line 171 def self.update_vrrp_intf_vrid(conn, intf, vrid, params) temp = intf.dup temp.sub! '/', '%2F' url = form_url(conn, @@cfg + '/' + temp + '/' + vrid.to_s) hdr = form_hdr(conn) params = params.to_json Rest.put(conn, url, hdr, params) end |