[ONOS-5911] Port removal after receiving OFPR_DELETE port status reason.
Change-Id: I1f3f6c752da5f989a2d727f378e9f04fbbb71341
diff --git a/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java b/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java
index 89cc6e8..cc28227 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java
@@ -34,6 +34,7 @@
private final PortNumber number;
private final boolean isEnabled;
+ private final boolean isRemoved;
private final Type type;
private final long portSpeed;
@@ -61,9 +62,26 @@
public DefaultPortDescription(PortNumber number, boolean isEnabled,
Type type, long portSpeed,
SparseAnnotations...annotations) {
+ this(number, isEnabled, false, type, portSpeed, annotations);
+ }
+
+ /**
+ * Creates a port description using the supplied information.
+ *
+ * @param number port number
+ * @param isEnabled port enabled state
+ * @param isRemoved port removed state
+ * @param type port type
+ * @param portSpeed port speed in Mbps
+ * @param annotations optional key/value annotations map
+ */
+ public DefaultPortDescription(PortNumber number, boolean isEnabled, boolean isRemoved,
+ Type type, long portSpeed,
+ SparseAnnotations...annotations) {
super(annotations);
this.number = checkNotNull(number);
this.isEnabled = isEnabled;
+ this.isRemoved = isRemoved;
this.type = type;
this.portSpeed = portSpeed;
}
@@ -72,6 +90,7 @@
protected DefaultPortDescription() {
this.number = null;
this.isEnabled = false;
+ this.isRemoved = false;
this.portSpeed = DEFAULT_SPEED;
this.type = Type.COPPER;
}
@@ -112,6 +131,11 @@
}
@Override
+ public boolean isRemoved() {
+ return isRemoved;
+ }
+
+ @Override
public Type type() {
return type;
}
diff --git a/core/api/src/main/java/org/onosproject/net/device/DeviceProviderService.java b/core/api/src/main/java/org/onosproject/net/device/DeviceProviderService.java
index f8c9442..ff34bd2 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DeviceProviderService.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DeviceProviderService.java
@@ -55,6 +55,17 @@
void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions);
/**
+ * Delete information about a single port of a device.
+ * It is up to the core to determine what has changed.
+ *
+ * @param deviceId identity of the device
+ * @param portDescription device port description
+ */
+ default void deletePort(DeviceId deviceId, PortDescription portDescription) {
+
+ }
+
+ /**
* Notifies the core about port status change of a single port.
*
* @param deviceId identity of the device
diff --git a/core/api/src/main/java/org/onosproject/net/device/PortDescription.java b/core/api/src/main/java/org/onosproject/net/device/PortDescription.java
index 31680e5..020794b 100644
--- a/core/api/src/main/java/org/onosproject/net/device/PortDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/device/PortDescription.java
@@ -40,6 +40,13 @@
boolean isEnabled();
/**
+ * Indicates whether or not the port was removed.
+ *
+ * @return true if the port is removed.
+ */
+ boolean isRemoved();
+
+ /**
* Returns the port type.
*
* @return port type