Java 类org.projectfloodlight.openflow.protocol.OFBadRequestCode 实例源码

项目:athena    文件:OFChannelHandler.java   
@Override
void processOFError(OFChannelHandler h, OFErrorMsg m)
        throws IOException, SwitchStateException {
    // if we get here, then the error message is for something else
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() ==
            OFBadRequestCode.EPERM) {
        // We are the master controller and the switch returned
        // a permission error. This is a likely indicator that
        // the switch thinks we are slave. Reassert our
        // role
        // FIXME: this could be really bad during role transitions
        // if two controllers are master (even if its only for
        // a brief period). We might need to see if these errors
        // persist before we reassert

        h.sw.reassertRole();
    } else if (m.getErrType() == OFErrorType.FLOW_MOD_FAILED &&
            ((OFFlowModFailedErrorMsg) m).getCode() ==
            OFFlowModFailedCode.ALL_TABLES_FULL) {
        h.sw.setTableFull(true);
    } else {
        logError(h, m);
    }
    h.dispatchMessage(m);
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:fresco_floodlight    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:iTAP-controller    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:SDN-Multicast    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:arscheduler    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:arscheduler    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:floodlight1.2-delay    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     *
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:floodlight-hardware    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:ACAMPController    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:ACAMPController    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:fast-failover-demo    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:fast-failover-demo    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:ravikumaran201504    文件:OFChannelHandler.java   
@Override
void processOFError(OFChannelHandler h, OFErrorMsg m)
        throws IOException, SwitchStateException {
    // if we get here, then the error message is for something else
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() ==
            OFBadRequestCode.EPERM) {
        // We are the master controller and the switch returned
        // a permission error. This is a likely indicator that
        // the switch thinks we are slave. Reassert our
        // role
        // FIXME: this could be really bad during role transitions
        // if two controllers are master (even if its only for
        // a brief period). We might need to see if these errors
        // persist before we reassert

        h.sw.reassertRole();
    } else if (m.getErrType() == OFErrorType.FLOW_MOD_FAILED &&
            ((OFFlowModFailedErrorMsg) m).getCode() ==
            OFFlowModFailedCode.ALL_TABLES_FULL) {
        h.sw.setTableFull(true);
    } else {
        logError(h, m);
    }
    h.dispatchMessage(m);
}
项目:floodlightLB    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:floodlightLB    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:DSC    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    /*
     * HP ProCurve switches do not support
     * the ofpt_barrier_request message.
     * 
     * Look for an error from a bad ofpt_barrier_request,
     * log a warning, but proceed.
     */
    if (m.getErrType() == OFErrorType.BAD_REQUEST &&
            ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE &&
            ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) {
        log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve.");
    } else {
        logErrorDisconnect(m);
    }
}
项目:DSC    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:floodlight    文件:OFSwitchHandlerTestBase.java   
/**
 * Test re-assert MASTER
 *
 */
@Test
public void testReassertMaster() throws Exception {
    testInitialMoveToMasterWithRole();

    OFMessage err = getBadRequestErrorMessage(OFBadRequestCode.EPERM, 42);

    reset(roleManager);
    roleManager.reassertRole(switchHandler, HARole.ACTIVE);
    expectLastCall().once();
    replay(roleManager);

    reset(switchManager);
    switchManager.handleMessage(sw, err, null);
    expectLastCall().once();
    replay(switchManager);

    switchHandler.processOFMessage(err);

    verify(sw);
}
项目:openflowj-otn    文件:OFBadRequestCodeSerializerVer10.java   
public static OFBadRequestCode ofWireValue(short val) {
    switch(val) {
        case BAD_VERSION_VAL:
            return OFBadRequestCode.BAD_VERSION;
        case BAD_TYPE_VAL:
            return OFBadRequestCode.BAD_TYPE;
        case BAD_STAT_VAL:
            return OFBadRequestCode.BAD_STAT;
        case BAD_EXPERIMENTER_VAL:
            return OFBadRequestCode.BAD_EXPERIMENTER;
        case BAD_SUBTYPE_VAL:
            return OFBadRequestCode.BAD_SUBTYPE;
        case EPERM_VAL:
            return OFBadRequestCode.EPERM;
        case BAD_LEN_VAL:
            return OFBadRequestCode.BAD_LEN;
        case BUFFER_EMPTY_VAL:
            return OFBadRequestCode.BUFFER_EMPTY;
        case BUFFER_UNKNOWN_VAL:
            return OFBadRequestCode.BUFFER_UNKNOWN;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.0: " + val);
    }
}
项目:openflowj-otn    文件:OFBadRequestCodeSerializerVer10.java   
public static short toWireValue(OFBadRequestCode e) {
    switch(e) {
        case BAD_VERSION:
            return BAD_VERSION_VAL;
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_STAT:
            return BAD_STAT_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_SUBTYPE:
            return BAD_SUBTYPE_VAL;
        case EPERM:
            return EPERM_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BUFFER_EMPTY:
            return BUFFER_EMPTY_VAL;
        case BUFFER_UNKNOWN:
            return BUFFER_UNKNOWN_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.0: " + e);
    }
}
项目:openflowj-otn    文件:OFBadRequestCodeSerializerVer11.java   
public static OFBadRequestCode ofWireValue(short val) {
    switch(val) {
        case BAD_VERSION_VAL:
            return OFBadRequestCode.BAD_VERSION;
        case BAD_TYPE_VAL:
            return OFBadRequestCode.BAD_TYPE;
        case BAD_STAT_VAL:
            return OFBadRequestCode.BAD_STAT;
        case BAD_EXPERIMENTER_VAL:
            return OFBadRequestCode.BAD_EXPERIMENTER;
        case BAD_SUBTYPE_VAL:
            return OFBadRequestCode.BAD_SUBTYPE;
        case EPERM_VAL:
            return OFBadRequestCode.EPERM;
        case BAD_LEN_VAL:
            return OFBadRequestCode.BAD_LEN;
        case BUFFER_EMPTY_VAL:
            return OFBadRequestCode.BUFFER_EMPTY;
        case BUFFER_UNKNOWN_VAL:
            return OFBadRequestCode.BUFFER_UNKNOWN;
        case BAD_TABLE_ID_VAL:
            return OFBadRequestCode.BAD_TABLE_ID;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.1: " + val);
    }
}
项目:openflowj-otn    文件:OFBadRequestCodeSerializerVer11.java   
public static short toWireValue(OFBadRequestCode e) {
    switch(e) {
        case BAD_VERSION:
            return BAD_VERSION_VAL;
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_STAT:
            return BAD_STAT_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_SUBTYPE:
            return BAD_SUBTYPE_VAL;
        case EPERM:
            return EPERM_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BUFFER_EMPTY:
            return BUFFER_EMPTY_VAL;
        case BUFFER_UNKNOWN:
            return BUFFER_UNKNOWN_VAL;
        case BAD_TABLE_ID:
            return BAD_TABLE_ID_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.1: " + e);
    }
}
项目:onos    文件:OFChannelHandler.java   
@Override
void processOFError(OFChannelHandler h, OFErrorMsg m) {
    if (m.getErrType() == OFErrorType.BAD_REQUEST) {
        OFBadRequestErrorMsg badRequest = (OFBadRequestErrorMsg) m;
        if (badRequest.getCode() == OFBadRequestCode.BAD_TYPE) {
             log.debug("{} does not support GetConfig, moving on", h.getSwitchInfoString());
             try {
                nextState(h);
                return;
            } catch (IOException e) {
                log.error("Exception thrown transitioning to next", e);
                logErrorDisconnect(h, m);
            }
        }
    }
    logErrorDisconnect(h, m);
}
项目:loxigen-artifacts    文件:OFBadRequestCodeSerializerVer10.java   
public static OFBadRequestCode ofWireValue(short val) {
    switch(val) {
        case BAD_VERSION_VAL:
            return OFBadRequestCode.BAD_VERSION;
        case BAD_TYPE_VAL:
            return OFBadRequestCode.BAD_TYPE;
        case BAD_STAT_VAL:
            return OFBadRequestCode.BAD_STAT;
        case BAD_EXPERIMENTER_VAL:
            return OFBadRequestCode.BAD_EXPERIMENTER;
        case BAD_SUBTYPE_VAL:
            return OFBadRequestCode.BAD_SUBTYPE;
        case EPERM_VAL:
            return OFBadRequestCode.EPERM;
        case BAD_LEN_VAL:
            return OFBadRequestCode.BAD_LEN;
        case BUFFER_EMPTY_VAL:
            return OFBadRequestCode.BUFFER_EMPTY;
        case BUFFER_UNKNOWN_VAL:
            return OFBadRequestCode.BUFFER_UNKNOWN;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.0: " + val);
    }
}
项目:loxigen-artifacts    文件:OFBadRequestCodeSerializerVer10.java   
public static short toWireValue(OFBadRequestCode e) {
    switch(e) {
        case BAD_VERSION:
            return BAD_VERSION_VAL;
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_STAT:
            return BAD_STAT_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_SUBTYPE:
            return BAD_SUBTYPE_VAL;
        case EPERM:
            return EPERM_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BUFFER_EMPTY:
            return BUFFER_EMPTY_VAL;
        case BUFFER_UNKNOWN:
            return BUFFER_UNKNOWN_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.0: " + e);
    }
}
项目:loxigen-artifacts    文件:OFBadRequestCodeSerializerVer11.java   
public static OFBadRequestCode ofWireValue(short val) {
    switch(val) {
        case BAD_VERSION_VAL:
            return OFBadRequestCode.BAD_VERSION;
        case BAD_TYPE_VAL:
            return OFBadRequestCode.BAD_TYPE;
        case BAD_STAT_VAL:
            return OFBadRequestCode.BAD_STAT;
        case BAD_EXPERIMENTER_VAL:
            return OFBadRequestCode.BAD_EXPERIMENTER;
        case BAD_SUBTYPE_VAL:
            return OFBadRequestCode.BAD_SUBTYPE;
        case EPERM_VAL:
            return OFBadRequestCode.EPERM;
        case BAD_LEN_VAL:
            return OFBadRequestCode.BAD_LEN;
        case BUFFER_EMPTY_VAL:
            return OFBadRequestCode.BUFFER_EMPTY;
        case BUFFER_UNKNOWN_VAL:
            return OFBadRequestCode.BUFFER_UNKNOWN;
        case BAD_TABLE_ID_VAL:
            return OFBadRequestCode.BAD_TABLE_ID;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFBadRequestCode in version 1.1: " + val);
    }
}
项目:loxigen-artifacts    文件:OFBadRequestCodeSerializerVer11.java   
public static short toWireValue(OFBadRequestCode e) {
    switch(e) {
        case BAD_VERSION:
            return BAD_VERSION_VAL;
        case BAD_TYPE:
            return BAD_TYPE_VAL;
        case BAD_STAT:
            return BAD_STAT_VAL;
        case BAD_EXPERIMENTER:
            return BAD_EXPERIMENTER_VAL;
        case BAD_SUBTYPE:
            return BAD_SUBTYPE_VAL;
        case EPERM:
            return EPERM_VAL;
        case BAD_LEN:
            return BAD_LEN_VAL;
        case BUFFER_EMPTY:
            return BUFFER_EMPTY_VAL;
        case BUFFER_UNKNOWN:
            return BUFFER_UNKNOWN_VAL;
        case BAD_TABLE_ID:
            return BAD_TABLE_ID_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFBadRequestCode in version 1.1: " + e);
    }
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    if ((m.getErrType() == OFErrorType.BAD_REQUEST) &&
            ((((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.MULTIPART_BUFFER_OVERFLOW)
                    || ((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.BAD_STAT)) { 
        log.warn("Switch {} is {} but does not support OFTableFeaturesStats. Assuming all tables can perform any match, action, and instruction in the spec.", 
                sw.getId().toString(), sw.getOFFactory().getVersion().toString());
    } else {
        log.error("Received unexpected OFErrorMsg {} on switch {}.", m.toString(), sw.getId().toString());
    }
    nextState();

}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    // role changer will ignore the error if it isn't for it
    boolean didHandle = roleChanger.deliverError(m);
    if (didHandle)
        return;
    if ((m.getErrType() == OFErrorType.BAD_REQUEST) &&
            (((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.EPERM)) {
        // We are the master controller and the switch returned
        // a permission error. This is a likely indicator that
        // the switch thinks we are slave. Reassert our
        // role
        // FIXME: this could be really bad during role transitions
        // if two controllers are master (even if its only for
        // a brief period). We might need to see if these errors
        // persist before we reassert
        switchManagerCounters.epermErrorWhileSwitchIsMaster.increment();
        log.warn("Received permission error from switch {} while" +
                "being master. Reasserting master role.",
                getSwitchInfoString());
        reassertRole(OFControllerRole.ROLE_MASTER);
    }
    else if ((m.getErrType() == OFErrorType.FLOW_MOD_FAILED) &&
            (((OFFlowModFailedErrorMsg)m).getCode() == OFFlowModFailedCode.ALL_TABLES_FULL)) {
        sw.setTableFull(true);
    }
    else {
        logError(m);
    }
    dispatchMessage(m);
}
项目:fresco_floodlight    文件:OFSwitchHandlerTestBase.java   
/** Return a bad request error message with the given xid/code */
private OFMessage getBadRequestErrorMessage(OFBadRequestCode code, long xid) {
    OFErrorMsg msg = factory.errorMsgs().buildBadRequestErrorMsg()
            .setXid(xid)
            .setCode(code)
            .build();
    return msg;
}
项目:fresco_floodlight    文件:OFSwitchHandlerTestBase.java   
/** Move the channel from scratch to SLAVE state
 * Builds on doMoveToWaitInitialRole()
 * adds testing for WAIT_INITAL_ROLE state
 *
 * This method tests the case that the switch does NOT support roles.
 * The channel handler still needs to send the initial request to find
 * out that whether the switch supports roles.
 *
 */
@Test
public void testInitialMoveToSlaveNoRole() throws Exception {
    // first, move us to WAIT_INITIAL_ROLE_STATE
    moveToWaitInitialRole();
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Set the role
    long xid = setupSwitchSendRoleRequestAndVerify(null, OFControllerRole.ROLE_SLAVE);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // prepare mocks and inject the role reply message
    reset(sw);
    sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
    expectLastCall().once();
    sw.setControllerRole(OFControllerRole.ROLE_SLAVE);
    expectLastCall().once();
    sw.disconnect(); // Make sure we disconnect
    expectLastCall().once();
    replay(sw);


    // FIXME: shouldn't use ordinal(), but OFError is broken

    // Error with incorrect xid and type. Should be ignored.
    OFMessage err = getBadActionErrorMessage(OFBadActionCode.BAD_TYPE, xid+1);

    // sendMessageToHandler will verify and rest controller mock
    switchHandler.processOFMessage(err);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Error with correct xid. Should trigger state transition
    err = getBadRequestErrorMessage(OFBadRequestCode.BAD_EXPERIMENTER, xid);
    // sendMessageToHandler will verify and rest controller mock
    switchHandler.processOFMessage(err);
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandler.java   
@LogMessageDoc(level="WARN",
        message="Received permission error from switch {} while" +
                "being master. Reasserting master role.",
                explanation="The switch has denied an operation likely " +
                        "indicating inconsistent controller roles",
                        recommendation="This situation can occurs transiently during role" +
                                " changes. If, however, the condition persists or happens" +
                                " frequently this indicates a role inconsistency. " +
                                LogMessageDoc.CHECK_CONTROLLER )
@Override
void processOFError(OFErrorMsg m) {
    // role changer will ignore the error if it isn't for it
    boolean didHandle = roleChanger.deliverError(m);
    if (didHandle)
        return;
    if ((m.getErrType() == OFErrorType.BAD_REQUEST) &&
            (((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.EPERM)) {
        // We are the master controller and the switch returned
        // a permission error. This is a likely indicator that
        // the switch thinks we are slave. Reassert our
        // role
        // FIXME: this could be really bad during role transitions
        // if two controllers are master (even if its only for
        // a brief period). We might need to see if these errors
        // persist before we reassert
        switchManagerCounters.epermErrorWhileSwitchIsMaster.increment();
        log.warn("Received permission error from switch {} while" +
                "being master. Reasserting master role.",
                getSwitchInfoString());
        reassertRole(OFControllerRole.ROLE_MASTER);
    }
    else if ((m.getErrType() == OFErrorType.FLOW_MOD_FAILED) &&
            (((OFFlowModFailedErrorMsg)m).getCode() == OFFlowModFailedCode.ALL_TABLES_FULL)) {
        sw.setTableFull(true);
    }
    else {
        logError(m);
    }
    dispatchMessage(m);
}
项目:iTAP-controller    文件:OFSwitchHandlerTestBase.java   
/** Return a bad request error message with the given xid/code */
private OFMessage getBadRequestErrorMessage(OFBadRequestCode code, long xid) {
    OFErrorMsg msg = factory.errorMsgs().buildBadRequestErrorMsg()
            .setXid(xid)
            .setCode(code)
            .build();
    return msg;
}
项目:iTAP-controller    文件:OFSwitchHandlerTestBase.java   
/** Move the channel from scratch to SLAVE state
 * Builds on doMoveToWaitInitialRole()
 * adds testing for WAIT_INITAL_ROLE state
 *
 * This method tests the case that the switch does NOT support roles.
 * The channel handler still needs to send the initial request to find
 * out that whether the switch supports roles.
 *
 */
@Test
public void testInitialMoveToSlaveNoRole() throws Exception {
    // first, move us to WAIT_INITIAL_ROLE_STATE
    moveToWaitInitialRole();
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Set the role
    long xid = setupSwitchSendRoleRequestAndVerify(null, OFControllerRole.ROLE_SLAVE);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // prepare mocks and inject the role reply message
    reset(sw);
    sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
    expectLastCall().once();
    sw.setControllerRole(OFControllerRole.ROLE_SLAVE);
    expectLastCall().once();
    sw.disconnect(); // Make sure we disconnect
    expectLastCall().once();
    replay(sw);


    // FIXME: shouldn't use ordinal(), but OFError is broken

    // Error with incorrect xid and type. Should be ignored.
    OFMessage err = getBadActionErrorMessage(OFBadActionCode.BAD_TYPE, xid+1);

    // sendMessageToHandler will verify and rest controller mock
    switchHandler.processOFMessage(err);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitInitialRoleState.class));

    // Error with correct xid. Should trigger state transition
    err = getBadRequestErrorMessage(OFBadRequestCode.BAD_EXPERIMENTER, xid);
    // sendMessageToHandler will verify and rest controller mock
    switchHandler.processOFMessage(err);
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFError(OFErrorMsg m) {
    if ((m.getErrType() == OFErrorType.BAD_REQUEST) &&
            ((((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.MULTIPART_BUFFER_OVERFLOW)
                    || ((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.BAD_STAT)) { 
        log.warn("Switch {} is {} but does not support OFTableFeaturesStats. Assuming all tables can perform any match, action, and instruction in the spec.", 
                sw.getId().toString(), sw.getOFFactory().getVersion().toString());
    } else {
        log.error("Received unexpected OFErrorMsg {} on switch {}.", m.toString(), sw.getId().toString());
    }
    nextState();

}