Sho SHIMIZU
Committed by Ray Milkey

Fix ONOS-815: register Optional class to Kryo

Change-Id: Iab40b3c02b54634452006bbaae18e450d91de347
......@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Optional;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.cluster.DefaultControllerNode;
......@@ -156,6 +157,7 @@ public final class KryoNamespaces {
.register(Collections.singletonList(1).getClass())
.register(Duration.class)
.register(Collections.emptySet().getClass())
.register(Optional.class)
.build();
/**
......
......@@ -42,7 +42,12 @@ import org.onosproject.net.Link.Type;
import org.onosproject.net.LinkKey;
import org.onosproject.net.PortNumber;
import org.onosproject.net.SparseAnnotations;
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.FlowId;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleBatchEntry;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.net.resource.Bandwidth;
......@@ -198,6 +203,22 @@ public class KryoSerializerTest {
}
@Test
public void testFlowRuleBatchEntry() {
final FlowRule rule1 =
new DefaultFlowRule(DID1, DefaultTrafficSelector.builder().build(),
DefaultTrafficTreatment.builder().build(), 0, 0, 0, true);
final FlowRule rule2 =
new DefaultFlowRule(DID1, DefaultTrafficSelector.builder().build(),
DefaultTrafficTreatment.builder().build(), 0, 0, 0, true);
final FlowRuleBatchEntry entry1 =
new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule1);
final FlowRuleBatchEntry entry2 =
new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule2);
testSerializedEquals(ImmutableList.of(entry1, entry2));
}
@Test
public void testIpPrefix() {
testSerializedEquals(IpPrefix.valueOf("192.168.0.1/24"));
}
......