Pavlin Radoslavov

Implement some of the missing Selector and Match Conditions

Work toward ONOS-509

The following match conditions are added/implemented:
 - UDP_SRC, UDP_DST
 - SCTP_SRC, SCTP_DST
 - ICMPV4_TYPE, ICMPV4_CODE
 - IPV6_FLABEL
 - IPV6_ND_TARGET
 - IPV6_ND_SLL
 - IPV6_ND_TLL

Also:
 * Renamed method
     TrafficSelector.Builder.matchInport(PortNumber port)
   to
     TrafficSelector.Builder.matchInPort(PortNumber port)
   (for consistency with the corresponding method(s) elsewhere)
 * Reordered the code for some of the existing matching conditions
   to follow the order in the OpenFlow spec, so it is easier to
   cross-reference such code.
 * Added missing Javadoc
 * Added few more Criterion.Type values as per OpenFlow spec 1.5.0

Change-Id: I7fc1656f32d8a7280c67d7827e4aa84528b0eafc
...@@ -288,7 +288,7 @@ public class ReactiveForwarding { ...@@ -288,7 +288,7 @@ public class ReactiveForwarding {
288 builder.matchEthType(inPkt.getEtherType()) 288 builder.matchEthType(inPkt.getEtherType())
289 .matchEthSrc(inPkt.getSourceMAC()) 289 .matchEthSrc(inPkt.getSourceMAC())
290 .matchEthDst(inPkt.getDestinationMAC()) 290 .matchEthDst(inPkt.getDestinationMAC())
291 - .matchInport(context.inPacket().receivedFrom().port()); 291 + .matchInPort(context.inPacket().receivedFrom().port());
292 292
293 TrafficTreatment.Builder treat = DefaultTrafficTreatment.builder(); 293 TrafficTreatment.Builder treat = DefaultTrafficTreatment.builder();
294 treat.setOutput(portNumber); 294 treat.setOutput(portNumber);
......
...@@ -107,21 +107,21 @@ public class LambdaForwarding { ...@@ -107,21 +107,21 @@ public class LambdaForwarding {
107 case 1: 107 case 1:
108 inport = 10; 108 inport = 10;
109 outport = 20; 109 outport = 20;
110 - sbuilder.matchInport(PortNumber.portNumber(inport)); 110 + sbuilder.matchInPort(PortNumber.portNumber(inport));
111 tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda); 111 tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda);
112 break; 112 break;
113 case 2: 113 case 2:
114 inport = 21; 114 inport = 21;
115 outport = 11; 115 outport = 11;
116 sbuilder.matchLambda(lambda). 116 sbuilder.matchLambda(lambda).
117 - matchInport(PortNumber.portNumber(inport)); // match sigtype 117 + matchInPort(PortNumber.portNumber(inport)); // match sigtype
118 tbuilder.setOutput(PortNumber.portNumber(outport)); 118 tbuilder.setOutput(PortNumber.portNumber(outport));
119 break; 119 break;
120 case 3: 120 case 3:
121 inport = 30; 121 inport = 30;
122 outport = 31; 122 outport = 31;
123 sbuilder.matchLambda(lambda). 123 sbuilder.matchLambda(lambda).
124 - matchInport(PortNumber.portNumber(inport)); 124 + matchInPort(PortNumber.portNumber(inport));
125 tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda); 125 tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda);
126 break; 126 break;
127 default: 127 default:
......
...@@ -106,7 +106,7 @@ public class MPLSForwarding { ...@@ -106,7 +106,7 @@ public class MPLSForwarding {
106 106
107 switch (switchNumber) { 107 switch (switchNumber) {
108 case 1: 108 case 1:
109 - sbuilder.matchInport(PortNumber.portNumber(inport)); 109 + sbuilder.matchInPort(PortNumber.portNumber(inport));
110 tbuilder.setOutput(PortNumber.portNumber(outport)) 110 tbuilder.setOutput(PortNumber.portNumber(outport))
111 .pushMpls() 111 .pushMpls()
112 .setMpls(mplsLabel); 112 .setMpls(mplsLabel);
...@@ -114,13 +114,13 @@ public class MPLSForwarding { ...@@ -114,13 +114,13 @@ public class MPLSForwarding {
114 case 2: 114 case 2:
115 sbuilder.matchMplsLabel(mplsLabel) 115 sbuilder.matchMplsLabel(mplsLabel)
116 .matchEthType(Ethernet.MPLS_UNICAST) 116 .matchEthType(Ethernet.MPLS_UNICAST)
117 - .matchInport(PortNumber.portNumber(inport)); 117 + .matchInPort(PortNumber.portNumber(inport));
118 tbuilder.setOutput(PortNumber.portNumber(outport)); 118 tbuilder.setOutput(PortNumber.portNumber(outport));
119 break; 119 break;
120 case 3: 120 case 3:
121 sbuilder.matchMplsLabel(mplsLabel) 121 sbuilder.matchMplsLabel(mplsLabel)
122 .matchEthType(Ethernet.MPLS_UNICAST) 122 .matchEthType(Ethernet.MPLS_UNICAST)
123 - .matchInport(PortNumber.portNumber(inport)); 123 + .matchInPort(PortNumber.portNumber(inport));
124 tbuilder.popMpls().setOutput(PortNumber.portNumber(outport)); 124 tbuilder.popMpls().setOutput(PortNumber.portNumber(outport));
125 break; 125 break;
126 default: 126 default:
......
...@@ -24,6 +24,7 @@ import org.onosproject.net.PortNumber; ...@@ -24,6 +24,7 @@ import org.onosproject.net.PortNumber;
24 import org.onosproject.net.flow.criteria.Criteria; 24 import org.onosproject.net.flow.criteria.Criteria;
25 import org.onosproject.net.flow.criteria.Criterion; 25 import org.onosproject.net.flow.criteria.Criterion;
26 import org.onlab.packet.IpPrefix; 26 import org.onlab.packet.IpPrefix;
27 +import org.onlab.packet.Ip6Address;
27 import org.onlab.packet.MacAddress; 28 import org.onlab.packet.MacAddress;
28 import org.onlab.packet.VlanId; 29 import org.onlab.packet.VlanId;
29 30
...@@ -129,22 +130,22 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -129,22 +130,22 @@ public final class DefaultTrafficSelector implements TrafficSelector {
129 } 130 }
130 131
131 @Override 132 @Override
132 - public Builder matchInport(PortNumber port) { 133 + public Builder matchInPort(PortNumber port) {
133 return add(Criteria.matchInPort(port)); 134 return add(Criteria.matchInPort(port));
134 } 135 }
135 136
136 @Override 137 @Override
137 - public Builder matchEthSrc(MacAddress addr) { 138 + public Builder matchEthDst(MacAddress addr) {
138 - return add(Criteria.matchEthSrc(addr)); 139 + return add(Criteria.matchEthDst(addr));
139 } 140 }
140 141
141 @Override 142 @Override
142 - public Builder matchEthDst(MacAddress addr) { 143 + public Builder matchEthSrc(MacAddress addr) {
143 - return add(Criteria.matchEthDst(addr)); 144 + return add(Criteria.matchEthSrc(addr));
144 } 145 }
145 146
146 @Override 147 @Override
147 - public Builder matchEthType(short ethType) { 148 + public Builder matchEthType(Short ethType) {
148 return add(Criteria.matchEthType(ethType)); 149 return add(Criteria.matchEthType(ethType));
149 } 150 }
150 151
...@@ -184,6 +185,36 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -184,6 +185,36 @@ public final class DefaultTrafficSelector implements TrafficSelector {
184 } 185 }
185 186
186 @Override 187 @Override
188 + public Builder matchUdpSrc(Short udpPort) {
189 + return add(Criteria.matchUdpSrc(udpPort));
190 + }
191 +
192 + @Override
193 + public Builder matchUdpDst(Short udpPort) {
194 + return add(Criteria.matchUdpDst(udpPort));
195 + }
196 +
197 + @Override
198 + public Builder matchSctpSrc(Short sctpPort) {
199 + return add(Criteria.matchSctpSrc(sctpPort));
200 + }
201 +
202 + @Override
203 + public Builder matchSctpDst(Short sctpPort) {
204 + return add(Criteria.matchSctpDst(sctpPort));
205 + }
206 +
207 + @Override
208 + public Builder matchIcmpType(Byte icmpType) {
209 + return add(Criteria.matchIcmpType(icmpType));
210 + }
211 +
212 + @Override
213 + public Builder matchIcmpCode(Byte icmpCode) {
214 + return add(Criteria.matchIcmpCode(icmpCode));
215 + }
216 +
217 + @Override
187 public Builder matchIPv6Src(IpPrefix ip) { 218 public Builder matchIPv6Src(IpPrefix ip) {
188 return add(Criteria.matchIPv6Src(ip)); 219 return add(Criteria.matchIPv6Src(ip));
189 } 220 }
...@@ -194,6 +225,11 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -194,6 +225,11 @@ public final class DefaultTrafficSelector implements TrafficSelector {
194 } 225 }
195 226
196 @Override 227 @Override
228 + public Builder matchIPv6FlowLabel(Integer flowLabel) {
229 + return add(Criteria.matchIPv6FlowLabel(flowLabel));
230 + }
231 +
232 + @Override
197 public Builder matchIcmpv6Type(Byte icmpv6Type) { 233 public Builder matchIcmpv6Type(Byte icmpv6Type) {
198 return add(Criteria.matchIcmpv6Type(icmpv6Type)); 234 return add(Criteria.matchIcmpv6Type(icmpv6Type));
199 } 235 }
...@@ -204,6 +240,21 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -204,6 +240,21 @@ public final class DefaultTrafficSelector implements TrafficSelector {
204 } 240 }
205 241
206 @Override 242 @Override
243 + public Builder matchIPv6NDTargetAddress(Ip6Address targetAddress) {
244 + return add(Criteria.matchIPv6NDTargetAddress(targetAddress));
245 + }
246 +
247 + @Override
248 + public Builder matchIPv6NDSourceLinkLayerAddress(MacAddress mac) {
249 + return add(Criteria.matchIPv6NDSourceLinkLayerAddress(mac));
250 + }
251 +
252 + @Override
253 + public Builder matchIPv6NDTargetLinkLayerAddress(MacAddress mac) {
254 + return add(Criteria.matchIPv6NDTargetLinkLayerAddress(mac));
255 + }
256 +
257 + @Override
207 public Builder matchMplsLabel(Integer mplsLabel) { 258 public Builder matchMplsLabel(Integer mplsLabel) {
208 return add(Criteria.matchMplsLabel(mplsLabel)); 259 return add(Criteria.matchMplsLabel(mplsLabel));
209 } 260 }
......
...@@ -20,6 +20,7 @@ import java.util.Set; ...@@ -20,6 +20,7 @@ import java.util.Set;
20 import org.onosproject.net.PortNumber; 20 import org.onosproject.net.PortNumber;
21 import org.onosproject.net.flow.criteria.Criterion; 21 import org.onosproject.net.flow.criteria.Criterion;
22 import org.onlab.packet.IpPrefix; 22 import org.onlab.packet.IpPrefix;
23 +import org.onlab.packet.Ip6Address;
23 import org.onlab.packet.MacAddress; 24 import org.onlab.packet.MacAddress;
24 import org.onlab.packet.VlanId; 25 import org.onlab.packet.VlanId;
25 26
...@@ -64,23 +65,23 @@ public interface TrafficSelector { ...@@ -64,23 +65,23 @@ public interface TrafficSelector {
64 * @param port the inport 65 * @param port the inport
65 * @return a selection builder 66 * @return a selection builder
66 */ 67 */
67 - public Builder matchInport(PortNumber port); 68 + public Builder matchInPort(PortNumber port);
68 69
69 /** 70 /**
70 - * Matches a l2 src address. 71 + * Matches a l2 dst address.
71 * 72 *
72 * @param addr a l2 address 73 * @param addr a l2 address
73 * @return a selection builder 74 * @return a selection builder
74 */ 75 */
75 - public Builder matchEthSrc(MacAddress addr); 76 + public Builder matchEthDst(MacAddress addr);
76 77
77 /** 78 /**
78 - * Matches a l2 dst address. 79 + * Matches a l2 src address.
79 * 80 *
80 * @param addr a l2 address 81 * @param addr a l2 address
81 * @return a selection builder 82 * @return a selection builder
82 */ 83 */
83 - public Builder matchEthDst(MacAddress addr); 84 + public Builder matchEthSrc(MacAddress addr);
84 85
85 /** 86 /**
86 * Matches the ethernet type. 87 * Matches the ethernet type.
...@@ -88,7 +89,7 @@ public interface TrafficSelector { ...@@ -88,7 +89,7 @@ public interface TrafficSelector {
88 * @param ethType an ethernet type 89 * @param ethType an ethernet type
89 * @return a selection builder 90 * @return a selection builder
90 */ 91 */
91 - public Builder matchEthType(short ethType); 92 + public Builder matchEthType(Short ethType);
92 93
93 /** 94 /**
94 * Matches the vlan id. 95 * Matches the vlan id.
...@@ -147,6 +148,54 @@ public interface TrafficSelector { ...@@ -147,6 +148,54 @@ public interface TrafficSelector {
147 public Builder matchTcpDst(Short tcpPort); 148 public Builder matchTcpDst(Short tcpPort);
148 149
149 /** 150 /**
151 + * Matches an UDP source port number.
152 + *
153 + * @param udpPort an UDP source port number
154 + * @return a selection builder
155 + */
156 + public Builder matchUdpSrc(Short udpPort);
157 +
158 + /**
159 + * Matches an UDP destination port number.
160 + *
161 + * @param udpPort an UDP destination port number
162 + * @return a selection builder
163 + */
164 + public Builder matchUdpDst(Short udpPort);
165 +
166 + /**
167 + * Matches a SCTP source port number.
168 + *
169 + * @param sctpPort a SCTP source port number
170 + * @return a selection builder
171 + */
172 + public Builder matchSctpSrc(Short sctpPort);
173 +
174 + /**
175 + * Matches a SCTP destination port number.
176 + *
177 + * @param sctpPort a SCTP destination port number
178 + * @return a selection builder
179 + */
180 + public Builder matchSctpDst(Short sctpPort);
181 +
182 + /**
183 + * Matches an ICMP type.
184 + *
185 + * @param icmpType an ICMP type
186 + * @return a selection builder
187 + */
188 + public Builder matchIcmpType(Byte icmpType);
189 +
190 + /**
191 + * Matches an ICMP code.
192 + *
193 + * @param icmpCode an ICMP code
194 + * @return a selection builder
195 + */
196 + public Builder matchIcmpCode(Byte icmpCode);
197 +
198 + /**
150 * Matches a l3 IPv6 address. 199 * Matches a l3 IPv6 address.
151 * 200 *
152 * @param ip a l3 IPv6 address 201 * @param ip a l3 IPv6 address
...@@ -163,23 +212,56 @@ public interface TrafficSelector { ...@@ -163,23 +212,56 @@ public interface TrafficSelector {
163 public Builder matchIPv6Dst(IpPrefix ip); 212 public Builder matchIPv6Dst(IpPrefix ip);
164 213
165 /** 214 /**
166 - * Matches a ICMPv6 type. 215 + * Matches an IPv6 flow label.
167 * 216 *
168 - * @param icmpv6Type a ICMPv6 type 217 + * @param flowLabel an IPv6 flow label
218 + * @return a selection builder
219 + */
220 + public Builder matchIPv6FlowLabel(Integer flowLabel);
221 +
222 + /**
223 + * Matches an ICMPv6 type.
224 + *
225 + * @param icmpv6Type an ICMPv6 type
169 * @return a selection builder 226 * @return a selection builder
170 */ 227 */
171 public Builder matchIcmpv6Type(Byte icmpv6Type); 228 public Builder matchIcmpv6Type(Byte icmpv6Type);
172 229
173 /** 230 /**
174 - * Matches a ICMPv6 code. 231 + * Matches an ICMPv6 code.
175 * 232 *
176 - * @param icmpv6Code a ICMPv6 code 233 + * @param icmpv6Code an ICMPv6 code
177 * @return a selection builder 234 * @return a selection builder
178 */ 235 */
179 public Builder matchIcmpv6Code(Byte icmpv6Code); 236 public Builder matchIcmpv6Code(Byte icmpv6Code);
180 237
181 /** 238 /**
182 - * Matches on a MPLS label . 239 + * Matches an IPv6 Neighbor Discovery target address.
240 + *
241 + * @param targetAddress an IPv6 Neighbor Discovery target address
242 + * @return a selection builder
243 + */
244 + public Builder matchIPv6NDTargetAddress(Ip6Address targetAddress);
245 +
246 + /**
247 + * Matches an IPv6 Neighbor Discovery source link-layer address.
248 + *
249 + * @param mac an IPv6 Neighbor Discovery source link-layer address
250 + * @return a selection builder
251 + */
252 + public Builder matchIPv6NDSourceLinkLayerAddress(MacAddress mac);
253 +
254 + /**
255 + * Matches an IPv6 Neighbor Discovery target link-layer address.
256 + *
257 + * @param mac an IPv6 Neighbor Discovery target link-layer address
258 + * @return a selection builder
259 + */
260 + public Builder matchIPv6NDTargetLinkLayerAddress(MacAddress mac);
261 +
262 + /**
263 + * Matches on a MPLS label.
264 + *
183 * @param mplsLabel a MPLS label. 265 * @param mplsLabel a MPLS label.
184 * @return a selection builder 266 * @return a selection builder
185 */ 267 */
...@@ -208,5 +290,4 @@ public interface TrafficSelector { ...@@ -208,5 +290,4 @@ public interface TrafficSelector {
208 */ 290 */
209 TrafficSelector build(); 291 TrafficSelector build();
210 } 292 }
211 -
212 } 293 }
......
...@@ -24,7 +24,7 @@ public interface Criterion { ...@@ -24,7 +24,7 @@ public interface Criterion {
24 /** 24 /**
25 * Types of fields to which the selection criterion may apply. 25 * Types of fields to which the selection criterion may apply.
26 */ 26 */
27 - // From page 42 of OpenFlow 1.3.x spec 27 + // From page 75 of OpenFlow 1.5.0 spec
28 public enum Type { 28 public enum Type {
29 /** Switch input port. */ 29 /** Switch input port. */
30 IN_PORT, 30 IN_PORT,
...@@ -106,6 +106,21 @@ public interface Criterion { ...@@ -106,6 +106,21 @@ public interface Criterion {
106 TUNNEL_ID, 106 TUNNEL_ID,
107 /** IPv6 Extension Header pseudo-field. */ 107 /** IPv6 Extension Header pseudo-field. */
108 IPV6_EXTHDR, 108 IPV6_EXTHDR,
109 + /** Unassigned value: 40. */
110 + UNASSIGNED_40,
111 + /** PBB UCA header field. */
112 + PBB_UCA,
113 + /** TCP flags. */
114 + TCP_FLAGS,
115 + /** Output port from action set metadata. */
116 + ACTSET_OUTPUT,
117 + /** Packet type value. */
118 + PACKET_TYPE,
119 +
120 + //
121 + // NOTE: Everything below is defined elsewhere: ONOS-specific,
122 + // extensions, etc.
123 + //
109 /** Optical channel signal ID (lambda). */ 124 /** Optical channel signal ID (lambda). */
110 OCH_SIGID, 125 OCH_SIGID,
111 /** Optical channel signal type (fixed or flexible). */ 126 /** Optical channel signal type (fixed or flexible). */
......
...@@ -25,6 +25,7 @@ import org.junit.Test; ...@@ -25,6 +25,7 @@ import org.junit.Test;
25 import org.onosproject.net.PortNumber; 25 import org.onosproject.net.PortNumber;
26 import org.onosproject.net.flow.criteria.Criteria; 26 import org.onosproject.net.flow.criteria.Criteria;
27 import org.onosproject.net.flow.criteria.Criterion; 27 import org.onosproject.net.flow.criteria.Criterion;
28 +import org.onlab.packet.Ip6Address;
28 import org.onlab.packet.IpPrefix; 29 import org.onlab.packet.IpPrefix;
29 import org.onlab.packet.MacAddress; 30 import org.onlab.packet.MacAddress;
30 import org.onlab.packet.VlanId; 31 import org.onlab.packet.VlanId;
...@@ -126,22 +127,25 @@ public class DefaultTrafficSelectorTest { ...@@ -126,22 +127,25 @@ public class DefaultTrafficSelectorTest {
126 public void testCriteriaCreation() { 127 public void testCriteriaCreation() {
127 TrafficSelector selector; 128 TrafficSelector selector;
128 129
130 + final int intValue = 22;
129 final short shortValue = 33; 131 final short shortValue = 33;
130 final byte byteValue = 44; 132 final byte byteValue = 44;
133 + final MacAddress macValue = MacAddress.valueOf("11:22:33:44:55:66");
131 final IpPrefix ipPrefixValue = IpPrefix.valueOf("192.168.1.0/24"); 134 final IpPrefix ipPrefixValue = IpPrefix.valueOf("192.168.1.0/24");
132 final IpPrefix ipv6PrefixValue = IpPrefix.valueOf("fe80::1/64"); 135 final IpPrefix ipv6PrefixValue = IpPrefix.valueOf("fe80::1/64");
136 + final Ip6Address ipv6AddressValue = Ip6Address.valueOf("fe80::1");
133 137
134 selector = DefaultTrafficSelector.builder() 138 selector = DefaultTrafficSelector.builder()
135 - .matchInport(PortNumber.portNumber(11)).build(); 139 + .matchInPort(PortNumber.portNumber(11)).build();
136 assertThat(selector, hasCriterionWithType(Type.IN_PORT)); 140 assertThat(selector, hasCriterionWithType(Type.IN_PORT));
137 141
138 selector = DefaultTrafficSelector.builder() 142 selector = DefaultTrafficSelector.builder()
139 - .matchEthSrc(MacAddress.BROADCAST).build(); 143 + .matchEthDst(macValue).build();
140 - assertThat(selector, hasCriterionWithType(Type.ETH_SRC)); 144 + assertThat(selector, hasCriterionWithType(Type.ETH_DST));
141 145
142 selector = DefaultTrafficSelector.builder() 146 selector = DefaultTrafficSelector.builder()
143 - .matchEthDst(MacAddress.BROADCAST).build(); 147 + .matchEthSrc(macValue).build();
144 - assertThat(selector, hasCriterionWithType(Type.ETH_DST)); 148 + assertThat(selector, hasCriterionWithType(Type.ETH_SRC));
145 149
146 selector = DefaultTrafficSelector.builder() 150 selector = DefaultTrafficSelector.builder()
147 .matchEthType(shortValue).build(); 151 .matchEthType(shortValue).build();
...@@ -176,6 +180,30 @@ public class DefaultTrafficSelectorTest { ...@@ -176,6 +180,30 @@ public class DefaultTrafficSelectorTest {
176 assertThat(selector, hasCriterionWithType(Type.TCP_DST)); 180 assertThat(selector, hasCriterionWithType(Type.TCP_DST));
177 181
178 selector = DefaultTrafficSelector.builder() 182 selector = DefaultTrafficSelector.builder()
183 + .matchUdpSrc(shortValue).build();
184 + assertThat(selector, hasCriterionWithType(Type.UDP_SRC));
185 +
186 + selector = DefaultTrafficSelector.builder()
187 + .matchUdpDst(shortValue).build();
188 + assertThat(selector, hasCriterionWithType(Type.UDP_DST));
189 +
190 + selector = DefaultTrafficSelector.builder()
191 + .matchSctpSrc(shortValue).build();
192 + assertThat(selector, hasCriterionWithType(Type.SCTP_SRC));
193 +
194 + selector = DefaultTrafficSelector.builder()
195 + .matchSctpDst(shortValue).build();
196 + assertThat(selector, hasCriterionWithType(Type.SCTP_DST));
197 +
198 + selector = DefaultTrafficSelector.builder()
199 + .matchIcmpType(byteValue).build();
200 + assertThat(selector, hasCriterionWithType(Type.ICMPV4_TYPE));
201 +
202 + selector = DefaultTrafficSelector.builder()
203 + .matchIcmpCode(byteValue).build();
204 + assertThat(selector, hasCriterionWithType(Type.ICMPV4_CODE));
205 +
206 + selector = DefaultTrafficSelector.builder()
179 .matchIPv6Src(ipv6PrefixValue).build(); 207 .matchIPv6Src(ipv6PrefixValue).build();
180 assertThat(selector, hasCriterionWithType(Type.IPV6_SRC)); 208 assertThat(selector, hasCriterionWithType(Type.IPV6_SRC));
181 209
...@@ -184,6 +212,26 @@ public class DefaultTrafficSelectorTest { ...@@ -184,6 +212,26 @@ public class DefaultTrafficSelectorTest {
184 assertThat(selector, hasCriterionWithType(Type.IPV6_DST)); 212 assertThat(selector, hasCriterionWithType(Type.IPV6_DST));
185 213
186 selector = DefaultTrafficSelector.builder() 214 selector = DefaultTrafficSelector.builder()
215 + .matchIPv6FlowLabel(intValue).build();
216 + assertThat(selector, hasCriterionWithType(Type.IPV6_FLABEL));
217 +
218 + selector = DefaultTrafficSelector.builder()
219 + .matchIcmpv6Type(byteValue).build();
220 + assertThat(selector, hasCriterionWithType(Type.ICMPV6_TYPE));
221 +
222 + selector = DefaultTrafficSelector.builder()
223 + .matchIPv6NDTargetAddress(ipv6AddressValue).build();
224 + assertThat(selector, hasCriterionWithType(Type.IPV6_ND_TARGET));
225 +
226 + selector = DefaultTrafficSelector.builder()
227 + .matchIPv6NDSourceLinkLayerAddress(macValue).build();
228 + assertThat(selector, hasCriterionWithType(Type.IPV6_ND_SLL));
229 +
230 + selector = DefaultTrafficSelector.builder()
231 + .matchIPv6NDTargetLinkLayerAddress(macValue).build();
232 + assertThat(selector, hasCriterionWithType(Type.IPV6_ND_TLL));
233 +
234 + selector = DefaultTrafficSelector.builder()
187 .matchMplsLabel(3).build(); 235 .matchMplsLabel(3).build();
188 assertThat(selector, hasCriterionWithType(Type.MPLS_LABEL)); 236 assertThat(selector, hasCriterionWithType(Type.MPLS_LABEL));
189 237
...@@ -194,12 +242,21 @@ public class DefaultTrafficSelectorTest { ...@@ -194,12 +242,21 @@ public class DefaultTrafficSelectorTest {
194 selector = DefaultTrafficSelector.builder() 242 selector = DefaultTrafficSelector.builder()
195 .matchOpticalSignalType(shortValue).build(); 243 .matchOpticalSignalType(shortValue).build();
196 assertThat(selector, hasCriterionWithType(Type.OCH_SIGTYPE)); 244 assertThat(selector, hasCriterionWithType(Type.OCH_SIGTYPE));
245 + }
246 +
247 + /**
248 + * Tests the traffic selector builder.
249 + */
250 + @Test
251 + public void testTrafficSelectorBuilder() {
252 + TrafficSelector selector;
253 + final short shortValue = 33;
197 254
198 final TrafficSelector baseSelector = DefaultTrafficSelector.builder() 255 final TrafficSelector baseSelector = DefaultTrafficSelector.builder()
199 - .matchOpticalSignalType(shortValue).build(); 256 + .matchLambda(shortValue).build();
200 selector = DefaultTrafficSelector.builder(baseSelector) 257 selector = DefaultTrafficSelector.builder(baseSelector)
201 .build(); 258 .build();
202 - assertThat(selector, hasCriterionWithType(Type.OCH_SIGTYPE)); 259 + assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
203 260
204 final Criterion criterion = Criteria.matchLambda(shortValue); 261 final Criterion criterion = Criteria.matchLambda(shortValue);
205 selector = DefaultTrafficSelector.builder() 262 selector = DefaultTrafficSelector.builder()
......
...@@ -127,7 +127,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn ...@@ -127,7 +127,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
127 LinkResourceAllocations allocations, 127 LinkResourceAllocations allocations,
128 FlowRuleOperation operation) { 128 FlowRuleOperation operation) {
129 TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); 129 TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
130 - selectorBuilder.matchInport(intent.src().port()); 130 + selectorBuilder.matchInPort(intent.src().port());
131 131
132 List<FlowRuleBatchEntry> rules = Lists.newLinkedList(); 132 List<FlowRuleBatchEntry> rules = Lists.newLinkedList();
133 ConnectPoint prev = intent.src(); 133 ConnectPoint prev = intent.src();
...@@ -163,7 +163,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn ...@@ -163,7 +163,7 @@ public class OpticalPathIntentInstaller implements IntentInstaller<OpticalPathIn
163 rules.add(new FlowRuleBatchEntry(operation, rule)); 163 rules.add(new FlowRuleBatchEntry(operation, rule));
164 164
165 prev = link.dst(); 165 prev = link.dst();
166 - selectorBuilder.matchInport(link.dst().port()); 166 + selectorBuilder.matchInPort(link.dst().port());
167 selectorBuilder.matchOpticalSignalType(SIGNAL_TYPE); //todo 167 selectorBuilder.matchOpticalSignalType(SIGNAL_TYPE); //todo
168 selectorBuilder.matchLambda((short) la.toInt()); 168 selectorBuilder.matchLambda((short) la.toInt());
169 169
......
...@@ -92,7 +92,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> { ...@@ -92,7 +92,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
92 List<FlowRuleBatchEntry> rules = Lists.newLinkedList(); 92 List<FlowRuleBatchEntry> rules = Lists.newLinkedList();
93 // TODO Generate multiple batches 93 // TODO Generate multiple batches
94 while (links.hasNext()) { 94 while (links.hasNext()) {
95 - builder.matchInport(prev.port()); 95 + builder.matchInPort(prev.port());
96 Link link = links.next(); 96 Link link = links.next();
97 // if this is the last flow rule, apply the intent's treatments 97 // if this is the last flow rule, apply the intent's treatments
98 TrafficTreatment treatment = 98 TrafficTreatment treatment =
...@@ -124,7 +124,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> { ...@@ -124,7 +124,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
124 List<FlowRuleBatchEntry> rules = Lists.newLinkedList(); 124 List<FlowRuleBatchEntry> rules = Lists.newLinkedList();
125 // TODO Generate multiple batches 125 // TODO Generate multiple batches
126 while (links.hasNext()) { 126 while (links.hasNext()) {
127 - builder.matchInport(prev.port()); 127 + builder.matchInPort(prev.port());
128 Link link = links.next(); 128 Link link = links.next();
129 // if this is the last flow rule, apply the intent's treatments 129 // if this is the last flow rule, apply the intent's treatments
130 TrafficTreatment treatment = 130 TrafficTreatment treatment =
......
...@@ -44,11 +44,11 @@ public class CriterionCodec extends JsonCodec<Criterion> { ...@@ -44,11 +44,11 @@ public class CriterionCodec extends JsonCodec<Criterion> {
44 44
45 case IN_PORT: 45 case IN_PORT:
46 final Criteria.PortCriterion portCriterion = (Criteria.PortCriterion) criterion; 46 final Criteria.PortCriterion portCriterion = (Criteria.PortCriterion) criterion;
47 - result.put("tcpPort", portCriterion.port().toLong()); 47 + result.put("port", portCriterion.port().toLong());
48 break; 48 break;
49 49
50 - case ETH_SRC:
51 case ETH_DST: 50 case ETH_DST:
51 + case ETH_SRC:
52 final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion; 52 final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion;
53 result.put("mac", ethCriterion.mac().toString()); 53 result.put("mac", ethCriterion.mac().toString());
54 break; 54 break;
...@@ -59,18 +59,10 @@ public class CriterionCodec extends JsonCodec<Criterion> { ...@@ -59,18 +59,10 @@ public class CriterionCodec extends JsonCodec<Criterion> {
59 result.put("ethType", ethTypeCriterion.ethType()); 59 result.put("ethType", ethTypeCriterion.ethType());
60 break; 60 break;
61 61
62 - case IPV4_SRC: 62 + case VLAN_VID:
63 - case IPV6_SRC: 63 + final Criteria.VlanIdCriterion vlanIdCriterion =
64 - case IPV4_DST: 64 + (Criteria.VlanIdCriterion) criterion;
65 - case IPV6_DST: 65 + result.put("vlanId", vlanIdCriterion.vlanId().toShort());
66 - final Criteria.IPCriterion iPCriterion = (Criteria.IPCriterion) criterion;
67 - result.put("ip", iPCriterion.ip().toString());
68 - break;
69 -
70 - case IP_PROTO:
71 - final Criteria.IPProtocolCriterion iPProtocolCriterion =
72 - (Criteria.IPProtocolCriterion) criterion;
73 - result.put("protocol", iPProtocolCriterion.protocol());
74 break; 66 break;
75 67
76 case VLAN_PCP: 68 case VLAN_PCP:
...@@ -79,10 +71,18 @@ public class CriterionCodec extends JsonCodec<Criterion> { ...@@ -79,10 +71,18 @@ public class CriterionCodec extends JsonCodec<Criterion> {
79 result.put("priority", vlanPcpCriterion.priority()); 71 result.put("priority", vlanPcpCriterion.priority());
80 break; 72 break;
81 73
82 - case VLAN_VID: 74 + case IP_PROTO:
83 - final Criteria.VlanIdCriterion vlanIdCriterion = 75 + final Criteria.IPProtocolCriterion iPProtocolCriterion =
84 - (Criteria.VlanIdCriterion) criterion; 76 + (Criteria.IPProtocolCriterion) criterion;
85 - result.put("vlanId", vlanIdCriterion.vlanId().toShort()); 77 + result.put("protocol", iPProtocolCriterion.protocol());
78 + break;
79 +
80 + case IPV4_SRC:
81 + case IPV4_DST:
82 + case IPV6_SRC:
83 + case IPV6_DST:
84 + final Criteria.IPCriterion iPCriterion = (Criteria.IPCriterion) criterion;
85 + result.put("ip", iPCriterion.ip().toString());
86 break; 86 break;
87 87
88 case TCP_SRC: 88 case TCP_SRC:
...@@ -92,6 +92,67 @@ public class CriterionCodec extends JsonCodec<Criterion> { ...@@ -92,6 +92,67 @@ public class CriterionCodec extends JsonCodec<Criterion> {
92 result.put("tcpPort", tcpPortCriterion.tcpPort().byteValue()); 92 result.put("tcpPort", tcpPortCriterion.tcpPort().byteValue());
93 break; 93 break;
94 94
95 + case UDP_SRC:
96 + case UDP_DST:
97 + final Criteria.UdpPortCriterion udpPortCriterion =
98 + (Criteria.UdpPortCriterion) criterion;
99 + result.put("udpPort", udpPortCriterion.udpPort().byteValue());
100 + break;
101 +
102 + case SCTP_SRC:
103 + case SCTP_DST:
104 + final Criteria.SctpPortCriterion sctpPortCriterion =
105 + (Criteria.SctpPortCriterion) criterion;
106 + result.put("sctpPort",
107 + sctpPortCriterion.sctpPort().byteValue());
108 + break;
109 +
110 + case ICMPV4_TYPE:
111 + final Criteria.IcmpTypeCriterion icmpTypeCriterion =
112 + (Criteria.IcmpTypeCriterion) criterion;
113 + result.put("icmpType", icmpTypeCriterion.icmpType());
114 + break;
115 +
116 + case ICMPV4_CODE:
117 + final Criteria.IcmpCodeCriterion icmpCodeCriterion =
118 + (Criteria.IcmpCodeCriterion) criterion;
119 + result.put("icmpCode", icmpCodeCriterion.icmpCode());
120 + break;
121 +
122 + case IPV6_FLABEL:
123 + final Criteria.IPv6FlowLabelCriterion ipv6FlowLabelCriterion =
124 + (Criteria.IPv6FlowLabelCriterion) criterion;
125 + result.put("flowLabel",
126 + ipv6FlowLabelCriterion.flowLabel());
127 + break;
128 +
129 + case ICMPV6_TYPE:
130 + final Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion =
131 + (Criteria.Icmpv6TypeCriterion) criterion;
132 + result.put("icmpv6Type", icmpv6TypeCriterion.icmpv6Type());
133 + break;
134 +
135 + case ICMPV6_CODE:
136 + final Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion =
137 + (Criteria.Icmpv6CodeCriterion) criterion;
138 + result.put("icmpv6Code", icmpv6CodeCriterion.icmpv6Code());
139 + break;
140 +
141 + case IPV6_ND_TARGET:
142 + final Criteria.IPv6NDTargetAddressCriterion ipv6NDTargetAddressCriterion
143 + = (Criteria.IPv6NDTargetAddressCriterion) criterion;
144 + result.put("targetAddress",
145 + ipv6NDTargetAddressCriterion.targetAddress().toString());
146 + break;
147 +
148 + case IPV6_ND_SLL:
149 + case IPV6_ND_TLL:
150 + final Criteria.IPv6NDLinkLayerAddressCriterion ipv6NDLinkLayerAddressCriterion
151 + = (Criteria.IPv6NDLinkLayerAddressCriterion) criterion;
152 + result.put("mac",
153 + ipv6NDLinkLayerAddressCriterion.mac().toString());
154 + break;
155 +
95 case MPLS_LABEL: 156 case MPLS_LABEL:
96 final Criteria.MplsCriterion mplsCriterion = 157 final Criteria.MplsCriterion mplsCriterion =
97 (Criteria.MplsCriterion) criterion; 158 (Criteria.MplsCriterion) criterion;
......
...@@ -33,6 +33,7 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -33,6 +33,7 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
33 criterion = criterionValue; 33 criterion = criterionValue;
34 } 34 }
35 35
36 + // CHECKSTYLE IGNORE MethodLength FOR NEXT 300 LINES
36 @Override 37 @Override
37 public boolean matchesSafely(JsonNode jsonCriterion, Description description) { 38 public boolean matchesSafely(JsonNode jsonCriterion, Description description) {
38 final String type = criterion.type().name(); 39 final String type = criterion.type().name();
...@@ -54,8 +55,8 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -54,8 +55,8 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
54 } 55 }
55 break; 56 break;
56 57
57 - case ETH_SRC:
58 case ETH_DST: 58 case ETH_DST:
59 + case ETH_SRC:
59 final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion; 60 final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion;
60 final String mac = ethCriterion.mac().toString(); 61 final String mac = ethCriterion.mac().toString();
61 final String jsonMac = jsonCriterion.get("mac").textValue(); 62 final String jsonMac = jsonCriterion.get("mac").textValue();
...@@ -76,15 +77,24 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -76,15 +77,24 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
76 } 77 }
77 break; 78 break;
78 79
79 - case IPV4_SRC: 80 + case VLAN_VID:
80 - case IPV6_SRC: 81 + final Criteria.VlanIdCriterion vlanIdCriterion =
81 - case IPV4_DST: 82 + (Criteria.VlanIdCriterion) criterion;
82 - case IPV6_DST: 83 + final short vlanId = vlanIdCriterion.vlanId().toShort();
83 - final Criteria.IPCriterion ipCriterion = (Criteria.IPCriterion) criterion; 84 + final short jsonVlanId = jsonCriterion.get("vlanId").shortValue();
84 - final String ip = ipCriterion.ip().toString(); 85 + if (vlanId != jsonVlanId) {
85 - final String jsonIp = jsonCriterion.get("ip").textValue(); 86 + description.appendText("vlanId was " + Short.toString(jsonVlanId));
86 - if (!ip.equals(jsonIp)) { 87 + return false;
87 - description.appendText("ip was " + jsonIp); 88 + }
89 + break;
90 +
91 + case VLAN_PCP:
92 + final Criteria.VlanPcpCriterion vlanPcpCriterion =
93 + (Criteria.VlanPcpCriterion) criterion;
94 + final byte priority = vlanPcpCriterion.priority();
95 + final byte jsonPriority = (byte) jsonCriterion.get("priority").shortValue();
96 + if (priority != jsonPriority) {
97 + description.appendText("priority was " + Byte.toString(jsonPriority));
88 return false; 98 return false;
89 } 99 }
90 break; 100 break;
...@@ -100,24 +110,15 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -100,24 +110,15 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
100 } 110 }
101 break; 111 break;
102 112
103 - case VLAN_PCP: 113 + case IPV4_SRC:
104 - final Criteria.VlanPcpCriterion vlanPcpCriterion = 114 + case IPV4_DST:
105 - (Criteria.VlanPcpCriterion) criterion; 115 + case IPV6_SRC:
106 - final byte priority = vlanPcpCriterion.priority(); 116 + case IPV6_DST:
107 - final byte jsonPriority = (byte) jsonCriterion.get("protocol").shortValue(); 117 + final Criteria.IPCriterion ipCriterion = (Criteria.IPCriterion) criterion;
108 - if (priority != jsonPriority) { 118 + final String ip = ipCriterion.ip().toString();
109 - description.appendText("priority was " + Byte.toString(jsonPriority)); 119 + final String jsonIp = jsonCriterion.get("ip").textValue();
110 - return false; 120 + if (!ip.equals(jsonIp)) {
111 - } 121 + description.appendText("ip was " + jsonIp);
112 - break;
113 -
114 - case VLAN_VID:
115 - final Criteria.VlanIdCriterion vlanIdCriterion =
116 - (Criteria.VlanIdCriterion) criterion;
117 - final short vlanId = vlanIdCriterion.vlanId().toShort();
118 - final short jsonvlanId = jsonCriterion.get("vlanId").shortValue();
119 - if (vlanId != jsonvlanId) {
120 - description.appendText("vlanId was " + Short.toString(jsonvlanId));
121 return false; 122 return false;
122 } 123 }
123 break; 124 break;
...@@ -126,10 +127,119 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -126,10 +127,119 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
126 case TCP_DST: 127 case TCP_DST:
127 final Criteria.TcpPortCriterion tcpPortCriterion = 128 final Criteria.TcpPortCriterion tcpPortCriterion =
128 (Criteria.TcpPortCriterion) criterion; 129 (Criteria.TcpPortCriterion) criterion;
129 - final byte tcpPort = tcpPortCriterion.tcpPort().byteValue(); 130 + final short tcpPort = tcpPortCriterion.tcpPort();
130 - final byte jsonTcpPort = (byte) jsonCriterion.get("tcpPort").shortValue(); 131 + final short jsonTcpPort = jsonCriterion.get("tcpPort").shortValue();
131 if (tcpPort != jsonTcpPort) { 132 if (tcpPort != jsonTcpPort) {
132 - description.appendText("tcp port was " + Byte.toString(jsonTcpPort)); 133 + description.appendText("tcp port was " + Short.toString(jsonTcpPort));
134 + return false;
135 + }
136 + break;
137 +
138 + case UDP_SRC:
139 + case UDP_DST:
140 + final Criteria.UdpPortCriterion udpPortCriterion =
141 + (Criteria.UdpPortCriterion) criterion;
142 + final short udpPort = udpPortCriterion.udpPort();
143 + final short jsonUdpPort = jsonCriterion.get("udpPort").shortValue();
144 + if (udpPort != jsonUdpPort) {
145 + description.appendText("udp port was " + Short.toString(jsonUdpPort));
146 + return false;
147 + }
148 + break;
149 +
150 + case SCTP_SRC:
151 + case SCTP_DST:
152 + final Criteria.SctpPortCriterion sctpPortCriterion =
153 + (Criteria.SctpPortCriterion) criterion;
154 + final short sctpPort = sctpPortCriterion.sctpPort();
155 + final short jsonSctpPort = jsonCriterion.get("sctpPort").shortValue();
156 + if (sctpPort != jsonSctpPort) {
157 + description.appendText("sctp port was " + Short.toString(jsonSctpPort));
158 + return false;
159 + }
160 + break;
161 +
162 + case ICMPV4_TYPE:
163 + final Criteria.IcmpTypeCriterion icmpTypeCriterion =
164 + (Criteria.IcmpTypeCriterion) criterion;
165 + final byte icmpType = icmpTypeCriterion.icmpType();
166 + final byte jsonIcmpType = (byte) jsonCriterion.get("icmpType").shortValue();
167 + if (icmpType != jsonIcmpType) {
168 + description.appendText("icmp type was " + Byte.toString(jsonIcmpType));
169 + return false;
170 + }
171 + break;
172 +
173 + case ICMPV4_CODE:
174 + final Criteria.IcmpCodeCriterion icmpCodeCriterion =
175 + (Criteria.IcmpCodeCriterion) criterion;
176 + final byte icmpCode = icmpCodeCriterion.icmpCode();
177 + final byte jsonIcmpCode = (byte) jsonCriterion.get("icmpCode").shortValue();
178 + if (icmpCode != jsonIcmpCode) {
179 + description.appendText("icmp code was " + Byte.toString(jsonIcmpCode));
180 + return false;
181 + }
182 + break;
183 +
184 + case IPV6_FLABEL:
185 + final Criteria.IPv6FlowLabelCriterion ipv6FlowLabelCriterion =
186 + (Criteria.IPv6FlowLabelCriterion) criterion;
187 + final int flowLabel = ipv6FlowLabelCriterion.flowLabel();
188 + final int jsonFlowLabel = jsonCriterion.get("flowLabel").intValue();
189 + if (flowLabel != jsonFlowLabel) {
190 + description.appendText("IPv6 flow label was " + Integer.toString(jsonFlowLabel));
191 + return false;
192 + }
193 + break;
194 +
195 + case ICMPV6_TYPE:
196 + final Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion =
197 + (Criteria.Icmpv6TypeCriterion) criterion;
198 + final byte icmpv6Type = icmpv6TypeCriterion.icmpv6Type();
199 + final byte jsonIcmpv6Type = (byte) jsonCriterion.get("icmpv6Type").shortValue();
200 + if (icmpv6Type != jsonIcmpv6Type) {
201 + description.appendText("icmpv6 type was " + Byte.toString(jsonIcmpv6Type));
202 + return false;
203 + }
204 + break;
205 +
206 + case ICMPV6_CODE:
207 + final Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion =
208 + (Criteria.Icmpv6CodeCriterion) criterion;
209 + final byte icmpv6Code = icmpv6CodeCriterion.icmpv6Code();
210 + final byte jsonIcmpv6Code = (byte) jsonCriterion.get("icmpv6Code").shortValue();
211 + if (icmpv6Code != jsonIcmpv6Code) {
212 + description.appendText("icmpv6 code was " + Byte.toString(jsonIcmpv6Code));
213 + return false;
214 + }
215 + break;
216 +
217 + case IPV6_ND_TARGET:
218 + final Criteria.IPv6NDTargetAddressCriterion
219 + ipv6NDTargetAddressCriterion =
220 + (Criteria.IPv6NDTargetAddressCriterion) criterion;
221 + final String targetAddress =
222 + ipv6NDTargetAddressCriterion.targetAddress().toString();
223 + final String jsonTargetAddress =
224 + jsonCriterion.get("targetAddress").textValue();
225 + if (!targetAddress.equals(jsonTargetAddress)) {
226 + description.appendText("target address was " +
227 + jsonTargetAddress);
228 + return false;
229 + }
230 + break;
231 +
232 + case IPV6_ND_SLL:
233 + case IPV6_ND_TLL:
234 + final Criteria.IPv6NDLinkLayerAddressCriterion
235 + ipv6NDLinkLayerAddressCriterion =
236 + (Criteria.IPv6NDLinkLayerAddressCriterion) criterion;
237 + final String llAddress =
238 + ipv6NDLinkLayerAddressCriterion.mac().toString();
239 + final String jsonLlAddress =
240 + jsonCriterion.get("mac").textValue();
241 + if (!llAddress.equals(jsonLlAddress)) {
242 + description.appendText("mac was " + jsonLlAddress);
133 return false; 243 return false;
134 } 244 }
135 break; 245 break;
......