sangho
Committed by Gerrit Code Review

Pushes flow rules to the control switch when the switch is connected and available.

Change-Id: I7cc03a44e21b9dd67d40139ceea7a9b44201d7a8
......@@ -381,6 +381,7 @@ public class BgpRouter {
case DEVICE_AVAILABILITY_CHANGED:
if (deviceService.isAvailable(event.subject().id())) {
log.info("Device connected {}", event.subject().id());
if (event.subject().id().equals(deviceId)) {
processIntfFilters(true, configService.getInterfaces());
/* For test only - will be removed before Cardinal release */
......@@ -391,6 +392,11 @@ public class BgpRouter {
FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry);
updateFibEntry(Collections.singletonList(fibUpdate));
}
if (event.subject().id().equals(ctrlDeviceId)) {
connectivityManager.notifySwitchAvailable();
}
}
break;
// TODO other cases
......
......@@ -81,6 +81,23 @@ public class TunnellingConnectivityManager {
this.bgpSpeaker = bgpSpeaker;
}
public void start() {
packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 3);
}
public void stop() {
packetService.removeProcessor(processor);
// Should revoke packet requests in the future
}
/**
* Pushes the flow rules for forwarding BGP TCP packets to controller.
* It is called when switches are connected and available.
*/
public void notifySwitchAvailable() {
// control plane OVS is available, push default flows
TrafficSelector selectorDst = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPProtocol(IPv4.PROTOCOL_TCP)
......@@ -117,16 +134,6 @@ public class TunnellingConnectivityManager {
flowObjectiveService.forward(bgpSpeaker.connectPoint().deviceId(),
puntDst);
log.info("Sent punt forwarding objective to {}", bgpSpeaker.connectPoint().deviceId());
}
public void start() {
packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 3);
}
public void stop() {
packetService.removeProcessor(processor);
// Should revoke packet requests in the future
}
/**
......