Committed by
Brian O'Connor
Remove class that is no longer used
Change-Id: I473b70e1cffba9728a3ebac23250b846a593a040
Showing
1 changed file
with
0 additions
and
224 deletions
... | @@ -67,7 +67,6 @@ import com.google.common.collect.ImmutableMap; | ... | @@ -67,7 +67,6 @@ import com.google.common.collect.ImmutableMap; |
67 | import com.google.common.collect.Lists; | 67 | import com.google.common.collect.Lists; |
68 | 68 | ||
69 | import static com.google.common.base.Preconditions.checkNotNull; | 69 | import static com.google.common.base.Preconditions.checkNotNull; |
70 | -import static com.google.common.base.Preconditions.checkState; | ||
71 | import static java.util.concurrent.Executors.newFixedThreadPool; | 70 | import static java.util.concurrent.Executors.newFixedThreadPool; |
72 | import static org.onlab.util.Tools.namedThreads; | 71 | import static org.onlab.util.Tools.namedThreads; |
73 | import static org.onosproject.net.intent.IntentState.FAILED; | 72 | import static org.onosproject.net.intent.IntentState.FAILED; |
... | @@ -486,40 +485,6 @@ public class IntentManager | ... | @@ -486,40 +485,6 @@ public class IntentManager |
486 | } | 485 | } |
487 | } | 486 | } |
488 | 487 | ||
489 | - private class ReplaceRequest implements IntentUpdate { | ||
490 | - | ||
491 | - private final Intent newIntent; | ||
492 | - private final Intent oldIntent; | ||
493 | - private final List<Intent> oldInstallables; | ||
494 | - | ||
495 | - ReplaceRequest(Intent newIntent, Intent oldIntent, List<Intent> oldInstallables) { | ||
496 | - this.newIntent = checkNotNull(newIntent); | ||
497 | - this.oldIntent = checkNotNull(oldIntent); | ||
498 | - this.oldInstallables = ImmutableList.copyOf(oldInstallables); | ||
499 | - } | ||
500 | - | ||
501 | - @Override | ||
502 | - public void writeBeforeExecution(BatchWrite batchWrite) { | ||
503 | - // TODO consider only "creating" intent if it does not exist | ||
504 | - // Note: We need to set state to INSTALL_REQ regardless. | ||
505 | - batchWrite.createIntent(newIntent); | ||
506 | - } | ||
507 | - | ||
508 | - @Override | ||
509 | - public Optional<IntentUpdate> execute() { | ||
510 | - try { | ||
511 | - List<Intent> installables = compileIntent(newIntent, oldInstallables); | ||
512 | - return Optional.of(new Replacing(newIntent, oldIntent, installables, oldInstallables)); | ||
513 | - } catch (PathNotFoundException e) { | ||
514 | - log.debug("Path not found for intent {}", newIntent); | ||
515 | - return Optional.of(new Withdrawing(oldIntent, oldInstallables)); | ||
516 | - } catch (IntentException e) { | ||
517 | - log.warn("Unable to compile intent {} due to:", newIntent.id(), e); | ||
518 | - return Optional.of(new Withdrawing(oldIntent, oldInstallables)); | ||
519 | - } | ||
520 | - } | ||
521 | - } | ||
522 | - | ||
523 | private class Compiling implements IntentUpdate { | 488 | private class Compiling implements IntentUpdate { |
524 | 489 | ||
525 | private final Intent intent; | 490 | private final Intent intent; |
... | @@ -600,66 +565,6 @@ public class IntentManager | ... | @@ -600,66 +565,6 @@ public class IntentManager |
600 | } | 565 | } |
601 | } | 566 | } |
602 | 567 | ||
603 | - private class Replacing implements IntentUpdate { | ||
604 | - | ||
605 | - private final Intent newIntent; | ||
606 | - private final Intent oldIntent; | ||
607 | - private final List<Intent> newInstallables; | ||
608 | - private final List<Intent> oldInstallables; | ||
609 | - | ||
610 | - private Exception exception; | ||
611 | - | ||
612 | - Replacing(Intent newIntent, Intent oldIntent, | ||
613 | - List<Intent> newInstallables, List<Intent> oldInstallables) { | ||
614 | - this.newIntent = checkNotNull(newIntent); | ||
615 | - this.oldIntent = checkNotNull(oldIntent); | ||
616 | - this.newInstallables = ImmutableList.copyOf(checkNotNull(newInstallables)); | ||
617 | - this.oldInstallables = ImmutableList.copyOf(checkNotNull(oldInstallables)); | ||
618 | - } | ||
619 | - | ||
620 | - @Override | ||
621 | - public Optional<IntentUpdate> execute() { | ||
622 | - List<FlowRuleBatchOperation> batches = replace(); | ||
623 | - | ||
624 | - if (exception == null) { | ||
625 | - return Optional.of( | ||
626 | - new Replaced(newIntent, oldIntent, newInstallables, oldInstallables, batches)); | ||
627 | - } | ||
628 | - | ||
629 | - return Optional.of( | ||
630 | - new ReplacingFailed(newIntent, oldIntent, newInstallables, oldInstallables, batches)); | ||
631 | - } | ||
632 | - | ||
633 | - protected List<FlowRuleBatchOperation> replace() { | ||
634 | - checkState(oldInstallables.size() == newInstallables.size(), | ||
635 | - "Old and New Intent must have equivalent installable intents."); | ||
636 | - | ||
637 | - List<FlowRuleBatchOperation> batches = Lists.newArrayList(); | ||
638 | - for (int i = 0; i < oldInstallables.size(); i++) { | ||
639 | - Intent oldInstallable = oldInstallables.get(i); | ||
640 | - Intent newInstallable = newInstallables.get(i); | ||
641 | - //FIXME revisit this | ||
642 | -// if (oldInstallable.equals(newInstallable)) { | ||
643 | -// continue; | ||
644 | -// } | ||
645 | - checkState(oldInstallable.getClass().equals(newInstallable.getClass()), | ||
646 | - "Installable Intent type mismatch."); | ||
647 | - trackerService.removeTrackedResources(oldIntent.id(), oldInstallable.resources()); | ||
648 | - trackerService.addTrackedResources(newIntent.id(), newInstallable.resources()); | ||
649 | - try { | ||
650 | - batches.addAll(getInstaller(newInstallable).replace(oldInstallable, newInstallable)); | ||
651 | - } catch (IntentException e) { | ||
652 | - log.warn("Unable to update intent {} due to:", oldIntent.id(), e); | ||
653 | - //FIXME... we failed. need to uninstall (if same) or revert (if different) | ||
654 | - trackerService.removeTrackedResources(newIntent.id(), newInstallable.resources()); | ||
655 | - exception = e; | ||
656 | - batches = uninstallIntent(oldIntent, oldInstallables); | ||
657 | - } | ||
658 | - } | ||
659 | - return batches; | ||
660 | - } | ||
661 | - } | ||
662 | - | ||
663 | private class Installed implements CompletedIntentUpdate { | 568 | private class Installed implements CompletedIntentUpdate { |
664 | 569 | ||
665 | private final Intent intent; | 570 | private final Intent intent; |
... | @@ -767,71 +672,6 @@ public class IntentManager | ... | @@ -767,71 +672,6 @@ public class IntentManager |
767 | } | 672 | } |
768 | } | 673 | } |
769 | 674 | ||
770 | - private class Replaced implements CompletedIntentUpdate { | ||
771 | - | ||
772 | - private final Intent newIntent; | ||
773 | - private final Intent oldIntent; | ||
774 | - | ||
775 | - private final List<Intent> newInstallables; | ||
776 | - private final List<Intent> oldInstallables; | ||
777 | - private final List<FlowRuleBatchOperation> batches; | ||
778 | - private int currentBatch; | ||
779 | - | ||
780 | - Replaced(Intent newIntent, Intent oldIntent, | ||
781 | - List<Intent> newInstallables, List<Intent> oldInstallables, | ||
782 | - List<FlowRuleBatchOperation> batches) { | ||
783 | - this.newIntent = checkNotNull(newIntent); | ||
784 | - this.oldIntent = checkNotNull(oldIntent); | ||
785 | - this.newInstallables = ImmutableList.copyOf(checkNotNull(newInstallables)); | ||
786 | - this.oldInstallables = ImmutableList.copyOf(checkNotNull(oldInstallables)); | ||
787 | - this.batches = new LinkedList<>(batches); | ||
788 | - this.currentBatch = 0; | ||
789 | - } | ||
790 | - | ||
791 | - @Override | ||
792 | - public List<Intent> allInstallables() { | ||
793 | - LinkedList<Intent> allInstallables = new LinkedList<>(); | ||
794 | - allInstallables.addAll(newInstallables); | ||
795 | - allInstallables.addAll(oldInstallables); | ||
796 | - | ||
797 | - return allInstallables; | ||
798 | - } | ||
799 | - | ||
800 | - @Override | ||
801 | - public void batchSuccess() { | ||
802 | - currentBatch++; | ||
803 | - } | ||
804 | - | ||
805 | - @Override | ||
806 | - public void writeAfterExecution(BatchWrite batchWrite) { | ||
807 | - batchWrite.setState(newIntent, INSTALLED); | ||
808 | - batchWrite.setInstallableIntents(newIntent.id(), newInstallables); | ||
809 | - | ||
810 | - batchWrite.setState(oldIntent, WITHDRAWN); | ||
811 | - batchWrite.removeInstalledIntents(oldIntent.id()); | ||
812 | - batchWrite.removeIntent(oldIntent.id()); | ||
813 | - } | ||
814 | - | ||
815 | - @Override | ||
816 | - public FlowRuleBatchOperation currentBatch() { | ||
817 | - return currentBatch < batches.size() ? batches.get(currentBatch) : null; | ||
818 | - } | ||
819 | - | ||
820 | - @Override | ||
821 | - public void batchFailed() { | ||
822 | - // the current batch has failed, so recompile | ||
823 | - // remove the current batch and all remaining | ||
824 | - for (int i = batches.size() - 1; i >= currentBatch; i--) { | ||
825 | - batches.remove(i); | ||
826 | - } | ||
827 | - batches.addAll(uninstallIntent(oldIntent, oldInstallables)); | ||
828 | - | ||
829 | - batches.addAll(uninstallIntent(newIntent, newInstallables)); | ||
830 | - | ||
831 | - // TODO we might want to try to recompile the new intent | ||
832 | - } | ||
833 | - } | ||
834 | - | ||
835 | private class InstallingFailed implements CompletedIntentUpdate { | 675 | private class InstallingFailed implements CompletedIntentUpdate { |
836 | 676 | ||
837 | private final Intent intent; | 677 | private final Intent intent; |
... | @@ -879,70 +719,6 @@ public class IntentManager | ... | @@ -879,70 +719,6 @@ public class IntentManager |
879 | } | 719 | } |
880 | } | 720 | } |
881 | 721 | ||
882 | - private class ReplacingFailed implements CompletedIntentUpdate { | ||
883 | - | ||
884 | - private final Intent newIntent; | ||
885 | - private final Intent oldIntent; | ||
886 | - private final List<Intent> newInstallables; | ||
887 | - private final List<Intent> oldInstallables; | ||
888 | - private final List<FlowRuleBatchOperation> batches; | ||
889 | - private int currentBatch; | ||
890 | - | ||
891 | - ReplacingFailed(Intent newIntent, Intent oldIntent, | ||
892 | - List<Intent> newInstallables, List<Intent> oldInstallables, | ||
893 | - List<FlowRuleBatchOperation> batches) { | ||
894 | - this.newIntent = checkNotNull(newIntent); | ||
895 | - this.oldIntent = checkNotNull(oldIntent); | ||
896 | - this.newInstallables = ImmutableList.copyOf(checkNotNull(newInstallables)); | ||
897 | - this.oldInstallables = ImmutableList.copyOf(checkNotNull(oldInstallables)); | ||
898 | - this.batches = new LinkedList<>(batches); | ||
899 | - this.currentBatch = 0; | ||
900 | - } | ||
901 | - | ||
902 | - @Override | ||
903 | - public List<Intent> allInstallables() { | ||
904 | - LinkedList<Intent> allInstallables = new LinkedList<>(); | ||
905 | - allInstallables.addAll(newInstallables); | ||
906 | - allInstallables.addAll(oldInstallables); | ||
907 | - | ||
908 | - return allInstallables; | ||
909 | - } | ||
910 | - | ||
911 | - @Override | ||
912 | - public void batchSuccess() { | ||
913 | - currentBatch++; | ||
914 | - } | ||
915 | - | ||
916 | - @Override | ||
917 | - public void writeAfterExecution(BatchWrite batchWrite) { | ||
918 | - batchWrite.setState(newIntent, FAILED); | ||
919 | - batchWrite.removeInstalledIntents(newIntent.id()); | ||
920 | - | ||
921 | - batchWrite.setState(oldIntent, WITHDRAWN); | ||
922 | - batchWrite.removeInstalledIntents(oldIntent.id()); | ||
923 | - batchWrite.removeIntent(oldIntent.id()); | ||
924 | - } | ||
925 | - | ||
926 | - @Override | ||
927 | - public FlowRuleBatchOperation currentBatch() { | ||
928 | - return currentBatch < batches.size() ? batches.get(currentBatch) : null; | ||
929 | - } | ||
930 | - | ||
931 | - @Override | ||
932 | - public void batchFailed() { | ||
933 | - // the current batch has failed, so recompile | ||
934 | - // remove the current batch and all remaining | ||
935 | - for (int i = batches.size() - 1; i >= currentBatch; i--) { | ||
936 | - batches.remove(i); | ||
937 | - } | ||
938 | - batches.addAll(uninstallIntent(oldIntent, oldInstallables)); | ||
939 | - | ||
940 | - batches.addAll(uninstallIntent(newIntent, newInstallables)); | ||
941 | - | ||
942 | - // TODO we might want to try to recompile the new intent | ||
943 | - } | ||
944 | - } | ||
945 | - | ||
946 | private class IntentBatchPreprocess implements Runnable { | 722 | private class IntentBatchPreprocess implements Runnable { |
947 | 723 | ||
948 | // TODO make this configurable | 724 | // TODO make this configurable | ... | ... |
-
Please register or login to post a comment