Showing
2 changed files
with
3 additions
and
225 deletions
... | @@ -241,7 +241,6 @@ class RoleManager { | ... | @@ -241,7 +241,6 @@ class RoleManager { |
241 | int xid = (int) rri.getXid(); | 241 | int xid = (int) rri.getXid(); |
242 | RoleState role = rri.getRole(); | 242 | RoleState role = rri.getRole(); |
243 | // XXX S should check generation id meaningfully and other cases of expectations | 243 | // XXX S should check generation id meaningfully and other cases of expectations |
244 | - // U64 genId = rri.getGenId(); | ||
245 | 244 | ||
246 | if (pendingXid != xid) { | 245 | if (pendingXid != xid) { |
247 | log.debug("Received older role reply from " + | 246 | log.debug("Received older role reply from " + |
... | @@ -257,7 +256,6 @@ class RoleManager { | ... | @@ -257,7 +256,6 @@ class RoleManager { |
257 | + "expected role-reply {} with expectations {}", | 256 | + "expected role-reply {} with expectations {}", |
258 | new Object[] {sw.getStringId(), role, expectation}); | 257 | new Object[] {sw.getStringId(), role, expectation}); |
259 | 258 | ||
260 | - //setSwitchRole(role, RoleRecvStatus.RECEIVED_REPLY); dont want to set state here | ||
261 | if (expectation == RoleRecvStatus.MATCHED_CURRENT_ROLE || | 259 | if (expectation == RoleRecvStatus.MATCHED_CURRENT_ROLE || |
262 | expectation == RoleRecvStatus.MATCHED_SET_ROLE) { | 260 | expectation == RoleRecvStatus.MATCHED_SET_ROLE) { |
263 | return expectation; | 261 | return expectation; |
... | @@ -482,224 +480,3 @@ class RoleManager { | ... | @@ -482,224 +480,3 @@ class RoleManager { |
482 | 480 | ||
483 | } | 481 | } |
484 | 482 | ||
485 | - | ||
486 | -///** | ||
487 | -// * We are waiting for a role reply message in response to a role request | ||
488 | -// * sent after hearing back from the registry service -- OR -- we are | ||
489 | -// * just waiting to hear back from the registry service in the case that | ||
490 | -// * the switch does not support role messages. If completed successfully, | ||
491 | -// * the controller's role for this switch will be set here. | ||
492 | -// * Before we move to the state corresponding to the role, we allow the | ||
493 | -// * switch specific driver to complete its configuration. This configuration | ||
494 | -// * typically depends on the role the controller is playing for this switch. | ||
495 | -// * And so we set the switch role (for 'this' controller) before we start | ||
496 | -// * the driver-sub-handshake. | ||
497 | -// * Next State: WAIT_SWITCH_DRIVER_SUB_HANDSHAKE | ||
498 | -// */ | ||
499 | -//WAIT_INITIAL_ROLE(false) { | ||
500 | -// @Override | ||
501 | -// void processOFError(OFChannelHandler h, OFErrorMsg m) | ||
502 | -// throws SwitchStateException { | ||
503 | -// // role changer will ignore the error if it isn't for it | ||
504 | -// RoleRecvStatus rrstatus = h.roleChanger.deliverError(m); | ||
505 | -// if (rrstatus == RoleRecvStatus.OTHER_EXPECTATION) { | ||
506 | -// logError(h, m); | ||
507 | -// } | ||
508 | -// } | ||
509 | -// | ||
510 | -// @Override | ||
511 | -// void processOFExperimenter(OFChannelHandler h, OFExperimenter m) | ||
512 | -// throws IOException, SwitchStateException { | ||
513 | -// Role role = extractNiciraRoleReply(h, m); | ||
514 | -// // If role == null it means the vendor (experimenter) message | ||
515 | -// // wasn't really a Nicira role reply. We ignore this case. | ||
516 | -// if (role != null) { | ||
517 | -// RoleReplyInfo rri = new RoleReplyInfo(role, null, m.getXid()); | ||
518 | -// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(rri); | ||
519 | -// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) { | ||
520 | -// setRoleAndStartDriverHandshake(h, rri.getRole()); | ||
521 | -// } // else do nothing - wait for the correct expected reply | ||
522 | -// } else { | ||
523 | -// unhandledMessageReceived(h, m); | ||
524 | -// } | ||
525 | -// } | ||
526 | -// | ||
527 | -// @Override | ||
528 | -// void processOFRoleReply(OFChannelHandler h, OFRoleReply m) | ||
529 | -// throws SwitchStateException, IOException { | ||
530 | -// RoleReplyInfo rri = extractOFRoleReply(h, m); | ||
531 | -// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(rri); | ||
532 | -// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) { | ||
533 | -// setRoleAndStartDriverHandshake(h, rri.getRole()); | ||
534 | -// } // else do nothing - wait for the correct expected reply | ||
535 | -// } | ||
536 | -// | ||
537 | -// @Override | ||
538 | -// void handleUnsentRoleMessage(OFChannelHandler h, Role role, | ||
539 | -// RoleRecvStatus expectation) throws IOException { | ||
540 | -// // typically this is triggered for a switch where role messages | ||
541 | -// // are not supported - we confirm that the role being set is | ||
542 | -// // master and move to the next state | ||
543 | -// if (expectation == RoleRecvStatus.MATCHED_SET_ROLE) { | ||
544 | -// if (role == Role.MASTER) { | ||
545 | -// setRoleAndStartDriverHandshake(h, role); | ||
546 | -// } else { | ||
547 | -// log.error("Expected MASTER role from registry for switch " | ||
548 | -// + "which has no support for role-messages." | ||
549 | -// + "Received {}. It is possible that this switch " | ||
550 | -// + "is connected to other controllers, in which " | ||
551 | -// + "case it should support role messages - not " | ||
552 | -// + "moving forward.", role); | ||
553 | -// } | ||
554 | -// } // else do nothing - wait to hear back from registry | ||
555 | -// | ||
556 | -// } | ||
557 | -// | ||
558 | -// private void setRoleAndStartDriverHandshake(OFChannelHandler h, | ||
559 | -// Role role) throws IOException { | ||
560 | -// h.setSwitchRole(role); | ||
561 | -// h.sw.startDriverHandshake(); | ||
562 | -// if (h.sw.isDriverHandshakeComplete()) { | ||
563 | -// Role mySwitchRole = h.sw.getRole(); | ||
564 | -// if (mySwitchRole == Role.MASTER) { | ||
565 | -// log.info("Switch-driver sub-handshake complete. " | ||
566 | -// + "Activating switch {} with Role: MASTER", | ||
567 | -// h.sw.getStringId()); | ||
568 | -// handlePendingPortStatusMessages(h); //before activation | ||
569 | -// boolean success = h.sw.addActivatedMasterSwitch(); | ||
570 | -// if (!success) { | ||
571 | -// disconnectDuplicate(h); | ||
572 | -// return; | ||
573 | -// } | ||
574 | -// h.setState(MASTER); | ||
575 | -// } else { | ||
576 | -// log.info("Switch-driver sub-handshake complete. " | ||
577 | -// + "Activating switch {} with Role: EQUAL", | ||
578 | -// h.sw.getStringId()); | ||
579 | -// handlePendingPortStatusMessages(h); //before activation | ||
580 | -// boolean success = h.sw.addActivatedEqualSwitch(); | ||
581 | -// if (!success) { | ||
582 | -// disconnectDuplicate(h); | ||
583 | -// return; | ||
584 | -// } | ||
585 | -// h.setState(EQUAL); | ||
586 | -// } | ||
587 | -// } else { | ||
588 | -// h.setState(WAIT_SWITCH_DRIVER_SUB_HANDSHAKE); | ||
589 | -// } | ||
590 | -// } | ||
591 | -// | ||
592 | -// @Override | ||
593 | -// void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m) | ||
594 | -// throws IOException, SwitchStateException { | ||
595 | -// illegalMessageReceived(h, m); | ||
596 | -// } | ||
597 | -// | ||
598 | -// @Override | ||
599 | -// void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m) | ||
600 | -// throws SwitchStateException { | ||
601 | -// illegalMessageReceived(h, m); | ||
602 | -// } | ||
603 | -// | ||
604 | -// @Override | ||
605 | -// void processOFPortStatus(OFChannelHandler h, OFPortStatus m) | ||
606 | -// throws IOException, SwitchStateException { | ||
607 | -// h.pendingPortStatusMsg.add(m); | ||
608 | -// | ||
609 | -// } | ||
610 | -//}, | ||
611 | - | ||
612 | - | ||
613 | - | ||
614 | - | ||
615 | - | ||
616 | - | ||
617 | - | ||
618 | -///** | ||
619 | -// * This controller is in EQUAL role for this switch. We enter this state | ||
620 | -// * after some /other/ controller instance wins mastership-role over this | ||
621 | -// * switch. The EQUAL role can be considered the same as the SLAVE role | ||
622 | -// * if this controller does NOT send commands or packets to the switch. | ||
623 | -// * This should always be true for OF1.0 switches. XXX S need to enforce. | ||
624 | -// * | ||
625 | -// * For OF1.3 switches, choosing this state as EQUAL instead of SLAVE, | ||
626 | -// * gives us the flexibility that if an app wants to send commands/packets | ||
627 | -// * to switches, it can, even thought it is running on a controller instance | ||
628 | -// * that is not in a MASTER role for this switch. Of course, it is the job | ||
629 | -// * of the app to ensure that commands/packets sent by this (EQUAL) controller | ||
630 | -// * instance does not clash/conflict with commands/packets sent by the MASTER | ||
631 | -// * controller for this switch. Neither the controller instances, nor the | ||
632 | -// * switch provides any kind of resolution mechanism should conflicts occur. | ||
633 | -// */ | ||
634 | -//EQUAL(true) { | ||
635 | -// @Override | ||
636 | -// void processOFError(OFChannelHandler h, OFErrorMsg m) | ||
637 | -// throws IOException, SwitchStateException { | ||
638 | -// // role changer will ignore the error if it isn't for it | ||
639 | -// RoleRecvStatus rrstatus = h.roleChanger.deliverError(m); | ||
640 | -// if (rrstatus == RoleRecvStatus.OTHER_EXPECTATION) { | ||
641 | -// logError(h, m); | ||
642 | -// h.dispatchMessage(m); | ||
643 | -// } | ||
644 | -// } | ||
645 | -// | ||
646 | -// @Override | ||
647 | -// void processOFStatisticsReply(OFChannelHandler h, | ||
648 | -// OFStatsReply m) { | ||
649 | -// h.sw.handleMessage(m); | ||
650 | -// } | ||
651 | -// | ||
652 | -// @Override | ||
653 | -// void processOFExperimenter(OFChannelHandler h, OFExperimenter m) | ||
654 | -// throws IOException, SwitchStateException { | ||
655 | -// Role role = extractNiciraRoleReply(h, m); | ||
656 | -// // If role == null it means the message wasn't really a | ||
657 | -// // Nicira role reply. We ignore it in this state. | ||
658 | -// if (role != null) { | ||
659 | -// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply( | ||
660 | -// new RoleReplyInfo(role, null, m.getXid())); | ||
661 | -// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) { | ||
662 | -// checkAndSetRoleTransition(h, role); | ||
663 | -// } | ||
664 | -// } else { | ||
665 | -// unhandledMessageReceived(h, m); | ||
666 | -// } | ||
667 | -// } | ||
668 | -// | ||
669 | -// @Override | ||
670 | -// void processOFRoleReply(OFChannelHandler h, OFRoleReply m) | ||
671 | -// throws SwitchStateException, IOException { | ||
672 | -// RoleReplyInfo rri = extractOFRoleReply(h, m); | ||
673 | -// RoleRecvStatus rrs = h.roleChanger.deliverRoleReply(rri); | ||
674 | -// if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) { | ||
675 | -// checkAndSetRoleTransition(h, rri.getRole()); | ||
676 | -// } | ||
677 | -// } | ||
678 | -// | ||
679 | -// // XXX S needs more handlers for 1.3 switches in equal role | ||
680 | -// | ||
681 | -// @Override | ||
682 | -// void processOFPortStatus(OFChannelHandler h, OFPortStatus m) | ||
683 | -// throws IOException, SwitchStateException { | ||
684 | -// handlePortStatusMessage(h, m, true); | ||
685 | -// } | ||
686 | -// | ||
687 | -// @Override | ||
688 | -// @LogMessageDoc(level = "WARN", | ||
689 | -// message = "Received PacketIn from switch {} while " | ||
690 | -// + "being slave. Reasserting slave role.", | ||
691 | -// explanation = "The switch has receive a PacketIn despite being " | ||
692 | -// + "in slave role indicating inconsistent controller roles", | ||
693 | -// recommendation = "This situation can occurs transiently during role" | ||
694 | -// + " changes. If, however, the condition persists or happens" | ||
695 | -// + " frequently this indicates a role inconsistency. " | ||
696 | -// + LogMessageDoc.CHECK_CONTROLLER) | ||
697 | -// void processOFPacketIn(OFChannelHandler h, OFPacketIn m) throws IOException { | ||
698 | -// // we don't expect packetIn while slave, reassert we are slave | ||
699 | -// h.counters.packetInWhileSwitchIsSlave.updateCounterNoFlush(); | ||
700 | -// log.warn("Received PacketIn from switch {} while" + | ||
701 | -// "being slave. Reasserting slave role.", h.sw); | ||
702 | -// //h.controller.reassertRole(h, Role.SLAVE); | ||
703 | -// // XXX reassert in role changer | ||
704 | -// } | ||
705 | -//}; | ... | ... |
... | @@ -4,6 +4,7 @@ import java.io.IOException; | ... | @@ -4,6 +4,7 @@ import java.io.IOException; |
4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
5 | import java.util.Collections; | 5 | import java.util.Collections; |
6 | import java.util.List; | 6 | import java.util.List; |
7 | +import java.util.Map; | ||
7 | import java.util.concurrent.ConcurrentHashMap; | 8 | import java.util.concurrent.ConcurrentHashMap; |
8 | import java.util.concurrent.atomic.AtomicBoolean; | 9 | import java.util.concurrent.atomic.AtomicBoolean; |
9 | 10 | ||
... | @@ -60,7 +61,7 @@ import org.slf4j.LoggerFactory; | ... | @@ -60,7 +61,7 @@ import org.slf4j.LoggerFactory; |
60 | */ | 61 | */ |
61 | public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { | 62 | public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { |
62 | 63 | ||
63 | - private static Logger log = | 64 | + private Logger log = |
64 | LoggerFactory.getLogger(OFSwitchImplCPqD13.class); | 65 | LoggerFactory.getLogger(OFSwitchImplCPqD13.class); |
65 | 66 | ||
66 | private static final int VLAN_ID_OFFSET = 16; | 67 | private static final int VLAN_ID_OFFSET = 16; |
... | @@ -95,7 +96,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { | ... | @@ -95,7 +96,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { |
95 | private static final short MIN_PRIORITY = 0x0; | 96 | private static final short MIN_PRIORITY = 0x0; |
96 | private static final U64 METADATA_MASK = U64.of(Long.MAX_VALUE << 1 | 0x1); | 97 | private static final U64 METADATA_MASK = U64.of(Long.MAX_VALUE << 1 | 0x1); |
97 | 98 | ||
98 | - ConcurrentHashMap<Integer, OFGroup> l2groups; | 99 | + private Map<Integer, OFGroup> l2groups; |
99 | 100 | ||
100 | private final boolean usePipeline13; | 101 | private final boolean usePipeline13; |
101 | 102 | ... | ... |
-
Please register or login to post a comment