Committed by
Gerrit Code Review
ONOS-1756: Improve CLI auto completers
- Add more ICMP types and codes - Add completer for --icmp6Type - Add completer for --icmp6Code - Add completer for --extHdr It is a multiValued option. For example, the following command will match an IPv6 packet with both fragment and routing extension header: add-point-intent --ethType IPV6 --extHdr FRAG --extHdr ROUTING NOTE: OVS 2.3.1 does not support OFPXMC_OFB_IPV6_EXTHDR match field yet. - Change parameter of TrafficSelector.matchIPv6ExthdrFlags() from int to short since that field is 9 bits only Change-Id: I55944399f3985f2cc09330a726f21983de273341
Showing
13 changed files
with
514 additions
and
29 deletions
... | @@ -104,8 +104,8 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -104,8 +104,8 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
104 | private String dstTcpString = null; | 104 | private String dstTcpString = null; |
105 | 105 | ||
106 | @Option(name = "--extHdr", description = "IPv6 Extension Header Pseudo-field", | 106 | @Option(name = "--extHdr", description = "IPv6 Extension Header Pseudo-field", |
107 | - required = false, multiValued = false) | 107 | + required = false, multiValued = true) |
108 | - private String extHdrString = null; | 108 | + private List<String> extHdrStringList = null; |
109 | 109 | ||
110 | @Option(name = "-b", aliases = "--bandwidth", description = "Bandwidth", | 110 | @Option(name = "-b", aliases = "--bandwidth", description = "Bandwidth", |
111 | required = false, multiValued = false) | 111 | required = false, multiValued = false) |
... | @@ -217,11 +217,13 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -217,11 +217,13 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
217 | } | 217 | } |
218 | 218 | ||
219 | if (!isNullOrEmpty(icmp6TypeString)) { | 219 | if (!isNullOrEmpty(icmp6TypeString)) { |
220 | - selectorBuilder.matchIcmpv6Type((byte) Integer.parseInt(icmp6TypeString)); | 220 | + byte icmp6Type = Icmp6Type.parseFromString(icmp6TypeString); |
221 | + selectorBuilder.matchIcmpv6Type(icmp6Type); | ||
221 | } | 222 | } |
222 | 223 | ||
223 | if (!isNullOrEmpty(icmp6CodeString)) { | 224 | if (!isNullOrEmpty(icmp6CodeString)) { |
224 | - selectorBuilder.matchIcmpv6Code((byte) Integer.parseInt(icmp6CodeString)); | 225 | + byte icmp6Code = Icmp6Code.parseFromString(icmp6CodeString); |
226 | + selectorBuilder.matchIcmpv6Code(icmp6Code); | ||
225 | } | 227 | } |
226 | 228 | ||
227 | if (!isNullOrEmpty(ndTargetString)) { | 229 | if (!isNullOrEmpty(ndTargetString)) { |
... | @@ -244,8 +246,12 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -244,8 +246,12 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
244 | selectorBuilder.matchTcpDst((short) Integer.parseInt(dstTcpString)); | 246 | selectorBuilder.matchTcpDst((short) Integer.parseInt(dstTcpString)); |
245 | } | 247 | } |
246 | 248 | ||
247 | - if (!isNullOrEmpty(extHdrString)) { | 249 | + if (extHdrStringList != null) { |
248 | - selectorBuilder.matchIPv6ExthdrFlags(Integer.parseInt(extHdrString)); | 250 | + short extHdr = 0; |
251 | + for (String extHdrString : extHdrStringList) { | ||
252 | + extHdr = (short) (extHdr | ExtHeader.parseFromString(extHdrString)); | ||
253 | + } | ||
254 | + selectorBuilder.matchIPv6ExthdrFlags(extHdr); | ||
249 | } | 255 | } |
250 | 256 | ||
251 | return selectorBuilder.build(); | 257 | return selectorBuilder.build(); | ... | ... |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.cli.net; | ||
17 | + | ||
18 | +/** | ||
19 | + * Known values for IPv6 extension header field that can be supplied to the CLI. | ||
20 | + */ | ||
21 | +public enum ExtHeader { | ||
22 | + /** No next header. */ | ||
23 | + NOEXT((short) (1 << 0)), | ||
24 | + /** Encapsulated Security Payload. */ | ||
25 | + ESP((short) (1 << 1)), | ||
26 | + /** Authentication header. */ | ||
27 | + AUTH((short) (1 << 2)), | ||
28 | + /** Destination header. */ | ||
29 | + DEST((short) (1 << 3)), | ||
30 | + /** Fragment header. */ | ||
31 | + FRAG((short) (1 << 4)), | ||
32 | + /** Router header. */ | ||
33 | + ROUTE((short) (1 << 5)), | ||
34 | + /** Hop-by-hop header. */ | ||
35 | + HOP((short) (1 << 6)), | ||
36 | + /** Unexpected repeats encountered. */ | ||
37 | + UNREP((short) (1 << 7)), | ||
38 | + /** Unexpected sequencing encountered. */ | ||
39 | + UNSEQ((short) (1 << 8)); | ||
40 | + | ||
41 | + private short value; | ||
42 | + | ||
43 | + /** | ||
44 | + * Constructs an ExtHeader with the given value. | ||
45 | + * | ||
46 | + * @param value value to use when this ExtHeader is seen | ||
47 | + */ | ||
48 | + private ExtHeader(short value) { | ||
49 | + this.value = value; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Gets the value to use for this ExtHeader. | ||
54 | + * | ||
55 | + * @return short value to use for this ExtHeader | ||
56 | + */ | ||
57 | + public short value() { | ||
58 | + return this.value; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Parse a string input that could contain an ExtHeader value. The value | ||
63 | + * may appear in the string either as a known exntension header name (one of the | ||
64 | + * values of this enum), or a numeric extension header value. | ||
65 | + * | ||
66 | + * @param input the input string to parse | ||
67 | + * @return the numeric value of the parsed IPv6 extension header | ||
68 | + * @throws IllegalArgumentException if the input string does not contain a | ||
69 | + * value that can be parsed into an IPv6 extension header | ||
70 | + */ | ||
71 | + public static short parseFromString(String input) { | ||
72 | + try { | ||
73 | + return valueOf(input).value(); | ||
74 | + } catch (IllegalArgumentException e) { | ||
75 | + // The input is not a known IPv6 extension header name, let's see if | ||
76 | + // it's an IPv6 extension header value (short). | ||
77 | + // We parse with Short to handle unsigned values correctly. | ||
78 | + try { | ||
79 | + return Short.parseShort(input); | ||
80 | + } catch (NumberFormatException e1) { | ||
81 | + throw new IllegalArgumentException( | ||
82 | + "ExtHeader value must be either a string extension header name" | ||
83 | + + " or an 8-bit extension header value"); | ||
84 | + } | ||
85 | + } | ||
86 | + } | ||
87 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.cli.net; | ||
17 | + | ||
18 | +import org.apache.karaf.shell.console.Completer; | ||
19 | +import org.apache.karaf.shell.console.completer.StringsCompleter; | ||
20 | + | ||
21 | +import java.util.List; | ||
22 | +import java.util.SortedSet; | ||
23 | + | ||
24 | +/** | ||
25 | + * IPv6 extension header completer. | ||
26 | + */ | ||
27 | +public class ExtHeaderCompleter implements Completer { | ||
28 | + @Override | ||
29 | + public int complete(String buffer, int cursor, List<String> candidates) { | ||
30 | + // Delegate string completer | ||
31 | + StringsCompleter delegate = new StringsCompleter(); | ||
32 | + SortedSet<String> strings = delegate.getStrings(); | ||
33 | + | ||
34 | + for (ExtHeader extHeader : ExtHeader.values()) { | ||
35 | + strings.add(extHeader.toString()); | ||
36 | + } | ||
37 | + | ||
38 | + // Now let the completer do the work for figuring out what to offer. | ||
39 | + return delegate.complete(buffer, cursor, candidates); | ||
40 | + } | ||
41 | + | ||
42 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.cli.net; | ||
17 | + | ||
18 | +import org.onlab.packet.ICMP6; | ||
19 | + | ||
20 | +/** | ||
21 | + * Known values for ICMPv6 code field that can be supplied to the CLI. | ||
22 | + */ | ||
23 | +public enum Icmp6Code { | ||
24 | + // Code for DEST_UNREACH | ||
25 | + /** No route to destination. */ | ||
26 | + NO_ROUTE(ICMP6.NO_ROUTE), | ||
27 | + /** Communication with destination administratively prohibited. */ | ||
28 | + COMM_PROHIBIT(ICMP6.COMM_PROHIBIT), | ||
29 | + /** Beyond scope of source address. */ | ||
30 | + BEYOND_SCOPE(ICMP6.BEYOND_SCOPE), | ||
31 | + /** Address unreachable. */ | ||
32 | + ADDR_UNREACH(ICMP6.ADDR_UNREACH), | ||
33 | + /** Port unreachable. */ | ||
34 | + PORT_UNREACH(ICMP6.PORT_UNREACH), | ||
35 | + /** Source address failed ingress/egress policy. */ | ||
36 | + FAIL_POLICY(ICMP6.FAIL_POLICY), | ||
37 | + /** Reject route to destination. */ | ||
38 | + REJECT_ROUTE(ICMP6.REJECT_ROUTE), | ||
39 | + /** Error in Source Routing Header. */ | ||
40 | + SRC_ROUTING_HEADER_ERR(ICMP6.SRC_ROUTING_HEADER_ERR), | ||
41 | + | ||
42 | + // Code for TIME_EXCEED | ||
43 | + /** Hop limit exceeded in transit. */ | ||
44 | + HOP_LIMIT_EXCEED(ICMP6.HOP_LIMIT_EXCEED), | ||
45 | + /** Fragment reassembly time exceeded. */ | ||
46 | + DEFRAG_TIME_EXCEED(ICMP6.DEFRAG_TIME_EXCEED), | ||
47 | + | ||
48 | + // Code for PARAM_ERR | ||
49 | + /** Erroneous header field encountered. */ | ||
50 | + HDR_FIELD_ERR(ICMP6.HDR_FIELD_ERR), | ||
51 | + /** Unrecognized Next Header type encountered. */ | ||
52 | + NEXT_HEADER_ERR(ICMP6.NEXT_HEADER_ERR), | ||
53 | + /** Unrecognized IPv6 option encountered. */ | ||
54 | + IPV6_OPT_ERR(ICMP6.IPV6_OPT_ERR); | ||
55 | + | ||
56 | + private byte value; | ||
57 | + | ||
58 | + /** | ||
59 | + * Constructs an Icmp6Code with the given value. | ||
60 | + * | ||
61 | + * @param value value to use when this Icmp6Code is seen | ||
62 | + */ | ||
63 | + private Icmp6Code(byte value) { | ||
64 | + this.value = value; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Gets the value to use for this Icmp6Code. | ||
69 | + * | ||
70 | + * @return short value to use for this Icmp6Code | ||
71 | + */ | ||
72 | + public byte value() { | ||
73 | + return this.value; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Parse a string input that could contain an Icmp6Code value. The value | ||
78 | + * may appear in the string either as a known code name (one of the | ||
79 | + * values of this enum), or a numeric code value. | ||
80 | + * | ||
81 | + * @param input the input string to parse | ||
82 | + * @return the numeric value of the parsed ICMPv6 code | ||
83 | + * @throws IllegalArgumentException if the input string does not contain a | ||
84 | + * value that can be parsed into an ICMPv6 code | ||
85 | + */ | ||
86 | + public static byte parseFromString(String input) { | ||
87 | + try { | ||
88 | + return valueOf(input).value(); | ||
89 | + } catch (IllegalArgumentException e) { | ||
90 | + // The input is not a known ICMPv6 code name, let's see if it's an ICMP6 | ||
91 | + // code value (byte). We parse with Byte to handle unsigned values | ||
92 | + // correctly. | ||
93 | + try { | ||
94 | + return Byte.parseByte(input); | ||
95 | + } catch (NumberFormatException e1) { | ||
96 | + throw new IllegalArgumentException( | ||
97 | + "Icmp6Code value must be either a string code name" | ||
98 | + + " or an 8-bit code value"); | ||
99 | + } | ||
100 | + } | ||
101 | + } | ||
102 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.cli.net; | ||
17 | + | ||
18 | +import org.apache.karaf.shell.console.Completer; | ||
19 | +import org.apache.karaf.shell.console.completer.StringsCompleter; | ||
20 | + | ||
21 | +import java.util.List; | ||
22 | +import java.util.SortedSet; | ||
23 | + | ||
24 | +/** | ||
25 | + * ICMPv6 type completer. | ||
26 | + */ | ||
27 | +public class Icmp6CodeCompleter implements Completer { | ||
28 | + @Override | ||
29 | + public int complete(String buffer, int cursor, List<String> candidates) { | ||
30 | + // Delegate string completer | ||
31 | + StringsCompleter delegate = new StringsCompleter(); | ||
32 | + SortedSet<String> strings = delegate.getStrings(); | ||
33 | + | ||
34 | + for (Icmp6Code code : Icmp6Code.values()) { | ||
35 | + strings.add(code.toString()); | ||
36 | + } | ||
37 | + | ||
38 | + // Now let the completer do the work for figuring out what to offer. | ||
39 | + return delegate.complete(buffer, cursor, candidates); | ||
40 | + } | ||
41 | + | ||
42 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.cli.net; | ||
17 | + | ||
18 | +import org.onlab.packet.ICMP6; | ||
19 | + | ||
20 | +/** | ||
21 | + * Known values for ICMPv6 type field that can be supplied to the CLI. | ||
22 | + */ | ||
23 | +public enum Icmp6Type { | ||
24 | + /** Destination Unreachable. */ | ||
25 | + DEST_UNREACH(ICMP6.DEST_UNREACH), | ||
26 | + /** Packet Too Big. */ | ||
27 | + PKT_TOO_BIG(ICMP6.PKT_TOO_BIG), | ||
28 | + /** Time Exceeded. */ | ||
29 | + TIME_EXCEED(ICMP6.TIME_EXCEED), | ||
30 | + /** Parameter Problem. */ | ||
31 | + PARAM_ERR(ICMP6.PARAM_ERR), | ||
32 | + /** Echo Request. */ | ||
33 | + ECHO_REQUEST(ICMP6.ECHO_REQUEST), | ||
34 | + /** Echo Reply. */ | ||
35 | + ECHO_REPLY(ICMP6.ECHO_REPLY), | ||
36 | + /** Multicast Listener Query. */ | ||
37 | + MCAST_QUERY(ICMP6.MCAST_QUERY), | ||
38 | + /** Multicast Listener Report. */ | ||
39 | + MCAST_REPORT(ICMP6.MCAST_REPORT), | ||
40 | + /** Multicast Listener Done. */ | ||
41 | + MCAST_DONE(ICMP6.MCAST_DONE), | ||
42 | + /** Router Solicitation. */ | ||
43 | + ROUTER_SOLICITATION(ICMP6.ROUTER_SOLICITATION), | ||
44 | + /** Router Advertisement. */ | ||
45 | + ROUTER_ADVERTISEMENT(ICMP6.ROUTER_ADVERTISEMENT), | ||
46 | + /** Neighbor Solicitation. */ | ||
47 | + NEIGHBOR_SOLICITATION(ICMP6.NEIGHBOR_SOLICITATION), | ||
48 | + /** Neighbor Advertisement. */ | ||
49 | + NEIGHBOR_ADVERTISEMENT(ICMP6.NEIGHBOR_ADVERTISEMENT), | ||
50 | + /** Redirect Message. */ | ||
51 | + REDIRECT(ICMP6.REDIRECT); | ||
52 | + | ||
53 | + | ||
54 | + private byte value; | ||
55 | + | ||
56 | + /** | ||
57 | + * Constructs an Icmp6Type with the given value. | ||
58 | + * | ||
59 | + * @param value value to use when this Icmp6Type is seen | ||
60 | + */ | ||
61 | + private Icmp6Type(byte value) { | ||
62 | + this.value = value; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Gets the value to use for this Icmp6Type. | ||
67 | + * | ||
68 | + * @return short value to use for this Icmp6Type | ||
69 | + */ | ||
70 | + public byte value() { | ||
71 | + return this.value; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Parse a string input that could contain an Icmp6Type value. The value | ||
76 | + * may appear in the string either as a known type name (one of the | ||
77 | + * values of this enum), or a numeric type value. | ||
78 | + * | ||
79 | + * @param input the input string to parse | ||
80 | + * @return the numeric value of the parsed ICMPv6 type | ||
81 | + * @throws IllegalArgumentException if the input string does not contain a | ||
82 | + * value that can be parsed into an ICMPv6 type | ||
83 | + */ | ||
84 | + public static byte parseFromString(String input) { | ||
85 | + try { | ||
86 | + return valueOf(input).value(); | ||
87 | + } catch (IllegalArgumentException e) { | ||
88 | + // The input is not a known ICMPv6 type name, let's see if it's an ICMP6 | ||
89 | + // type value (byte). We parse with Byte to handle unsigned values | ||
90 | + // correctly. | ||
91 | + try { | ||
92 | + return Byte.parseByte(input); | ||
93 | + } catch (NumberFormatException e1) { | ||
94 | + throw new IllegalArgumentException( | ||
95 | + "Icmp6Type value must be either a string type name" | ||
96 | + + " or an 8-bit type value"); | ||
97 | + } | ||
98 | + } | ||
99 | + } | ||
100 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.cli.net; | ||
17 | + | ||
18 | +import org.apache.karaf.shell.console.Completer; | ||
19 | +import org.apache.karaf.shell.console.completer.StringsCompleter; | ||
20 | + | ||
21 | +import java.util.List; | ||
22 | +import java.util.SortedSet; | ||
23 | + | ||
24 | +/** | ||
25 | + * ICMPv6 type completer. | ||
26 | + */ | ||
27 | +public class Icmp6TypeCompleter implements Completer { | ||
28 | + @Override | ||
29 | + public int complete(String buffer, int cursor, List<String> candidates) { | ||
30 | + // Delegate string completer | ||
31 | + StringsCompleter delegate = new StringsCompleter(); | ||
32 | + SortedSet<String> strings = delegate.getStrings(); | ||
33 | + | ||
34 | + for (Icmp6Type type : Icmp6Type.values()) { | ||
35 | + strings.add(type.toString()); | ||
36 | + } | ||
37 | + | ||
38 | + // Now let the completer do the work for figuring out what to offer. | ||
39 | + return delegate.complete(buffer, cursor, candidates); | ||
40 | + } | ||
41 | + | ||
42 | +} |
... | @@ -49,14 +49,6 @@ | ... | @@ -49,14 +49,6 @@ |
49 | <command> | 49 | <command> |
50 | <action class="org.onosproject.cli.NodesListCommand"/> | 50 | <action class="org.onosproject.cli.NodesListCommand"/> |
51 | </command> | 51 | </command> |
52 | - <!-- | ||
53 | - <command> | ||
54 | - <action class="org.onosproject.cli.NodeAddCommand"/> | ||
55 | - </command> | ||
56 | - <command> | ||
57 | - <action class="org.onosproject.cli.NodeRemoveCommand"/> | ||
58 | - </command> | ||
59 | - --> | ||
60 | 52 | ||
61 | <command> | 53 | <command> |
62 | <action class="org.onosproject.cli.RolesCommand"/> | 54 | <action class="org.onosproject.cli.RolesCommand"/> |
... | @@ -165,6 +157,9 @@ | ... | @@ -165,6 +157,9 @@ |
165 | <optional-completers> | 157 | <optional-completers> |
166 | <entry key="-t" value-ref="ethTypeCompleter"/> | 158 | <entry key="-t" value-ref="ethTypeCompleter"/> |
167 | <entry key="--ipProto" value-ref="ipProtocolCompleter"/> | 159 | <entry key="--ipProto" value-ref="ipProtocolCompleter"/> |
160 | + <entry key="--icmp6Type" value-ref="Icmp6TypeCompleter"/> | ||
161 | + <entry key="--icmp6Code" value-ref="Icmp6CodeCompleter"/> | ||
162 | + <entry key="--extHdr" value-ref="ExtHeaderCompleter"/> | ||
168 | <entry key="-a" value-ref="allAppNameCompleter"/> | 163 | <entry key="-a" value-ref="allAppNameCompleter"/> |
169 | </optional-completers> | 164 | </optional-completers> |
170 | </command> | 165 | </command> |
... | @@ -193,6 +188,9 @@ | ... | @@ -193,6 +188,9 @@ |
193 | <optional-completers> | 188 | <optional-completers> |
194 | <entry key="-t" value-ref="ethTypeCompleter"/> | 189 | <entry key="-t" value-ref="ethTypeCompleter"/> |
195 | <entry key="--ipProto" value-ref="ipProtocolCompleter"/> | 190 | <entry key="--ipProto" value-ref="ipProtocolCompleter"/> |
191 | + <entry key="--icmp6Type" value-ref="Icmp6TypeCompleter"/> | ||
192 | + <entry key="--icmp6Code" value-ref="Icmp6CodeCompleter"/> | ||
193 | + <entry key="--extHdr" value-ref="ExtHeaderCompleter"/> | ||
196 | <entry key="-a" value-ref="allAppNameCompleter"/> | 194 | <entry key="-a" value-ref="allAppNameCompleter"/> |
197 | </optional-completers> | 195 | </optional-completers> |
198 | </command> | 196 | </command> |
... | @@ -204,6 +202,9 @@ | ... | @@ -204,6 +202,9 @@ |
204 | <optional-completers> | 202 | <optional-completers> |
205 | <entry key="-t" value-ref="ethTypeCompleter"/> | 203 | <entry key="-t" value-ref="ethTypeCompleter"/> |
206 | <entry key="--ipProto" value-ref="ipProtocolCompleter"/> | 204 | <entry key="--ipProto" value-ref="ipProtocolCompleter"/> |
205 | + <entry key="--icmp6Type" value-ref="Icmp6TypeCompleter"/> | ||
206 | + <entry key="--icmp6Code" value-ref="Icmp6CodeCompleter"/> | ||
207 | + <entry key="--extHdr" value-ref="ExtHeaderCompleter"/> | ||
207 | <entry key="-a" value-ref="allAppNameCompleter"/> | 208 | <entry key="-a" value-ref="allAppNameCompleter"/> |
208 | </optional-completers> | 209 | </optional-completers> |
209 | </command> | 210 | </command> |
... | @@ -327,6 +328,11 @@ | ... | @@ -327,6 +328,11 @@ |
327 | <null/> | 328 | <null/> |
328 | </completers> | 329 | </completers> |
329 | <optional-completers> | 330 | <optional-completers> |
331 | + <entry key="-t" value-ref="ethTypeCompleter"/> | ||
332 | + <entry key="--ipProto" value-ref="ipProtocolCompleter"/> | ||
333 | + <entry key="--icmp6Type" value-ref="Icmp6TypeCompleter"/> | ||
334 | + <entry key="--icmp6Code" value-ref="Icmp6CodeCompleter"/> | ||
335 | + <entry key="--extHdr" value-ref="ExtHeaderCompleter"/> | ||
330 | <entry key="-a" value-ref="allAppNameCompleter"/> | 336 | <entry key="-a" value-ref="allAppNameCompleter"/> |
331 | </optional-completers> | 337 | </optional-completers> |
332 | </command> | 338 | </command> |
... | @@ -351,6 +357,9 @@ | ... | @@ -351,6 +357,9 @@ |
351 | <bean id="ethTypeCompleter" class="org.onosproject.cli.net.EthTypeCompleter"/> | 357 | <bean id="ethTypeCompleter" class="org.onosproject.cli.net.EthTypeCompleter"/> |
352 | <bean id="ipProtocolCompleter" class="org.onosproject.cli.net.IpProtocolCompleter"/> | 358 | <bean id="ipProtocolCompleter" class="org.onosproject.cli.net.IpProtocolCompleter"/> |
353 | <bean id="driverNameCompleter" class="org.onosproject.cli.net.DriverNameCompleter"/> | 359 | <bean id="driverNameCompleter" class="org.onosproject.cli.net.DriverNameCompleter"/> |
360 | + <bean id="Icmp6TypeCompleter" class="org.onosproject.cli.net.Icmp6TypeCompleter"/> | ||
361 | + <bean id="Icmp6CodeCompleter" class="org.onosproject.cli.net.Icmp6CodeCompleter"/> | ||
362 | + <bean id="ExtHeaderCompleter" class="org.onosproject.cli.net.ExtHeaderCompleter"/> | ||
354 | 363 | ||
355 | <bean id="startStopCompleter" class="org.onosproject.cli.StartStopCompleter"/> | 364 | <bean id="startStopCompleter" class="org.onosproject.cli.StartStopCompleter"/> |
356 | <bean id="upDownCompleter" class="org.onosproject.cli.UpDownCompleter"/> | 365 | <bean id="upDownCompleter" class="org.onosproject.cli.UpDownCompleter"/> | ... | ... |
... | @@ -293,7 +293,7 @@ public final class DefaultTrafficSelector implements TrafficSelector { | ... | @@ -293,7 +293,7 @@ public final class DefaultTrafficSelector implements TrafficSelector { |
293 | } | 293 | } |
294 | 294 | ||
295 | @Override | 295 | @Override |
296 | - public Builder matchIPv6ExthdrFlags(int exthdrFlags) { | 296 | + public Builder matchIPv6ExthdrFlags(short exthdrFlags) { |
297 | return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags)); | 297 | return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags)); |
298 | } | 298 | } |
299 | 299 | ... | ... |
... | @@ -306,7 +306,7 @@ public interface TrafficSelector { | ... | @@ -306,7 +306,7 @@ public interface TrafficSelector { |
306 | * @param exthdrFlags the IPv6 Extension Header pseudo-field fiags | 306 | * @param exthdrFlags the IPv6 Extension Header pseudo-field fiags |
307 | * @return a selection builder | 307 | * @return a selection builder |
308 | */ | 308 | */ |
309 | - public Builder matchIPv6ExthdrFlags(int exthdrFlags); | 309 | + public Builder matchIPv6ExthdrFlags(short exthdrFlags); |
310 | 310 | ||
311 | /** | 311 | /** |
312 | * Matches an optical signal ID or lambda. | 312 | * Matches an optical signal ID or lambda. | ... | ... |
... | @@ -145,27 +145,27 @@ public interface Criterion { | ... | @@ -145,27 +145,27 @@ public interface Criterion { |
145 | */ | 145 | */ |
146 | public enum IPv6ExthdrFlags { | 146 | public enum IPv6ExthdrFlags { |
147 | /** "No next header" encountered. */ | 147 | /** "No next header" encountered. */ |
148 | - NONEXT(1 << 0), | 148 | + NONEXT((short) (1 << 0)), |
149 | /** Encrypted Sec Payload header present. */ | 149 | /** Encrypted Sec Payload header present. */ |
150 | - ESP(1 << 1), | 150 | + ESP((short) (1 << 1)), |
151 | /** Authentication header present. */ | 151 | /** Authentication header present. */ |
152 | - AUTH(1 << 2), | 152 | + AUTH((short) (1 << 2)), |
153 | /** 1 or 2 dest headers present. */ | 153 | /** 1 or 2 dest headers present. */ |
154 | - DEST(1 << 3), | 154 | + DEST((short) (1 << 3)), |
155 | /** Fragment header present. */ | 155 | /** Fragment header present. */ |
156 | - FRAG(1 << 4), | 156 | + FRAG((short) (1 << 4)), |
157 | /** Router header present. */ | 157 | /** Router header present. */ |
158 | - ROUTER(1 << 5), | 158 | + ROUTER((short) (1 << 5)), |
159 | /** Hop-by-hop header present. */ | 159 | /** Hop-by-hop header present. */ |
160 | - HOP(1 << 6), | 160 | + HOP((short) (1 << 6)), |
161 | /** Unexpected repeats encountered. */ | 161 | /** Unexpected repeats encountered. */ |
162 | - UNREP(1 << 7), | 162 | + UNREP((short) (1 << 7)), |
163 | /** Unexpected sequencing encountered. */ | 163 | /** Unexpected sequencing encountered. */ |
164 | - UNSEQ(1 << 8); | 164 | + UNSEQ((short) (1 << 8)); |
165 | 165 | ||
166 | - private int value; | 166 | + private short value; |
167 | 167 | ||
168 | - IPv6ExthdrFlags(int value) { | 168 | + IPv6ExthdrFlags(short value) { |
169 | this.value = value; | 169 | this.value = value; |
170 | } | 170 | } |
171 | 171 | ||
... | @@ -174,7 +174,7 @@ public interface Criterion { | ... | @@ -174,7 +174,7 @@ public interface Criterion { |
174 | * | 174 | * |
175 | * @return the value as an integer | 175 | * @return the value as an integer |
176 | */ | 176 | */ |
177 | - public int getValue() { | 177 | + public short getValue() { |
178 | return this.value; | 178 | return this.value; |
179 | } | 179 | } |
180 | } | 180 | } | ... | ... |
... | @@ -622,7 +622,7 @@ public class FlowEntryBuilder { | ... | @@ -622,7 +622,7 @@ public class FlowEntryBuilder { |
622 | builder.matchIPv6NDTargetLinkLayerAddress(mac); | 622 | builder.matchIPv6NDTargetLinkLayerAddress(mac); |
623 | break; | 623 | break; |
624 | case IPV6_EXTHDR: | 624 | case IPV6_EXTHDR: |
625 | - builder.matchIPv6ExthdrFlags((int) match.get(MatchField.IPV6_EXTHDR) | 625 | + builder.matchIPv6ExthdrFlags((short) match.get(MatchField.IPV6_EXTHDR) |
626 | .getValue()); | 626 | .getValue()); |
627 | break; | 627 | break; |
628 | case OCH_SIGID: | 628 | case OCH_SIGID: | ... | ... |
... | @@ -34,13 +34,68 @@ import java.util.Map; | ... | @@ -34,13 +34,68 @@ import java.util.Map; |
34 | public class ICMP6 extends BasePacket { | 34 | public class ICMP6 extends BasePacket { |
35 | public static final byte HEADER_LENGTH = 4; // bytes | 35 | public static final byte HEADER_LENGTH = 4; // bytes |
36 | 36 | ||
37 | + // Type | ||
38 | + /** Destination Unreachable. */ | ||
39 | + public static final byte DEST_UNREACH = (byte) 0x01; | ||
40 | + /** Packet Too Big. */ | ||
41 | + public static final byte PKT_TOO_BIG = (byte) 0x02; | ||
42 | + /** Time Exceeded. */ | ||
43 | + public static final byte TIME_EXCEED = (byte) 0x03; | ||
44 | + /** Parameter Problem. */ | ||
45 | + public static final byte PARAM_ERR = (byte) 0x04; | ||
46 | + /** Echo Request. */ | ||
37 | public static final byte ECHO_REQUEST = (byte) 0x80; | 47 | public static final byte ECHO_REQUEST = (byte) 0x80; |
48 | + /** Echo Reply. */ | ||
38 | public static final byte ECHO_REPLY = (byte) 0x81; | 49 | public static final byte ECHO_REPLY = (byte) 0x81; |
50 | + /** Multicast Listener Query. */ | ||
51 | + public static final byte MCAST_QUERY = (byte) 0x82; | ||
52 | + /** Multicast Listener Report. */ | ||
53 | + public static final byte MCAST_REPORT = (byte) 0x83; | ||
54 | + /** Multicast Listener Done. */ | ||
55 | + public static final byte MCAST_DONE = (byte) 0x84; | ||
56 | + /** Router Solicitation. */ | ||
39 | public static final byte ROUTER_SOLICITATION = (byte) 0x85; | 57 | public static final byte ROUTER_SOLICITATION = (byte) 0x85; |
58 | + /** Router Advertisement. */ | ||
40 | public static final byte ROUTER_ADVERTISEMENT = (byte) 0x86; | 59 | public static final byte ROUTER_ADVERTISEMENT = (byte) 0x86; |
60 | + /** Neighbor Solicitation. */ | ||
41 | public static final byte NEIGHBOR_SOLICITATION = (byte) 0x87; | 61 | public static final byte NEIGHBOR_SOLICITATION = (byte) 0x87; |
62 | + /** Neighbor Advertisement. */ | ||
42 | public static final byte NEIGHBOR_ADVERTISEMENT = (byte) 0x88; | 63 | public static final byte NEIGHBOR_ADVERTISEMENT = (byte) 0x88; |
64 | + /** Redirect Message. */ | ||
43 | public static final byte REDIRECT = (byte) 0x89; | 65 | public static final byte REDIRECT = (byte) 0x89; |
66 | + | ||
67 | + // Code for DEST_UNREACH | ||
68 | + /** No route to destination. */ | ||
69 | + public static final byte NO_ROUTE = (byte) 0x00; | ||
70 | + /** Communication with destination administratively prohibited. */ | ||
71 | + public static final byte COMM_PROHIBIT = (byte) 0x01; | ||
72 | + /** Beyond scope of source address. */ | ||
73 | + public static final byte BEYOND_SCOPE = (byte) 0x02; | ||
74 | + /** Address unreachable. */ | ||
75 | + public static final byte ADDR_UNREACH = (byte) 0x03; | ||
76 | + /** Port unreachable. */ | ||
77 | + public static final byte PORT_UNREACH = (byte) 0x04; | ||
78 | + /** Source address failed ingress/egress policy. */ | ||
79 | + public static final byte FAIL_POLICY = (byte) 0x05; | ||
80 | + /** Reject route to destination. */ | ||
81 | + public static final byte REJECT_ROUTE = (byte) 0x06; | ||
82 | + /** Error in Source Routing Header. */ | ||
83 | + public static final byte SRC_ROUTING_HEADER_ERR = (byte) 0x07; | ||
84 | + | ||
85 | + // Code for TIME_EXCEED | ||
86 | + /** Hop limit exceeded in transit. */ | ||
87 | + public static final byte HOP_LIMIT_EXCEED = (byte) 0x00; | ||
88 | + /** Fragment reassembly time exceeded. */ | ||
89 | + public static final byte DEFRAG_TIME_EXCEED = (byte) 0x01; | ||
90 | + | ||
91 | + // Code for PARAM_ERR | ||
92 | + /** Erroneous header field encountered. */ | ||
93 | + public static final byte HDR_FIELD_ERR = (byte) 0x00; | ||
94 | + /** Unrecognized Next Header type encountered. */ | ||
95 | + public static final byte NEXT_HEADER_ERR = (byte) 0x01; | ||
96 | + /** Unrecognized IPv6 option encountered. */ | ||
97 | + public static final byte IPV6_OPT_ERR = (byte) 0x01; | ||
98 | + | ||
44 | public static final Map<Byte, Class<? extends IPacket>> PROTOCOL_CLASS_MAP = | 99 | public static final Map<Byte, Class<? extends IPacket>> PROTOCOL_CLASS_MAP = |
45 | new HashMap<>(); | 100 | new HashMap<>(); |
46 | 101 | ... | ... |
-
Please register or login to post a comment