class Ipintf
The Ipintf
class provides a class implementation and methods for managing the Ip Interfaces on the node. This class presents an abstraction
Public Class Methods
get_ip_prop_all(conn)
click to toggle source
This API gets the IP properties of all interface.
parameters: conn - connection object to the node return: JSON response
# 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)
click to toggle source
This API gets the IP properties of one interface.
parameters: conn - connection object to the node intf - Interface name return: JSON response
# 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)
click to toggle source
This API updates the IP properties of one interface.
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
# 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