[ODTN] Update of driver for Lumentum:ROADM with Twin 1X20 WSS
Tested on software versions:
- dcian_R3.1.2_057
- dcian_R2.1.4_136
* patch 2: checkstyle
* patch 3: comments
Change-Id: I436f22b2b0221527765eee9777df9d9ce4f0b146
diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumFlowRule.java b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumFlowRule.java
index fe26d72..1d29f13 100644
--- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumFlowRule.java
+++ b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumFlowRule.java
@@ -76,6 +76,10 @@
Set<Criterion> criteria = rule.selector().criteria();
List<Instruction> instructions = rule.treatment().immediate();
+ log.debug("Lumentum device received criteria {} - treatment {}",
+ criteria,
+ instructions);
+
// Proper cross connect has criteria for input port, OChSignal and OCh signal type.
// Instruction is only output to port (rule generated by ROADM app).
// Instruction includes output port and OChSignal (rule generated by OpticalConnectivityIntent).
@@ -103,11 +107,11 @@
);
if (criteria.size() == NUM_CRITERIA_INTENT && instructions.size() == NUM_INSTRUCTIONS_INTENT) {
- log.info("Lumentum device, FlowRule coming from OpticalConnectivityIntentCompiler");
+ log.debug("Lumentum device, FlowRule coming from OpticalConnectivityIntentCompiler");
type = Type.OPTICAL_CONNECTIVITY_INTENT_RULE;
} else {
- log.info("Lumentum device, FlowRule coming from ROADM app");
+ log.debug("Lumentum device, FlowRule coming from ROADM app");
type = Type.ROADM_APP_RULE;
}
@@ -118,6 +122,9 @@
.findAny()
.orElse(null);
+ checkArgument(ochSignal.slotGranularity() == 4 || ochSignal.slotGranularity() == 8,
+ "Lumentum device, only supports 50 GHz and 100 GHz frequency slots");
+
inputPort = criteria.stream()
.filter(c -> c instanceof PortCriterion)
.map(c -> ((PortCriterion) c).port())
diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmDiscovery.java b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmDiscovery.java
index df656c9..6b8fdf1 100644
--- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmDiscovery.java
+++ b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmDiscovery.java
@@ -57,6 +57,11 @@
/**
* Device description behaviour for Lumentum ROADM-A Whitebox devices using NETCONF.
+ *
+ * Tested on device Lumentum:ROADM with Twin 1X20 WSS
+ * Software versions:
+ * - dcian_R3.1.2_057
+ * - dcian_R2.1.4_136
*/
public class LumentumNetconfRoadmDiscovery
extends AbstractHandlerBehaviour implements DeviceDescriptionDiscovery {
@@ -237,11 +242,14 @@
Port.Type type = null;
for (Object o : pcfg.getList(PORT_EXTENSION)) {
String s = (String) o;
- if (s.equals(OPTICAL_INPUT) || s.equals(OPTICAL_OUTPUT)) {
+ if (s.contains(OPTICAL_INPUT) || s.contains(OPTICAL_OUTPUT)) {
type = Port.Type.FIBER;
+ log.debug("Loaded OPTICAL port {}", portNum);
- } else if (s.equals(PORT_ETHERNET) || s.equals(PORT_PLUGGABLE)) {
+ } else if (s.contains(PORT_ETHERNET) || s.contains(PORT_PLUGGABLE)) {
type = Port.Type.COPPER;
+ log.debug("Loaded PACKET port {}", portNum);
+
}
}
@@ -250,9 +258,18 @@
if (type != null) {
if (type.equals(Port.Type.COPPER)) {
String speedString = pcfg.getString(PORT_SPEED);
+ log.debug("--- port {} loaded speed {}", portNum, speedString);
if (speedString != null) {
- speed = Long.parseLong(speedString.substring(speedString.lastIndexOf("speed_") + 6,
- speedString.lastIndexOf("Mb")));
+ if (speedString.contains("Mb")) {
+ speed = Long.parseLong(speedString.substring(
+ speedString.lastIndexOf("speed_") + 6,
+ speedString.lastIndexOf("Mb")));
+ }
+ if (speedString.contains("Gb")) {
+ speed = 1000 * Long.parseLong(speedString.substring(
+ speedString.lastIndexOf("speed_") + 6,
+ speedString.lastIndexOf("Gb")));
+ }
} else {
log.error("Lumentum NETCONF - Port speed of Ethernet port not correctly loaded");
}
diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmFlowRuleProgrammable.java b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmFlowRuleProgrammable.java
index 57cc025..1fe8148 100644
--- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmFlowRuleProgrammable.java
+++ b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumNetconfRoadmFlowRuleProgrammable.java
@@ -130,6 +130,7 @@
if (rpcAddConnection(lumFlowRule)) {
added.add(lumFlowRule);
getConnectionCache().add(did(), lumFlowRule.getConnectionName(), lumFlowRule);
+ log.debug("Adding connection with selector {}", lumFlowRule.selector());
}
}
@@ -273,6 +274,7 @@
.build();
log.debug("Lumentum NETCONF - retrieved FlowRule startFreq {} endFreq {}", startFreq, endFreq);
+ log.debug("Lumentum NETCONF - retrieved FlowRule selector {}", selector);
//Lookup of connection
//Retrieved rules, cached rules are considered equal if the selector is equal
@@ -287,7 +289,7 @@
if (cacheRule == null) {
//TODO consider a way to keep "external" FlowRules
- log.error("Lumentum NETCONF connection not in the cache {}", pair.getRight());
+ log.error("Lumentum NETCONF connection {} not in the cache", pair.getRight());
rpcDeleteExternalConnection(moduleId, connId);
return null;
} else {
@@ -491,7 +493,7 @@
try {
return session.editConfig(xcString);
} catch (NetconfException e) {
- log.error("Failed to edit the CrossConnect edid-cfg for device {}",
+ log.error("Failed to edit the CrossConnect edit-cfg for device {}",
handler().data().deviceId(), e);
log.debug("Failed configuration {}", xcString);
return false;