Bug 5540 - PortConvertor, MatchConvertor
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / OFRpcTaskFactory.java
index 442b51c3f4216475382e35fb5d380cd013bec141..ef7741a89c2c4e1c0681db516da3dfd87bbb88c5 100644 (file)
@@ -2088,14 +2088,16 @@ public abstract class OFRpcTaskFactory {
             @Override
             public ListenableFuture<RpcResult<UpdatePortOutput>> call() {
                 ListenableFuture<RpcResult<UpdatePortOutput>> result = SettableFuture.create();
-                final Long xid = taskContext.getSession().getNextXid();
-                Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
+                final short version = taskContext.getSession().getPrimaryConductor().getVersion();
+                final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
 
-                PortModInput ofPortModInput = PortConvertor.toPortModInput(inputPort,
-                        taskContext.getSession().getPrimaryConductor().getVersion());
+                final java.util.Optional<PortModInput> ofPortModInput = ConvertorManager
+                        .getInstance()
+                        .convert(inputPort, new VersionConvertorData(version));
 
-                PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput);
-                mdInput.setXid(xid);
+                PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput
+                        .orElse(PortConvertor.defaultResult(version)))
+                        .setXid(taskContext.getSession().getNextXid());
 
                 Future<RpcResult<UpdatePortOutput>> resultFromOFLib = getMessageService()
                         .portMod(mdInput.build(), cookie);