Module: OsCtld::Utils::Ip

Included in:
NetInterface::Bridge, NetInterface::Routed, NetInterface::Veth
Defined in:
lib/osctld/utils/ip.rb

Instance Method Summary collapse

Instance Method Details

#ip(ip_v, args, **opts) ⇒ OsCtl::Lib::SystemCommandResult

Returns:

  • (OsCtl::Lib::SystemCommandResult)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/osctld/utils/ip.rb', line 4

def ip(ip_v, args, **opts)
  cmd = ['ip']

  case ip_v
  when 4
    cmd << '-4'
  when 6
    cmd << '-6'
  when :all
    # nothing to do
  else
    raise "unknown IP version '#{ip_v}'"
  end

  cmd.concat(args)
  syscmd(cmd.join(' '), opts)
end

#tc(args, **opts) ⇒ OsCtl::Lib::SystemCommandResult

Returns:

  • (OsCtl::Lib::SystemCommandResult)


23
24
25
26
# File 'lib/osctld/utils/ip.rb', line 23

def tc(args, **opts)
  cmd = ['tc'].concat(args)
  syscmd(cmd.join(' '), opts)
end