Remove IP addresses from the Port interface.
Addresses are now indirectly associated with Ports.
Showing
4 changed files
with
4 additions
and
61 deletions
... | @@ -2,13 +2,7 @@ package org.onlab.onos.net; | ... | @@ -2,13 +2,7 @@ package org.onlab.onos.net; |
2 | 2 | ||
3 | import static com.google.common.base.MoreObjects.toStringHelper; | 3 | import static com.google.common.base.MoreObjects.toStringHelper; |
4 | 4 | ||
5 | -import java.util.Collections; | ||
6 | import java.util.Objects; | 5 | import java.util.Objects; |
7 | -import java.util.Set; | ||
8 | - | ||
9 | -import org.onlab.packet.IpPrefix; | ||
10 | - | ||
11 | -import com.google.common.collect.ImmutableSet; | ||
12 | 6 | ||
13 | /** | 7 | /** |
14 | * Default port implementation. | 8 | * Default port implementation. |
... | @@ -19,36 +13,18 @@ public class DefaultPort implements Port { | ... | @@ -19,36 +13,18 @@ public class DefaultPort implements Port { |
19 | private final PortNumber number; | 13 | private final PortNumber number; |
20 | private final boolean isEnabled; | 14 | private final boolean isEnabled; |
21 | 15 | ||
22 | - // Attributes | ||
23 | - private final Set<IpPrefix> ipAddresses; | ||
24 | - | ||
25 | - /** | ||
26 | - * Creates a network element attributed to the specified provider. | ||
27 | - * | ||
28 | - * @param element parent network element | ||
29 | - * @param number port number | ||
30 | - * @param isEnabled indicator whether the port is up and active | ||
31 | - */ | ||
32 | - public DefaultPort(Element element, PortNumber number, | ||
33 | - boolean isEnabled) { | ||
34 | - this(element, number, isEnabled, null); | ||
35 | - } | ||
36 | - | ||
37 | /** | 16 | /** |
38 | * Creates a network element attributed to the specified provider. | 17 | * Creates a network element attributed to the specified provider. |
39 | * | 18 | * |
40 | * @param element parent network element | 19 | * @param element parent network element |
41 | * @param number port number | 20 | * @param number port number |
42 | * @param isEnabled indicator whether the port is up and active | 21 | * @param isEnabled indicator whether the port is up and active |
43 | - * @param ipAddresses set of IP addresses assigned to the port | ||
44 | */ | 22 | */ |
45 | public DefaultPort(Element element, PortNumber number, | 23 | public DefaultPort(Element element, PortNumber number, |
46 | - boolean isEnabled, Set<IpPrefix> ipAddresses) { | 24 | + boolean isEnabled) { |
47 | this.element = element; | 25 | this.element = element; |
48 | this.number = number; | 26 | this.number = number; |
49 | this.isEnabled = isEnabled; | 27 | this.isEnabled = isEnabled; |
50 | - this.ipAddresses = (ipAddresses == null) ? Collections.<IpPrefix>emptySet() : | ||
51 | - ImmutableSet.copyOf(ipAddresses); | ||
52 | } | 28 | } |
53 | 29 | ||
54 | @Override | 30 | @Override |
... | @@ -94,9 +70,4 @@ public class DefaultPort implements Port { | ... | @@ -94,9 +70,4 @@ public class DefaultPort implements Port { |
94 | return element; | 70 | return element; |
95 | } | 71 | } |
96 | 72 | ||
97 | - @Override | ||
98 | - public Set<IpPrefix> ipAddresses() { | ||
99 | - return ipAddresses; | ||
100 | - } | ||
101 | - | ||
102 | } | 73 | } | ... | ... |
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | -import java.util.Set; | ||
4 | - | ||
5 | -import org.onlab.packet.IpPrefix; | ||
6 | 3 | ||
7 | /** | 4 | /** |
8 | * Abstraction of a network port. | 5 | * Abstraction of a network port. |
... | @@ -32,12 +29,4 @@ public interface Port { | ... | @@ -32,12 +29,4 @@ public interface Port { |
32 | 29 | ||
33 | // set of port attributes | 30 | // set of port attributes |
34 | 31 | ||
35 | - /** | ||
36 | - * Returns the set of IP addresses that are logically configured on this | ||
37 | - * port. | ||
38 | - * | ||
39 | - * @return the set of IP addresses configured on the port. The set is empty | ||
40 | - * if no addresses are configured. | ||
41 | - */ | ||
42 | - Set<IpPrefix> ipAddresses(); | ||
43 | } | 32 | } | ... | ... |
... | @@ -6,7 +6,6 @@ import java.util.concurrent.TimeUnit; | ... | @@ -6,7 +6,6 @@ import java.util.concurrent.TimeUnit; |
6 | 6 | ||
7 | import org.jboss.netty.util.Timeout; | 7 | import org.jboss.netty.util.Timeout; |
8 | import org.jboss.netty.util.TimerTask; | 8 | import org.jboss.netty.util.TimerTask; |
9 | -import org.onlab.onos.net.Device; | ||
10 | import org.onlab.onos.net.Host; | 9 | import org.onlab.onos.net.Host; |
11 | import org.onlab.onos.net.Port; | 10 | import org.onlab.onos.net.Port; |
12 | import org.onlab.onos.net.device.DeviceService; | 11 | import org.onlab.onos.net.device.DeviceService; |
... | @@ -89,7 +88,7 @@ public class HostMonitor implements TimerTask { | ... | @@ -89,7 +88,7 @@ public class HostMonitor implements TimerTask { |
89 | // else (ip isn't in any configured subnet) | 88 | // else (ip isn't in any configured subnet) |
90 | // send out all non-external edge ports | 89 | // send out all non-external edge ports |
91 | 90 | ||
92 | - for (Device device : deviceService.getDevices()) { | 91 | + /*for (Device device : deviceService.getDevices()) { |
93 | for (Port port : deviceService.getPorts(device.id())) { | 92 | for (Port port : deviceService.getPorts(device.id())) { |
94 | for (IpPrefix ip : port.ipAddresses()) { | 93 | for (IpPrefix ip : port.ipAddresses()) { |
95 | if (ip.contains(targetIp)) { | 94 | if (ip.contains(targetIp)) { |
... | @@ -98,7 +97,7 @@ public class HostMonitor implements TimerTask { | ... | @@ -98,7 +97,7 @@ public class HostMonitor implements TimerTask { |
98 | } | 97 | } |
99 | } | 98 | } |
100 | } | 99 | } |
101 | - } | 100 | + }*/ |
102 | 101 | ||
103 | } | 102 | } |
104 | 103 | ... | ... |
1 | package org.onlab.onos.store.device.impl; | 1 | package org.onlab.onos.store.device.impl; |
2 | 2 | ||
3 | -import java.util.ArrayList; | ||
4 | -import java.util.Collection; | ||
5 | - | ||
6 | import org.onlab.onos.net.DefaultPort; | 3 | import org.onlab.onos.net.DefaultPort; |
7 | import org.onlab.onos.net.Element; | 4 | import org.onlab.onos.net.Element; |
8 | import org.onlab.onos.net.PortNumber; | 5 | import org.onlab.onos.net.PortNumber; |
9 | -import org.onlab.packet.IpPrefix; | ||
10 | 6 | ||
11 | import com.esotericsoftware.kryo.Kryo; | 7 | import com.esotericsoftware.kryo.Kryo; |
12 | import com.esotericsoftware.kryo.Serializer; | 8 | import com.esotericsoftware.kryo.Serializer; |
13 | import com.esotericsoftware.kryo.io.Input; | 9 | import com.esotericsoftware.kryo.io.Input; |
14 | import com.esotericsoftware.kryo.io.Output; | 10 | import com.esotericsoftware.kryo.io.Output; |
15 | -import com.esotericsoftware.kryo.serializers.CollectionSerializer; | ||
16 | -import com.google.common.collect.ImmutableSet; | ||
17 | 11 | ||
18 | // TODO move to util, etc. | 12 | // TODO move to util, etc. |
19 | /** | 13 | /** |
... | @@ -22,10 +16,6 @@ import com.google.common.collect.ImmutableSet; | ... | @@ -22,10 +16,6 @@ import com.google.common.collect.ImmutableSet; |
22 | public final class DefaultPortSerializer extends | 16 | public final class DefaultPortSerializer extends |
23 | Serializer<DefaultPort> { | 17 | Serializer<DefaultPort> { |
24 | 18 | ||
25 | - private final CollectionSerializer ipAddrSerializer | ||
26 | - = new CollectionSerializer(IpPrefix.class, | ||
27 | - new IpPrefixSerializer(), false); | ||
28 | - | ||
29 | /** | 19 | /** |
30 | * Default constructor. | 20 | * Default constructor. |
31 | */ | 21 | */ |
... | @@ -39,8 +29,6 @@ public final class DefaultPortSerializer extends | ... | @@ -39,8 +29,6 @@ public final class DefaultPortSerializer extends |
39 | kryo.writeClassAndObject(output, object.element()); | 29 | kryo.writeClassAndObject(output, object.element()); |
40 | kryo.writeObject(output, object.number()); | 30 | kryo.writeObject(output, object.number()); |
41 | output.writeBoolean(object.isEnabled()); | 31 | output.writeBoolean(object.isEnabled()); |
42 | - kryo.writeObject(output, object.ipAddresses(), | ||
43 | - ipAddrSerializer); | ||
44 | } | 32 | } |
45 | 33 | ||
46 | @Override | 34 | @Override |
... | @@ -49,11 +37,7 @@ public final class DefaultPortSerializer extends | ... | @@ -49,11 +37,7 @@ public final class DefaultPortSerializer extends |
49 | Element element = (Element) kryo.readClassAndObject(input); | 37 | Element element = (Element) kryo.readClassAndObject(input); |
50 | PortNumber number = kryo.readObject(input, PortNumber.class); | 38 | PortNumber number = kryo.readObject(input, PortNumber.class); |
51 | boolean isEnabled = input.readBoolean(); | 39 | boolean isEnabled = input.readBoolean(); |
52 | - @SuppressWarnings("unchecked") | ||
53 | - Collection<IpPrefix> ipAddresses = kryo.readObject( | ||
54 | - input, ArrayList.class, ipAddrSerializer); | ||
55 | 40 | ||
56 | - return new DefaultPort(element, number, isEnabled, | 41 | + return new DefaultPort(element, number, isEnabled); |
57 | - ImmutableSet.copyOf(ipAddresses)); | ||
58 | } | 42 | } |
59 | } | 43 | } | ... | ... |
-
Please register or login to post a comment