- Fix minor issues in ICMP handler
- Now use the flushFlow function to populate the tables
Change-Id: If4468aeadcc9b801f2f2c1f451b29ea8f4a1852b
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/GenericIpHandler.java b/src/main/java/net/onrc/onos/apps/segmentrouting/GenericIpHandler.java
index 0784144..b0b8cb3 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/GenericIpHandler.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/GenericIpHandler.java
@@ -104,6 +104,12 @@
*/
public void addRouteToHost(Switch sw, int destinationAddress, byte[] destinationMacAddress) {
+ // If we do not know the host, then we cannot set the forwarding rule
+ net.onrc.onos.core.topology.Host host = mutableTopology.getHostByMac(MACAddress.valueOf(destinationMacAddress));
+ if (host == null) {
+ return;
+ }
+
IOFSwitch ofSwitch = floodlightProvider.getMasterSwitch(sw.getDpid().value());
OFFactory factory = ofSwitch.getFactory();
@@ -158,13 +164,10 @@
*/
// Set output port
- net.onrc.onos.core.topology.Host host = mutableTopology.getHostByMac(MACAddress.valueOf(destinationMacAddress));
- if (host != null) {
- for (Port port: host.getAttachmentPoints()) {
- OFAction out = factory.actions().buildOutput()
- .setPort(OFPort.of(port.getPortNumber().shortValue())).build();
- actionList.add(out);
- }
+ for (Port port: host.getAttachmentPoints()) {
+ OFAction out = factory.actions().buildOutput()
+ .setPort(OFPort.of(port.getPortNumber().shortValue())).build();
+ actionList.add(out);
}
OFInstruction writeInstr = factory.instructions().buildWriteActions()