Showing
2 changed files
with
23 additions
and
16 deletions
1 | package org.onlab.onos.net.trivial.impl; | 1 | package org.onlab.onos.net.trivial.impl; |
2 | 2 | ||
3 | +import static org.onlab.onos.net.host.HostEvent.Type.HOST_ADDED; | ||
4 | +import static org.onlab.onos.net.host.HostEvent.Type.HOST_MOVED; | ||
5 | +import static org.onlab.onos.net.host.HostEvent.Type.HOST_REMOVED; | ||
6 | +import static org.onlab.onos.net.host.HostEvent.Type.HOST_UPDATED; | ||
7 | + | ||
8 | +import java.util.Collections; | ||
9 | +import java.util.HashSet; | ||
10 | +import java.util.Map; | ||
11 | +import java.util.Set; | ||
12 | +import java.util.concurrent.ConcurrentHashMap; | ||
13 | + | ||
3 | import org.onlab.onos.net.ConnectPoint; | 14 | import org.onlab.onos.net.ConnectPoint; |
4 | import org.onlab.onos.net.DefaultHost; | 15 | import org.onlab.onos.net.DefaultHost; |
5 | import org.onlab.onos.net.DeviceId; | 16 | import org.onlab.onos.net.DeviceId; |
... | @@ -15,17 +26,6 @@ import com.google.common.collect.HashMultimap; | ... | @@ -15,17 +26,6 @@ import com.google.common.collect.HashMultimap; |
15 | import com.google.common.collect.ImmutableSet; | 26 | import com.google.common.collect.ImmutableSet; |
16 | import com.google.common.collect.Multimap; | 27 | import com.google.common.collect.Multimap; |
17 | 28 | ||
18 | -import java.util.Collections; | ||
19 | -import java.util.HashSet; | ||
20 | -import java.util.Map; | ||
21 | -import java.util.Set; | ||
22 | -import java.util.concurrent.ConcurrentHashMap; | ||
23 | - | ||
24 | -import static org.onlab.onos.net.host.HostEvent.Type.HOST_REMOVED; | ||
25 | -import static org.onlab.onos.net.host.HostEvent.Type.HOST_ADDED; | ||
26 | -import static org.onlab.onos.net.host.HostEvent.Type.HOST_UPDATED; | ||
27 | -import static org.onlab.onos.net.host.HostEvent.Type.HOST_MOVED; | ||
28 | - | ||
29 | /** | 29 | /** |
30 | * Manages inventory of end-station hosts using trivial in-memory | 30 | * Manages inventory of end-station hosts using trivial in-memory |
31 | * implementation. | 31 | * implementation. |
... | @@ -46,7 +46,7 @@ public class SimpleHostStore { | ... | @@ -46,7 +46,7 @@ public class SimpleHostStore { |
46 | * @return appropriate event or null if no change resulted | 46 | * @return appropriate event or null if no change resulted |
47 | */ | 47 | */ |
48 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, | 48 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, |
49 | - HostDescription hostDescription) { | 49 | + HostDescription hostDescription) { |
50 | Host host = hosts.get(hostId); | 50 | Host host = hosts.get(hostId); |
51 | if (host == null) { | 51 | if (host == null) { |
52 | return createHost(providerId, hostId, hostDescription); | 52 | return createHost(providerId, hostId, hostDescription); |
... | @@ -62,7 +62,7 @@ public class SimpleHostStore { | ... | @@ -62,7 +62,7 @@ public class SimpleHostStore { |
62 | descr.vlan(), | 62 | descr.vlan(), |
63 | descr.location(), | 63 | descr.location(), |
64 | descr.ipAddresses()); | 64 | descr.ipAddresses()); |
65 | - synchronized(this) { | 65 | + synchronized (this) { |
66 | hosts.put(hostId, newhost); | 66 | hosts.put(hostId, newhost); |
67 | locations.put(descr.location(), newhost); | 67 | locations.put(descr.location(), newhost); |
68 | } | 68 | } |
... | @@ -104,7 +104,7 @@ public class SimpleHostStore { | ... | @@ -104,7 +104,7 @@ public class SimpleHostStore { |
104 | * @return remove even or null if host was not found | 104 | * @return remove even or null if host was not found |
105 | */ | 105 | */ |
106 | HostEvent removeHost(HostId hostId) { | 106 | HostEvent removeHost(HostId hostId) { |
107 | - synchronized(this) { | 107 | + synchronized (this) { |
108 | Host host = hosts.remove(hostId); | 108 | Host host = hosts.remove(hostId); |
109 | if (host != null) { | 109 | if (host != null) { |
110 | locations.remove((host.location()), host); | 110 | locations.remove((host.location()), host); |
... | @@ -216,4 +216,4 @@ public class SimpleHostStore { | ... | @@ -216,4 +216,4 @@ public class SimpleHostStore { |
216 | return hostset; | 216 | return hostset; |
217 | } | 217 | } |
218 | 218 | ||
219 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
219 | +} | ... | ... |
... | @@ -7,6 +7,7 @@ import org.projectfloodlight.openflow.protocol.OFPacketIn; | ... | @@ -7,6 +7,7 @@ import org.projectfloodlight.openflow.protocol.OFPacketIn; |
7 | import org.projectfloodlight.openflow.protocol.OFPacketOut; | 7 | import org.projectfloodlight.openflow.protocol.OFPacketOut; |
8 | import org.projectfloodlight.openflow.protocol.action.OFAction; | 8 | import org.projectfloodlight.openflow.protocol.action.OFAction; |
9 | import org.projectfloodlight.openflow.protocol.action.OFActionOutput; | 9 | import org.projectfloodlight.openflow.protocol.action.OFActionOutput; |
10 | +import org.projectfloodlight.openflow.protocol.match.MatchField; | ||
10 | import org.projectfloodlight.openflow.types.OFBufferId; | 11 | import org.projectfloodlight.openflow.types.OFBufferId; |
11 | import org.projectfloodlight.openflow.types.OFPort; | 12 | import org.projectfloodlight.openflow.types.OFPort; |
12 | 13 | ||
... | @@ -83,12 +84,18 @@ public final class DefaultPacketContext implements PacketContext { | ... | @@ -83,12 +84,18 @@ public final class DefaultPacketContext implements PacketContext { |
83 | 84 | ||
84 | @Override | 85 | @Override |
85 | public Integer inPort() { | 86 | public Integer inPort() { |
86 | - return pktin.getInPort().getPortNumber(); | 87 | + try { |
88 | + return pktin.getInPort().getPortNumber(); | ||
89 | + } catch (UnsupportedOperationException e) { | ||
90 | + return pktin.getMatch().get(MatchField.IN_PORT).getPortNumber(); | ||
91 | + } | ||
87 | } | 92 | } |
88 | 93 | ||
89 | @Override | 94 | @Override |
90 | public byte[] unparsed() { | 95 | public byte[] unparsed() { |
96 | + | ||
91 | return pktin.getData().clone(); | 97 | return pktin.getData().clone(); |
98 | + | ||
92 | } | 99 | } |
93 | 100 | ||
94 | private OFActionOutput buildOutput(Integer port) { | 101 | private OFActionOutput buildOutput(Integer port) { | ... | ... |
-
Please register or login to post a comment