Class: Ipintf
- Inherits:
-
Object
- Object
- Ipintf
- Defined in:
- lib/cnos-rbapi/ip_intf.rb
Overview
The Ipintf class provides a class implementation and methods for managing the Ip Interfaces on the node. This class presents an abstraction
Constant Summary collapse
- @@cfg =
'/nos/api/cfg/ip_interface'
Class Method Summary collapse
-
.get_ip_prop_all(conn) ⇒ Object
parameters: conn - connection object to the node.
-
.get_ip_prop_intf(conn, intf) ⇒ Object
parameters: conn - connection object to the node intf - Interface name.
-
.update_ip_prop_intf(conn, intf, params) ⇒ Object
parameters: conn - connection object to the node intf - Interface name params - dictionary that requires the following format of key-value pairs { “if_name”: “<if_name>”, “bridge_port”: “<bridge_port>”, “mtu”: “<mtu>”, “ip_addr”: “<ip_addr>”, “ip_prefix_len”: “<ip_prefix_len>”, “vrf_name”: “<vrf_name>”, “admin_state”: “<admin_state>” } description - if_name :IP interface name (String).Note: The interface must exist.
Class Method Details
.get_ip_prop_all(conn) ⇒ Object
parameters:
conn - connection object to the node
return: JSON response
34 35 36 37 38 |
# File 'lib/cnos-rbapi/ip_intf.rb', line 34 def self.get_ip_prop_all(conn) url = form_url(conn, @@cfg) hdr = form_hdr(conn) Rest.get(conn, url, hdr) end |
.get_ip_prop_intf(conn, intf) ⇒ Object
parameters:
conn - connection object to the node
intf - Interface name
return: JSON response
48 49 50 51 52 53 54 |
# File 'lib/cnos-rbapi/ip_intf.rb', line 48 def self.get_ip_prop_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 |
.update_ip_prop_intf(conn, intf, params) ⇒ Object
parameters:
conn - connection object to the node
intf - Interface name
params - dictionary that requires the following format of key-value pairs
{
"if_name": "<if_name>",
"bridge_port": "<bridge_port>",
"mtu": "<mtu>",
"ip_addr": "<ip_addr>",
"ip_prefix_len": "<ip_prefix_len>",
"vrf_name": "<vrf_name>",
"admin_state": "<admin_state>"
}
description -
if_name :IP interface name (String).Note: The interface must exist.
bridge_port :Whether or not the port is a bridge port; one of yes (default), no.
mtu :The maximum transmission unit, in bytes; an integer from
64‐9216. Default value: 1500.
ip_addr :IP address for the interface.
ip_prefix_len:IP address mask; a positive integer from 1‐32.
vrf_name :The name of the VRF to which the interface belongs. Note: The named VRF must exist.
admin_state :The admin status; one of up, down
return: JSON response
83 84 85 86 87 88 89 90 |
# File 'lib/cnos-rbapi/ip_intf.rb', line 83 def self.update_ip_prop_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.put(conn, url, hdr, params) end |