3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.protocol_plugin.openflow.internal;
12 import org.openflow.protocol.OFError;
13 import org.openflow.protocol.OFError.OFBadActionCode;
14 import org.openflow.protocol.OFError.OFBadRequestCode;
15 import org.openflow.protocol.OFError.OFErrorType;
16 import org.openflow.protocol.OFError.OFFlowModFailedCode;
17 import org.openflow.protocol.OFError.OFHelloFailedCode;
18 import org.openflow.protocol.OFError.OFPortModFailedCode;
19 import org.openflow.protocol.OFError.OFQueueOpFailedCode;
21 public abstract class Utils {
22 public static String getOFErrorString(OFError error) {
23 OFErrorType et = OFErrorType.values()[0xffff & error.getErrorType()];
24 String errorStr = "Error : " + et.toString();
26 case OFPET_HELLO_FAILED:
27 OFHelloFailedCode hfc = OFHelloFailedCode.values()[0xffff & error
29 errorStr += " " + hfc.toString();
31 case OFPET_BAD_REQUEST:
32 OFBadRequestCode brc = OFBadRequestCode.values()[0xffff & error
34 errorStr += " " + brc.toString();
36 case OFPET_BAD_ACTION:
37 OFBadActionCode bac = OFBadActionCode.values()[0xffff & error
39 errorStr += " " + bac.toString();
41 case OFPET_FLOW_MOD_FAILED:
42 OFFlowModFailedCode fmfc = OFFlowModFailedCode.values()[0xffff & error
44 errorStr += " " + fmfc.toString();
46 case OFPET_PORT_MOD_FAILED:
47 OFPortModFailedCode pmfc = OFPortModFailedCode.values()[0xffff & error
49 errorStr += " " + pmfc.toString();
51 case OFPET_QUEUE_OP_FAILED:
52 OFQueueOpFailedCode qofc = OFQueueOpFailedCode.values()[0xffff & error
54 errorStr += " " + qofc.toString();