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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e77a2eee0eb08495f947f9dc3b130a7c47cd713ab2f970dcc8fd17b7b52cd8b3
|
4
|
+
data.tar.gz: 76d3ec684fe307aafce2f3be2c594f47a38c50f2b0bb394998c1c83c06d8a47b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdd8b0d400e2557525fca889bbd3ef8b8eef67774f0143ea925fa9c5ac091acabe2986de25d0f69a7005185425cf94edcd873b19cacbe56aa823c9c64fa607b3
|
7
|
+
data.tar.gz: c1d802b26491e276ffbcdc3e3dd4e4272c9b48ab63a5e6b7283fb5e5f7b706ce64d5216728946aa3783f88396a0ec9a0582c045571cd78de050f42496479a392
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## Kanrisuru 0.15.0 (December 13, 2021) ##
|
2
|
+
* Add opts for `ip` command.
|
3
|
+
* Refactor `ip` object commands into smaller methods. Refactor `version` for consistent use and stub ability in funcitonal test cases.
|
4
|
+
* Add functional test cases for `ip` command.
|
5
|
+
* Add `append_flag_no` to `Kanrisuru::Command` class. Adds no to value for `falsey` statements. The `no` flag is commonly appended to indicate a deactived state for many arguments passed to programs on the command line.
|
6
|
+
* Fix test case `transfer` by appending the osname to the filename to avoid parallel overwrite.
|
7
|
+
|
1
8
|
## Kanrisuru 0.14.0 (December 08, 2021) ##
|
2
9
|
* Add additional unit test cases for `util` methods.
|
3
10
|
* Refactor the `core` module commands into smaller files, with each command split up. Also refactor parsing code into separate `Parser` class.
|
data/README.md
CHANGED
@@ -7,12 +7,12 @@
|
|
7
7
|
<img src="https://img.shields.io/gem/v/kanrisuru?style=flat-square" alt="Latest version" />
|
8
8
|
</a>
|
9
9
|
<a href="https://github.com/avamia/kanrisuru/blob/main/LICENSE.txt">
|
10
|
-
<img src="https://img.shields.io/github/license/avamia/kanrisuru" alt="Latest version" />
|
10
|
+
<img src="https://img.shields.io/github/license/avamia/kanrisuru?style=flat-square" alt="Latest version" />
|
11
11
|
</a>
|
12
|
-
<img src="https://img.shields.io/github/repo-size/avamia/kanrisuru" alt="GitHub repo size" />
|
13
|
-
<img src="https://img.shields.io/codecov/c/gh/avamia/kanrisuru?token=2Q1BE106B2" alt="Codecov" />
|
14
|
-
<img src="https://img.shields.io/codacy/grade/9e839eb160bc445ea4e81b64cef22b27" alt="Codacy grade" />
|
15
|
-
<img src="https://img.shields.io/codeclimate/maintainability/avamia/kanrisuru" alt="Code Climate maintainability" />
|
12
|
+
<img src="https://img.shields.io/github/repo-size/avamia/kanrisuru?style=flat-square" alt="GitHub repo size" />
|
13
|
+
<img src="https://img.shields.io/codecov/c/gh/avamia/kanrisuru?token=2Q1BE106B2&style=flat-square" alt="Codecov" />
|
14
|
+
<img src="https://img.shields.io/codacy/grade/9e839eb160bc445ea4e81b64cef22b27?style=flat-square" alt="Codacy grade" />
|
15
|
+
<img src="https://img.shields.io/codeclimate/maintainability/avamia/kanrisuru?style=flat-square" alt="Code Climate maintainability" />
|
16
16
|
</p>
|
17
17
|
|
18
18
|
# Kanrisuru
|
data/lib/kanrisuru/command.rb
CHANGED
@@ -103,6 +103,16 @@ module Kanrisuru
|
|
103
103
|
@raw_command = Kanrisuru::Util.present?(boolean) ? "#{@raw_command} #{arg}" : @raw_command
|
104
104
|
end
|
105
105
|
|
106
|
+
def append_flag_no(arg, boolean = 'true')
|
107
|
+
return if boolean.nil?
|
108
|
+
|
109
|
+
if boolean
|
110
|
+
append_flag(arg, true)
|
111
|
+
else
|
112
|
+
append_flag("no#{arg}", true)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
106
116
|
def append_valid_exit_code(code)
|
107
117
|
@valid_exit_codes << code if code.instance_of?(Integer)
|
108
118
|
@valid_exit_codes.concat(code) if code.instance_of?(Array)
|
@@ -4,58 +4,16 @@ module Kanrisuru
|
|
4
4
|
module Core
|
5
5
|
module IP
|
6
6
|
def ip_address(action, opts)
|
7
|
-
command = nil
|
8
|
-
|
9
7
|
case action
|
10
8
|
when 'show', 'list'
|
11
|
-
version = ip_version
|
12
|
-
|
13
|
-
command = Kanrisuru::Command.new('ip')
|
14
|
-
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
15
|
-
command.append_flag('-s', opts[:stats])
|
16
|
-
command.append_arg('-family', opts[:family])
|
17
|
-
command << 'address show'
|
18
|
-
|
19
|
-
command.append_arg('dev', opts[:dev])
|
20
|
-
command.append_arg('scope', opts[:scope])
|
21
|
-
command.append_arg('to', opts[:prefix])
|
22
|
-
command.append_arg('label', opts[:label])
|
23
|
-
|
24
|
-
command.append_flag('dynamic', opts[:dynamic])
|
25
|
-
command.append_flag('permanent', opts[:permanent])
|
26
|
-
command.append_flag('tenative', opts[:tenative])
|
27
|
-
command.append_flag('deprecated', opts[:deprecated])
|
28
|
-
command.append_flag('primary', opts[:primary])
|
29
|
-
command.append_flag('secondary', opts[:secondary])
|
30
|
-
command.append_flag('up', opts[:up])
|
9
|
+
version = ip_version.to_i
|
10
|
+
command = ip_address_show(opts, version)
|
31
11
|
when 'add'
|
32
|
-
command =
|
33
|
-
command << opts[:address]
|
34
|
-
|
35
|
-
command.append_arg('dev', opts[:dev])
|
36
|
-
command.append_arg('label', opts[:label])
|
37
|
-
command.append_arg('scope', opts[:scope])
|
12
|
+
command = ip_address_add(opts)
|
38
13
|
when 'del', 'delete'
|
39
|
-
command =
|
40
|
-
command << opts[:address]
|
41
|
-
|
42
|
-
command.append_arg('dev', opts[:dev])
|
43
|
-
command.append_arg('label', opts[:label])
|
44
|
-
command.append_arg('scope', opts[:scope])
|
14
|
+
command = ip_address_delete(opts)
|
45
15
|
when 'flush'
|
46
|
-
command =
|
47
|
-
|
48
|
-
command.append_arg('dev', opts[:dev])
|
49
|
-
command.append_arg('scope', opts[:scope])
|
50
|
-
command.append_arg('to', opts[:prefix])
|
51
|
-
command.append_arg('label', opts[:label])
|
52
|
-
|
53
|
-
command.append_flag('dynamic', opts[:dynamic])
|
54
|
-
command.append_flag('permanent', opts[:permanent])
|
55
|
-
command.append_flag('tenative', opts[:tenative])
|
56
|
-
command.append_flag('deprecated', opts[:deprecated])
|
57
|
-
command.append_flag('primary', opts[:primary])
|
58
|
-
command.append_flag('secondary', opts[:secondary])
|
16
|
+
command = ip_address_flush(opts)
|
59
17
|
end
|
60
18
|
|
61
19
|
execute_shell(command)
|
@@ -64,6 +22,65 @@ module Kanrisuru
|
|
64
22
|
Parser::Address.parse(cmd, action, version)
|
65
23
|
end
|
66
24
|
end
|
25
|
+
|
26
|
+
def ip_address_show(opts, version)
|
27
|
+
command = Kanrisuru::Command.new('ip')
|
28
|
+
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
29
|
+
command.append_flag('-s', opts[:stats])
|
30
|
+
command.append_arg('-family', opts[:family])
|
31
|
+
command << 'address show'
|
32
|
+
|
33
|
+
command.append_arg('dev', opts[:dev])
|
34
|
+
command.append_arg('scope', opts[:scope])
|
35
|
+
command.append_arg('to', opts[:prefix])
|
36
|
+
command.append_arg('label', opts[:label])
|
37
|
+
|
38
|
+
command.append_flag('dynamic', opts[:dynamic])
|
39
|
+
command.append_flag('permanent', opts[:permanent])
|
40
|
+
command.append_flag('tenative', opts[:tenative])
|
41
|
+
command.append_flag('deprecated', opts[:deprecated])
|
42
|
+
command.append_flag('primary', opts[:primary])
|
43
|
+
command.append_flag('secondary', opts[:secondary])
|
44
|
+
command.append_flag('up', opts[:up])
|
45
|
+
command
|
46
|
+
end
|
47
|
+
|
48
|
+
def ip_address_add(opts)
|
49
|
+
command = Kanrisuru::Command.new('ip address add')
|
50
|
+
command << opts[:address]
|
51
|
+
|
52
|
+
command.append_arg('dev', opts[:dev])
|
53
|
+
command.append_arg('label', opts[:label])
|
54
|
+
command.append_arg('scope', opts[:scope])
|
55
|
+
command
|
56
|
+
end
|
57
|
+
|
58
|
+
def ip_address_delete(opts)
|
59
|
+
command = Kanrisuru::Command.new('ip address del')
|
60
|
+
command << opts[:address]
|
61
|
+
|
62
|
+
command.append_arg('dev', opts[:dev])
|
63
|
+
command.append_arg('label', opts[:label])
|
64
|
+
command.append_arg('scope', opts[:scope])
|
65
|
+
command
|
66
|
+
end
|
67
|
+
|
68
|
+
def ip_address_flush(opts)
|
69
|
+
command = Kanrisuru::Command.new('ip address flush')
|
70
|
+
|
71
|
+
command.append_arg('dev', opts[:dev])
|
72
|
+
command.append_arg('scope', opts[:scope])
|
73
|
+
command.append_arg('to', opts[:prefix])
|
74
|
+
command.append_arg('label', opts[:label])
|
75
|
+
|
76
|
+
command.append_flag('dynamic', opts[:dynamic])
|
77
|
+
command.append_flag('permanent', opts[:permanent])
|
78
|
+
command.append_flag('tenative', opts[:tenative])
|
79
|
+
command.append_flag('deprecated', opts[:deprecated])
|
80
|
+
command.append_flag('primary', opts[:primary])
|
81
|
+
command.append_flag('secondary', opts[:secondary])
|
82
|
+
command
|
83
|
+
end
|
67
84
|
end
|
68
85
|
end
|
69
86
|
end
|
@@ -4,27 +4,16 @@ module Kanrisuru
|
|
4
4
|
module Core
|
5
5
|
module IP
|
6
6
|
def ip_address_label(action, opts)
|
7
|
-
command = nil
|
8
|
-
|
9
7
|
case action
|
10
8
|
when 'show', 'list'
|
11
|
-
version = ip_version
|
12
|
-
|
13
|
-
command = Kanrisuru::Command.new('ip')
|
14
|
-
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
15
|
-
command << 'addrlabel list'
|
9
|
+
version = ip_version.to_i
|
10
|
+
command = ip_address_label_show(opts, version)
|
16
11
|
when 'flush'
|
17
|
-
command =
|
12
|
+
command = ip_address_label_flush(opts)
|
18
13
|
when 'add'
|
19
|
-
command =
|
20
|
-
command.append_arg('prefix', opts[:prefix])
|
21
|
-
command.append_arg('dev', opts[:dev])
|
22
|
-
command.append_arg('label', opts[:label])
|
14
|
+
command = ip_address_label_add(opts)
|
23
15
|
when 'del'
|
24
|
-
command =
|
25
|
-
command.append_arg('prefix', opts[:prefix])
|
26
|
-
command.append_arg('dev', opts[:dev])
|
27
|
-
command.append_arg('label', opts[:label])
|
16
|
+
command = ip_address_label_delete(opts)
|
28
17
|
end
|
29
18
|
|
30
19
|
execute_shell(command)
|
@@ -33,6 +22,33 @@ module Kanrisuru
|
|
33
22
|
Parser::AddressLabel.parse(cmd, action, version)
|
34
23
|
end
|
35
24
|
end
|
25
|
+
|
26
|
+
def ip_address_label_delete(opts)
|
27
|
+
command = Kanrisuru::Command.new('ip addrlabel del')
|
28
|
+
command.append_arg('prefix', opts[:prefix])
|
29
|
+
command.append_arg('dev', opts[:dev])
|
30
|
+
command.append_arg('label', opts[:label])
|
31
|
+
command
|
32
|
+
end
|
33
|
+
|
34
|
+
def ip_address_label_add(opts)
|
35
|
+
command = Kanrisuru::Command.new('ip addrlabel add')
|
36
|
+
command.append_arg('prefix', opts[:prefix])
|
37
|
+
command.append_arg('dev', opts[:dev])
|
38
|
+
command.append_arg('label', opts[:label])
|
39
|
+
command
|
40
|
+
end
|
41
|
+
|
42
|
+
def ip_address_label_flush(_opts)
|
43
|
+
Kanrisuru::Command.new('ip addrlabel flush')
|
44
|
+
end
|
45
|
+
|
46
|
+
def ip_address_label_show(_opts, version)
|
47
|
+
command = Kanrisuru::Command.new('ip')
|
48
|
+
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
49
|
+
command << 'addrlabel list'
|
50
|
+
command
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
38
54
|
end
|
@@ -4,63 +4,16 @@ module Kanrisuru
|
|
4
4
|
module Core
|
5
5
|
module IP
|
6
6
|
def ip_link(action, opts)
|
7
|
-
command = nil
|
8
|
-
|
9
7
|
case action
|
10
8
|
when 'show', 'list'
|
11
|
-
version = ip_version
|
12
|
-
|
13
|
-
|
14
|
-
command
|
15
|
-
|
16
|
-
command
|
17
|
-
command << 'link show'
|
18
|
-
|
19
|
-
command.append_arg('dev', opts[:dev])
|
20
|
-
command.append_arg('group', opts[:group])
|
21
|
-
command.append_arg('master', opts[:master])
|
22
|
-
command.append_arg('type', opts[:type])
|
23
|
-
command.append_arg('vrf', opts[:vrf])
|
24
|
-
|
25
|
-
command.append_flag('up', opts[:up])
|
9
|
+
version = ip_version.to_i
|
10
|
+
command = ip_link_show(opts, version)
|
11
|
+
when 'add', 'a'
|
12
|
+
command = ip_link_add(opts)
|
13
|
+
when 'delete', 'del'
|
14
|
+
command = ip_link_delete(opts)
|
26
15
|
when 'set'
|
27
|
-
command =
|
28
|
-
|
29
|
-
raise ArgumentError, 'no device defined' unless opts[:dev]
|
30
|
-
|
31
|
-
command.append_arg('dev', opts[:dev])
|
32
|
-
|
33
|
-
case opts[:direction]
|
34
|
-
when 'up'
|
35
|
-
command.append_flag('up')
|
36
|
-
when 'down'
|
37
|
-
command.append_flag('down')
|
38
|
-
end
|
39
|
-
|
40
|
-
command.append_arg('arp', opts[:arp])
|
41
|
-
command.append_arg('multicast', opts[:multicast])
|
42
|
-
command.append_arg('dynamic', opts[:dynamic])
|
43
|
-
command.append_arg('name', opts[:name])
|
44
|
-
command.append_arg('txqueuelen', opts[:txqueuelen])
|
45
|
-
command.append_arg('txqlen', opts[:txqlen])
|
46
|
-
command.append_arg('mtu', opts[:mtu])
|
47
|
-
command.append_arg('address', opts[:address])
|
48
|
-
command.append_arg('broadcast', opts[:broadcast])
|
49
|
-
command.append_arg('brd', opts[:brd])
|
50
|
-
command.append_arg('peer', opts[:peer])
|
51
|
-
command.append_arg('netns', opts[:netns])
|
52
|
-
|
53
|
-
if Kanrisuru::Util.present?(opts[:vf])
|
54
|
-
command.append_arg('vf', opts[:vf])
|
55
|
-
command.append_arg('mac', opts[:mac])
|
56
|
-
|
57
|
-
if Kanrisuru::Util.present?(opts[:vlan])
|
58
|
-
command.append_arg('vlan', opts[:vlan])
|
59
|
-
command.append_arg('qos', opts[:qos])
|
60
|
-
end
|
61
|
-
|
62
|
-
command.append_arg('rate', opts[:rate])
|
63
|
-
end
|
16
|
+
command = ip_link_set(opts)
|
64
17
|
end
|
65
18
|
|
66
19
|
execute_shell(command)
|
@@ -69,6 +22,95 @@ module Kanrisuru
|
|
69
22
|
Parser::Link.parse(cmd, action, version)
|
70
23
|
end
|
71
24
|
end
|
25
|
+
|
26
|
+
def ip_link_show(opts, version)
|
27
|
+
command = Kanrisuru::Command.new('ip')
|
28
|
+
command.append_flag('-json') if version >= IPROUTE2_JSON_VERSION
|
29
|
+
command.append_flag('-s', opts[:stats])
|
30
|
+
command.append_arg('-family', opts[:family])
|
31
|
+
command << 'link show'
|
32
|
+
|
33
|
+
command.append_arg('dev', opts[:dev])
|
34
|
+
command.append_arg('group', opts[:group])
|
35
|
+
command.append_arg('master', opts[:master])
|
36
|
+
command.append_arg('type', opts[:type])
|
37
|
+
command.append_arg('vrf', opts[:vrf])
|
38
|
+
|
39
|
+
command.append_flag('up', opts[:up])
|
40
|
+
command
|
41
|
+
end
|
42
|
+
|
43
|
+
def ip_link_add(opts)
|
44
|
+
command = Kanrisuru::Command.new('ip link add')
|
45
|
+
|
46
|
+
command.append_arg('dev', opts[:dev])
|
47
|
+
command.append_arg('name', opts[:name])
|
48
|
+
command.append_arg('mtu', opts[:mtu])
|
49
|
+
command.append_arg('index', opts[:index])
|
50
|
+
|
51
|
+
command.append_arg('numtxqueues', opts[:numtxqueues])
|
52
|
+
command.append_arg('numrxqueues', opts[:numrxqueues])
|
53
|
+
command.append_arg('gso_max_size', opts[:gso_max_size])
|
54
|
+
command.append_arg('gso_max_segs', opts[:gso_max_segs])
|
55
|
+
|
56
|
+
if Kanrisuru::Util.present?(opts[:type])
|
57
|
+
raise ArgumentError, 'invalid link type' unless IP_LINK_TYPES.include?(opts[:type])
|
58
|
+
|
59
|
+
command.append_arg('type', opts[:type])
|
60
|
+
|
61
|
+
ip_link_type_opts(command, opts) if Kanrisuru::Util.present?(opts[:type_opts])
|
62
|
+
end
|
63
|
+
|
64
|
+
command
|
65
|
+
end
|
66
|
+
|
67
|
+
def ip_link_delete(opts)
|
68
|
+
command = Kanrisuru::Command.new('ip link delete')
|
69
|
+
command.append_arg('dev', opts[:dev])
|
70
|
+
command.append_arg('group', opts[:group])
|
71
|
+
command.append_arg('type', opts[:type])
|
72
|
+
command
|
73
|
+
end
|
74
|
+
|
75
|
+
def ip_link_set(opts)
|
76
|
+
command = Kanrisuru::Command.new('ip link set')
|
77
|
+
raise ArgumentError, 'no device defined' unless opts[:dev]
|
78
|
+
|
79
|
+
command.append_arg('dev', opts[:dev])
|
80
|
+
command.append_arg('group', opts[:group])
|
81
|
+
|
82
|
+
case opts[:direction]
|
83
|
+
when 'up'
|
84
|
+
command.append_flag('up')
|
85
|
+
when 'down'
|
86
|
+
command.append_flag('down')
|
87
|
+
end
|
88
|
+
|
89
|
+
ip_link_common_opts(command, opts)
|
90
|
+
|
91
|
+
ip_link_vf_opts(command, opts) if Kanrisuru::Util.present?(opts[:vf])
|
92
|
+
|
93
|
+
ip_link_xdp_opts(command, opts) if Kanrisuru::Util.present?(opts[:xdp])
|
94
|
+
|
95
|
+
if opts[:master] == false
|
96
|
+
command.append_flag('nomaster')
|
97
|
+
else
|
98
|
+
command.append_arg('master', opts[:master])
|
99
|
+
end
|
100
|
+
|
101
|
+
command.append_arg('addrgenmode', opts[:addrgenmode])
|
102
|
+
command.append_flag('link-netnsid', opts[:link_netnsid])
|
103
|
+
|
104
|
+
if Kanrisuru::Util.present?(opts[:type])
|
105
|
+
raise ArgumentError, 'invalid link type' unless IP_LINK_TYPES.include?(opts[:type])
|
106
|
+
|
107
|
+
command.append_arg('type', opts[:type])
|
108
|
+
|
109
|
+
ip_link_type_opts(command, opts) if Kanrisuru::Util.present?(opts[:type_opts])
|
110
|
+
end
|
111
|
+
|
112
|
+
command
|
113
|
+
end
|
72
114
|
end
|
73
115
|
end
|
74
116
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kanrisuru
|
4
|
+
module Core
|
5
|
+
module IP
|
6
|
+
def ip_link_common_opts(command, opts)
|
7
|
+
command.append_arg('arp', opts[:arp])
|
8
|
+
command.append_arg('multicast', opts[:multicast])
|
9
|
+
command.append_arg('allmulticast', opts[:allmulticast])
|
10
|
+
command.append_arg('promisc', opts[:promisc])
|
11
|
+
command.append_arg('protodown', opts[:protodown])
|
12
|
+
command.append_arg('protodown_reason', opts[:protodown_reason])
|
13
|
+
command.append_arg('dynamic', opts[:dynamic])
|
14
|
+
command.append_arg('name', opts[:name])
|
15
|
+
command.append_arg('txqueuelen', opts[:txqueuelen])
|
16
|
+
command.append_arg('txqlen', opts[:txqlen])
|
17
|
+
command.append_arg('mtu', opts[:mtu])
|
18
|
+
command.append_arg('address', opts[:address])
|
19
|
+
command.append_arg('broadcast', opts[:broadcast])
|
20
|
+
command.append_arg('brd', opts[:brd])
|
21
|
+
command.append_arg('peer', opts[:peer])
|
22
|
+
command.append_arg('netns', opts[:netns])
|
23
|
+
command.append_arg('alias', opts[:alias])
|
24
|
+
end
|
25
|
+
|
26
|
+
def ip_link_xdp_opts(command, opts)
|
27
|
+
command.append_arg('xdp', opts[:xdp])
|
28
|
+
|
29
|
+
case opts[:xdp]
|
30
|
+
when 'object'
|
31
|
+
command << opts[:object]
|
32
|
+
command.append_arg('section', opts[:section])
|
33
|
+
command.append_flag('verbose', opts[:verbose])
|
34
|
+
when 'pinned'
|
35
|
+
command << opts[:pinned]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def ip_link_vf_opts(command, opts)
|
40
|
+
command.append_arg('vf', opts[:vf])
|
41
|
+
command.append_arg('mac', opts[:mac])
|
42
|
+
|
43
|
+
if Kanrisuru::Util.present?(opts[:vlan])
|
44
|
+
command.append_arg('vlan', opts[:vlan])
|
45
|
+
command.append_arg('qos', opts[:qos])
|
46
|
+
end
|
47
|
+
|
48
|
+
command.append_arg('proto', opts[:proto])
|
49
|
+
command.append_arg('rate', opts[:rate])
|
50
|
+
command.append_arg('max_tx_rate', opts[:max_tx_rate])
|
51
|
+
command.append_arg('min_tx_rate', opts[:min_tx_rate])
|
52
|
+
command.append_arg('spoofchk', opts[:spoofchk])
|
53
|
+
command.append_arg('query_rss', opts[:query_rss])
|
54
|
+
command.append_arg('state', opts[:state])
|
55
|
+
command.append_arg('trust', opts[:trust])
|
56
|
+
command.append_arg('node_guid', opts[:node_guid])
|
57
|
+
command.append_arg('port_guid', opts[:port_guid])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|