class Stp

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

Public Class Methods

get_all_stp(conn) click to toggle source

This API gets STP properties of all interfaces.

parameters:
conn - connection object to the node

return: JSON response
# File lib/cnos-rbapi/stp.rb, line 34
def self.get_all_stp(conn)
        url = form_url(conn, @@cfg)
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end
get_stp_intf(conn, intf) click to toggle source

This API gets STP properties of one interface.

parameters:
conn - connection object to the node
intf - Interface name

return: JSON response
# File lib/cnos-rbapi/stp.rb, line 48
def self.get_stp_intf(conn, intf)
        intf.sub! '/', '%2F'
        url = form_url(conn, @@cfg + '/' + intf)
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)      
end
update_stp(conn, intf, params) click to toggle source

This API updates STP 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>",
                       "edge_port":  "<edge_port>",
                       "bpdu_guard":  "<bpdu_guard>",
                       "loop_guard":  "<loop_guard>",
                       "root_guard":  "<root_guard>"
             }
description -
if_name      :The IP interface name; a string.
              Note: The interface must exist.
edge_port    :Whether the interface is configured as an edge port, which allows
              the port to automatically transition to the STP forwarding state;
              one of yes, no. Default value: yes.
bpdu_guard   :(Optional) Whether BPDU guard is enabled on a port, which
              automatically shuts down the interface upon receipt of a BPDU;
              one of enable, disable. Default value: disable.
loop_guard   :(Optional) Whether look guard is enabled on a port for additional
              checks for preventing STP looping; one of enable, disable.
              Default value: disable.
root_guard   :(Optional) Whether guard mode is set to root guard on interface

return: JSON response
# File lib/cnos-rbapi/stp.rb, line 85
def self.update_stp(conn, intf, params)
        intf.sub! '/', '%2F'
        url = form_url(conn, @@cfg + '/' + intf)
        hdr = form_hdr(conn)
        params = params.to_json
        Rest.put(conn, url, hdr, params)
end