Showing
11 changed files
with
141 additions
and
70 deletions
... | @@ -24,7 +24,7 @@ public class DeviceIdCompleter implements Completer { | ... | @@ -24,7 +24,7 @@ public class DeviceIdCompleter implements Completer { |
24 | Iterator<Device> it = service.getDevices().iterator(); | 24 | Iterator<Device> it = service.getDevices().iterator(); |
25 | SortedSet<String> strings = delegate.getStrings(); | 25 | SortedSet<String> strings = delegate.getStrings(); |
26 | while (it.hasNext()) { | 26 | while (it.hasNext()) { |
27 | - strings.add(it.next().id().uri().toString()); | 27 | + strings.add(it.next().id().toString()); |
28 | } | 28 | } |
29 | 29 | ||
30 | // Now let the completer do the work for figuring out what to offer. | 30 | // Now let the completer do the work for figuring out what to offer. | ... | ... |
... | @@ -2,10 +2,15 @@ package org.onlab.onos.cli.net; | ... | @@ -2,10 +2,15 @@ package org.onlab.onos.cli.net; |
2 | 2 | ||
3 | import org.apache.karaf.shell.commands.Argument; | 3 | import org.apache.karaf.shell.commands.Argument; |
4 | import org.apache.karaf.shell.commands.Command; | 4 | import org.apache.karaf.shell.commands.Command; |
5 | -import org.onlab.onos.cli.AbstractShellCommand; | 5 | +import org.onlab.onos.net.Device; |
6 | import org.onlab.onos.net.Port; | 6 | import org.onlab.onos.net.Port; |
7 | import org.onlab.onos.net.device.DeviceService; | 7 | import org.onlab.onos.net.device.DeviceService; |
8 | 8 | ||
9 | +import java.util.ArrayList; | ||
10 | +import java.util.Collections; | ||
11 | +import java.util.Comparator; | ||
12 | +import java.util.List; | ||
13 | + | ||
9 | import static org.onlab.onos.net.DeviceId.deviceId; | 14 | import static org.onlab.onos.net.DeviceId.deviceId; |
10 | 15 | ||
11 | /** | 16 | /** |
... | @@ -13,21 +18,42 @@ import static org.onlab.onos.net.DeviceId.deviceId; | ... | @@ -13,21 +18,42 @@ import static org.onlab.onos.net.DeviceId.deviceId; |
13 | */ | 18 | */ |
14 | @Command(scope = "onos", name = "ports", | 19 | @Command(scope = "onos", name = "ports", |
15 | description = "Lists all ports of a device") | 20 | description = "Lists all ports of a device") |
16 | -public class DevicePortsListCommand extends AbstractShellCommand { | 21 | +public class DevicePortsListCommand extends DevicesListCommand { |
17 | 22 | ||
18 | - private static final String FMT = "port=%s, state=%s"; | 23 | + private static final String FMT = " port=%s, state=%s"; |
19 | 24 | ||
20 | @Argument(index = 0, name = "deviceId", description = "Device ID", | 25 | @Argument(index = 0, name = "deviceId", description = "Device ID", |
21 | - required = true, multiValued = false) | 26 | + required = false, multiValued = false) |
22 | - String deviceId = null; | 27 | + String uri = null; |
28 | + | ||
29 | + private static final Comparator<Port> PORT_COMPARATOR = new Comparator<Port>() { | ||
30 | + @Override | ||
31 | + public int compare(Port p1, Port p2) { | ||
32 | + long delta = p1.number().toLong() - p2.number().toLong(); | ||
33 | + return delta == 0 ? 0 : (delta < 0 ? -1 : +1); | ||
34 | + } | ||
35 | + }; | ||
23 | 36 | ||
24 | @Override | 37 | @Override |
25 | protected Object doExecute() throws Exception { | 38 | protected Object doExecute() throws Exception { |
26 | DeviceService service = getService(DeviceService.class); | 39 | DeviceService service = getService(DeviceService.class); |
27 | - Iterable<Port> ports = service.getPorts(deviceId(deviceId)); | 40 | + if (uri == null) { |
41 | + for (Device device : service.getDevices()) { | ||
42 | + printDevicePorts(service, device); | ||
43 | + } | ||
44 | + } else { | ||
45 | + printDevicePorts(service, service.getDevice(deviceId(uri))); | ||
46 | + } | ||
47 | + return null; | ||
48 | + } | ||
49 | + | ||
50 | + private void printDevicePorts(DeviceService service, Device device) { | ||
51 | + List<Port> ports = new ArrayList<>(service.getPorts(device.id())); | ||
52 | + Collections.sort(ports, PORT_COMPARATOR); | ||
53 | + printDevice(device, service.isAvailable(device.id())); | ||
28 | for (Port port : ports) { | 54 | for (Port port : ports) { |
29 | print(FMT, port.number(), port.isEnabled() ? "enabled" : "disabled"); | 55 | print(FMT, port.number(), port.isEnabled() ? "enabled" : "disabled"); |
30 | } | 56 | } |
31 | - return null; | ||
32 | } | 57 | } |
58 | + | ||
33 | } | 59 | } | ... | ... |
... | @@ -13,14 +13,27 @@ import org.onlab.onos.net.device.DeviceService; | ... | @@ -13,14 +13,27 @@ import org.onlab.onos.net.device.DeviceService; |
13 | public class DevicesListCommand extends AbstractShellCommand { | 13 | public class DevicesListCommand extends AbstractShellCommand { |
14 | 14 | ||
15 | private static final String FMT = | 15 | private static final String FMT = |
16 | - "id=%s, type=%s, mfr=%s, hw=%s, sw=%s, serial=%s"; | 16 | + "id=%s, available=%s, type=%s, mfr=%s, hw=%s, sw=%s, serial=%s"; |
17 | 17 | ||
18 | @Override | 18 | @Override |
19 | protected Object doExecute() throws Exception { | 19 | protected Object doExecute() throws Exception { |
20 | - for (Device device : getService(DeviceService.class).getDevices()) { | 20 | + DeviceService service = getService(DeviceService.class); |
21 | - print(FMT, device.id().uri(), device.type(), device.manufacturer(), | 21 | + for (Device device : service.getDevices()) { |
22 | - device.hwVersion(), device.swVersion(), device.serialNumber()); | 22 | + printDevice(device, service.isAvailable(device.id())); |
23 | } | 23 | } |
24 | return null; | 24 | return null; |
25 | } | 25 | } |
26 | + | ||
27 | + /** | ||
28 | + * Prints information about the specified device. | ||
29 | + * | ||
30 | + * @param device infrastructure device | ||
31 | + * @param isAvailable true of device is available | ||
32 | + */ | ||
33 | + protected void printDevice(Device device, boolean isAvailable) { | ||
34 | + print(FMT, device.id(), isAvailable, device.type(), | ||
35 | + device.manufacturer(), device.hwVersion(), device.swVersion(), | ||
36 | + device.serialNumber()); | ||
37 | + } | ||
38 | + | ||
26 | } | 39 | } | ... | ... |
... | @@ -27,8 +27,8 @@ public class LinksListCommand extends AbstractShellCommand { | ... | @@ -27,8 +27,8 @@ public class LinksListCommand extends AbstractShellCommand { |
27 | Iterable<Link> links = deviceId != null ? | 27 | Iterable<Link> links = deviceId != null ? |
28 | service.getDeviceLinks(deviceId(deviceId)) : service.getLinks(); | 28 | service.getDeviceLinks(deviceId(deviceId)) : service.getLinks(); |
29 | for (Link link : links) { | 29 | for (Link link : links) { |
30 | - print(FMT, link.src().deviceId().uri(), link.src().port(), | 30 | + print(FMT, link.src().deviceId(), link.src().port(), |
31 | - link.dst().deviceId().uri(), link.dst().port(), link.type()); | 31 | + link.dst().deviceId(), link.dst().port(), link.type()); |
32 | } | 32 | } |
33 | return null; | 33 | return null; |
34 | } | 34 | } | ... | ... |
... | @@ -3,8 +3,6 @@ package org.onlab.onos.net; | ... | @@ -3,8 +3,6 @@ package org.onlab.onos.net; |
3 | import java.net.URI; | 3 | import java.net.URI; |
4 | import java.util.Objects; | 4 | import java.util.Objects; |
5 | 5 | ||
6 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
7 | - | ||
8 | /** | 6 | /** |
9 | * Immutable representation of a network element identity. | 7 | * Immutable representation of a network element identity. |
10 | */ | 8 | */ |
... | @@ -47,7 +45,7 @@ public abstract class ElementId { | ... | @@ -47,7 +45,7 @@ public abstract class ElementId { |
47 | 45 | ||
48 | @Override | 46 | @Override |
49 | public String toString() { | 47 | public String toString() { |
50 | - return toStringHelper(this).add("uri", uri).toString(); | 48 | + return uri.toString(); |
51 | } | 49 | } |
52 | 50 | ||
53 | } | 51 | } | ... | ... |
... | @@ -55,13 +55,22 @@ public interface DeviceService { | ... | @@ -55,13 +55,22 @@ public interface DeviceService { |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Returns the port with the specified number and hosted by the given device. | 57 | * Returns the port with the specified number and hosted by the given device. |
58 | - * @param deviceId device identifier | 58 | + * |
59 | + * @param deviceId device identifier | ||
59 | * @param portNumber port number | 60 | * @param portNumber port number |
60 | * @return device port | 61 | * @return device port |
61 | */ | 62 | */ |
62 | Port getPort(DeviceId deviceId, PortNumber portNumber); | 63 | Port getPort(DeviceId deviceId, PortNumber portNumber); |
63 | 64 | ||
64 | /** | 65 | /** |
66 | + * Indicates whether or not the device is presently online and available. | ||
67 | + * | ||
68 | + * @param deviceId device identifier | ||
69 | + * @return true if the device is available | ||
70 | + */ | ||
71 | + boolean isAvailable(DeviceId deviceId); | ||
72 | + | ||
73 | + /** | ||
65 | * Adds the specified device listener. | 74 | * Adds the specified device listener. |
66 | * | 75 | * |
67 | * @param listener device listener | 76 | * @param listener device listener | ... | ... |
... | @@ -104,6 +104,12 @@ public class SimpleDeviceManager | ... | @@ -104,6 +104,12 @@ public class SimpleDeviceManager |
104 | } | 104 | } |
105 | 105 | ||
106 | @Override | 106 | @Override |
107 | + public boolean isAvailable(DeviceId deviceId) { | ||
108 | + checkNotNull(deviceId, DEVICE_ID_NULL); | ||
109 | + return store.isAvailable(deviceId); | ||
110 | + } | ||
111 | + | ||
112 | + @Override | ||
107 | public void addListener(DeviceListener listener) { | 113 | public void addListener(DeviceListener listener) { |
108 | listenerRegistry.addListener(listener); | 114 | listenerRegistry.addListener(listener); |
109 | } | 115 | } |
... | @@ -185,8 +191,10 @@ public class SimpleDeviceManager | ... | @@ -185,8 +191,10 @@ public class SimpleDeviceManager |
185 | checkNotNull(deviceId, DEVICE_ID_NULL); | 191 | checkNotNull(deviceId, DEVICE_ID_NULL); |
186 | checkNotNull(portDescription, PORT_DESCRIPTION_NULL); | 192 | checkNotNull(portDescription, PORT_DESCRIPTION_NULL); |
187 | checkValidity(); | 193 | checkValidity(); |
188 | - log.info("Device {} port status changed", deviceId); | ||
189 | DeviceEvent event = store.updatePortStatus(deviceId, portDescription); | 194 | DeviceEvent event = store.updatePortStatus(deviceId, portDescription); |
195 | + if (event != null) { | ||
196 | + log.info("Device {} port status changed", deviceId); | ||
197 | + } | ||
190 | post(event); | 198 | post(event); |
191 | } | 199 | } |
192 | } | 200 | } | ... | ... |
... | @@ -271,6 +271,16 @@ class SimpleDeviceStore { | ... | @@ -271,6 +271,16 @@ class SimpleDeviceStore { |
271 | } | 271 | } |
272 | 272 | ||
273 | /** | 273 | /** |
274 | + * Indicates whether the specified device is available/online. | ||
275 | + * | ||
276 | + * @param deviceId device identifier | ||
277 | + * @return true if device is available | ||
278 | + */ | ||
279 | + boolean isAvailable(DeviceId deviceId) { | ||
280 | + return availableDevices.contains(deviceId); | ||
281 | + } | ||
282 | + | ||
283 | + /** | ||
274 | * Returns the mastership role determined for this device. | 284 | * Returns the mastership role determined for this device. |
275 | * | 285 | * |
276 | * @param deviceId device identifier | 286 | * @param deviceId device identifier | ... | ... |
... | @@ -104,6 +104,7 @@ public class SimpleDeviceManagerTest { | ... | @@ -104,6 +104,7 @@ public class SimpleDeviceManagerTest { |
104 | assertNotNull("one device expected", it.next()); | 104 | assertNotNull("one device expected", it.next()); |
105 | assertFalse("only one device expected", it.hasNext()); | 105 | assertFalse("only one device expected", it.hasNext()); |
106 | assertEquals("incorrect device count", 1, service.getDeviceCount()); | 106 | assertEquals("incorrect device count", 1, service.getDeviceCount()); |
107 | + assertTrue("device should be available", service.isAvailable(DID1)); | ||
107 | } | 108 | } |
108 | 109 | ||
109 | @Test | 110 | @Test |
... | @@ -111,10 +112,12 @@ public class SimpleDeviceManagerTest { | ... | @@ -111,10 +112,12 @@ public class SimpleDeviceManagerTest { |
111 | connectDevice(DID1, SW1); | 112 | connectDevice(DID1, SW1); |
112 | connectDevice(DID2, SW1); | 113 | connectDevice(DID2, SW1); |
113 | validateEvents(DEVICE_ADDED, DEVICE_ADDED); | 114 | validateEvents(DEVICE_ADDED, DEVICE_ADDED); |
115 | + assertTrue("device should be available", service.isAvailable(DID1)); | ||
114 | 116 | ||
115 | // Disconnect | 117 | // Disconnect |
116 | providerService.deviceDisconnected(DID1); | 118 | providerService.deviceDisconnected(DID1); |
117 | assertNotNull("device should not be found", service.getDevice(DID1)); | 119 | assertNotNull("device should not be found", service.getDevice(DID1)); |
120 | + assertFalse("device should not be available", service.isAvailable(DID1)); | ||
118 | validateEvents(DEVICE_AVAILABILITY_CHANGED); | 121 | validateEvents(DEVICE_AVAILABILITY_CHANGED); |
119 | 122 | ||
120 | // Reconnect | 123 | // Reconnect | ... | ... |
1 | package org.onlab.onos.of.controller.impl; | 1 | package org.onlab.onos.of.controller.impl; |
2 | 2 | ||
3 | -import java.util.ArrayList; | ||
4 | -import java.util.concurrent.ConcurrentHashMap; | ||
5 | -import java.util.concurrent.locks.Lock; | ||
6 | -import java.util.concurrent.locks.ReentrantLock; | ||
7 | - | ||
8 | import org.apache.felix.scr.annotations.Activate; | 3 | import org.apache.felix.scr.annotations.Activate; |
9 | import org.apache.felix.scr.annotations.Component; | 4 | import org.apache.felix.scr.annotations.Component; |
10 | import org.apache.felix.scr.annotations.Deactivate; | 5 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -21,6 +16,14 @@ import org.projectfloodlight.openflow.protocol.OFPortStatus; | ... | @@ -21,6 +16,14 @@ import org.projectfloodlight.openflow.protocol.OFPortStatus; |
21 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
22 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
23 | 18 | ||
19 | +import java.util.ArrayList; | ||
20 | +import java.util.HashSet; | ||
21 | +import java.util.List; | ||
22 | +import java.util.Set; | ||
23 | +import java.util.concurrent.ConcurrentHashMap; | ||
24 | +import java.util.concurrent.locks.Lock; | ||
25 | +import java.util.concurrent.locks.ReentrantLock; | ||
26 | + | ||
24 | @Component(immediate = true) | 27 | @Component(immediate = true) |
25 | @Service | 28 | @Service |
26 | public class OpenFlowControllerImpl implements OpenFlowController { | 29 | public class OpenFlowControllerImpl implements OpenFlowController { |
... | @@ -36,11 +39,11 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -36,11 +39,11 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
36 | new ConcurrentHashMap<Dpid, OpenFlowSwitch>(); | 39 | new ConcurrentHashMap<Dpid, OpenFlowSwitch>(); |
37 | 40 | ||
38 | protected OpenFlowSwitchAgent agent = new OpenFlowSwitchAgent(); | 41 | protected OpenFlowSwitchAgent agent = new OpenFlowSwitchAgent(); |
39 | - protected ArrayList<OpenFlowSwitchListener> ofEventListener = | 42 | + protected Set<OpenFlowSwitchListener> ofEventListener = |
40 | - new ArrayList<OpenFlowSwitchListener>(); | 43 | + new HashSet<>(); |
41 | 44 | ||
42 | - protected ArrayList<PacketListener> ofPacketListener = | 45 | + protected List<PacketListener> ofPacketListener = |
43 | - new ArrayList<PacketListener>(); | 46 | + new ArrayList<>(); |
44 | 47 | ||
45 | private final Controller ctrl = new Controller(); | 48 | private final Controller ctrl = new Controller(); |
46 | 49 | ||
... | @@ -114,19 +117,19 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -114,19 +117,19 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
114 | @Override | 117 | @Override |
115 | public void processPacket(Dpid dpid, OFMessage msg) { | 118 | public void processPacket(Dpid dpid, OFMessage msg) { |
116 | switch (msg.getType()) { | 119 | switch (msg.getType()) { |
117 | - case PORT_STATUS: | 120 | + case PORT_STATUS: |
118 | - for (OpenFlowSwitchListener l : ofEventListener) { | 121 | + for (OpenFlowSwitchListener l : ofEventListener) { |
119 | - l.portChanged(dpid, (OFPortStatus) msg); | 122 | + l.portChanged(dpid, (OFPortStatus) msg); |
120 | - } | 123 | + } |
121 | - break; | 124 | + break; |
122 | - case PACKET_IN: | 125 | + case PACKET_IN: |
123 | - for (PacketListener p : ofPacketListener) { | 126 | + for (PacketListener p : ofPacketListener) { |
124 | - //TODO fix me! | 127 | + //TODO fix me! |
125 | - p.handlePacket(null); | 128 | + p.handlePacket(null); |
126 | - } | 129 | + } |
127 | - break; | 130 | + break; |
128 | - default: | 131 | + default: |
129 | - log.warn("Handling message type {} not yet implemented", msg.getType()); | 132 | + log.warn("Handling message type {} not yet implemented", msg.getType()); |
130 | } | 133 | } |
131 | } | 134 | } |
132 | 135 | ||
... | @@ -139,7 +142,6 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -139,7 +142,6 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
139 | * Implementation of an OpenFlow Agent which is responsible for | 142 | * Implementation of an OpenFlow Agent which is responsible for |
140 | * keeping track of connected switches and the state in which | 143 | * keeping track of connected switches and the state in which |
141 | * they are. | 144 | * they are. |
142 | - * | ||
143 | */ | 145 | */ |
144 | public class OpenFlowSwitchAgent implements OpenFlowAgent { | 146 | public class OpenFlowSwitchAgent implements OpenFlowAgent { |
145 | 147 | ||
... | @@ -150,7 +152,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -150,7 +152,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
150 | public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw) { | 152 | public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw) { |
151 | if (connectedSwitches.get(dpid) != null) { | 153 | if (connectedSwitches.get(dpid) != null) { |
152 | log.error("Trying to add connectedSwitch but found a previous " | 154 | log.error("Trying to add connectedSwitch but found a previous " |
153 | - + "value for dpid: {}", dpid); | 155 | + + "value for dpid: {}", dpid); |
154 | return false; | 156 | return false; |
155 | } else { | 157 | } else { |
156 | log.error("Added switch {}", dpid); | 158 | log.error("Added switch {}", dpid); |
... | @@ -166,18 +168,18 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -166,18 +168,18 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
166 | public boolean validActivation(Dpid dpid) { | 168 | public boolean validActivation(Dpid dpid) { |
167 | if (connectedSwitches.get(dpid) == null) { | 169 | if (connectedSwitches.get(dpid) == null) { |
168 | log.error("Trying to activate switch but is not in " | 170 | log.error("Trying to activate switch but is not in " |
169 | - + "connected switches: dpid {}. Aborting ..", | 171 | + + "connected switches: dpid {}. Aborting ..", |
170 | - dpid); | 172 | + dpid); |
171 | return false; | 173 | return false; |
172 | } | 174 | } |
173 | if (activeMasterSwitches.get(dpid) != null || | 175 | if (activeMasterSwitches.get(dpid) != null || |
174 | activeEqualSwitches.get(dpid) != null) { | 176 | activeEqualSwitches.get(dpid) != null) { |
175 | log.error("Trying to activate switch but it is already " | 177 | log.error("Trying to activate switch but it is already " |
176 | - + "activated: dpid {}. Found in activeMaster: {} " | 178 | + + "activated: dpid {}. Found in activeMaster: {} " |
177 | - + "Found in activeEqual: {}. Aborting ..", new Object[] { | 179 | + + "Found in activeEqual: {}. Aborting ..", new Object[]{ |
178 | - dpid, | 180 | + dpid, |
179 | - (activeMasterSwitches.get(dpid) == null) ? 'N' : 'Y', | 181 | + (activeMasterSwitches.get(dpid) == null) ? 'N' : 'Y', |
180 | - (activeEqualSwitches.get(dpid) == null) ? 'N' : 'Y'}); | 182 | + (activeEqualSwitches.get(dpid) == null) ? 'N' : 'Y'}); |
181 | return false; | 183 | return false; |
182 | } | 184 | } |
183 | return true; | 185 | return true; |
... | @@ -223,7 +225,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -223,7 +225,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
223 | OpenFlowSwitch sw = activeEqualSwitches.remove(dpid); | 225 | OpenFlowSwitch sw = activeEqualSwitches.remove(dpid); |
224 | if (sw == null) { | 226 | if (sw == null) { |
225 | log.error("Transition to master called on sw {}, but switch " | 227 | log.error("Transition to master called on sw {}, but switch " |
226 | - + "was not found in controller-cache", dpid); | 228 | + + "was not found in controller-cache", dpid); |
227 | return; | 229 | return; |
228 | } | 230 | } |
229 | log.info("Transitioned switch {} to MASTER", dpid); | 231 | log.info("Transitioned switch {} to MASTER", dpid); |
... | @@ -244,7 +246,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -244,7 +246,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
244 | OpenFlowSwitch sw = activeMasterSwitches.remove(dpid); | 246 | OpenFlowSwitch sw = activeMasterSwitches.remove(dpid); |
245 | if (sw == null) { | 247 | if (sw == null) { |
246 | log.error("Transition to equal called on sw {}, but switch " | 248 | log.error("Transition to equal called on sw {}, but switch " |
247 | - + "was not found in controller-cache", dpid); | 249 | + + "was not found in controller-cache", dpid); |
248 | return; | 250 | return; |
249 | } | 251 | } |
250 | log.info("Transitioned switch {} to EQUAL", dpid); | 252 | log.info("Transitioned switch {} to EQUAL", dpid); |
... | @@ -274,5 +276,4 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -274,5 +276,4 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
274 | } | 276 | } |
275 | 277 | ||
276 | 278 | ||
277 | - | ||
278 | } | 279 | } | ... | ... |
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
... | @@ -85,19 +85,19 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -85,19 +85,19 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
85 | @Override | 85 | @Override |
86 | public void roleChanged(Device device, MastershipRole newRole) { | 86 | public void roleChanged(Device device, MastershipRole newRole) { |
87 | switch (newRole) { | 87 | switch (newRole) { |
88 | - case MASTER: | 88 | + case MASTER: |
89 | - controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), | 89 | + controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), |
90 | - RoleState.MASTER); | 90 | + RoleState.MASTER); |
91 | - break; | 91 | + break; |
92 | - case STANDBY: | 92 | + case STANDBY: |
93 | - controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), | 93 | + controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), |
94 | - RoleState.EQUAL); | 94 | + RoleState.EQUAL); |
95 | - case NONE: | 95 | + case NONE: |
96 | - controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), | 96 | + controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), |
97 | - RoleState.SLAVE); | 97 | + RoleState.SLAVE); |
98 | - break; | 98 | + break; |
99 | - default: | 99 | + default: |
100 | - log.error("Unknown Mastership state : {}", newRole); | 100 | + log.error("Unknown Mastership state : {}", newRole); |
101 | 101 | ||
102 | } | 102 | } |
103 | log.info("Accepting mastership role change for device {}", device.id()); | 103 | log.info("Accepting mastership role change for device {}", device.id()); |
... | @@ -114,10 +114,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -114,10 +114,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
114 | 114 | ||
115 | DeviceDescription description = | 115 | DeviceDescription description = |
116 | new DefaultDeviceDescription(buildURI(dpid), Device.Type.SWITCH, | 116 | new DefaultDeviceDescription(buildURI(dpid), Device.Type.SWITCH, |
117 | - sw.manfacturerDescription(), | 117 | + sw.manfacturerDescription(), |
118 | - sw.hardwareDescription(), | 118 | + sw.hardwareDescription(), |
119 | - sw.softwareDescription(), | 119 | + sw.softwareDescription(), |
120 | - sw.serialNumber()); | 120 | + sw.serialNumber()); |
121 | providerService.deviceConnected(deviceId(uri), description); | 121 | providerService.deviceConnected(deviceId(uri), description); |
122 | providerService.updatePorts(deviceId(uri), buildPortDescriptions(sw.getPorts())); | 122 | providerService.updatePorts(deviceId(uri), buildPortDescriptions(sw.getPorts())); |
123 | } | 123 | } |
... | @@ -140,6 +140,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -140,6 +140,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Given a dpid builds a URI for the device. | 142 | * Given a dpid builds a URI for the device. |
143 | + * | ||
143 | * @param dpid the dpid to build the uri from | 144 | * @param dpid the dpid to build the uri from |
144 | * @return returns a uri of the form of:<dpidHexForm> | 145 | * @return returns a uri of the form of:<dpidHexForm> |
145 | */ | 146 | */ |
... | @@ -155,6 +156,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -155,6 +156,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
155 | 156 | ||
156 | /** | 157 | /** |
157 | * Builds a list of port descriptions for a given list of ports. | 158 | * Builds a list of port descriptions for a given list of ports. |
159 | + * | ||
158 | * @param ports the list of ports | 160 | * @param ports the list of ports |
159 | * @return list of portdescriptions | 161 | * @return list of portdescriptions |
160 | */ | 162 | */ |
... | @@ -169,6 +171,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -169,6 +171,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
169 | 171 | ||
170 | /** | 172 | /** |
171 | * Build a portDescription from a given port. | 173 | * Build a portDescription from a given port. |
174 | + * | ||
172 | * @param port the port to build from. | 175 | * @param port the port to build from. |
173 | * @return portDescription for the port. | 176 | * @return portDescription for the port. |
174 | */ | 177 | */ | ... | ... |
-
Please register or login to post a comment