class F5::Cli::SelfIP

Public Instance Methods

create(name, address, vlan) click to toggle source
# File lib/f5/cli/application.rb, line 132
def create(name, address, vlan)
  (ip, netmask) = address.split(/\//)
  result = client.Networking.SelfIPV2.create(
    self_ips: itemize(name),
    vlan_names: itemize(vlan),
    addresses: itemize(ip),
    netmasks: itemize(netmask),
    traffic_groups: itemize(options[:traffic_group]),
    floating_states: itemize(options[:floating] ? 'STATE_ENABLED' : 'STATE_DISABLED')
  )
end
list() click to toggle source
# File lib/f5/cli/application.rb, line 103
def list
  response = client.Networking.SelfIPV2.get_list

  selfips = extract_items(response, :as_array)
  if selfips.empty?
    puts "No selfips found"
  else
    selfips.each do |selfip|
      puts selfip
    end
  end
end
show(name) click to toggle source
# File lib/f5/cli/application.rb, line 117
def show(name)
  address = extract_items client.Networking.SelfIPV2.get_address(self_ips: { item: [ name ] })
  netmask = extract_items client.Networking.SelfIPV2.get_netmask(self_ips: { item: [ name ] })
  vlan = extract_items client.Networking.SelfIPV2.get_vlan(self_ips: { item: [ name ] })
  trafficgroup = extract_items client.Networking.SelfIPV2.get_traffic_group(self_ips: { item: [ name ] })
  floating = extract_items client.Networking.SelfIPV2.get_floating_state(self_ips: { item: [ name ] })

  puts "#{address}/#{netmask}"
  puts vlan
  puts "#{trafficgroup} #{floating == 'STATE_ENABLED' ? 'FLOATING' : 'NONFLOATING'}"
end