Class: F5::Cli::SelfIP
- Inherits:
-
Subcommand
- Object
- Thor
- Subcommand
- F5::Cli::SelfIP
- Defined in:
- lib/f5/cli/application.rb
Instance Method Summary collapse
Instance Method Details
#create(name, address, vlan) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 |
# 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([:traffic_group]), floating_states: itemize([:floating] ? 'STATE_ENABLED' : 'STATE_DISABLED') ) end |
#list ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 |
# 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) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# 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 |