Marc De Leenheer

Support optical port status via OFExperimenter type 0x748771

...@@ -73,7 +73,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro ...@@ -73,7 +73,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro
73 73
74 // TODO: fix hard coded file path later. 74 // TODO: fix hard coded file path later.
75 private static final String DEFAULT_CONFIG_FILE = 75 private static final String DEFAULT_CONFIG_FILE =
76 - "/opt/onos/config/demo-3-roadm-2-ps.json"; 76 + "config/demo-3-roadm-2-ps.json";
77 private String configFileName = DEFAULT_CONFIG_FILE; 77 private String configFileName = DEFAULT_CONFIG_FILE;
78 78
79 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 79 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
......
...@@ -39,8 +39,11 @@ import org.onlab.onos.openflow.controller.OpenFlowSwitchListener; ...@@ -39,8 +39,11 @@ import org.onlab.onos.openflow.controller.OpenFlowSwitchListener;
39 import org.onlab.onos.openflow.controller.PacketListener; 39 import org.onlab.onos.openflow.controller.PacketListener;
40 import org.onlab.onos.openflow.controller.RoleState; 40 import org.onlab.onos.openflow.controller.RoleState;
41 import org.onlab.onos.openflow.controller.driver.OpenFlowAgent; 41 import org.onlab.onos.openflow.controller.driver.OpenFlowAgent;
42 +import org.projectfloodlight.openflow.protocol.OFCircuitPortStatus;
43 +import org.projectfloodlight.openflow.protocol.OFExperimenter;
42 import org.projectfloodlight.openflow.protocol.OFMessage; 44 import org.projectfloodlight.openflow.protocol.OFMessage;
43 import org.projectfloodlight.openflow.protocol.OFPacketIn; 45 import org.projectfloodlight.openflow.protocol.OFPacketIn;
46 +import org.projectfloodlight.openflow.protocol.OFPortDesc;
44 import org.projectfloodlight.openflow.protocol.OFPortStatus; 47 import org.projectfloodlight.openflow.protocol.OFPortStatus;
45 import org.projectfloodlight.openflow.protocol.OFStatsReply; 48 import org.projectfloodlight.openflow.protocol.OFStatsReply;
46 import org.projectfloodlight.openflow.protocol.OFStatsType; 49 import org.projectfloodlight.openflow.protocol.OFStatsType;
...@@ -183,11 +186,32 @@ public class OpenFlowControllerImpl implements OpenFlowController { ...@@ -183,11 +186,32 @@ public class OpenFlowControllerImpl implements OpenFlowController {
183 l.switchChanged(dpid); 186 l.switchChanged(dpid);
184 } 187 }
185 } 188 }
189 + break;
186 case FLOW_REMOVED: 190 case FLOW_REMOVED:
187 case ERROR: 191 case ERROR:
188 case BARRIER_REPLY: 192 case BARRIER_REPLY:
189 executor.submit(new OFMessageHandler(dpid, msg)); 193 executor.submit(new OFMessageHandler(dpid, msg));
190 break; 194 break;
195 + case EXPERIMENTER:
196 + // Handle optical port stats
197 + if (((OFExperimenter) msg).getExperimenter() == 0x748771) {
198 + OFCircuitPortStatus circuitPortStatus = (OFCircuitPortStatus) msg;
199 + OFPortStatus.Builder portStatus = this.getSwitch(dpid).factory().buildPortStatus();
200 + OFPortDesc.Builder portDesc = this.getSwitch(dpid).factory().buildPortDesc();
201 + portDesc.setPortNo(circuitPortStatus.getPortNo())
202 + .setHwAddr(circuitPortStatus.getHwAddr())
203 + .setName(circuitPortStatus.getName())
204 + .setConfig(circuitPortStatus.getConfig())
205 + .setState(circuitPortStatus.getState());
206 + portStatus.setReason(circuitPortStatus.getReason()).setDesc(portDesc.build());
207 + for (OpenFlowSwitchListener l : ofSwitchListener) {
208 + l.portChanged(dpid, portStatus.build());
209 + }
210 + } else {
211 + log.warn("Handling experimenter type {} not yet implemented",
212 + ((OFExperimenter) msg).getExperimenter(), msg);
213 + }
214 + break;
191 default: 215 default:
192 log.warn("Handling message type {} not yet implemented {}", 216 log.warn("Handling message type {} not yet implemented {}",
193 msg.getType(), msg); 217 msg.getType(), msg);
......