Committed by
Gerrit Code Review
Pushes flow rules to the control switch when the switch is connected and available.
Change-Id: I7cc03a44e21b9dd67d40139ceea7a9b44201d7a8
Showing
2 changed files
with
23 additions
and
10 deletions
... | @@ -381,6 +381,7 @@ public class BgpRouter { | ... | @@ -381,6 +381,7 @@ public class BgpRouter { |
381 | case DEVICE_AVAILABILITY_CHANGED: | 381 | case DEVICE_AVAILABILITY_CHANGED: |
382 | if (deviceService.isAvailable(event.subject().id())) { | 382 | if (deviceService.isAvailable(event.subject().id())) { |
383 | log.info("Device connected {}", event.subject().id()); | 383 | log.info("Device connected {}", event.subject().id()); |
384 | + if (event.subject().id().equals(deviceId)) { | ||
384 | processIntfFilters(true, configService.getInterfaces()); | 385 | processIntfFilters(true, configService.getInterfaces()); |
385 | 386 | ||
386 | /* For test only - will be removed before Cardinal release */ | 387 | /* For test only - will be removed before Cardinal release */ |
... | @@ -391,6 +392,11 @@ public class BgpRouter { | ... | @@ -391,6 +392,11 @@ public class BgpRouter { |
391 | FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry); | 392 | FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry); |
392 | updateFibEntry(Collections.singletonList(fibUpdate)); | 393 | updateFibEntry(Collections.singletonList(fibUpdate)); |
393 | } | 394 | } |
395 | + | ||
396 | + if (event.subject().id().equals(ctrlDeviceId)) { | ||
397 | + connectivityManager.notifySwitchAvailable(); | ||
398 | + } | ||
399 | + } | ||
394 | break; | 400 | break; |
395 | 401 | ||
396 | // TODO other cases | 402 | // TODO other cases | ... | ... |
... | @@ -81,6 +81,23 @@ public class TunnellingConnectivityManager { | ... | @@ -81,6 +81,23 @@ public class TunnellingConnectivityManager { |
81 | 81 | ||
82 | this.bgpSpeaker = bgpSpeaker; | 82 | this.bgpSpeaker = bgpSpeaker; |
83 | 83 | ||
84 | + } | ||
85 | + | ||
86 | + public void start() { | ||
87 | + packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 3); | ||
88 | + } | ||
89 | + | ||
90 | + public void stop() { | ||
91 | + packetService.removeProcessor(processor); | ||
92 | + // Should revoke packet requests in the future | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * Pushes the flow rules for forwarding BGP TCP packets to controller. | ||
97 | + * It is called when switches are connected and available. | ||
98 | + */ | ||
99 | + public void notifySwitchAvailable() { | ||
100 | + // control plane OVS is available, push default flows | ||
84 | TrafficSelector selectorDst = DefaultTrafficSelector.builder() | 101 | TrafficSelector selectorDst = DefaultTrafficSelector.builder() |
85 | .matchEthType(Ethernet.TYPE_IPV4) | 102 | .matchEthType(Ethernet.TYPE_IPV4) |
86 | .matchIPProtocol(IPv4.PROTOCOL_TCP) | 103 | .matchIPProtocol(IPv4.PROTOCOL_TCP) |
... | @@ -117,16 +134,6 @@ public class TunnellingConnectivityManager { | ... | @@ -117,16 +134,6 @@ public class TunnellingConnectivityManager { |
117 | flowObjectiveService.forward(bgpSpeaker.connectPoint().deviceId(), | 134 | flowObjectiveService.forward(bgpSpeaker.connectPoint().deviceId(), |
118 | puntDst); | 135 | puntDst); |
119 | log.info("Sent punt forwarding objective to {}", bgpSpeaker.connectPoint().deviceId()); | 136 | log.info("Sent punt forwarding objective to {}", bgpSpeaker.connectPoint().deviceId()); |
120 | - | ||
121 | - } | ||
122 | - | ||
123 | - public void start() { | ||
124 | - packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 3); | ||
125 | - } | ||
126 | - | ||
127 | - public void stop() { | ||
128 | - packetService.removeProcessor(processor); | ||
129 | - // Should revoke packet requests in the future | ||
130 | } | 137 | } |
131 | 138 | ||
132 | /** | 139 | /** | ... | ... |
-
Please register or login to post a comment