[ONOS-5097]adding group table entry failed
Change-Id: I17fc9f156e1f10800caba2cbc180dac45e97a675
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/ExtensionInstructionSerializer.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/ExtensionInstructionSerializer.java
index ef55977..daf6910 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/ExtensionInstructionSerializer.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/ExtensionInstructionSerializer.java
@@ -21,6 +21,7 @@
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import org.onlab.osgi.DefaultServiceDirectory;
+import org.onlab.util.ItemNotFoundException;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
import org.onosproject.net.driver.DefaultDriverData;
@@ -30,6 +31,7 @@
import org.onosproject.net.flow.instructions.ExtensionTreatment;
import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.flow.instructions.UnresolvedExtensionTreatment;
/**
* Serializer for extension instructions.
@@ -56,17 +58,19 @@
Class<Instructions.ExtensionInstructionWrapper> type) {
ExtensionTreatmentType exType = (ExtensionTreatmentType) kryo.readClassAndObject(input);
DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);
-
DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
- DriverHandler handler = new DefaultDriverHandler(
- new DefaultDriverData(driverService.getDriver(deviceId), deviceId));
-
- ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
- ExtensionTreatment instruction = resolver.getExtensionInstruction(exType);
-
byte[] bytes = (byte[]) kryo.readClassAndObject(input);
+ ExtensionTreatment instruction;
- instruction.deserialize(bytes);
+ try {
+ DriverHandler handler = new DefaultDriverHandler(
+ new DefaultDriverData(driverService.getDriver(deviceId), deviceId));
+ ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
+ instruction = resolver.getExtensionInstruction(exType);
+ instruction.deserialize(bytes);
+ } catch (ItemNotFoundException | IllegalArgumentException e) {
+ instruction = new UnresolvedExtensionTreatment(bytes, exType);
+ }
return Instructions.extension(instruction, deviceId);
}