Class: Telemetry

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

Overview

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

Constant Summary collapse

@@cfg =
'/nos/api/cfg/telemetry'

Class Method Summary collapse

Class Method Details

.clear_bst_cgsn_ctrs(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


272
273
274
275
276
# File 'lib/cnos-rbapi/telemetry.rb', line 272

def self.clear_bst_cgsn_ctrs(conn)
        url = form_url(conn, @@cfg + '/clear-cgsn-drop-counters')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.clear_bst_stats(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


259
260
261
262
263
# File 'lib/cnos-rbapi/telemetry.rb', line 259

def self.clear_bst_stats(conn)
        url = form_url(conn, @@cfg + '/bst/clear/statistics')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.clear_bst_threshold(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


246
247
248
249
250
# File 'lib/cnos-rbapi/telemetry.rb', line 246

def self.clear_bst_threshold(conn)
        url = form_url(conn, @@cfg + '/bst/clear/threshold')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.get_bst_feature(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


131
132
133
134
135
# File 'lib/cnos-rbapi/telemetry.rb', line 131

def self.get_bst_feature(conn)
        url = form_url(conn, @@cfg + '/bst/feature')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.get_bst_report(conn, params) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


194
195
196
197
198
199
200
201
# File 'lib/cnos-rbapi/telemetry.rb', line 194

def self.get_bst_report(conn, params)
        temp = @@cfg.dup
        temp.sub! 'cfg', 'info'
        url = form_url(conn, temp + '/bst/report')
        hdr = form_hdr(conn)
        params = params.to_json
        Rest.post(conn, url, hdr, params)
end

.get_bst_threshold(conn, params) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


210
211
212
213
214
215
# File 'lib/cnos-rbapi/telemetry.rb', line 210

def self.get_bst_threshold(conn, params)
        url = form_url(conn, @@cfg + '/bst/threshold')
        hdr = form_hdr(conn)
        params = params.to_json
        Rest.post(conn, url, hdr, params)
end

.get_bst_tracking(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


76
77
78
79
80
# File 'lib/cnos-rbapi/telemetry.rb', line 76

def self.get_bst_tracking(conn)
        url = form_url(conn, @@cfg + '/bst/tracking')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.get_sys_feature(conn) ⇒ Object

parameters:

conn - connection object to the node

return: JSON response


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

def self.get_sys_feature(conn)
        url = form_url(conn, @@cfg + '/feature')
        hdr = form_hdr(conn)
        Rest.get(conn, url, hdr)
end

.set_bst_feature(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
    {
      "bst­enable": 1,
      "send­async­reports": 1,
      "collection­interval": 300,
      "trigger­rate­limit": 5,
      "trigger­rate­limit­interval": 2,
      "send­snapshot­on­trigger": 1,
      "async­full­reports": 1,
    }
description -
bst

asynchronous reports, 0 to disable this feature.

collection

reports containing data related to all counters.

        When the feature is disabled, the agent sends
        incremental reports containing only the counters
        that have changed since the last report.

return: JSON response


180
181
182
183
184
185
# File 'lib/cnos-rbapi/telemetry.rb', line 180

def self.set_bst_feature(conn, params)
        url = form_url(conn, @@cfg + '/bst/feature')
        hdr = form_hdr(conn)
        params = params.to_json
        Rest.put(conn, url, hdr, params)
end

.set_bst_threshold(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs for the realms 
      given in description
    {
      "realm": "ingress­service­pool",


232
233
234
235
236
237
# File 'lib/cnos-rbapi/telemetry.rb', line 232

def self.set_bst_threshold(conn, params)
        url = form_url(conn, @@cfg + '/bst/threshold')
        hdr = form_hdr(conn)
        params = params.to_json
        Rest.put(conn, url, hdr, params)
end

.set_bst_tracking(conn, params) ⇒ Object

parameters:

conn - connection object to the node
params - dictionary that requires the following format of key-value pairs
    {
      "track­peak­stats" : 1,
      "track­ingress­port­priority­group" : 1,
      "track­ingress­port­service­pool" : 1,
      "track­ingress­service­pool" : 1,
      "track­egress­port­service­pool" : 1,
      "track­egress­service­pool" : 1,
      "track­egress­rqe­queue" : 1,
      "track­device" : 1
    }
description -
track


117
118
119
120
121
122
# File 'lib/cnos-rbapi/telemetry.rb', line 117

def self.set_bst_tracking(conn, params)
        url = form_url(conn, @@cfg + '/bst/tracking')
        hdr = form_hdr(conn)
        params = params.to_json
        Rest.put(conn, url, hdr, params)
end

.set_sys_feature(conn, params) ⇒ Object

parameters:

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


62
63
64
65
66
67
# File 'lib/cnos-rbapi/telemetry.rb', line 62

def self.set_sys_feature(conn, params)
               url = form_url(conn, @@cfg + '/feature')
               hdr = form_hdr(conn)
  params = params.to_json
  Rest.put(conn, url, hdr, params)
end