add edges from flowentry to ports and switches
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
index e58b19f..640c7e3 100644
--- a/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
@@ -54,6 +54,10 @@
@JsonIgnore
@GremlinGroovy("_().out('on').out('host')")
public Iterable<IDeviceObject> getDevices();
+
+ @JsonIgnore
+ @Incidence(label="switch",direction = Direction.IN)
+ public Iterable<IFlowEntry> getFlowEntries();
}
public interface IPortObject extends IBaseObject{
@@ -94,6 +98,14 @@
@Adjacency(label="host")
public void removeDevice(final IDeviceObject device);
+ @JsonIgnore
+ @Incidence(label="inport",direction = Direction.IN)
+ public Iterable<IFlowEntry> getInFlowEntries();
+
+ @JsonIgnore
+ @Incidence(label="outport",direction = Direction.IN)
+ public Iterable<IFlowEntry> getOutFlowEntries();
+
// @JsonIgnore
// @Adjacency(label="link")
// public Iterable<ILinkObject> getLinks();
@@ -187,6 +199,10 @@
@Adjacency(label="flow", direction=Direction.IN)
public void removeFlowEntry(final IFlowEntry flowEntry);
+
+ @JsonIgnore
+ @GremlinGroovy("_().in('flow').out('switch')")
+ public Iterable<IDeviceObject> getSwitches();
}
public interface IFlowEntry extends IBaseObject {
@@ -267,5 +283,24 @@
@Property("actionOutput")
public void setActionOutput(Short actionOutput);
+
+ @Adjacency(label="switch")
+ public ISwitchObject getSwitch();
+
+ @Adjacency(label="switch")
+ public void setSwitch(ISwitchObject sw);
+
+ @Adjacency(label="inport")
+ public IPortObject getInPort();
+
+ @Adjacency(label="inport")
+ public void setInPort(IPortObject port);
+
+ @Adjacency(label="outport")
+ public IPortObject getOutPort();
+
+ @Adjacency(label="switch")
+ public void setOutPort(IPortObject port);
+
}
}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index 405af1a..3eec2ec 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -22,6 +22,8 @@
import net.floodlightcontroller.core.INetMapStorage;
import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowEntry;
import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
@@ -702,23 +704,39 @@
// - flowEntry.matchDstMac()
// - flowEntry.actionOutput()
//
+ ISwitchObject sw = conn.utils().searchSwitch(conn,flowEntry.dpid().toString());
flowEntryObj.setSwitchDpid(flowEntry.dpid().toString());
- if (flowEntry.flowEntryMatch().matchInPort())
- flowEntryObj.setMatchInPort(flowEntry.flowEntryMatch().inPort().value());
- if (flowEntry.flowEntryMatch().matchEthernetFrameType())
- flowEntryObj.setMatchEthernetFrameType(flowEntry.flowEntryMatch().ethernetFrameType());
- if (flowEntry.flowEntryMatch().matchSrcIPv4Net())
- flowEntryObj.setMatchSrcIPv4Net(flowEntry.flowEntryMatch().srcIPv4Net().toString());
- if (flowEntry.flowEntryMatch().matchDstIPv4Net())
- flowEntryObj.setMatchDstIPv4Net(flowEntry.flowEntryMatch().dstIPv4Net().toString());
- if (flowEntry.flowEntryMatch().matchSrcMac())
- flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
- if (flowEntry.flowEntryMatch().matchDstMac())
- flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+
+ flowEntryObj.setSwitch(sw);
+ if (flowEntry.flowEntryMatch().matchInPort()) {
+ IPortObject inport = conn.utils().searchPort(conn,flowEntry.dpid().toString(),
+ flowEntry.flowEntryMatch().inPort().value());
+ flowEntryObj.setMatchInPort(flowEntry.flowEntryMatch().inPort().value());
+ flowEntryObj.setInPort(inport);
+ }
+ if (flowEntry.flowEntryMatch().matchEthernetFrameType()) {
+ flowEntryObj.setMatchEthernetFrameType(flowEntry.flowEntryMatch().ethernetFrameType());
+ }
+ if (flowEntry.flowEntryMatch().matchSrcIPv4Net()) {
+ flowEntryObj.setMatchSrcIPv4Net(flowEntry.flowEntryMatch().srcIPv4Net().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchDstIPv4Net()) {
+ flowEntryObj.setMatchDstIPv4Net(flowEntry.flowEntryMatch().dstIPv4Net().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchSrcMac()) {
+ flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchDstMac()) {
+ flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+ }
for (FlowEntryAction fa : flowEntry.flowEntryActions()) {
- if (fa.actionOutput() != null)
- flowEntryObj.setActionOutput(fa.actionOutput().port().value());
+ if (fa.actionOutput() != null) {
+ IPortObject outport = conn.utils().searchPort(conn,flowEntry.dpid().toString(),
+ fa.actionOutput().port().value());
+ flowEntryObj.setActionOutput(fa.actionOutput().port().value());
+ flowEntryObj.setOutPort(outport);
+ }
}
// TODO: Hacks with hard-coded state names!
if (found)