When ports are added to a container, construct its topology immediately based on...
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / internal / Utils.java
index 77a39e904ad16505a9ac573879236fd6c4c51dd9..8d2ca8704a6b46aee8a6f05771d4392445777241 100644 (file)
@@ -9,6 +9,9 @@
 
 package org.opendaylight.controller.protocol_plugin.openflow.internal;
 
+import java.nio.ByteBuffer;
+
+import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6Error;
 import org.openflow.protocol.OFError;
 import org.openflow.protocol.OFError.OFBadActionCode;
 import org.openflow.protocol.OFError.OFBadRequestCode;
@@ -18,8 +21,24 @@ import org.openflow.protocol.OFError.OFHelloFailedCode;
 import org.openflow.protocol.OFError.OFPortModFailedCode;
 import org.openflow.protocol.OFError.OFQueueOpFailedCode;
 
-public abstract class Utils {
-    public static String getOFErrorString(OFError error) {
+public final class Utils {
+
+    private Utils() { //prevent instantiation
+        throw new AssertionError();
+    }
+    static String getOFErrorString(OFError error) {
+        // Handle VENDOR extension errors here
+        if (error.getErrorType() == V6Error.NICIRA_VENDOR_ERRORTYPE) {
+            V6Error er = new V6Error(error);
+            byte[] b = error.getError();
+            ByteBuffer bb = ByteBuffer.allocate(b.length);
+            bb.put(b);
+            bb.rewind();
+            er.readFrom(bb);
+            return er.toString();
+        }
+
+        // Handle OF1.0 errors here
         OFErrorType et = OFErrorType.values()[0xffff & error.getErrorType()];
         String errorStr = "Error : " + et.toString();
         switch (et) {