alshabib

many fixes from different people in various place. Optical, FlowRuleManager, LinkDiscovery

Change-Id: Ie3302e80ee94bf2e41b3da7ac765557b1e7509fd
......@@ -83,7 +83,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro
protected OpticalNetworkConfig opticalNetworkConfig;
public OpticalConfigProvider() {
super(new ProviderId("of", "org.onlab.onos.provider.opticalConfig", true));
super(new ProviderId("optical", "org.onlab.onos.provider.opticalConfig", true));
}
@Activate
......@@ -238,7 +238,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro
while (iterWdmNode.hasNext()) {
Roadm value = iterWdmNode.next();
DeviceId did = deviceId("of:" + value.getNodeId().replace(":", ""));
ChassisId cid = new ChassisId(value.getNodeId());
ChassisId cid = new ChassisId();
DefaultAnnotations extendedAttributes = DefaultAnnotations.builder()
.set(OPTICAL_ANNOTATION + "switchType", "ROADM")
.set(OPTICAL_ANNOTATION + "switchName", value.getName())
......
......@@ -299,7 +299,8 @@ public class FlowRuleManager
private void extraneousFlow(FlowRule flowRule) {
checkNotNull(flowRule, FLOW_RULE_NULL);
checkValidity();
removeFlowRules(flowRule);
FlowRuleProvider frp = getProvider(flowRule.deviceId());
frp.removeFlowRule(flowRule);
log.debug("Flow {} is on switch but not in store.", flowRule);
}
......
......@@ -9,6 +9,7 @@ import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.Link;
import org.onlab.onos.net.Path;
import org.onlab.onos.net.flow.FlowRule;
import org.onlab.onos.net.flow.FlowRuleEvent;
import org.onlab.onos.net.flow.FlowRuleListener;
......@@ -35,12 +36,14 @@ public class StatisticManager implements StatisticService {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected StatisticStore statisticStore;
private final InternalFlowRuleListener listener = new InternalFlowRuleListener();
@Activate
public void activate() {
flowRuleService.addListener(listener);
log.info("Started");
}
@Deactivate
......@@ -81,7 +84,22 @@ public class StatisticManager implements StatisticService {
@Override
public void event(FlowRuleEvent event) {
// FlowRule rule = event.subject();
// switch (event.type()) {
// case RULE_ADDED:
// case RULE_UPDATED:
// if (rule instanceof FlowEntry) {
// statisticStore.addOrUpdateStatistic((FlowEntry) rule);
// }
// break;
// case RULE_ADD_REQUESTED:
// statisticStore.prepareForStatistics(rule);
// break;
// case RULE_REMOVE_REQUESTED:
// case RULE_REMOVED:
// statisticStore.removeFromStatistics(rule);
// break;
// }
}
}
......
......@@ -177,6 +177,7 @@ public class SimpleFlowRuleStore
public boolean deleteFlowRule(FlowRule rule) {
List<StoredFlowEntry> entries = getFlowEntries(rule.deviceId(), rule.id());
synchronized (entries) {
for (StoredFlowEntry entry : entries) {
if (entry.equals(rule)) {
......
......@@ -344,7 +344,8 @@ public class LinkDiscovery implements TimerTask {
}
private void sendProbes(Long portNumber) {
if (mastershipService.getLocalRole(this.device.id()) ==
if (device.type() != Device.Type.ROADM &&
mastershipService.getLocalRole(this.device.id()) ==
MastershipRole.MASTER) {
OutboundPacket pkt = this.createOutBoundLLDP(portNumber);
pktService.emit(pkt);
......