Saurav Das
Committed by Gerrit Code Review

Currently need to specify handshaker behavior in onos-drivers xml file.

Later this need will be removed as the system will use default behaviors.
Fixed a bug in group checker where it was consulting the wrong map.
Cleaned up some logs

Change-Id: I45d91bc8d4c19474dcf0c37f82763985e5d2c84f
...@@ -366,14 +366,14 @@ public class BgpRouter { ...@@ -366,14 +366,14 @@ public class BgpRouter {
366 @Override 366 @Override
367 public void onSuccess(Objective objective) { 367 public void onSuccess(Objective objective) {
368 log.info("Successfully installed interface based " 368 log.info("Successfully installed interface based "
369 - + "filtering objcetives"); 369 + + "filtering objcetives for intf {}", intf);
370 } 370 }
371 371
372 @Override 372 @Override
373 public void onError(Objective objective, 373 public void onError(Objective objective,
374 ObjectiveError error) { 374 ObjectiveError error) {
375 - log.error("Failed to install interface filters {}: {}", 375 + log.error("Failed to install interface filters for intf {}: {}",
376 - objective, error); 376 + intf, error);
377 // TODO something more than just logging 377 // TODO something more than just logging
378 } 378 }
379 })); 379 }));
......
...@@ -353,14 +353,14 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline ...@@ -353,14 +353,14 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline
353 flowRuleService.apply(ops.build(new FlowRuleOperationsContext() { 353 flowRuleService.apply(ops.build(new FlowRuleOperationsContext() {
354 @Override 354 @Override
355 public void onSuccess(FlowRuleOperations ops) { 355 public void onSuccess(FlowRuleOperations ops) {
356 - pass(filt);
357 log.info("Applied filtering rules"); 356 log.info("Applied filtering rules");
357 + pass(filt);
358 } 358 }
359 359
360 @Override 360 @Override
361 public void onError(FlowRuleOperations ops) { 361 public void onError(FlowRuleOperations ops) {
362 - fail(filt, ObjectiveError.FLOWINSTALLATIONFAILED);
363 log.info("Failed to apply filtering rules"); 362 log.info("Failed to apply filtering rules");
363 + fail(filt, ObjectiveError.FLOWINSTALLATIONFAILED);
364 } 364 }
365 })); 365 }));
366 366
...@@ -377,7 +377,7 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline ...@@ -377,7 +377,7 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline
377 * @param nextObj the nextObjective of type SIMPLE 377 * @param nextObj the nextObjective of type SIMPLE
378 */ 378 */
379 private void processSimpleNextObjective(NextObjective nextObj) { 379 private void processSimpleNextObjective(NextObjective nextObj) {
380 - // break up next objective to GroupChain objects 380 + // break up simple next objective to GroupChain objects
381 TrafficTreatment treatment = nextObj.next().iterator().next(); 381 TrafficTreatment treatment = nextObj.next().iterator().next();
382 // for the l2interface group, get vlan and port info 382 // for the l2interface group, get vlan and port info
383 // for the l3unicast group, get the src/dst mac and vlan info 383 // for the l3unicast group, get the src/dst mac and vlan info
...@@ -824,7 +824,7 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline ...@@ -824,7 +824,7 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline
824 private class GroupChecker implements Runnable { 824 private class GroupChecker implements Runnable {
825 @Override 825 @Override
826 public void run() { 826 public void run() {
827 - Set<GroupKey> keys = pendingNextObjectives.asMap().keySet().stream() 827 + Set<GroupKey> keys = pendingGroups.keySet().stream()
828 .filter(key -> groupService.getGroup(deviceId, key) != null) 828 .filter(key -> groupService.getGroup(deviceId, key) != null)
829 .collect(Collectors.toSet()); 829 .collect(Collectors.toSet());
830 830
...@@ -832,43 +832,49 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline ...@@ -832,43 +832,49 @@ public class OFDPA1Pipeline extends AbstractHandlerBehaviour implements Pipeline
832 //first check for group chain 832 //first check for group chain
833 GroupChainElem gce = pendingGroups.remove(key); 833 GroupChainElem gce = pendingGroups.remove(key);
834 if (gce != null) { 834 if (gce != null) {
835 - log.info("Heard back from group service. Processing next " 835 + log.info("Group service processed group key {}. Processing next "
836 - + "group in group chain with group key {}", gce.getGkey()); 836 + + "group in group chain with group key {}",
837 + appKryo.deserialize(key.key()),
838 + appKryo.deserialize(gce.getGkey().key()));
837 processGroupChain(gce); 839 processGroupChain(gce);
838 } else { 840 } else {
839 OfdpaGroupChain obj = pendingNextObjectives.getIfPresent(key); 841 OfdpaGroupChain obj = pendingNextObjectives.getIfPresent(key);
840 - if (obj == null) { 842 + log.info("Group service processed group key {}. Done implementing "
841 - return; 843 + + "next objective: {}", appKryo.deserialize(key.key()),
842 - } 844 + obj.nextObjective().id());
845 + if (obj != null) {
843 pass(obj.nextObjective()); 846 pass(obj.nextObjective());
844 pendingNextObjectives.invalidate(key); 847 pendingNextObjectives.invalidate(key);
845 - log.info("Heard back from group service. Applying pending "
846 - + "objectives for nextId {}", obj.nextObjective().id());
847 flowObjectiveStore.putNextGroup(obj.nextObjective().id(), obj); 848 flowObjectiveStore.putNextGroup(obj.nextObjective().id(), obj);
848 } 849 }
850 + }
849 }); 851 });
850 } 852 }
851 } 853 }
852 854
853 -
854 private class InnerGroupListener implements GroupListener { 855 private class InnerGroupListener implements GroupListener {
855 @Override 856 @Override
856 public void event(GroupEvent event) { 857 public void event(GroupEvent event) {
858 + log.info("received group event of type {}", event.type());
857 if (event.type() == GroupEvent.Type.GROUP_ADDED) { 859 if (event.type() == GroupEvent.Type.GROUP_ADDED) {
858 GroupKey key = event.subject().appCookie(); 860 GroupKey key = event.subject().appCookie();
859 // first check for group chain 861 // first check for group chain
860 GroupChainElem gce = pendingGroups.remove(key); 862 GroupChainElem gce = pendingGroups.remove(key);
861 if (gce != null) { 863 if (gce != null) {
862 - log.info("group ADDED .. Processing next group in group chain " 864 + log.info("group ADDED with group key {} .. "
863 - + "with group key {}", gce.getGkey()); 865 + + "Processing next group in group chain with group key {}",
866 + appKryo.deserialize(key.key()),
867 + appKryo.deserialize(gce.getGkey().key()));
864 processGroupChain(gce); 868 processGroupChain(gce);
865 } else { 869 } else {
866 OfdpaGroupChain obj = pendingNextObjectives.getIfPresent(key); 870 OfdpaGroupChain obj = pendingNextObjectives.getIfPresent(key);
867 - log.info("group ADDED .. Applying pending objectives if any");
868 if (obj != null) { 871 if (obj != null) {
869 - flowObjectiveStore.putNextGroup(obj.nextObjective().id(), obj); 872 + log.info("group ADDED with key {}.. Done implementing next "
873 + + "objective: {}",
874 + appKryo.deserialize(key.key()), obj.nextObjective().id());
870 pass(obj.nextObjective()); 875 pass(obj.nextObjective());
871 pendingNextObjectives.invalidate(key); 876 pendingNextObjectives.invalidate(key);
877 + flowObjectiveStore.putNextGroup(obj.nextObjective().id(), obj);
872 } 878 }
873 } 879 }
874 } 880 }
......
...@@ -30,10 +30,14 @@ ...@@ -30,10 +30,14 @@
30 <driver name="spring-open-cpqd" manufacturer="Stanford University, Ericsson Research and CPqD Research" hwVersion="OpenFlow 1.3 Reference Userspace Switch" swVersion=".*"> 30 <driver name="spring-open-cpqd" manufacturer="Stanford University, Ericsson Research and CPqD Research" hwVersion="OpenFlow 1.3 Reference Userspace Switch" swVersion=".*">
31 <behaviour api="org.onosproject.net.behaviour.Pipeliner" 31 <behaviour api="org.onosproject.net.behaviour.Pipeliner"
32 impl="org.onosproject.driver.pipeline.SpringOpenTTP"/> 32 impl="org.onosproject.driver.pipeline.SpringOpenTTP"/>
33 + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
34 + impl="org.onosproject.driver.handshaker.DefaultSwitchHandShaker"/>
33 </driver> 35 </driver>
34 <driver name="spring-open" manufacturer="Dell " hwVersion="OpenFlow switch HW ver. 1.0" swVersion="OpenFlow switch SW ver. 1.0 and 1.3"> 36 <driver name="spring-open" manufacturer="Dell " hwVersion="OpenFlow switch HW ver. 1.0" swVersion="OpenFlow switch SW ver. 1.0 and 1.3">
35 <behaviour api="org.onosproject.net.behaviour.Pipeliner" 37 <behaviour api="org.onosproject.net.behaviour.Pipeliner"
36 impl="org.onosproject.driver.pipeline.SpringOpenTTPDell"/> 38 impl="org.onosproject.driver.pipeline.SpringOpenTTPDell"/>
39 + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
40 + impl="org.onosproject.driver.handshaker.DefaultSwitchHandShaker"/>
37 </driver> 41 </driver>
38 <driver name="cpqd" manufacturer="Stanford University, Ericsson Research and CPqD Research" 42 <driver name="cpqd" manufacturer="Stanford University, Ericsson Research and CPqD Research"
39 hwVersion="OpenFlow 1.3 Reference Userspace Switch" swVersion=".*"> 43 hwVersion="OpenFlow 1.3 Reference Userspace Switch" swVersion=".*">
...@@ -58,6 +62,8 @@ ...@@ -58,6 +62,8 @@
58 <driver name="ofdpa" manufacturer="Broadcom Corp." hwVersion="OF-DPA 1.0" swVersion="OF-DPA 1.0"> 62 <driver name="ofdpa" manufacturer="Broadcom Corp." hwVersion="OF-DPA 1.0" swVersion="OF-DPA 1.0">
59 <behaviour api="org.onosproject.net.behaviour.Pipeliner" 63 <behaviour api="org.onosproject.net.behaviour.Pipeliner"
60 impl="org.onosproject.driver.pipeline.OFDPA1Pipeline"/> 64 impl="org.onosproject.driver.pipeline.OFDPA1Pipeline"/>
65 + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
66 + impl="org.onosproject.driver.handshaker.DefaultSwitchHandShaker"/>
61 </driver> 67 </driver>
62 </drivers> 68 </drivers>
63 69
......
...@@ -417,9 +417,9 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { ...@@ -417,9 +417,9 @@ class OFChannelHandler extends IdleStateAwareChannelHandler {
417 h.channel.getRemoteAddress()); 417 h.channel.getRemoteAddress());
418 return; 418 return;
419 } 419 }
420 - log.info("Received switch description reply from switch at {}",
421 - h.channel.getRemoteAddress());
422 OFDescStatsReply drep = (OFDescStatsReply) m; 420 OFDescStatsReply drep = (OFDescStatsReply) m;
421 + log.info("Received switch description reply {} from switch at {}",
422 + drep, h.channel.getRemoteAddress());
423 // Here is where we differentiate between different kinds of switches 423 // Here is where we differentiate between different kinds of switches
424 h.sw = h.controller.getOFSwitchInstance(h.thisdpid, drep, h.ofVersion); 424 h.sw = h.controller.getOFSwitchInstance(h.thisdpid, drep, h.ofVersion);
425 425
......