Committed by
Ray Milkey
Fix ONOS-815: register Optional class to Kryo
Change-Id: Iab40b3c02b54634452006bbaae18e450d91de347
Showing
2 changed files
with
23 additions
and
0 deletions
... | @@ -23,6 +23,7 @@ import java.util.Collections; | ... | @@ -23,6 +23,7 @@ import java.util.Collections; |
23 | import java.util.HashMap; | 23 | import java.util.HashMap; |
24 | import java.util.HashSet; | 24 | import java.util.HashSet; |
25 | import java.util.LinkedList; | 25 | import java.util.LinkedList; |
26 | +import java.util.Optional; | ||
26 | 27 | ||
27 | import org.onosproject.cluster.ControllerNode; | 28 | import org.onosproject.cluster.ControllerNode; |
28 | import org.onosproject.cluster.DefaultControllerNode; | 29 | import org.onosproject.cluster.DefaultControllerNode; |
... | @@ -156,6 +157,7 @@ public final class KryoNamespaces { | ... | @@ -156,6 +157,7 @@ public final class KryoNamespaces { |
156 | .register(Collections.singletonList(1).getClass()) | 157 | .register(Collections.singletonList(1).getClass()) |
157 | .register(Duration.class) | 158 | .register(Duration.class) |
158 | .register(Collections.emptySet().getClass()) | 159 | .register(Collections.emptySet().getClass()) |
160 | + .register(Optional.class) | ||
159 | .build(); | 161 | .build(); |
160 | 162 | ||
161 | /** | 163 | /** | ... | ... |
... | @@ -42,7 +42,12 @@ import org.onosproject.net.Link.Type; | ... | @@ -42,7 +42,12 @@ import org.onosproject.net.Link.Type; |
42 | import org.onosproject.net.LinkKey; | 42 | import org.onosproject.net.LinkKey; |
43 | import org.onosproject.net.PortNumber; | 43 | import org.onosproject.net.PortNumber; |
44 | import org.onosproject.net.SparseAnnotations; | 44 | import org.onosproject.net.SparseAnnotations; |
45 | +import org.onosproject.net.flow.DefaultFlowRule; | ||
46 | +import org.onosproject.net.flow.DefaultTrafficSelector; | ||
47 | +import org.onosproject.net.flow.DefaultTrafficTreatment; | ||
45 | import org.onosproject.net.flow.FlowId; | 48 | import org.onosproject.net.flow.FlowId; |
49 | +import org.onosproject.net.flow.FlowRule; | ||
50 | +import org.onosproject.net.flow.FlowRuleBatchEntry; | ||
46 | import org.onosproject.net.intent.IntentId; | 51 | import org.onosproject.net.intent.IntentId; |
47 | import org.onosproject.net.provider.ProviderId; | 52 | import org.onosproject.net.provider.ProviderId; |
48 | import org.onosproject.net.resource.Bandwidth; | 53 | import org.onosproject.net.resource.Bandwidth; |
... | @@ -198,6 +203,22 @@ public class KryoSerializerTest { | ... | @@ -198,6 +203,22 @@ public class KryoSerializerTest { |
198 | } | 203 | } |
199 | 204 | ||
200 | @Test | 205 | @Test |
206 | + public void testFlowRuleBatchEntry() { | ||
207 | + final FlowRule rule1 = | ||
208 | + new DefaultFlowRule(DID1, DefaultTrafficSelector.builder().build(), | ||
209 | + DefaultTrafficTreatment.builder().build(), 0, 0, 0, true); | ||
210 | + final FlowRule rule2 = | ||
211 | + new DefaultFlowRule(DID1, DefaultTrafficSelector.builder().build(), | ||
212 | + DefaultTrafficTreatment.builder().build(), 0, 0, 0, true); | ||
213 | + final FlowRuleBatchEntry entry1 = | ||
214 | + new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule1); | ||
215 | + final FlowRuleBatchEntry entry2 = | ||
216 | + new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule2); | ||
217 | + | ||
218 | + testSerializedEquals(ImmutableList.of(entry1, entry2)); | ||
219 | + } | ||
220 | + | ||
221 | + @Test | ||
201 | public void testIpPrefix() { | 222 | public void testIpPrefix() { |
202 | testSerializedEquals(IpPrefix.valueOf("192.168.0.1/24")); | 223 | testSerializedEquals(IpPrefix.valueOf("192.168.0.1/24")); |
203 | } | 224 | } | ... | ... |
-
Please register or login to post a comment