Updated the debug log messages for SDN-IP IntentSynchronizer.
Change-Id: I74ababe18113489ad64a2ca4a63bc1c63211a3ee
Showing
1 changed file
with
33 additions
and
22 deletions
| ... | @@ -108,7 +108,8 @@ public class IntentSynchronizer { | ... | @@ -108,7 +108,8 @@ public class IntentSynchronizer { |
| 108 | // Build a batch operation to withdraw all intents from this | 108 | // Build a batch operation to withdraw all intents from this |
| 109 | // application. | 109 | // application. |
| 110 | // | 110 | // |
| 111 | - log.debug("Withdrawing all SDN-IP Intents..."); | 111 | + log.debug("SDN-IP Intent Synchronizer shutdown: " + |
| 112 | + "withdrawing all intents..."); | ||
| 112 | IntentOperations.Builder builder = IntentOperations.builder(); | 113 | IntentOperations.Builder builder = IntentOperations.builder(); |
| 113 | for (Intent intent : intentService.getIntents()) { | 114 | for (Intent intent : intentService.getIntents()) { |
| 114 | // Skip the intents from other applications | 115 | // Skip the intents from other applications |
| ... | @@ -124,18 +125,22 @@ public class IntentSynchronizer { | ... | @@ -124,18 +125,22 @@ public class IntentSynchronizer { |
| 124 | continue; | 125 | continue; |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 128 | + log.debug("SDN-IP Intent Synchronizer withdrawing intent: {}", | ||
| 129 | + intent); | ||
| 127 | builder.addWithdrawOperation(intent.id()); | 130 | builder.addWithdrawOperation(intent.id()); |
| 128 | } | 131 | } |
| 129 | - intentService.execute(builder.build()); | 132 | + IntentOperations intentOperations = builder.build(); |
| 133 | + intentService.execute(intentOperations); | ||
| 130 | leaderChanged(false); | 134 | leaderChanged(false); |
| 131 | 135 | ||
| 132 | peerIntents.clear(); | 136 | peerIntents.clear(); |
| 133 | routeIntents.clear(); | 137 | routeIntents.clear(); |
| 138 | + log.debug("SDN-IP Intent Synchronizer shutdown completed"); | ||
| 134 | } | 139 | } |
| 135 | } | 140 | } |
| 136 | 141 | ||
| 137 | public void leaderChanged(boolean isLeader) { | 142 | public void leaderChanged(boolean isLeader) { |
| 138 | - log.debug("Leader changed: {}", isLeader); | 143 | + log.debug("SDN-IP Leader changed: {}", isLeader); |
| 139 | 144 | ||
| 140 | if (!isLeader) { | 145 | if (!isLeader) { |
| 141 | this.isElectedLeader = false; | 146 | this.isElectedLeader = false; |
| ... | @@ -181,7 +186,7 @@ public class IntentSynchronizer { | ... | @@ -181,7 +186,7 @@ public class IntentSynchronizer { |
| 181 | // | 186 | // |
| 182 | intentsSynchronizerSemaphore.drainPermits(); | 187 | intentsSynchronizerSemaphore.drainPermits(); |
| 183 | } catch (InterruptedException e) { | 188 | } catch (InterruptedException e) { |
| 184 | - log.debug("Interrupted while waiting to become " + | 189 | + log.debug("SDN-IP interrupted while waiting to become " + |
| 185 | "Intent Synchronization leader"); | 190 | "Intent Synchronization leader"); |
| 186 | interrupted = true; | 191 | interrupted = true; |
| 187 | break; | 192 | break; |
| ... | @@ -209,12 +214,15 @@ public class IntentSynchronizer { | ... | @@ -209,12 +214,15 @@ public class IntentSynchronizer { |
| 209 | 214 | ||
| 210 | // Push the intents | 215 | // Push the intents |
| 211 | if (isElectedLeader && isActivatedLeader) { | 216 | if (isElectedLeader && isActivatedLeader) { |
| 212 | - log.debug("Submitting all SDN-IP Peer Intents..."); | 217 | + log.debug("SDN-IP Submitting all Peer Intents..."); |
| 213 | IntentOperations.Builder builder = IntentOperations.builder(); | 218 | IntentOperations.Builder builder = IntentOperations.builder(); |
| 214 | for (Intent intent : intents) { | 219 | for (Intent intent : intents) { |
| 215 | builder.addSubmitOperation(intent); | 220 | builder.addSubmitOperation(intent); |
| 216 | } | 221 | } |
| 217 | - intentService.execute(builder.build()); | 222 | + IntentOperations intentOperations = builder.build(); |
| 223 | + log.debug("SDN-IP Submitting intents: {}", | ||
| 224 | + intentOperations.operations()); | ||
| 225 | + intentService.execute(intentOperations); | ||
| 218 | } | 226 | } |
| 219 | } | 227 | } |
| 220 | } | 228 | } |
| ... | @@ -232,15 +240,15 @@ public class IntentSynchronizer { | ... | @@ -232,15 +240,15 @@ public class IntentSynchronizer { |
| 232 | routeIntents.put(prefix, intent); | 240 | routeIntents.put(prefix, intent); |
| 233 | 241 | ||
| 234 | if (isElectedLeader && isActivatedLeader) { | 242 | if (isElectedLeader && isActivatedLeader) { |
| 235 | - log.debug("Intent installation: adding Intent for prefix: {}", | ||
| 236 | - prefix); | ||
| 237 | if (oldIntent != null) { | 243 | if (oldIntent != null) { |
| 238 | // | 244 | // |
| 239 | // TODO: Short-term solution to explicitly withdraw | 245 | // TODO: Short-term solution to explicitly withdraw |
| 240 | // instead of using "replace" operation. | 246 | // instead of using "replace" operation. |
| 241 | // | 247 | // |
| 248 | + log.debug("SDN-IP Withdrawing old intent: {}", oldIntent); | ||
| 242 | intentService.withdraw(oldIntent); | 249 | intentService.withdraw(oldIntent); |
| 243 | } | 250 | } |
| 251 | + log.debug("SDN-IP Submitting intent: {}", intent); | ||
| 244 | intentService.submit(intent); | 252 | intentService.submit(intent); |
| 245 | } | 253 | } |
| 246 | } | 254 | } |
| ... | @@ -257,14 +265,13 @@ public class IntentSynchronizer { | ... | @@ -257,14 +265,13 @@ public class IntentSynchronizer { |
| 257 | routeIntents.remove(prefix); | 265 | routeIntents.remove(prefix); |
| 258 | 266 | ||
| 259 | if (intent == null) { | 267 | if (intent == null) { |
| 260 | - log.debug("There is no Intent in routeIntents to " + | 268 | + log.debug("SDN-IP no intent in routeIntents to delete for " + |
| 261 | - "delete for prefix: {}", prefix); | 269 | + "prefix: {}", prefix); |
| 262 | return; | 270 | return; |
| 263 | } | 271 | } |
| 264 | 272 | ||
| 265 | if (isElectedLeader && isActivatedLeader) { | 273 | if (isElectedLeader && isActivatedLeader) { |
| 266 | - log.debug("Intent installation: deleting Intent for prefix: {}", | 274 | + log.debug("SDN-IP Withdrawing intent: {}", intent); |
| 267 | - prefix); | ||
| 268 | intentService.withdraw(intent); | 275 | intentService.withdraw(intent); |
| 269 | } | 276 | } |
| 270 | } | 277 | } |
| ... | @@ -282,11 +289,12 @@ public class IntentSynchronizer { | ... | @@ -282,11 +289,12 @@ public class IntentSynchronizer { |
| 282 | Collection<Intent> storeInMemoryIntents = new LinkedList<>(); | 289 | Collection<Intent> storeInMemoryIntents = new LinkedList<>(); |
| 283 | Collection<Intent> addIntents = new LinkedList<>(); | 290 | Collection<Intent> addIntents = new LinkedList<>(); |
| 284 | Collection<Intent> deleteIntents = new LinkedList<>(); | 291 | Collection<Intent> deleteIntents = new LinkedList<>(); |
| 292 | + IntentOperations intentOperations; | ||
| 285 | 293 | ||
| 286 | if (!isElectedLeader) { | 294 | if (!isElectedLeader) { |
| 287 | return; // Nothing to do: not the leader anymore | 295 | return; // Nothing to do: not the leader anymore |
| 288 | } | 296 | } |
| 289 | - log.debug("Syncing SDN-IP Intents..."); | 297 | + log.debug("SDN-IP synchronizing all intents..."); |
| 290 | 298 | ||
| 291 | // Prepare the local intents | 299 | // Prepare the local intents |
| 292 | for (Intent intent : routeIntents.values()) { | 300 | for (Intent intent : routeIntents.values()) { |
| ... | @@ -330,19 +338,19 @@ public class IntentSynchronizer { | ... | @@ -330,19 +338,19 @@ public class IntentSynchronizer { |
| 330 | // TODO: For now we support only IPv4 | 338 | // TODO: For now we support only IPv4 |
| 331 | continue; | 339 | continue; |
| 332 | } | 340 | } |
| 333 | - log.debug("Intent synchronization: updating " + | 341 | + log.debug("SDN-IP Intent Synchronizer: updating " + |
| 334 | "in-memory Route Intent for prefix {}", | 342 | "in-memory Route Intent for prefix {}", |
| 335 | ip4Prefix); | 343 | ip4Prefix); |
| 336 | routeIntents.put(ip4Prefix, mp2pIntent); | 344 | routeIntents.put(ip4Prefix, mp2pIntent); |
| 337 | } else { | 345 | } else { |
| 338 | - log.warn("No IPV4_DST criterion found for Intent {}", | 346 | + log.warn("SDN-IP no IPV4_DST criterion found for Intent {}", |
| 339 | mp2pIntent.id()); | 347 | mp2pIntent.id()); |
| 340 | } | 348 | } |
| 341 | continue; | 349 | continue; |
| 342 | } | 350 | } |
| 343 | if (intent instanceof PointToPointIntent) { | 351 | if (intent instanceof PointToPointIntent) { |
| 344 | PointToPointIntent p2pIntent = (PointToPointIntent) intent; | 352 | PointToPointIntent p2pIntent = (PointToPointIntent) intent; |
| 345 | - log.debug("Intent synchronization: updating " + | 353 | + log.debug("SDN-IP Intent Synchronizer: updating " + |
| 346 | "in-memory Peer Intent {}", p2pIntent); | 354 | "in-memory Peer Intent {}", p2pIntent); |
| 347 | peerIntents.put(new IntentKey(intent), p2pIntent); | 355 | peerIntents.put(new IntentKey(intent), p2pIntent); |
| 348 | continue; | 356 | continue; |
| ... | @@ -353,33 +361,36 @@ public class IntentSynchronizer { | ... | @@ -353,33 +361,36 @@ public class IntentSynchronizer { |
| 353 | IntentOperations.Builder builder = IntentOperations.builder(); | 361 | IntentOperations.Builder builder = IntentOperations.builder(); |
| 354 | for (Intent intent : deleteIntents) { | 362 | for (Intent intent : deleteIntents) { |
| 355 | builder.addWithdrawOperation(intent.id()); | 363 | builder.addWithdrawOperation(intent.id()); |
| 356 | - log.debug("Intent synchronization: deleting Intent {}", | 364 | + log.debug("SDN-IP Intent Synchronizer: withdrawing intent: {}", |
| 357 | - intent); | 365 | + intent); |
| 358 | } | 366 | } |
| 359 | if (!isElectedLeader) { | 367 | if (!isElectedLeader) { |
| 360 | isActivatedLeader = false; | 368 | isActivatedLeader = false; |
| 361 | return; | 369 | return; |
| 362 | } | 370 | } |
| 363 | - intentService.execute(builder.build()); | 371 | + intentOperations = builder.build(); |
| 372 | + intentService.execute(intentOperations); | ||
| 364 | 373 | ||
| 365 | // Add Intents | 374 | // Add Intents |
| 366 | builder = IntentOperations.builder(); | 375 | builder = IntentOperations.builder(); |
| 367 | for (Intent intent : addIntents) { | 376 | for (Intent intent : addIntents) { |
| 368 | builder.addSubmitOperation(intent); | 377 | builder.addSubmitOperation(intent); |
| 369 | - log.debug("Intent synchronization: adding Intent {}", intent); | ||
| 370 | } | 378 | } |
| 371 | if (!isElectedLeader) { | 379 | if (!isElectedLeader) { |
| 372 | isActivatedLeader = false; | 380 | isActivatedLeader = false; |
| 373 | return; | 381 | return; |
| 374 | } | 382 | } |
| 375 | - intentService.execute(builder.build()); | 383 | + intentOperations = builder.build(); |
| 384 | + log.debug("SDN-IP Intent Synchronizer: submitting intents: {}", | ||
| 385 | + intentOperations); | ||
| 386 | + intentService.execute(intentOperations); | ||
| 376 | 387 | ||
| 377 | if (isElectedLeader) { | 388 | if (isElectedLeader) { |
| 378 | isActivatedLeader = true; // Allow push of Intents | 389 | isActivatedLeader = true; // Allow push of Intents |
| 379 | } else { | 390 | } else { |
| 380 | isActivatedLeader = false; | 391 | isActivatedLeader = false; |
| 381 | } | 392 | } |
| 382 | - log.debug("Syncing SDN-IP routes completed."); | 393 | + log.debug("SDN-IP intent synchronization completed"); |
| 383 | } | 394 | } |
| 384 | } | 395 | } |
| 385 | 396 | ... | ... |
-
Please register or login to post a comment