alshabib
Committed by Gerrit Code Review

olt testing

Change-Id: I169f2225b1df7b7de0ac7d977b6b6b4c63827c56
...@@ -81,6 +81,7 @@ public class CordFabricManager implements FabricService { ...@@ -81,6 +81,7 @@ public class CordFabricManager implements FabricService {
81 private InternalDeviceListener deviceListener = new InternalDeviceListener(); 81 private InternalDeviceListener deviceListener = new InternalDeviceListener();
82 82
83 private static final int PRIORITY = 50000; 83 private static final int PRIORITY = 50000;
84 + private static final int TESTPRIO = 49999;
84 85
85 private short radiusPort = 1812; 86 private short radiusPort = 1812;
86 87
...@@ -90,6 +91,10 @@ public class CordFabricManager implements FabricService { ...@@ -90,6 +91,10 @@ public class CordFabricManager implements FabricService {
90 91
91 private final Multimap<VlanId, ConnectPoint> vlans = HashMultimap.create(); 92 private final Multimap<VlanId, ConnectPoint> vlans = HashMultimap.create();
92 93
94 + //TODO make this configurable
95 + private boolean testMode = true;
96 +
97 +
93 @Activate 98 @Activate
94 public void activate() { 99 public void activate() {
95 appId = coreService.registerApplication("org.onosproject.cordfabric"); 100 appId = coreService.registerApplication("org.onosproject.cordfabric");
...@@ -169,6 +174,22 @@ public class CordFabricManager implements FabricService { ...@@ -169,6 +174,22 @@ public class CordFabricManager implements FabricService {
169 .setOutput(PortNumber.portNumber(5)) 174 .setOutput(PortNumber.portNumber(5))
170 .build(); 175 .build();
171 176
177 + TrafficTreatment testPort = DefaultTrafficTreatment.builder()
178 + .setOutput(PortNumber.portNumber(8))
179 + .build();
180 +
181 + ForwardingObjective ofTestPath = DefaultForwardingObjective.builder()
182 + .fromApp(appId)
183 + .makePermanent()
184 + .withFlag(ForwardingObjective.Flag.VERSATILE)
185 + .withPriority(TESTPRIO)
186 + .withSelector(
187 + DefaultTrafficSelector.builder()
188 + .matchInPort(PortNumber.portNumber(2))
189 + .build())
190 + .withTreatment(testPort)
191 + .add();
192 +
172 ForwardingObjective radiusToServer = DefaultForwardingObjective.builder() 193 ForwardingObjective radiusToServer = DefaultForwardingObjective.builder()
173 .fromApp(appId) 194 .fromApp(appId)
174 .makePermanent() 195 .makePermanent()
...@@ -225,6 +246,9 @@ public class CordFabricManager implements FabricService { ...@@ -225,6 +246,9 @@ public class CordFabricManager implements FabricService {
225 .withTreatment(toOlt) 246 .withTreatment(toOlt)
226 .add(); 247 .add();
227 248
249 + if (testMode) {
250 + flowObjectiveService.forward(fabricDeviceId, ofTestPath);
251 + }
228 252
229 flowObjectiveService.forward(fabricDeviceId, upCtrl); 253 flowObjectiveService.forward(fabricDeviceId, upCtrl);
230 flowObjectiveService.forward(fabricDeviceId, downCtrl); 254 flowObjectiveService.forward(fabricDeviceId, downCtrl);
......