module Havox::Command

Public Class Methods

compile(topology_file, policy_file) click to toggle source
# File lib/havox/modules/command.rb, line 12
def compile(topology_file, policy_file)
  merlin_command("-topo #{topology_file} #{policy_file} -verbose")
end
show_ip_route(vm_name, protocol) click to toggle source
# File lib/havox/modules/command.rb, line 4
def show_ip_route(vm_name, protocol)
  vtysh_run(vm_name, "show ip route #{protocol}")
end
vtysh_run(vm_name, command) click to toggle source
# File lib/havox/modules/command.rb, line 8
def vtysh_run(vm_name, command)
  rf_command(vm_name, "/usr/bin/vtysh -c '#{command}'")
end

Private Class Methods

merlin_command(args) click to toggle source
# File lib/havox/modules/command.rb, line 22
def merlin_command(args)
  env_vars = "GUROBI_HOME=\"#{Havox.configuration.gurobi_path}\" " \
             'PATH="${PATH}:${GUROBI_HOME}/bin" ' \
             'LD_LIBRARY_PATH="${GUROBI_HOME}/lib" ' \
             'GRB_LICENSE_FILE="${GUROBI_HOME}/gurobi.lic"'
  "#{env_vars} #{Havox.configuration.merlin_path}/Merlin.native #{args}"
end
rf_command(vm_name, command) click to toggle source
# File lib/havox/modules/command.rb, line 18
def rf_command(vm_name, command)
  "sudo lxc-attach -n #{vm_name} -- #{command}"
end