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 ...@@ -83,7 +83,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro
83 protected OpticalNetworkConfig opticalNetworkConfig; 83 protected OpticalNetworkConfig opticalNetworkConfig;
84 84
85 public OpticalConfigProvider() { 85 public OpticalConfigProvider() {
86 - super(new ProviderId("of", "org.onlab.onos.provider.opticalConfig", true)); 86 + super(new ProviderId("optical", "org.onlab.onos.provider.opticalConfig", true));
87 } 87 }
88 88
89 @Activate 89 @Activate
...@@ -238,7 +238,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro ...@@ -238,7 +238,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro
238 while (iterWdmNode.hasNext()) { 238 while (iterWdmNode.hasNext()) {
239 Roadm value = iterWdmNode.next(); 239 Roadm value = iterWdmNode.next();
240 DeviceId did = deviceId("of:" + value.getNodeId().replace(":", "")); 240 DeviceId did = deviceId("of:" + value.getNodeId().replace(":", ""));
241 - ChassisId cid = new ChassisId(value.getNodeId()); 241 + ChassisId cid = new ChassisId();
242 DefaultAnnotations extendedAttributes = DefaultAnnotations.builder() 242 DefaultAnnotations extendedAttributes = DefaultAnnotations.builder()
243 .set(OPTICAL_ANNOTATION + "switchType", "ROADM") 243 .set(OPTICAL_ANNOTATION + "switchType", "ROADM")
244 .set(OPTICAL_ANNOTATION + "switchName", value.getName()) 244 .set(OPTICAL_ANNOTATION + "switchName", value.getName())
......
...@@ -299,7 +299,8 @@ public class FlowRuleManager ...@@ -299,7 +299,8 @@ public class FlowRuleManager
299 private void extraneousFlow(FlowRule flowRule) { 299 private void extraneousFlow(FlowRule flowRule) {
300 checkNotNull(flowRule, FLOW_RULE_NULL); 300 checkNotNull(flowRule, FLOW_RULE_NULL);
301 checkValidity(); 301 checkValidity();
302 - removeFlowRules(flowRule); 302 + FlowRuleProvider frp = getProvider(flowRule.deviceId());
303 + frp.removeFlowRule(flowRule);
303 log.debug("Flow {} is on switch but not in store.", flowRule); 304 log.debug("Flow {} is on switch but not in store.", flowRule);
304 } 305 }
305 306
......
...@@ -9,6 +9,7 @@ import org.apache.felix.scr.annotations.Service; ...@@ -9,6 +9,7 @@ import org.apache.felix.scr.annotations.Service;
9 import org.onlab.onos.net.ConnectPoint; 9 import org.onlab.onos.net.ConnectPoint;
10 import org.onlab.onos.net.Link; 10 import org.onlab.onos.net.Link;
11 import org.onlab.onos.net.Path; 11 import org.onlab.onos.net.Path;
12 +
12 import org.onlab.onos.net.flow.FlowRule; 13 import org.onlab.onos.net.flow.FlowRule;
13 import org.onlab.onos.net.flow.FlowRuleEvent; 14 import org.onlab.onos.net.flow.FlowRuleEvent;
14 import org.onlab.onos.net.flow.FlowRuleListener; 15 import org.onlab.onos.net.flow.FlowRuleListener;
...@@ -35,12 +36,14 @@ public class StatisticManager implements StatisticService { ...@@ -35,12 +36,14 @@ public class StatisticManager implements StatisticService {
35 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 36 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
36 protected StatisticStore statisticStore; 37 protected StatisticStore statisticStore;
37 38
39 +
38 private final InternalFlowRuleListener listener = new InternalFlowRuleListener(); 40 private final InternalFlowRuleListener listener = new InternalFlowRuleListener();
39 41
40 @Activate 42 @Activate
41 public void activate() { 43 public void activate() {
42 flowRuleService.addListener(listener); 44 flowRuleService.addListener(listener);
43 log.info("Started"); 45 log.info("Started");
46 +
44 } 47 }
45 48
46 @Deactivate 49 @Deactivate
...@@ -81,7 +84,22 @@ public class StatisticManager implements StatisticService { ...@@ -81,7 +84,22 @@ public class StatisticManager implements StatisticService {
81 84
82 @Override 85 @Override
83 public void event(FlowRuleEvent event) { 86 public void event(FlowRuleEvent event) {
84 - 87 +// FlowRule rule = event.subject();
88 +// switch (event.type()) {
89 +// case RULE_ADDED:
90 +// case RULE_UPDATED:
91 +// if (rule instanceof FlowEntry) {
92 +// statisticStore.addOrUpdateStatistic((FlowEntry) rule);
93 +// }
94 +// break;
95 +// case RULE_ADD_REQUESTED:
96 +// statisticStore.prepareForStatistics(rule);
97 +// break;
98 +// case RULE_REMOVE_REQUESTED:
99 +// case RULE_REMOVED:
100 +// statisticStore.removeFromStatistics(rule);
101 +// break;
102 +// }
85 } 103 }
86 } 104 }
87 105
......
...@@ -177,6 +177,7 @@ public class SimpleFlowRuleStore ...@@ -177,6 +177,7 @@ public class SimpleFlowRuleStore
177 public boolean deleteFlowRule(FlowRule rule) { 177 public boolean deleteFlowRule(FlowRule rule) {
178 178
179 List<StoredFlowEntry> entries = getFlowEntries(rule.deviceId(), rule.id()); 179 List<StoredFlowEntry> entries = getFlowEntries(rule.deviceId(), rule.id());
180 +
180 synchronized (entries) { 181 synchronized (entries) {
181 for (StoredFlowEntry entry : entries) { 182 for (StoredFlowEntry entry : entries) {
182 if (entry.equals(rule)) { 183 if (entry.equals(rule)) {
......
...@@ -344,7 +344,8 @@ public class LinkDiscovery implements TimerTask { ...@@ -344,7 +344,8 @@ public class LinkDiscovery implements TimerTask {
344 } 344 }
345 345
346 private void sendProbes(Long portNumber) { 346 private void sendProbes(Long portNumber) {
347 - if (mastershipService.getLocalRole(this.device.id()) == 347 + if (device.type() != Device.Type.ROADM &&
348 + mastershipService.getLocalRole(this.device.id()) ==
348 MastershipRole.MASTER) { 349 MastershipRole.MASTER) {
349 OutboundPacket pkt = this.createOutBoundLLDP(portNumber); 350 OutboundPacket pkt = this.createOutBoundLLDP(portNumber);
350 pktService.emit(pkt); 351 pktService.emit(pkt);
......