Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
Showing
4 changed files
with
12 additions
and
39 deletions
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | -import java.util.Set; | ||
4 | - | ||
5 | /** | 3 | /** |
6 | * Abstraction of a network port. | 4 | * Abstraction of a network port. |
7 | */ | 5 | */ |
8 | public interface Port { | 6 | public interface Port { |
9 | 7 | ||
10 | /** | 8 | /** |
11 | - * Port state. | ||
12 | - */ | ||
13 | - enum State { | ||
14 | - UP, DOWN, BLOCKED, UNKNOWN | ||
15 | - } | ||
16 | - | ||
17 | - /** | ||
18 | * Returns the port number. | 9 | * Returns the port number. |
19 | * | 10 | * |
20 | * @return port number | 11 | * @return port number |
... | @@ -22,13 +13,6 @@ public interface Port { | ... | @@ -22,13 +13,6 @@ public interface Port { |
22 | PortNumber number(); | 13 | PortNumber number(); |
23 | 14 | ||
24 | /** | 15 | /** |
25 | - * Returns the port state(s). | ||
26 | - * | ||
27 | - * @return port state set | ||
28 | - */ | ||
29 | - Set<State> state(); | ||
30 | - | ||
31 | - /** | ||
32 | * Indicates whether or not the port is currently up and active. | 16 | * Indicates whether or not the port is currently up and active. |
33 | * | 17 | * |
34 | * @return true if the port is operational | 18 | * @return true if the port is operational |
... | @@ -36,13 +20,6 @@ public interface Port { | ... | @@ -36,13 +20,6 @@ public interface Port { |
36 | boolean isEnabled(); | 20 | boolean isEnabled(); |
37 | 21 | ||
38 | /** | 22 | /** |
39 | - * Indicates whether or not the port is administratively blocked. | ||
40 | - * | ||
41 | - * @return true if the port is blocked | ||
42 | - */ | ||
43 | - boolean isBlocked(); | ||
44 | - | ||
45 | - /** | ||
46 | * Returns the identifier of the network element to which this port belongs. | 23 | * Returns the identifier of the network element to which this port belongs. |
47 | * | 24 | * |
48 | * @return parent network element | 25 | * @return parent network element | ... | ... |
1 | package org.onlab.onos.net.device; | 1 | package org.onlab.onos.net.device; |
2 | 2 | ||
3 | -import com.google.common.collect.ImmutableSet; | ||
4 | -import org.onlab.onos.net.Port; | ||
5 | import org.onlab.onos.net.PortNumber; | 3 | import org.onlab.onos.net.PortNumber; |
6 | 4 | ||
7 | -import java.util.Set; | ||
8 | - | ||
9 | /** | 5 | /** |
10 | * Default implementation of immutable port description. | 6 | * Default implementation of immutable port description. |
11 | */ | 7 | */ |
12 | public class DefaultPortDescription implements PortDescription { | 8 | public class DefaultPortDescription implements PortDescription { |
13 | 9 | ||
14 | private final PortNumber number; | 10 | private final PortNumber number; |
15 | - private final Set<Port.State> state; | 11 | + private final boolean isEnabled; |
16 | 12 | ||
17 | - public DefaultPortDescription(PortNumber number, Set<Port.State> state) { | 13 | + public DefaultPortDescription(PortNumber number, boolean isEnabled) { |
18 | this.number = number; | 14 | this.number = number; |
19 | - this.state = ImmutableSet.copyOf(state); | 15 | + this.isEnabled = isEnabled; |
20 | } | 16 | } |
21 | 17 | ||
22 | @Override | 18 | @Override |
... | @@ -25,8 +21,8 @@ public class DefaultPortDescription implements PortDescription { | ... | @@ -25,8 +21,8 @@ public class DefaultPortDescription implements PortDescription { |
25 | } | 21 | } |
26 | 22 | ||
27 | @Override | 23 | @Override |
28 | - public Set<Port.State> portState() { | 24 | + public boolean isEnabled() { |
29 | - return state; | 25 | + return isEnabled; |
30 | } | 26 | } |
31 | 27 | ||
32 | } | 28 | } | ... | ... |
1 | package org.onlab.onos.net.device; | 1 | package org.onlab.onos.net.device; |
2 | 2 | ||
3 | -import org.onlab.onos.net.Port; | ||
4 | import org.onlab.onos.net.PortNumber; | 3 | import org.onlab.onos.net.PortNumber; |
5 | 4 | ||
6 | -import java.util.Set; | ||
7 | - | ||
8 | /** | 5 | /** |
9 | * Information about a port. | 6 | * Information about a port. |
10 | */ | 7 | */ |
... | @@ -20,10 +17,10 @@ public interface PortDescription { | ... | @@ -20,10 +17,10 @@ public interface PortDescription { |
20 | PortNumber portNumber(); | 17 | PortNumber portNumber(); |
21 | 18 | ||
22 | /** | 19 | /** |
23 | - * Returns the port state set. | 20 | + * Indicates whether or not the port is up and active. |
24 | * | 21 | * |
25 | - * @return set of port states | 22 | + * @return true if the port is active and has carrier signal |
26 | */ | 23 | */ |
27 | - Set<Port.State> portState(); | 24 | + boolean isEnabled(); |
28 | 25 | ||
29 | } | 26 | } | ... | ... |
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
... | @@ -50,6 +50,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -50,6 +50,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
50 | 50 | ||
51 | private DeviceProviderService providerService; | 51 | private DeviceProviderService providerService; |
52 | 52 | ||
53 | + private OpenFlowSwitchListener listener = new InternalDeviceProvider(); | ||
54 | + | ||
53 | /** | 55 | /** |
54 | * Creates an OpenFlow device provider. | 56 | * Creates an OpenFlow device provider. |
55 | */ | 57 | */ |
... | @@ -60,13 +62,14 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -60,13 +62,14 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
60 | @Activate | 62 | @Activate |
61 | public void activate() { | 63 | public void activate() { |
62 | providerService = providerRegistry.register(this); | 64 | providerService = providerRegistry.register(this); |
63 | - controller.addListener(new InternalDeviceProvider()); | 65 | + controller.addListener(listener); |
64 | log.info("Started"); | 66 | log.info("Started"); |
65 | } | 67 | } |
66 | 68 | ||
67 | @Deactivate | 69 | @Deactivate |
68 | public void deactivate() { | 70 | public void deactivate() { |
69 | providerRegistry.unregister(this); | 71 | providerRegistry.unregister(this); |
72 | + controller.removeListener(listener); | ||
70 | providerService = null; | 73 | providerService = null; |
71 | log.info("Stopped"); | 74 | log.info("Stopped"); |
72 | } | 75 | } | ... | ... |
-
Please register or login to post a comment