Implementing port methods in trivial core.
diff --git a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
index 0179507..dbff8d1 100644
--- a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
@@ -1,5 +1,6 @@
package org.onlab.onos.net.trivial.impl;
+import com.google.common.collect.ImmutableList;
import org.onlab.onos.net.DefaultDevice;
import org.onlab.onos.net.DefaultPort;
import org.onlab.onos.net.Device;
@@ -227,7 +228,13 @@
*/
DeviceEvent updatePortStatus(DeviceId deviceId,
PortDescription portDescription) {
- return null;
+ synchronized (this) {
+ Device device = devices.get(deviceId);
+ checkArgument(device != null, DEVICE_NOT_FOUND, deviceId);
+ Map<PortNumber, Port> ports = getPortMap(deviceId);
+ Port port = ports.get(portDescription.portNumber());
+ return updatePort(device, port, portDescription, ports);
+ }
}
/**
@@ -237,7 +244,8 @@
* @return list of device ports
*/
List<Port> getPorts(DeviceId deviceId) {
- return null;
+ Map<PortNumber, Port> ports = devicePorts.get(deviceId);
+ return ports == null ? new ArrayList<Port>() : ImmutableList.copyOf(ports.values());
}
/**
@@ -248,7 +256,8 @@
* @return device port
*/
Port getPort(DeviceId deviceId, PortNumber portNumber) {
- return null;
+ Map<PortNumber, Port> ports = devicePorts.get(deviceId);
+ return ports == null ? null : ports.get(portNumber);
}
/**