Class: TCWrapper::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/distem/wrapper/tc/wrapper.rb

Direct Known Subclasses

Class, Filter, Qdisc, QdiscIngress, QdiscRoot

Constant Summary

CMDBIN =
"tc"

Instance Method Summary (collapse)

Constructor Details

- (Wrapper) initialize(iface, wtype, type, params)

Returns a new instance of Wrapper



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/distem/wrapper/tc/wrapper.rb', line 7

def initialize(iface,wtype,type,params)
  @iface = iface
  @wtype = wtype
  @type = type

  unless (params.kind_of? Hash)
    raise "Params must be a Hash"
  end

  @params = params
end

Instance Method Details

- (Object) add_param(name, val)



30
31
32
# File 'lib/distem/wrapper/tc/wrapper.rb', line 30

def add_param(name,val)
  @params[name] = val
end

- (Object) get_cmd(*args)

Argument 1: the action



20
21
22
# File 'lib/distem/wrapper/tc/wrapper.rb', line 20

def get_cmd(*args)
  CMDBIN + " " + @wtype + " " + args[0] + " dev " + @iface + " "
end

- (Object) get_params



24
25
26
27
28
# File 'lib/distem/wrapper/tc/wrapper.rb', line 24

def get_params
  ret = ""
  @params.each{ |name,val| ret += name + " " + val.to_s + " "}
  return ret
end