Class: Mstp

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

Overview

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

Constant Summary collapse

@@cfg =
'/nos/api/cfg/mstp'

Class Method Summary collapse

Class Method Details

.create_mstp_inst(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
    {
    


101
102
103
104
105
106
# File 'lib/cnos-rbapi/mstp.rb', line 101

def self.create_mstp_inst(conn, params)
        url = form_url(conn, @@cfg + '_instance')
        hdr = form_hdr(conn)
    params = params.to_json
        Rest.post(conn, url, hdr, params)
end

.del_mstp_inst(conn, inst_id) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


160
161
162
163
164
# File 'lib/cnos-rbapi/mstp.rb', line 160

def self.del_mstp_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_mstp_inst(conn, inst_id) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


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

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

.get_mstp_inst_all(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


71
72
73
74
75
# File 'lib/cnos-rbapi/mstp.rb', line 71

def self.get_mstp_inst_all(conn)
        url = form_url(conn, @@cfg + '_instance')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.get_mstp_inst_intf(conn, inst_id, intf) ⇒ Object

parameters:

conn - connection object to the node
inst_id - instance id
intf - interface in the MSTP instance 

return: JSON response


175
176
177
178
179
180
# File 'lib/cnos-rbapi/mstp.rb', line 175

def self.get_mstp_inst_intf(conn, inst_id, intf)
    intf.sub! '/', '%2F'
        url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s + '/' + intf )
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.get_mstp_sys_prop(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


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

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

.update_mstp_inst(conn, inst_id, params) ⇒ Object

return : JSON response



145
146
147
148
149
150
151
# File 'lib/cnos-rbapi/mstp.rb', line 145

def self.update_mstp_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_mstp_inst_intf(conn, inst_id, intf, params) ⇒ Object

parameters:

conn - connection object to the node
inst_id - instance id
intf - interface in the MSTP instance 
params - dictionary that requires the following format of key-value pairs
    {
    


203
204
205
206
207
208
209
210
# File 'lib/cnos-rbapi/mstp.rb', line 203

def self.update_mstp_inst_intf(conn, inst_id, intf, params)
        intf.sub! '/', '%2F'
        url = form_url(conn, @@cfg + '_instance/' + inst_id.to_s + '/' + intf )
        hdr = form_hdr(conn)
    params = params.to_json
        Rest.put(conn, url, hdr, params)

end

.update_mstp_sys_prop(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
    {
    


56
57
58
59
60
61
62
# File 'lib/cnos-rbapi/mstp.rb', line 56

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

end