Marc De Leenheer
Committed by Gerrit Code Review

Fix for drop/demux cross connect rules.

Change-Id: I239d50e7faeb0cd3d91ad0c17db58e2ab905426f
...@@ -70,10 +70,13 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements ...@@ -70,10 +70,13 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements
70 private static final int DEFAULT_CHANNEL_TARGET_POWER = -30; 70 private static final int DEFAULT_CHANNEL_TARGET_POWER = -30;
71 private static final int DISABLE_CHANNEL_ABSOLUTE_ATTENUATION = 160; 71 private static final int DISABLE_CHANNEL_ABSOLUTE_ATTENUATION = 160;
72 private static final int DEFAULT_CHANNEL_ABSOLUTE_ATTENUATION = 50; 72 private static final int DEFAULT_CHANNEL_ABSOLUTE_ATTENUATION = 50;
73 + private static final int DISABLE_CHANNEL_ADD_DROP_PORT_INDEX = 1;
73 private static final int OUT_OF_SERVICE = 1; 74 private static final int OUT_OF_SERVICE = 1;
74 private static final int IN_SERVICE = 2; 75 private static final int IN_SERVICE = 2;
75 private static final int OPEN_LOOP = 1; 76 private static final int OPEN_LOOP = 1;
76 private static final int CLOSED_LOOP = 2; 77 private static final int CLOSED_LOOP = 2;
78 + // First 20 ports are add/mux ports, next 20 are drop/demux
79 + private static final int DROP_PORT_OFFSET = 20;
77 80
78 // OIDs 81 // OIDs
79 private static final String CTRL_AMP_MODULE_SERVICE_STATE_PREAMP = ".1.3.6.1.4.1.46184.1.4.4.1.2.1"; 82 private static final String CTRL_AMP_MODULE_SERVICE_STATE_PREAMP = ".1.3.6.1.4.1.46184.1.4.4.1.2.1";
...@@ -194,6 +197,9 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements ...@@ -194,6 +197,9 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements
194 197
195 int channel = toChannel(xc.ochSignal()); 198 int channel = toChannel(xc.ochSignal());
196 long addDrop = xc.addDrop().toLong(); 199 long addDrop = xc.addDrop().toLong();
200 + if (!xc.isAddRule()) {
201 + addDrop -= DROP_PORT_OFFSET;
202 + }
197 203
198 // Create the PDU object 204 // Create the PDU object
199 PDU pdu = new PDU(); 205 PDU pdu = new PDU();
...@@ -265,7 +271,8 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements ...@@ -265,7 +271,8 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements
265 // Put cross connect back into default port 1 271 // Put cross connect back into default port 1
266 OID ctrlChannelAddDropPortIndex = new OID(CTRL_CHANNEL_ADD_DROP_PORT_INDEX + 272 OID ctrlChannelAddDropPortIndex = new OID(CTRL_CHANNEL_ADD_DROP_PORT_INDEX +
267 (xc.isAddRule() ? "1." : "2.") + channel); 273 (xc.isAddRule() ? "1." : "2.") + channel);
268 - pdu.add(new VariableBinding(ctrlChannelAddDropPortIndex, new UnsignedInteger32(OUT_OF_SERVICE))); 274 + pdu.add(new VariableBinding(ctrlChannelAddDropPortIndex,
275 + new UnsignedInteger32(DISABLE_CHANNEL_ADD_DROP_PORT_INDEX)));
269 276
270 // Put port/channel back to open loop 277 // Put port/channel back to open loop
271 OID ctrlChannelMode = new OID(CTRL_CHANNEL_MODE + (xc.isAddRule() ? "1." : "2.") + channel); 278 OID ctrlChannelMode = new OID(CTRL_CHANNEL_MODE + (xc.isAddRule() ? "1." : "2.") + channel);
...@@ -336,6 +343,9 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements ...@@ -336,6 +343,9 @@ public class LumentumFlowRuleDriver extends AbstractHandlerBehaviour implements
336 for (VariableBinding varBinding : varBindings) { 343 for (VariableBinding varBinding : varBindings) {
337 if (varBinding.getOid().last() == channel) { 344 if (varBinding.getOid().last() == channel) {
338 int port = varBinding.getVariable().toInt(); 345 int port = varBinding.getVariable().toInt();
346 + if (!isAddPort) {
347 + port += DROP_PORT_OFFSET;
348 + }
339 return PortNumber.portNumber(port); 349 return PortNumber.portNumber(port);
340 350
341 } 351 }
......