Search in sources :

Example 1 with OFBadRequestErrorMsg

use of org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg in project onos by opennetworkinglab.

the class DefaultOFSwitch method processControllerCommand.

@Override
public void processControllerCommand(Channel channel, OFMessage msg) {
    OFControllerRole myRole = role(channel);
    if (OFControllerRole.ROLE_SLAVE.equals(myRole)) {
        OFBadRequestErrorMsg errorMsg = FACTORY.errorMsgs().buildBadRequestErrorMsg().setXid(msg.getXid()).setCode(OFBadRequestCode.IS_SLAVE).build();
        channel.writeAndFlush(Collections.singletonList(errorMsg));
        return;
    }
    switch(msg.getType()) {
        case PORT_MOD:
            OFPortMod portMod = (OFPortMod) msg;
            processPortMod(portMod);
            break;
        case FLOW_MOD:
            OFFlowMod flowMod = (OFFlowMod) msg;
            processFlowMod(flowMod);
            break;
        case GROUP_MOD:
            OFGroupMod groupMod = (OFGroupMod) msg;
            processGroupMod(groupMod);
            break;
        case METER_MOD:
            OFMeterMod meterMod = (OFMeterMod) msg;
            processMeterMod(meterMod, channel);
            break;
        case TABLE_MOD:
            log.debug("processControllerCommand: {} not yet supported for {}", msg.getType(), msg);
            break;
        default:
            log.warn("Unexpected message {} received for switch {}", msg.getType(), this);
    }
}
Also used : OFControllerRole(org.projectfloodlight.openflow.protocol.OFControllerRole) OFGroupMod(org.projectfloodlight.openflow.protocol.OFGroupMod) OFPortMod(org.projectfloodlight.openflow.protocol.OFPortMod) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFBadRequestErrorMsg(org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Aggregations

OFControllerRole (org.projectfloodlight.openflow.protocol.OFControllerRole)1 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)1 OFGroupMod (org.projectfloodlight.openflow.protocol.OFGroupMod)1 OFMeterMod (org.projectfloodlight.openflow.protocol.OFMeterMod)1 OFPortMod (org.projectfloodlight.openflow.protocol.OFPortMod)1 OFBadRequestErrorMsg (org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg)1