@Override void processOFRoleStatus(OFRoleStatus m) { /** * Tulio Ribeiro * * Controller roles. * enum ofp_controller_role { * OFPCR_ROLE_NOCHANGE = 0, Don’t change current role. * OFPCR_ROLE_EQUAL = 1, Default role, full access. * OFPCR_ROLE_MASTER = 2, Full access, at most one master. * OFPCR_ROLE_SLAVE = 3, Read-only access. * }; */ long role = m.getRole(); if(role==3) sendRoleRequest(OFControllerRole.ROLE_SLAVE); else if (role==2) sendRoleRequest(OFControllerRole.ROLE_MASTER); else if (role==1) sendRoleRequest(OFControllerRole.ROLE_EQUAL); else sendRoleRequest(OFControllerRole.ROLE_NOCHANGE); }
@Override void processOFRoleStatus(OFRoleStatus m) { /** * Tulio Ribeiro * * Controller roles. * enum ofp_controller_role { * OFPCR_ROLE_NOCHANGE = 0, Don’t change current role. * OFPCR_ROLE_EQUAL = 1, Default role, full access. * OFPCR_ROLE_MASTER = 2, Full access, at most one master. * OFPCR_ROLE_SLAVE = 3, Read-only access. * }; */ //log.info("Processing roleStatus from MasterState..."); long role = m.getRole(); if(role==3){ sendRoleRequest(OFControllerRole.ROLE_SLAVE); /*OFSwitchManager.switchInitialRole.remove(mainConnection.getDatapathId()); OFSwitchManager.switchInitialRole.put(mainConnection.getDatapathId(), OFControllerRole.ROLE_SLAVE);*/ } else if (role==2) sendRoleRequest(OFControllerRole.ROLE_MASTER); else if (role==1) sendRoleRequest(OFControllerRole.ROLE_EQUAL); else sendRoleRequest(OFControllerRole.ROLE_NOCHANGE); }
/** * Tulio Ribeiro */ void processOFRoleStatus(OFRoleStatus m){ unhandledMessageReceived(m); }
/** * Process an OF message received on the channel and * update state accordingly. * * The main "event" of the state machine. Process the received message, * send follow up message if required and update state if required. * * Switches on the message type and calls more specific event handlers * for each individual OF message type. If we receive a message that * is supposed to be sent from a controller to a switch we throw * a SwitchStateExeption. * * The more specific handlers can also throw SwitchStateExceptions * * @param h The OFChannelHandler that received the message * @param m The message we received. * @throws SwitchStateException * @throws IOException */ void processOFMessage(OFMessage m) { roleChanger.checkTimeout(); switch(m.getType()) { case BARRIER_REPLY: processOFBarrierReply((OFBarrierReply) m); break; case ERROR: processOFError((OFErrorMsg) m); break; case FLOW_REMOVED: processOFFlowRemoved((OFFlowRemoved) m); break; case GET_CONFIG_REPLY: processOFGetConfigReply((OFGetConfigReply) m); break; case PACKET_IN: processOFPacketIn((OFPacketIn) m); break; case PORT_STATUS: processOFPortStatus((OFPortStatus) m); break; case QUEUE_GET_CONFIG_REPLY: processOFQueueGetConfigReply((OFQueueGetConfigReply) m); break; case STATS_REPLY: processOFStatsReply((OFStatsReply) m); break; case ROLE_REPLY: processOFRoleReply((OFRoleReply) m); break; case EXPERIMENTER: processOFExperimenter((OFExperimenter) m); break; case ROLE_STATUS: processOFRoleStatus((OFRoleStatus) m); break; default: illegalMessageReceived(m); break; } }