alshabib

more cleanup

......@@ -241,7 +241,6 @@ class RoleManager {
int xid = (int) rri.getXid();
RoleState role = rri.getRole();
// XXX S should check generation id meaningfully and other cases of expectations
// U64 genId = rri.getGenId();
if (pendingXid != xid) {
log.debug("Received older role reply from " +
......@@ -257,7 +256,6 @@ class RoleManager {
+ "expected role-reply {} with expectations {}",
new Object[] {sw.getStringId(), role, expectation});
//setSwitchRole(role, RoleRecvStatus.RECEIVED_REPLY); dont want to set state here
if (expectation == RoleRecvStatus.MATCHED_CURRENT_ROLE ||
expectation == RoleRecvStatus.MATCHED_SET_ROLE) {
return expectation;
......@@ -482,224 +480,3 @@ class RoleManager {
}
///**
// * We are waiting for a role reply message in response to a role request
// * sent after hearing back from the registry service -- OR -- we are
// * just waiting to hear back from the registry service in the case that
// * the switch does not support role messages. If completed successfully,
// * the controller's role for this switch will be set here.
// * Before we move to the state corresponding to the role, we allow the
// * switch specific driver to complete its configuration. This configuration
// * typically depends on the role the controller is playing for this switch.
// * And so we set the switch role (for 'this' controller) before we start
// * the driver-sub-handshake.
// * Next State: WAIT_SWITCH_DRIVER_SUB_HANDSHAKE
// */
//WAIT_INITIAL_ROLE(false) {
// @Override
// void processOFError(OFChannelHandler h, OFErrorMsg m)
// throws SwitchStateException {
// // role changer will ignore the error if it isn't for it
// RoleRecvStatus rrstatus = h.roleChanger.deliverError(m);
// if (rrstatus == RoleRecvStatus.OTHER_EXPECTATION) {
// logError(h, m);
// }
// }
//
// @Override
// void processOFExperimenter(OFChannelHandler h, OFExperimenter m)
// throws IOException, SwitchStateException {
// Role role = extractNiciraRoleReply(h, m);
// // If role == null it means the vendor (experimenter) message
// // wasn't really a Nicira role reply. We ignore this case.
// if (role != null) {
// RoleReplyInfo rri = new RoleReplyInfo(role, null, m.getXid());
// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(rri);
// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
// setRoleAndStartDriverHandshake(h, rri.getRole());
// } // else do nothing - wait for the correct expected reply
// } else {
// unhandledMessageReceived(h, m);
// }
// }
//
// @Override
// void processOFRoleReply(OFChannelHandler h, OFRoleReply m)
// throws SwitchStateException, IOException {
// RoleReplyInfo rri = extractOFRoleReply(h, m);
// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(rri);
// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
// setRoleAndStartDriverHandshake(h, rri.getRole());
// } // else do nothing - wait for the correct expected reply
// }
//
// @Override
// void handleUnsentRoleMessage(OFChannelHandler h, Role role,
// RoleRecvStatus expectation) throws IOException {
// // typically this is triggered for a switch where role messages
// // are not supported - we confirm that the role being set is
// // master and move to the next state
// if (expectation == RoleRecvStatus.MATCHED_SET_ROLE) {
// if (role == Role.MASTER) {
// setRoleAndStartDriverHandshake(h, role);
// } else {
// log.error("Expected MASTER role from registry for switch "
// + "which has no support for role-messages."
// + "Received {}. It is possible that this switch "
// + "is connected to other controllers, in which "
// + "case it should support role messages - not "
// + "moving forward.", role);
// }
// } // else do nothing - wait to hear back from registry
//
// }
//
// private void setRoleAndStartDriverHandshake(OFChannelHandler h,
// Role role) throws IOException {
// h.setSwitchRole(role);
// h.sw.startDriverHandshake();
// if (h.sw.isDriverHandshakeComplete()) {
// Role mySwitchRole = h.sw.getRole();
// if (mySwitchRole == Role.MASTER) {
// log.info("Switch-driver sub-handshake complete. "
// + "Activating switch {} with Role: MASTER",
// h.sw.getStringId());
// handlePendingPortStatusMessages(h); //before activation
// boolean success = h.sw.addActivatedMasterSwitch();
// if (!success) {
// disconnectDuplicate(h);
// return;
// }
// h.setState(MASTER);
// } else {
// log.info("Switch-driver sub-handshake complete. "
// + "Activating switch {} with Role: EQUAL",
// h.sw.getStringId());
// handlePendingPortStatusMessages(h); //before activation
// boolean success = h.sw.addActivatedEqualSwitch();
// if (!success) {
// disconnectDuplicate(h);
// return;
// }
// h.setState(EQUAL);
// }
// } else {
// h.setState(WAIT_SWITCH_DRIVER_SUB_HANDSHAKE);
// }
// }
//
// @Override
// void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
// throws IOException, SwitchStateException {
// illegalMessageReceived(h, m);
// }
//
// @Override
// void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
// throws SwitchStateException {
// illegalMessageReceived(h, m);
// }
//
// @Override
// void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
// throws IOException, SwitchStateException {
// h.pendingPortStatusMsg.add(m);
//
// }
//},
///**
// * This controller is in EQUAL role for this switch. We enter this state
// * after some /other/ controller instance wins mastership-role over this
// * switch. The EQUAL role can be considered the same as the SLAVE role
// * if this controller does NOT send commands or packets to the switch.
// * This should always be true for OF1.0 switches. XXX S need to enforce.
// *
// * For OF1.3 switches, choosing this state as EQUAL instead of SLAVE,
// * gives us the flexibility that if an app wants to send commands/packets
// * to switches, it can, even thought it is running on a controller instance
// * that is not in a MASTER role for this switch. Of course, it is the job
// * of the app to ensure that commands/packets sent by this (EQUAL) controller
// * instance does not clash/conflict with commands/packets sent by the MASTER
// * controller for this switch. Neither the controller instances, nor the
// * switch provides any kind of resolution mechanism should conflicts occur.
// */
//EQUAL(true) {
// @Override
// void processOFError(OFChannelHandler h, OFErrorMsg m)
// throws IOException, SwitchStateException {
// // role changer will ignore the error if it isn't for it
// RoleRecvStatus rrstatus = h.roleChanger.deliverError(m);
// if (rrstatus == RoleRecvStatus.OTHER_EXPECTATION) {
// logError(h, m);
// h.dispatchMessage(m);
// }
// }
//
// @Override
// void processOFStatisticsReply(OFChannelHandler h,
// OFStatsReply m) {
// h.sw.handleMessage(m);
// }
//
// @Override
// void processOFExperimenter(OFChannelHandler h, OFExperimenter m)
// throws IOException, SwitchStateException {
// Role role = extractNiciraRoleReply(h, m);
// // If role == null it means the message wasn't really a
// // Nicira role reply. We ignore it in this state.
// if (role != null) {
// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(
// new RoleReplyInfo(role, null, m.getXid()));
// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
// checkAndSetRoleTransition(h, role);
// }
// } else {
// unhandledMessageReceived(h, m);
// }
// }
//
// @Override
// void processOFRoleReply(OFChannelHandler h, OFRoleReply m)
// throws SwitchStateException, IOException {
// RoleReplyInfo rri = extractOFRoleReply(h, m);
// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(rri);
// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
// checkAndSetRoleTransition(h, rri.getRole());
// }
// }
//
// // XXX S needs more handlers for 1.3 switches in equal role
//
// @Override
// void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
// throws IOException, SwitchStateException {
// handlePortStatusMessage(h, m, true);
// }
//
// @Override
// @LogMessageDoc(level = "WARN",
// message = "Received PacketIn from switch {} while "
// + "being slave. Reasserting slave role.",
// explanation = "The switch has receive a PacketIn despite being "
// + "in slave role 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)
// void processOFPacketIn(OFChannelHandler h, OFPacketIn m) throws IOException {
// // we don't expect packetIn while slave, reassert we are slave
// h.counters.packetInWhileSwitchIsSlave.updateCounterNoFlush();
// log.warn("Received PacketIn from switch {} while" +
// "being slave. Reasserting slave role.", h.sw);
// //h.controller.reassertRole(h, Role.SLAVE);
// // XXX reassert in role changer
// }
//};
......
......@@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
......@@ -60,7 +61,7 @@ import org.slf4j.LoggerFactory;
*/
public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch {
private static Logger log =
private Logger log =
LoggerFactory.getLogger(OFSwitchImplCPqD13.class);
private static final int VLAN_ID_OFFSET = 16;
......@@ -95,7 +96,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch {
private static final short MIN_PRIORITY = 0x0;
private static final U64 METADATA_MASK = U64.of(Long.MAX_VALUE << 1 | 0x1);
ConcurrentHashMap<Integer, OFGroup> l2groups;
private Map<Integer, OFGroup> l2groups;
private final boolean usePipeline13;
......