Committed by
Brian O'Connor
Delete unnecessary semicolon
Change-Id: I2eaa4d900342a665f6dc4731a298b30a9ec40696
Showing
5 changed files
with
15 additions
and
232 deletions
... | @@ -301,19 +301,10 @@ public class DemoInstaller implements DemoAPI { | ... | @@ -301,19 +301,10 @@ public class DemoInstaller implements DemoAPI { |
301 | * @throws InterruptedException if the thread go interupted | 301 | * @throws InterruptedException if the thread go interupted |
302 | */ | 302 | */ |
303 | private void trackIntents() throws InterruptedException { | 303 | private void trackIntents() throws InterruptedException { |
304 | - int count = 0; | 304 | + //FIXME |
305 | - while (!latch.await(100, TimeUnit.NANOSECONDS)) { | 305 | + // TODO generate keys for each set of intents to allow manager to throttle |
306 | - if (intentBatchService.getPendingOperations().isEmpty()) { | 306 | + // TODO may also look into the store to see how many operations are pending |
307 | - latch.countDown(); | 307 | + |
308 | - } | ||
309 | - count++; | ||
310 | - if (count > ITERATIONMAX) { | ||
311 | - log.warn("A batch is stuck processing. " + | ||
312 | - "pending : {}", | ||
313 | - intentBatchService.getPendingOperations()); | ||
314 | - shutdownAndAwaitTermination(installWorker); | ||
315 | - } | ||
316 | - } | ||
317 | //if everything is good proceed. | 308 | //if everything is good proceed. |
318 | if (!installWorker.isShutdown()) { | 309 | if (!installWorker.isShutdown()) { |
319 | installWorker.execute(this); | 310 | installWorker.execute(this); | ... | ... |
... | @@ -15,19 +15,12 @@ | ... | @@ -15,19 +15,12 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.sdnip; | 16 | package org.onosproject.sdnip; |
17 | 17 | ||
18 | -import static org.easymock.EasyMock.reportMatcher; | ||
19 | - | ||
20 | -import java.util.LinkedList; | ||
21 | -import java.util.List; | ||
22 | - | ||
23 | -import org.apache.commons.collections4.CollectionUtils; | ||
24 | import org.easymock.IArgumentMatcher; | 18 | import org.easymock.IArgumentMatcher; |
25 | import org.onosproject.net.intent.Intent; | 19 | import org.onosproject.net.intent.Intent; |
26 | -import org.onosproject.net.intent.IntentId; | ||
27 | -import org.onosproject.net.intent.IntentOperation; | ||
28 | -import org.onosproject.net.intent.IntentOperations; | ||
29 | import org.onosproject.sdnip.IntentSynchronizer.IntentKey; | 20 | import org.onosproject.sdnip.IntentSynchronizer.IntentKey; |
30 | 21 | ||
22 | +import static org.easymock.EasyMock.reportMatcher; | ||
23 | + | ||
31 | /** | 24 | /** |
32 | * Helper class for testing operations submitted to the IntentService. | 25 | * Helper class for testing operations submitted to the IntentService. |
33 | */ | 26 | */ |
... | @@ -54,13 +47,15 @@ public final class TestIntentServiceHelper { | ... | @@ -54,13 +47,15 @@ public final class TestIntentServiceHelper { |
54 | * Matcher method to set the expected intent operations to match against | 47 | * Matcher method to set the expected intent operations to match against |
55 | * (ignoring the intent ID for each intent). | 48 | * (ignoring the intent ID for each intent). |
56 | * | 49 | * |
57 | - * @param intentOperations the expected Intent Operations | 50 | + * param intentOperations the expected Intent Operations |
58 | * @return the submitted Intent Operations | 51 | * @return the submitted Intent Operations |
59 | */ | 52 | */ |
53 | + /* | ||
60 | static IntentOperations eqExceptId(IntentOperations intentOperations) { | 54 | static IntentOperations eqExceptId(IntentOperations intentOperations) { |
61 | reportMatcher(new IdAgnosticIntentOperationsMatcher(intentOperations)); | 55 | reportMatcher(new IdAgnosticIntentOperationsMatcher(intentOperations)); |
62 | return intentOperations; | 56 | return intentOperations; |
63 | } | 57 | } |
58 | + */ | ||
64 | 59 | ||
65 | /* | 60 | /* |
66 | * EasyMock matcher that matches {@link Intent} but | 61 | * EasyMock matcher that matches {@link Intent} but |
... | @@ -120,22 +115,13 @@ public final class TestIntentServiceHelper { | ... | @@ -120,22 +115,13 @@ public final class TestIntentServiceHelper { |
120 | * value properties of the provided intent match the expected values, but | 115 | * value properties of the provided intent match the expected values, but |
121 | * ignores the intent ID when testing equality. | 116 | * ignores the intent ID when testing equality. |
122 | */ | 117 | */ |
118 | + /* | ||
123 | private static final class IdAgnosticIntentOperationsMatcher implements | 119 | private static final class IdAgnosticIntentOperationsMatcher implements |
124 | IArgumentMatcher { | 120 | IArgumentMatcher { |
125 | 121 | ||
126 | - private final IntentOperations intentOperations; | 122 | + //private final IntentOperations intentOperations; |
127 | private String providedString; | 123 | private String providedString; |
128 | 124 | ||
129 | - /** | ||
130 | - * Constructor taking the expected intent operations to match against. | ||
131 | - * | ||
132 | - * @param intentOperations the expected intent operations | ||
133 | - */ | ||
134 | - public IdAgnosticIntentOperationsMatcher( | ||
135 | - IntentOperations intentOperations) { | ||
136 | - this.intentOperations = intentOperations; | ||
137 | - } | ||
138 | - | ||
139 | @Override | 125 | @Override |
140 | public void appendTo(StringBuffer strBuffer) { | 126 | public void appendTo(StringBuffer strBuffer) { |
141 | strBuffer.append("IntentOperationsMatcher unable to match: " | 127 | strBuffer.append("IntentOperationsMatcher unable to match: " |
... | @@ -178,6 +164,7 @@ public final class TestIntentServiceHelper { | ... | @@ -178,6 +164,7 @@ public final class TestIntentServiceHelper { |
178 | providedReplaceIntents); | 164 | providedReplaceIntents); |
179 | } | 165 | } |
180 | 166 | ||
167 | + | ||
181 | /** | 168 | /** |
182 | * Extracts the intents per operation type. Each intent is encapsulated | 169 | * Extracts the intents per operation type. Each intent is encapsulated |
183 | * in IntentKey so it can be compared by excluding the Intent ID. | 170 | * in IntentKey so it can be compared by excluding the Intent ID. |
... | @@ -189,6 +176,7 @@ public final class TestIntentServiceHelper { | ... | @@ -189,6 +176,7 @@ public final class TestIntentServiceHelper { |
189 | * @param replaceIntents the REPLACE intents | 176 | * @param replaceIntents the REPLACE intents |
190 | * @param updateIntents the UPDATE intents | 177 | * @param updateIntents the UPDATE intents |
191 | */ | 178 | */ |
179 | + /* | ||
192 | private void extractIntents(IntentOperations intentOperations, | 180 | private void extractIntents(IntentOperations intentOperations, |
193 | List<IntentKey> submitIntents, | 181 | List<IntentKey> submitIntents, |
194 | List<IntentId> withdrawIntentIds, | 182 | List<IntentId> withdrawIntentIds, |
... | @@ -220,4 +208,5 @@ public final class TestIntentServiceHelper { | ... | @@ -220,4 +208,5 @@ public final class TestIntentServiceHelper { |
220 | } | 208 | } |
221 | } | 209 | } |
222 | } | 210 | } |
211 | + */ | ||
223 | } | 212 | } | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.intent; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.intent; |
17 | 17 | ||
18 | import org.onosproject.core.ApplicationId; | 18 | import org.onosproject.core.ApplicationId; |
19 | 19 | ||
20 | -import java.util.Set; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Service for tracking and delegating batches of intent operations. | 21 | * Service for tracking and delegating batches of intent operations. |
24 | */ | 22 | */ |
... | @@ -26,26 +24,6 @@ import java.util.Set; | ... | @@ -26,26 +24,6 @@ import java.util.Set; |
26 | public interface IntentBatchService { | 24 | public interface IntentBatchService { |
27 | 25 | ||
28 | /** | 26 | /** |
29 | - * Submits a batch of intent operations. | ||
30 | - * | ||
31 | - * @param operations batch of operations | ||
32 | - */ | ||
33 | - void addIntentOperations(IntentOperations operations); | ||
34 | - | ||
35 | - /** | ||
36 | - * Removes the specified batch of intent operations after completion. | ||
37 | - * | ||
38 | - * @param operations batch of operations | ||
39 | - */ | ||
40 | - void removeIntentOperations(IntentOperations operations); | ||
41 | - | ||
42 | - /** | ||
43 | - * Returns the set of intent batches that are pending. | ||
44 | - * @return set of batches | ||
45 | - */ | ||
46 | - Set<IntentOperations> getPendingOperations(); | ||
47 | - | ||
48 | - /** | ||
49 | * Return true if this instance is the local leader for batch | 27 | * Return true if this instance is the local leader for batch |
50 | * processing a given application id. | 28 | * processing a given application id. |
51 | * | 29 | * | ... | ... |
1 | -/* | ||
2 | - * Copyright 2014 Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.net.intent; | ||
17 | - | ||
18 | -import java.util.List; | ||
19 | -import java.util.Objects; | ||
20 | - | ||
21 | -import com.google.common.collect.ImmutableList; | ||
22 | -import org.onosproject.core.ApplicationId; | ||
23 | - | ||
24 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
25 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
26 | -import static org.onosproject.net.intent.IntentOperation.Type.REPLACE; | ||
27 | -import static org.onosproject.net.intent.IntentOperation.Type.SUBMIT; | ||
28 | -import static org.onosproject.net.intent.IntentOperation.Type.UPDATE; | ||
29 | -import static org.onosproject.net.intent.IntentOperation.Type.WITHDRAW; | ||
30 | - | ||
31 | -/** | ||
32 | - * Batch of intent submit/withdraw/replace operations. | ||
33 | - */ | ||
34 | -@Deprecated //DELETEME | ||
35 | -public final class IntentOperations { | ||
36 | - | ||
37 | - private final List<IntentOperation> operations; | ||
38 | - private final ApplicationId appId; | ||
39 | - | ||
40 | - /** | ||
41 | - * Creates a batch of intent operations using the supplied list. | ||
42 | - * | ||
43 | - * @param operations list of intent operations | ||
44 | - */ | ||
45 | - private IntentOperations(List<IntentOperation> operations, ApplicationId appId) { | ||
46 | - checkNotNull(operations); | ||
47 | - checkNotNull(appId); | ||
48 | - // TODO: consider check whether operations are not empty because empty batch is meaningless | ||
49 | - // but it affects the existing code to add this checking | ||
50 | - | ||
51 | - this.operations = operations; | ||
52 | - this.appId = appId; | ||
53 | - } | ||
54 | - | ||
55 | - /** | ||
56 | - * List of operations that need to be executed as a unit. | ||
57 | - * | ||
58 | - * @return list of intent operations | ||
59 | - */ | ||
60 | - public List<IntentOperation> operations() { | ||
61 | - return operations; | ||
62 | - } | ||
63 | - | ||
64 | - public ApplicationId appId() { | ||
65 | - return appId; | ||
66 | - } | ||
67 | - | ||
68 | - /** | ||
69 | - * Returns a builder for intent operation batches. | ||
70 | - * | ||
71 | - * @return intent operations builder | ||
72 | - * @param applicationId application id | ||
73 | - */ | ||
74 | - public static Builder builder(ApplicationId applicationId) { | ||
75 | - return new Builder(applicationId); | ||
76 | - } | ||
77 | - | ||
78 | - @Override | ||
79 | - public int hashCode() { | ||
80 | - return Objects.hash(operations); | ||
81 | - } | ||
82 | - | ||
83 | - @Override | ||
84 | - public boolean equals(Object obj) { | ||
85 | - if (this == obj) { | ||
86 | - return true; | ||
87 | - } | ||
88 | - if (obj == null || getClass() != obj.getClass()) { | ||
89 | - return false; | ||
90 | - } | ||
91 | - final IntentOperations other = (IntentOperations) obj; | ||
92 | - return Objects.equals(this.operations, other.operations); | ||
93 | - } | ||
94 | - | ||
95 | - @Override | ||
96 | - public String toString() { | ||
97 | - return toStringHelper(this) | ||
98 | - .add("operations", operations) | ||
99 | - .toString(); | ||
100 | - } | ||
101 | - | ||
102 | - /** | ||
103 | - * Builder for batches of intent operations. | ||
104 | - */ | ||
105 | - public static final class Builder { | ||
106 | - | ||
107 | - private final ImmutableList.Builder<IntentOperation> builder = ImmutableList.builder(); | ||
108 | - private final ApplicationId appId; | ||
109 | - | ||
110 | - // Public construction is forbidden. | ||
111 | - private Builder(ApplicationId appId) { | ||
112 | - this.appId = appId; | ||
113 | - } | ||
114 | - | ||
115 | - /** | ||
116 | - * Adds an intent submit operation. | ||
117 | - * | ||
118 | - * @param intent intent to be submitted | ||
119 | - * @return self | ||
120 | - */ | ||
121 | - public Builder addSubmitOperation(Intent intent) { | ||
122 | - checkNotNull(intent, "Intent cannot be null"); | ||
123 | - builder.add(new IntentOperation(SUBMIT, intent)); | ||
124 | - return this; | ||
125 | - } | ||
126 | - | ||
127 | - /** | ||
128 | - * Adds an intent submit operation. | ||
129 | - * | ||
130 | - * @param oldIntentId intent to be replaced | ||
131 | - * @param newIntent replacement intent | ||
132 | - * @return self | ||
133 | - */ | ||
134 | - public Builder addReplaceOperation(IntentId oldIntentId, Intent newIntent) { | ||
135 | - checkNotNull(oldIntentId, "Intent ID cannot be null"); | ||
136 | - checkNotNull(newIntent, "Intent cannot be null"); | ||
137 | - builder.add(new IntentOperation(REPLACE, newIntent)); //FIXME | ||
138 | - return this; | ||
139 | - } | ||
140 | - | ||
141 | - /** | ||
142 | - * Adds an intent submit operation. | ||
143 | - * | ||
144 | - * @param intentId identifier of the intent to be withdrawn | ||
145 | - * @return self | ||
146 | - */ | ||
147 | - public Builder addWithdrawOperation(IntentId intentId) { | ||
148 | - checkNotNull(intentId, "Intent ID cannot be null"); | ||
149 | - builder.add(new IntentOperation(WITHDRAW, null)); //FIXME | ||
150 | - return this; | ||
151 | - } | ||
152 | - | ||
153 | - /** | ||
154 | - * Adds an intent update operation. | ||
155 | - * | ||
156 | - * @param intentId identifier of the intent to be updated | ||
157 | - * @return self | ||
158 | - */ | ||
159 | - public Builder addUpdateOperation(IntentId intentId) { | ||
160 | - checkNotNull(intentId, "Intent ID cannot be null"); | ||
161 | - builder.add(new IntentOperation(UPDATE, null)); //FIXME | ||
162 | - return this; | ||
163 | - } | ||
164 | - | ||
165 | - /** | ||
166 | - * Builds a batch of intent operations. | ||
167 | - * | ||
168 | - * @return immutable batch of intent operations | ||
169 | - */ | ||
170 | - public IntentOperations build() { | ||
171 | - return new IntentOperations(builder.build(), appId); | ||
172 | - } | ||
173 | - | ||
174 | - } | ||
175 | -} |
... | @@ -48,7 +48,7 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { | ... | @@ -48,7 +48,7 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
48 | @Deprecated | 48 | @Deprecated |
49 | default Intent getIntent(IntentId intentId) { | 49 | default Intent getIntent(IntentId intentId) { |
50 | throw new UnsupportedOperationException("deprecated"); | 50 | throw new UnsupportedOperationException("deprecated"); |
51 | - }; | 51 | + } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Returns the state of the specified intent. | 54 | * Returns the state of the specified intent. | ... | ... |
-
Please register or login to post a comment