kanrisuru 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +5 -5
- data/lib/kanrisuru/command.rb +10 -0
- data/lib/kanrisuru/core/apt/parsers/base.rb +1 -1
- data/lib/kanrisuru/core/ip/commands/address.rb +64 -47
- data/lib/kanrisuru/core/ip/commands/address_label.rb +32 -16
- data/lib/kanrisuru/core/ip/commands/link.rb +96 -54
- data/lib/kanrisuru/core/ip/commands/link_set_opts.rb +61 -0
- data/lib/kanrisuru/core/ip/commands/link_type_opts.rb +313 -0
- data/lib/kanrisuru/core/ip/commands/maddress.rb +22 -13
- data/lib/kanrisuru/core/ip/commands/neighbour.rb +49 -32
- data/lib/kanrisuru/core/ip/commands/route.rb +130 -93
- data/lib/kanrisuru/core/ip/commands/rule.rb +37 -22
- data/lib/kanrisuru/core/ip/commands.rb +5 -3
- data/lib/kanrisuru/core/ip/constants.rb +12 -0
- data/lib/kanrisuru/core/ip/parser.rb +1 -0
- data/lib/kanrisuru/core/ip/parsers/version.rb +15 -0
- data/lib/kanrisuru/core/ip.rb +10 -7
- data/lib/kanrisuru/version.rb +1 -1
- data/spec/functional/core/ip/ip_address_label_spec.rb +81 -0
- data/spec/functional/core/ip/ip_address_spec.rb +95 -0
- data/spec/functional/core/ip/ip_link_spec.rb +814 -0
- data/spec/functional/core/ip/ip_maddress_spec.rb +78 -0
- data/spec/functional/core/ip/ip_neighbour_spec.rb +119 -0
- data/spec/functional/core/ip/ip_route_spec.rb +174 -0
- data/spec/functional/core/ip/ip_rule_spec.rb +75 -0
- data/spec/functional/core/ip/ip_spec.rb +27 -0
- data/spec/support/shared_examples/integration/core/transfer.rb +1 -1
- metadata +13 -2
@@ -0,0 +1,313 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kanrisuru
|
4
|
+
module Core
|
5
|
+
module IP
|
6
|
+
def ip_link_type_opts(command, opts)
|
7
|
+
case opts[:type]
|
8
|
+
when 'vlan'
|
9
|
+
ip_link_vlan_opts(command, opts[:type_opts])
|
10
|
+
when 'vxlan'
|
11
|
+
ip_link_vxlan_opts(command, opts[:type_opts])
|
12
|
+
when 'veth', 'vxcan'
|
13
|
+
ip_link_veth_vxcan_opts(command, opts[:type_opts])
|
14
|
+
when 'ipip', 'sit'
|
15
|
+
ip_link_ipip_sit_opts(command, opts[:type_opts])
|
16
|
+
when 'gre', 'gretap'
|
17
|
+
ip_link_gre_gretap_opts(command, opts[:type_opts])
|
18
|
+
when 'ip6gre', 'ip6gretap'
|
19
|
+
ip_link_ip6gre_ip6gretap_opts(command, opts[:type_opts])
|
20
|
+
when 'ipoib'
|
21
|
+
ip_link_ipoib_opts(command, opts[:type_opts])
|
22
|
+
when 'erspan', 'ip6erspan'
|
23
|
+
ip_link_erspan_opts(command, opts[:type_opts])
|
24
|
+
when 'geneve'
|
25
|
+
ip_link_geneve_opts(command, opts[:type_opts])
|
26
|
+
when 'bareudp'
|
27
|
+
ip_link_bareudp_opts(command, opts[:type_opts])
|
28
|
+
when 'macvlan', 'macvtap'
|
29
|
+
ip_link_macvlan_macvtap_opts(command, opts[:type_opts])
|
30
|
+
when 'hsr'
|
31
|
+
ip_link_hsr_opts(command, opts[:type_opts])
|
32
|
+
when 'bridge'
|
33
|
+
ip_link_bridge_opts(command, opts[:type_opts])
|
34
|
+
when 'macsec'
|
35
|
+
ip_link_macsec_opts(command, opts[:type_opts])
|
36
|
+
when 'vrf'
|
37
|
+
ip_link_vrf_opts(command, opts[:type_opts])
|
38
|
+
when 'rmnet'
|
39
|
+
ip_link_rmnet_opts(command, opts[:type_opts])
|
40
|
+
when 'xfrm'
|
41
|
+
ip_link_xfrm_opts(command, opts[:type_opts])
|
42
|
+
when 'bridge_slave'
|
43
|
+
ip_link_bridge_slave_opts(command, opts[:type_opts])
|
44
|
+
when 'bond_slave'
|
45
|
+
ip_link_bond_slave_opts(command, opts[:type_opts])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def ip_link_vlan_opts(command, opts)
|
50
|
+
command.append_arg('protocol', opts[:protocol])
|
51
|
+
command.append_arg('id', opts[:id])
|
52
|
+
command.append_arg('reorder_hdr', opts[:reorder_hdr])
|
53
|
+
command.append_arg('gvrp', opts[:gvrp])
|
54
|
+
command.append_arg('mvrp', opts[:mvrp])
|
55
|
+
command.append_arg('loose_binding', opts[:loose_binding])
|
56
|
+
command.append_arg('bridge_binding', opts[:bridge_binding])
|
57
|
+
command.append_arg('ingress-qos-map', opts[:ingress_qos_map])
|
58
|
+
command.append_arg('egress-qos-map', opts[:egress_qos_map])
|
59
|
+
end
|
60
|
+
|
61
|
+
def ip_link_vxlan_opts(command, opts)
|
62
|
+
command.append_arg('id', opts[:id])
|
63
|
+
command.append_arg('dev', opts[:dev])
|
64
|
+
command.append_arg('group', opts[:group])
|
65
|
+
command.append_arg('remote', opts[:remote])
|
66
|
+
command.append_arg('local', opts[:local])
|
67
|
+
command.append_arg('ttl', opts[:ttl])
|
68
|
+
command.append_arg('tos', opts[:tos])
|
69
|
+
command.append_arg('df', opts[:df])
|
70
|
+
command.append_arg('flowlabel', opts[:flowlabel])
|
71
|
+
command.append_arg('dstport', opts[:dstport])
|
72
|
+
command.append_arg('srcport', opts[:srcport])
|
73
|
+
|
74
|
+
command.append_flag_no('learning', opts[:learning])
|
75
|
+
command.append_flag_no('rsc', opts[:rsc])
|
76
|
+
command.append_flag_no('proxy', opts[:proxy])
|
77
|
+
command.append_flag_no('l2miss', opts[:l2miss])
|
78
|
+
command.append_flag_no('l3miss', opts[:l3miss])
|
79
|
+
command.append_flag_no('udpcsum', opts[:udpcsum])
|
80
|
+
command.append_flag_no('udp6zerocsumtx', opts[:udp6zerocsumtx])
|
81
|
+
command.append_flag_no('udp6zerocsumrx', opts[:udp6zerocsumrx])
|
82
|
+
|
83
|
+
command.append_arg('ageing', opts[:ageing])
|
84
|
+
command.append_arg('maxaddress', opts[:maxaddress])
|
85
|
+
|
86
|
+
command.append_flag('gbp', opts[:gbp])
|
87
|
+
command.append_flag('gpe', opts[:gpe])
|
88
|
+
end
|
89
|
+
|
90
|
+
def ip_link_veth_vxcan_opts(command, opts)
|
91
|
+
command.append_arg('peer name', opts[:peer_name])
|
92
|
+
end
|
93
|
+
|
94
|
+
def ip_link_ipip_sit_opts(command, opts)
|
95
|
+
ip_link_shared_sit_gre_opts(command, opts)
|
96
|
+
command.append_arg('mode', opts[:mode])
|
97
|
+
end
|
98
|
+
|
99
|
+
def ip_link_gre_gretap_opts(command, opts)
|
100
|
+
ip_link_shared_sit_gre_opts(command, opts)
|
101
|
+
ip_link_shared_io_opts(command, opts)
|
102
|
+
|
103
|
+
command.append_arg('ttl', opts[:ttl])
|
104
|
+
command.append_arg('tos', opts[:tos])
|
105
|
+
|
106
|
+
command.append_flag_no('pmtudisc', opts[:pmtudisc])
|
107
|
+
command.append_flag_no('ignore-df', opts[:ignore_df])
|
108
|
+
|
109
|
+
command.append_arg('dev', opts[:dev])
|
110
|
+
end
|
111
|
+
|
112
|
+
def ip_link_ip6gre_ip6gretap_opts(command, opts)
|
113
|
+
command.append_arg('remote', opts[:remote])
|
114
|
+
command.append_arg('local', opts[:local])
|
115
|
+
ip_link_shared_io_opts(command, opts)
|
116
|
+
|
117
|
+
command.append_arg('hoplimit', opts[:hoplimit])
|
118
|
+
command.append_arg('encaplimit', opts[:encaplimit])
|
119
|
+
command.append_arg('flowlabel', opts[:flowlabel])
|
120
|
+
|
121
|
+
command.append_flag_no('allow-localremote', opts[:allow_localremote])
|
122
|
+
command.append_arg('tclass', opts[:tclass])
|
123
|
+
command.append_arg('external', opts[:external])
|
124
|
+
end
|
125
|
+
|
126
|
+
def ip_link_ipoib_opts(command, opts)
|
127
|
+
command.append_arg('pkey', opts[:pkey])
|
128
|
+
command.append_arg('mode', opts[:mode])
|
129
|
+
end
|
130
|
+
|
131
|
+
def ip_link_erspan_opts(command, opts)
|
132
|
+
command.append_arg('remote', opts[:remote])
|
133
|
+
command.append_arg('local', opts[:local])
|
134
|
+
command.append_arg('erspan_ver', opts[:erspan_ver])
|
135
|
+
command.append_arg('erspan', opts[:erspan])
|
136
|
+
command.append_arg('erspan_dir', opts[:erspan_dir])
|
137
|
+
command.append_arg('erspan_hwid', opts[:erspan_hwid])
|
138
|
+
command.append_flag_no('allow-localremote', opts[:allow_localremote])
|
139
|
+
command.append_flag('external', opts[:external])
|
140
|
+
end
|
141
|
+
|
142
|
+
def ip_link_geneve_opts(command, opts)
|
143
|
+
command.append_arg('id', opts[:id])
|
144
|
+
command.append_arg('remote', opts[:remote])
|
145
|
+
command.append_arg('ttl', opts[:ttl])
|
146
|
+
command.append_arg('tos', opts[:tos])
|
147
|
+
command.append_arg('df', opts[:df])
|
148
|
+
command.append_arg('flowlabel', opts[:flowlabel])
|
149
|
+
command.append_arg('dstport', opts[:dstport])
|
150
|
+
|
151
|
+
command.append_flag_no('external', opts[:external])
|
152
|
+
command.append_flag_no('udpcsum', opts[:udpcsum])
|
153
|
+
command.append_flag_no('udp6zerocsumtx', opts[:udp6zerocsumtx])
|
154
|
+
command.append_flag_no('udp6zerocsumrx', opts[:udp6zerocsumrx])
|
155
|
+
end
|
156
|
+
|
157
|
+
def ip_link_bareudp_opts(command, opts)
|
158
|
+
command.append_arg('dstport', opts[:dstport])
|
159
|
+
command.append_arg('ethertype', opts[:ethertype])
|
160
|
+
command.append_arg('srcportmin', opts[:srcportmin])
|
161
|
+
command.append_flag_no('multiproto', opts[:multiproto])
|
162
|
+
end
|
163
|
+
|
164
|
+
def ip_link_macvlan_macvtap_opts(command, opts)
|
165
|
+
command.append_arg('mode', opts[:mode])
|
166
|
+
command.append_arg('flag', opts[:flag])
|
167
|
+
|
168
|
+
case opts[:mode_opts]
|
169
|
+
when 'add', 'del'
|
170
|
+
command << opts[:mode_opts]
|
171
|
+
command << opts[:mac_address]
|
172
|
+
when 'set'
|
173
|
+
command << 'set'
|
174
|
+
command.append_array(opts[:mac_address])
|
175
|
+
when 'flush'
|
176
|
+
command << 'flush'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def ip_link_hsr_opts(command, opts)
|
181
|
+
command.append_arg('slave1', opts[:slave1])
|
182
|
+
command.append_arg('slave2', opts[:slave2])
|
183
|
+
command.append_arg('supervision', opts[:supervision])
|
184
|
+
command.append_arg('version', opts[:version])
|
185
|
+
command.append_arg('proto', opts[:proto])
|
186
|
+
end
|
187
|
+
|
188
|
+
def ip_link_bridge_opts(command, opts)
|
189
|
+
command.append_arg('ageing_time', opts[:ageing_time])
|
190
|
+
command.append_arg('group_fwd_mask', opts[:group_fwd_mask])
|
191
|
+
command.append_arg('group_address', opts[:group_address])
|
192
|
+
command.append_arg('forward_delay', opts[:forward_delay])
|
193
|
+
command.append_arg('hello_time', opts[:hello_time])
|
194
|
+
command.append_arg('max_age', opts[:max_age])
|
195
|
+
command.append_arg('stp_state', opts[:stp_state])
|
196
|
+
command.append_arg('priority', opts[:priority])
|
197
|
+
command.append_arg('vlan_filtering', opts[:vlan_filtering])
|
198
|
+
command.append_arg('vlan_protocol', opts[:vlan_protocol])
|
199
|
+
command.append_arg('vlan_default_pvid', opts[:vlan_default_pvid])
|
200
|
+
command.append_arg('vlan_stats_enabled', opts[:vlan_stats_enabled])
|
201
|
+
command.append_arg('vlan_stats_per_port', opts[:vlan_stats_per_port])
|
202
|
+
command.append_arg('mcast_snooping', opts[:mcast_snooping])
|
203
|
+
command.append_arg('mcast_router', opts[:mcast_router])
|
204
|
+
command.append_arg('mcast_query_use_ifaddr', opts[:mcast_query_use_ifaddr])
|
205
|
+
command.append_arg('mcast_querier', opts[:mcast_querier])
|
206
|
+
command.append_arg('mcast_querier_interval', opts[:mcast_querier_interval])
|
207
|
+
command.append_arg('mcast_hash_elasticity', opts[:mcast_hash_elasticity])
|
208
|
+
command.append_arg('mcast_hash_max', opts[:mcast_hash_max])
|
209
|
+
command.append_arg('mcast_last_member_count', opts[:mcast_last_member_count])
|
210
|
+
command.append_arg('mcast_last_member_interval', opts[:mcast_last_member_interval])
|
211
|
+
command.append_arg('mcast_startup_query_count', opts[:mcast_startup_query_count])
|
212
|
+
command.append_arg('mcast_startup_query_interval', opts[:mcast_startup_query_interval])
|
213
|
+
command.append_arg('mcast_query_interval', opts[:mcast_query_interval])
|
214
|
+
command.append_arg('mcast_query_response_interval', opts[:mcast_query_response_interval])
|
215
|
+
command.append_arg('mcast_membership_interval', opts[:mcast_membership_interval])
|
216
|
+
command.append_arg('mcast_stats_enabled', opts[:mcast_stats_enabled])
|
217
|
+
command.append_arg('mcast_igmp_version', opts[:mcast_igmp_version])
|
218
|
+
command.append_arg('mcast_mld_version', opts[:mcast_mld_version])
|
219
|
+
command.append_arg('nf_call_iptables', opts[:nf_call_iptables])
|
220
|
+
command.append_arg('nf_call_ip6tables', opts[:nf_call_ip6tables])
|
221
|
+
command.append_arg('nf_call_arptables', opts[:nf_call_arptables])
|
222
|
+
end
|
223
|
+
|
224
|
+
def ip_link_macsec_opts(command, opts)
|
225
|
+
command.append_arg('address', opts[:address])
|
226
|
+
command.append_arg('port', opts[:port])
|
227
|
+
command.append_arg('sci', opts[:sci])
|
228
|
+
command.append_arg('cipher', opts[:cipher])
|
229
|
+
command.append_arg('icvlen', opts[:icvlen])
|
230
|
+
command.append_arg('encrypt', opts[:encrypt])
|
231
|
+
command.append_arg('send_sci', opts[:send_sci])
|
232
|
+
command.append_arg('end_station', opts[:end_station])
|
233
|
+
command.append_arg('scb', opts[:scb])
|
234
|
+
command.append_arg('protect', opts[:protect])
|
235
|
+
command.append_arg('replay', opts[:replay])
|
236
|
+
command.append_arg('window', opts[:window])
|
237
|
+
command.append_arg('validate', opts[:validate])
|
238
|
+
command.append_arg('encodingsa', opts[:encodingsa])
|
239
|
+
end
|
240
|
+
|
241
|
+
def ip_link_vrf_opts(command, opts)
|
242
|
+
command.append_arg('table', opts[:table])
|
243
|
+
end
|
244
|
+
|
245
|
+
def ip_link_rmnet_opts(command, opts)
|
246
|
+
command.append_arg('mux_id', opts[:mux_id])
|
247
|
+
end
|
248
|
+
|
249
|
+
def ip_link_xfrm_opts(command, opts)
|
250
|
+
command.append_arg('if_id', opts[:if_id])
|
251
|
+
end
|
252
|
+
|
253
|
+
def ip_link_bridge_slave_opts(command, opts)
|
254
|
+
command.append_flag('fdb_flush', opts[:fdb_flush])
|
255
|
+
command.append_arg('state', opts[:state])
|
256
|
+
command.append_arg('priority', opts[:priority])
|
257
|
+
command.append_arg('cost', opts[:cost])
|
258
|
+
command.append_arg('guard', opts[:guard])
|
259
|
+
command.append_arg('hairpin', opts[:hairpin])
|
260
|
+
command.append_arg('fastleave', opts[:fastleave])
|
261
|
+
command.append_arg('root_block', opts[:root_block])
|
262
|
+
command.append_arg('learning', opts[:learning])
|
263
|
+
command.append_arg('flood', opts[:flood])
|
264
|
+
command.append_arg('proxy_arp', opts[:proxy_arp])
|
265
|
+
command.append_arg('proxy_arp_wifi', opts[:proxy_arp_wifi])
|
266
|
+
command.append_arg('mcast_router', opts[:mcast_router])
|
267
|
+
command.append_arg('mcast_fast_leave', opts[:mcast_fast_leave])
|
268
|
+
command.append_arg('mcast_flood', opts[:mcast_flood])
|
269
|
+
command.append_arg('mcast_to_unicast', opts[:mcast_to_unicast])
|
270
|
+
command.append_arg('group_fwd_mask', opts[:group_fwd_mask])
|
271
|
+
command.append_arg('neigh_suppress', opts[:neigh_suppress])
|
272
|
+
command.append_arg('neigh_suppress', opts[:neigh_suppress])
|
273
|
+
command.append_arg('backup_port', opts[:backup_port])
|
274
|
+
command.append_flag('nobackup_port', opts[:nobackup_port])
|
275
|
+
end
|
276
|
+
|
277
|
+
def ip_link_bond_slave_opts(command, opts)
|
278
|
+
command.append_arg('queue_id', opts[:queue_id])
|
279
|
+
end
|
280
|
+
|
281
|
+
def ip_link_shared_io_opts(command, opts)
|
282
|
+
command.append_flag_no('iseq', opts[:iseq])
|
283
|
+
command.append_flag_no('oseq', opts[:oseq])
|
284
|
+
|
285
|
+
command.append_flag_no('icsum', opts[:icsum])
|
286
|
+
command.append_flag_no('ocsum', opts[:ocsum])
|
287
|
+
|
288
|
+
if opts[:okey] == false
|
289
|
+
command.append_flag('nookey', opts[:okey])
|
290
|
+
elsif opts[:okey].instance_of?(Integer)
|
291
|
+
command.append_arg('okey', opts[:okey])
|
292
|
+
end
|
293
|
+
|
294
|
+
if opts[:ikey] == false
|
295
|
+
command.append_flag('noikey', opts[:ikey])
|
296
|
+
elsif opts[:ikey].instance_of?(Integer)
|
297
|
+
command.append_arg('ikey', opts[:ikey])
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
def ip_link_shared_sit_gre_opts(command, opts)
|
302
|
+
command.append_arg('remote', opts[:remote])
|
303
|
+
command.append_arg('local', opts[:local])
|
304
|
+
command.append_arg('encap', opts[:encap])
|
305
|
+
command.append_arg('encap-sport', opts[:encap_sport])
|
306
|
+
|
307
|
+
command.append_flag_no('encap-csum', opts[:encap_csum])
|
308
|
+
command.append_flag_no('encap-remcsum', opts[:encap_remcsum])
|
309
|
+
command.append_flag('external', opts[:external])
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
@@ -6,20 +6,10 @@ module Kanrisuru
|
|
6
6
|
def ip_maddress(action, opts)
|
7
7
|
case action
|
8
8
|
when 'show', 'list'
|
9
|
-
|
10
|
-
|
11
|
-
version = ip_version
|
12
|
-
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
13
|
-
command.append_arg('-family', opts[:family])
|
14
|
-
command << 'maddress show'
|
15
|
-
|
16
|
-
command.append_arg('dev', opts[:dev])
|
9
|
+
version = ip_version.to_i
|
10
|
+
command = ip_maddress_show(opts, version)
|
17
11
|
when 'add', 'delete', 'del'
|
18
|
-
command =
|
19
|
-
command << action
|
20
|
-
|
21
|
-
command.append_arg('address', opts[:lladdress])
|
22
|
-
command.append_arg('dev', opts[:dev])
|
12
|
+
command = ip_maddress_modify(action, opts)
|
23
13
|
end
|
24
14
|
|
25
15
|
execute_shell(command)
|
@@ -28,6 +18,25 @@ module Kanrisuru
|
|
28
18
|
Parser::Maddress.parse(cmd, action, version)
|
29
19
|
end
|
30
20
|
end
|
21
|
+
|
22
|
+
def ip_maddress_show(opts, version)
|
23
|
+
command = Kanrisuru::Command.new('ip')
|
24
|
+
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
25
|
+
command.append_arg('-family', opts[:family])
|
26
|
+
command << 'maddress show'
|
27
|
+
|
28
|
+
command.append_arg('dev', opts[:dev])
|
29
|
+
command
|
30
|
+
end
|
31
|
+
|
32
|
+
def ip_maddress_modify(action, opts)
|
33
|
+
command = Kanrisuru::Command.new('ip maddress')
|
34
|
+
command << action
|
35
|
+
|
36
|
+
command.append_arg('address', opts[:address])
|
37
|
+
command.append_arg('dev', opts[:dev])
|
38
|
+
command
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
42
|
end
|
@@ -5,50 +5,67 @@ module Kanrisuru
|
|
5
5
|
module IP
|
6
6
|
def ip_neighbour(action, opts)
|
7
7
|
case action
|
8
|
+
when 'show', 'list'
|
9
|
+
version = ip_version.to_i
|
10
|
+
command = ip_neighbour_show(opts, version)
|
8
11
|
when 'add', 'change', 'replace', 'del', 'delete'
|
9
|
-
command =
|
10
|
-
|
12
|
+
command = ip_neighbour_modify(action, opts)
|
13
|
+
when 'flush'
|
14
|
+
command = ip_neighbour_flush(opts)
|
15
|
+
end
|
11
16
|
|
12
|
-
|
13
|
-
command.append_arg('dev', opts[:dev])
|
17
|
+
execute_shell(command)
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
Kanrisuru::Result.new(command) do |cmd|
|
20
|
+
Parser::Neighbour.parse(cmd, action, version)
|
21
|
+
end
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
when 'show', 'list'
|
25
|
-
version = ip_version
|
24
|
+
def ip_neighbour_show(opts, version)
|
25
|
+
command = Kanrisuru::Command.new('ip')
|
26
|
+
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
27
|
+
command.append_flag('-s', opts[:stats])
|
26
28
|
|
27
|
-
|
28
|
-
command.append_flag('-json') if version >= Kanrisuru::Core::IP::IPROUTE2_JSON_VERSION
|
29
|
-
command.append_flag('-s', opts[:stats])
|
29
|
+
command << 'neighbour show'
|
30
30
|
|
31
|
-
|
31
|
+
command.append_arg('to', opts[:to])
|
32
|
+
command.append_arg('dev', opts[:dev])
|
33
|
+
command.append_arg('nud', opts[:nud])
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
command.append_flag('proxy', opts[:proxy])
|
36
|
+
command.append_flag('unused', opts[:unused])
|
37
|
+
command
|
38
|
+
end
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
def ip_neighbour_modify(action, opts)
|
41
|
+
command = Kanrisuru::Command.new('ip neighbour')
|
42
|
+
command << action
|
43
|
+
|
44
|
+
command.append_arg('to', opts[:to])
|
45
|
+
command.append_arg('dev', opts[:dev])
|
43
46
|
|
44
|
-
|
47
|
+
if action != 'del' && action != 'delete'
|
48
|
+
command.append_arg('lladdr', opts[:lladdr])
|
49
|
+
command.append_arg('nud', opts[:nud])
|
45
50
|
end
|
46
51
|
|
47
|
-
|
52
|
+
command.append_flag('proxy', opts[:proxy])
|
53
|
+
command.append_flag('router', opts[:router])
|
54
|
+
command.append_flag('extern_learn', opts[:extern_learn])
|
55
|
+
command
|
56
|
+
end
|
48
57
|
|
49
|
-
|
50
|
-
|
51
|
-
|
58
|
+
def ip_neighbour_flush(opts)
|
59
|
+
command = Kanrisuru::Command.new('ip')
|
60
|
+
command.append_flag('-s', opts[:stats])
|
61
|
+
command << 'neighbour flush'
|
62
|
+
|
63
|
+
command.append_arg('to', opts[:to])
|
64
|
+
command.append_arg('dev', opts[:dev])
|
65
|
+
command.append_arg('nud', opts[:nud])
|
66
|
+
|
67
|
+
command.append_flag('unused', opts[:unused])
|
68
|
+
command
|
52
69
|
end
|
53
70
|
end
|
54
71
|
end
|