Jonathan Hart
Committed by Gerrit Code Review

Change OLT app to push Q-in-Q tagging flows rather than transparent VLAN flows.

Device VLAN is set through configuration, subscriber VLAN can be added using
CLI (eventually this will come through a call from the AAA app).

Moving towards generalizing this app as an 'Access Device' app rather than purely OLT.

Change-Id: I9b82b39f6a2dee2c6f10f3fd13b261f3e0313db7
...@@ -37,6 +37,15 @@ ...@@ -37,6 +37,15 @@
37 37
38 <dependencies> 38 <dependencies>
39 <dependency> 39 <dependency>
40 + <groupId>org.onosproject</groupId>
41 + <artifactId>onos-cli</artifactId>
42 + <version>${project.version}</version>
43 + </dependency>
44 + <dependency>
45 + <groupId>org.apache.karaf.shell</groupId>
46 + <artifactId>org.apache.karaf.shell.console</artifactId>
47 + </dependency>
48 + <dependency>
40 <groupId>com.google.guava</groupId> 49 <groupId>com.google.guava</groupId>
41 <artifactId>guava</artifactId> 50 <artifactId>guava</artifactId>
42 </dependency> 51 </dependency>
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.olt;
18 +
19 +import org.onlab.packet.VlanId;
20 +import org.onosproject.net.DeviceId;
21 +import org.onosproject.net.PortNumber;
22 +import org.onosproject.net.config.Config;
23 +
24 +/**
25 + * Config object for access device data.
26 + */
27 +public class AccessDeviceConfig extends Config<DeviceId> {
28 +
29 + private static final String UPLINK = "uplink";
30 + private static final String VLAN = "vlan";
31 +
32 + /**
33 + * Gets the access device configuration for this device.
34 + *
35 + * @return access device configuration
36 + */
37 + public AccessDeviceData getOlt() {
38 + PortNumber uplink = PortNumber.portNumber(node.path(UPLINK).asText());
39 + VlanId vlan = VlanId.vlanId(Short.parseShort(node.path(VLAN).asText()));
40 +
41 + return new AccessDeviceData(subject(), uplink, vlan);
42 + }
43 +}
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.olt;
18 +
19 +import org.onlab.packet.VlanId;
20 +import org.onosproject.net.DeviceId;
21 +import org.onosproject.net.PortNumber;
22 +
23 +import static com.google.common.base.Preconditions.checkNotNull;
24 +
25 +/**
26 + * Information about an access device.
27 + */
28 +public class AccessDeviceData {
29 + private static final String DEVICE_ID_MISSING = "Device ID cannot be null";
30 + private static final String UPLINK_MISSING = "Uplink cannot be null";
31 + private static final String VLAN_MISSING = "VLAN ID cannot be null";
32 +
33 + private final DeviceId deviceId;
34 + private final PortNumber uplink;
35 + private final VlanId vlan;
36 +
37 + /**
38 + * Class constructor.
39 + *
40 + * @param deviceId access device ID
41 + * @param uplink uplink port number
42 + * @param vlan device VLAN ID
43 + */
44 + public AccessDeviceData(DeviceId deviceId, PortNumber uplink, VlanId vlan) {
45 + this.deviceId = checkNotNull(deviceId, DEVICE_ID_MISSING);
46 + this.uplink = checkNotNull(uplink, UPLINK_MISSING);
47 + this.vlan = checkNotNull(vlan, VLAN_MISSING);
48 + }
49 +
50 + /**
51 + * Retrieves the access device ID.
52 + *
53 + * @return device ID
54 + */
55 + public DeviceId deviceId() {
56 + return deviceId;
57 + }
58 +
59 + /**
60 + * Retrieves the uplink port number.
61 + *
62 + * @return port number
63 + */
64 + public PortNumber uplink() {
65 + return uplink;
66 + }
67 +
68 + /**
69 + * Retrieves the VLAN ID assigned to the device.
70 + *
71 + * @return vlan ID
72 + */
73 + public VlanId vlan() {
74 + return vlan;
75 + }
76 +}
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.olt;
18 +
19 +import org.onlab.packet.VlanId;
20 +import org.onosproject.net.ConnectPoint;
21 +
22 +/**
23 + * Service for interacting with an access device (OLT).
24 + */
25 +public interface AccessDeviceService {
26 +
27 + /**
28 + * Provisions connectivity for a subscriber on an access device.
29 + *
30 + * @param port subscriber's connection point
31 + * @param vlan VLAN ID to provision for subscriber
32 + */
33 + void provisionSubscriber(ConnectPoint port, VlanId vlan);
34 +
35 + /**
36 + * Removes provisioned connectivity for a subscriber from an access device.
37 + *
38 + * @param port subscriber's connection point
39 + */
40 + void removeSubscriber(ConnectPoint port);
41 +}
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
15 */ 15 */
16 package org.onosproject.olt; 16 package org.onosproject.olt;
17 17
18 -
19 import com.google.common.base.Strings; 18 import com.google.common.base.Strings;
20 import org.apache.felix.scr.annotations.Activate; 19 import org.apache.felix.scr.annotations.Activate;
21 import org.apache.felix.scr.annotations.Component; 20 import org.apache.felix.scr.annotations.Component;
...@@ -24,13 +23,20 @@ import org.apache.felix.scr.annotations.Modified; ...@@ -24,13 +23,20 @@ import org.apache.felix.scr.annotations.Modified;
24 import org.apache.felix.scr.annotations.Property; 23 import org.apache.felix.scr.annotations.Property;
25 import org.apache.felix.scr.annotations.Reference; 24 import org.apache.felix.scr.annotations.Reference;
26 import org.apache.felix.scr.annotations.ReferenceCardinality; 25 import org.apache.felix.scr.annotations.ReferenceCardinality;
26 +import org.apache.felix.scr.annotations.Service;
27 import org.onlab.packet.VlanId; 27 import org.onlab.packet.VlanId;
28 import org.onlab.util.Tools; 28 import org.onlab.util.Tools;
29 import org.onosproject.core.ApplicationId; 29 import org.onosproject.core.ApplicationId;
30 import org.onosproject.core.CoreService; 30 import org.onosproject.core.CoreService;
31 +import org.onosproject.net.ConnectPoint;
31 import org.onosproject.net.DeviceId; 32 import org.onosproject.net.DeviceId;
32 import org.onosproject.net.Port; 33 import org.onosproject.net.Port;
33 import org.onosproject.net.PortNumber; 34 import org.onosproject.net.PortNumber;
35 +import org.onosproject.net.config.ConfigFactory;
36 +import org.onosproject.net.config.NetworkConfigEvent;
37 +import org.onosproject.net.config.NetworkConfigListener;
38 +import org.onosproject.net.config.NetworkConfigRegistry;
39 +import org.onosproject.net.config.basics.SubjectFactories;
34 import org.onosproject.net.device.DeviceEvent; 40 import org.onosproject.net.device.DeviceEvent;
35 import org.onosproject.net.device.DeviceListener; 41 import org.onosproject.net.device.DeviceListener;
36 import org.onosproject.net.device.DeviceService; 42 import org.onosproject.net.device.DeviceService;
...@@ -45,15 +51,17 @@ import org.osgi.service.component.ComponentContext; ...@@ -45,15 +51,17 @@ import org.osgi.service.component.ComponentContext;
45 import org.slf4j.Logger; 51 import org.slf4j.Logger;
46 52
47 import java.util.Dictionary; 53 import java.util.Dictionary;
54 +import java.util.Map;
55 +import java.util.concurrent.ConcurrentHashMap;
48 56
49 import static org.slf4j.LoggerFactory.getLogger; 57 import static org.slf4j.LoggerFactory.getLogger;
50 58
51 /** 59 /**
52 - * Sample mobility application. Cleans up flowmods when a host moves. 60 + * Provisions rules on access devices.
53 */ 61 */
62 +@Service
54 @Component(immediate = true) 63 @Component(immediate = true)
55 -public class OLT { 64 +public class OLT implements AccessDeviceService {
56 -
57 private final Logger log = getLogger(getClass()); 65 private final Logger log = getLogger(getClass());
58 66
59 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 67 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
...@@ -65,10 +73,14 @@ public class OLT { ...@@ -65,10 +73,14 @@ public class OLT {
65 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 73 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
66 protected CoreService coreService; 74 protected CoreService coreService;
67 75
76 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
77 + protected NetworkConfigRegistry networkConfig;
78 +
68 private final DeviceListener deviceListener = new InternalDeviceListener(); 79 private final DeviceListener deviceListener = new InternalDeviceListener();
69 80
70 private ApplicationId appId; 81 private ApplicationId appId;
71 82
83 + private static final VlanId DEFAULT_VLAN = VlanId.vlanId((short) 0);
72 public static final int OFFSET = 200; 84 public static final int OFFSET = 200;
73 85
74 public static final int UPLINK_PORT = 129; 86 public static final int UPLINK_PORT = 129;
...@@ -94,11 +106,39 @@ public class OLT { ...@@ -94,11 +106,39 @@ public class OLT {
94 label = "The gfast device id") 106 label = "The gfast device id")
95 private String gfastDevice = GFAST_DEVICE; 107 private String gfastDevice = GFAST_DEVICE;
96 108
109 + private Map<DeviceId, AccessDeviceData> oltData = new ConcurrentHashMap<>();
110 +
111 + private InternalNetworkConfigListener configListener =
112 + new InternalNetworkConfigListener();
113 + private static final Class<AccessDeviceConfig> CONFIG_CLASS =
114 + AccessDeviceConfig.class;
115 +
116 + private ConfigFactory<DeviceId, AccessDeviceConfig> configFactory =
117 + new ConfigFactory<DeviceId, AccessDeviceConfig>(
118 + SubjectFactories.DEVICE_SUBJECT_FACTORY, CONFIG_CLASS, "accessDevice") {
119 + @Override
120 + public AccessDeviceConfig createConfig() {
121 + return new AccessDeviceConfig();
122 + }
123 + };
97 124
98 @Activate 125 @Activate
99 public void activate() { 126 public void activate() {
100 appId = coreService.registerApplication("org.onosproject.olt"); 127 appId = coreService.registerApplication("org.onosproject.olt");
101 128
129 + networkConfig.registerConfigFactory(configFactory);
130 + networkConfig.addListener(configListener);
131 +
132 + networkConfig.getSubjects(DeviceId.class, AccessDeviceConfig.class).forEach(
133 + subject -> {
134 + AccessDeviceConfig config = networkConfig.getConfig(subject, AccessDeviceConfig.class);
135 + if (config != null) {
136 + AccessDeviceData data = config.getOlt();
137 + oltData.put(data.deviceId(), data);
138 + }
139 + }
140 + );
141 +
102 /*deviceService.addListener(deviceListener); 142 /*deviceService.addListener(deviceListener);
103 143
104 deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach( 144 deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach(
...@@ -129,6 +169,8 @@ public class OLT { ...@@ -129,6 +169,8 @@ public class OLT {
129 169
130 @Deactivate 170 @Deactivate
131 public void deactivate() { 171 public void deactivate() {
172 + networkConfig.removeListener(configListener);
173 + networkConfig.unregisterConfigFactory(configFactory);
132 log.info("Stopped"); 174 log.info("Stopped");
133 } 175 }
134 176
...@@ -136,16 +178,13 @@ public class OLT { ...@@ -136,16 +178,13 @@ public class OLT {
136 public void modified(ComponentContext context) { 178 public void modified(ComponentContext context) {
137 Dictionary<?, ?> properties = context.getProperties(); 179 Dictionary<?, ?> properties = context.getProperties();
138 180
139 -
140 String s = Tools.get(properties, "uplinkPort"); 181 String s = Tools.get(properties, "uplinkPort");
141 uplinkPort = Strings.isNullOrEmpty(s) ? UPLINK_PORT : Integer.parseInt(s); 182 uplinkPort = Strings.isNullOrEmpty(s) ? UPLINK_PORT : Integer.parseInt(s);
142 183
143 s = Tools.get(properties, "oltDevice"); 184 s = Tools.get(properties, "oltDevice");
144 oltDevice = Strings.isNullOrEmpty(s) ? OLT_DEVICE : s; 185 oltDevice = Strings.isNullOrEmpty(s) ? OLT_DEVICE : s;
145 -
146 } 186 }
147 187
148 -
149 private short fetchVlanId(PortNumber port) { 188 private short fetchVlanId(PortNumber port) {
150 long p = port.toLong() + OFFSET; 189 long p = port.toLong() + OFFSET;
151 if (p > 4095) { 190 if (p > 4095) {
...@@ -155,7 +194,6 @@ public class OLT { ...@@ -155,7 +194,6 @@ public class OLT {
155 return (short) p; 194 return (short) p;
156 } 195 }
157 196
158 -
159 private void provisionVlanOnPort(String deviceId, int uplinkPort, PortNumber p, short vlanId) { 197 private void provisionVlanOnPort(String deviceId, int uplinkPort, PortNumber p, short vlanId) {
160 DeviceId did = DeviceId.deviceId(deviceId); 198 DeviceId did = DeviceId.deviceId(deviceId);
161 199
...@@ -198,7 +236,73 @@ public class OLT { ...@@ -198,7 +236,73 @@ public class OLT {
198 236
199 flowObjectiveService.forward(did, upFwd); 237 flowObjectiveService.forward(did, upFwd);
200 flowObjectiveService.forward(did, downFwd); 238 flowObjectiveService.forward(did, downFwd);
239 + }
201 240
241 + @Override
242 + public void provisionSubscriber(ConnectPoint port, VlanId vlan) {
243 + AccessDeviceData olt = oltData.get(port.deviceId());
244 +
245 + if (olt == null) {
246 + log.warn("No data found for OLT device {}", port.deviceId());
247 + return;
248 + }
249 +
250 + provisionVlans(olt.deviceId(), olt.uplink(), port.port(), vlan, olt.vlan());
251 + }
252 +
253 + private void provisionVlans(DeviceId deviceId, PortNumber uplinkPort,
254 + PortNumber subscriberPort,
255 + VlanId subscriberVlan, VlanId deviceVlan) {
256 +
257 + TrafficSelector upstream = DefaultTrafficSelector.builder()
258 + .matchVlanId(DEFAULT_VLAN)
259 + .matchInPort(subscriberPort)
260 + .build();
261 +
262 + TrafficSelector downstream = DefaultTrafficSelector.builder()
263 + .matchVlanId(deviceVlan)
264 + .matchInPort(uplinkPort)
265 + .build();
266 +
267 + TrafficTreatment upstreamTreatment = DefaultTrafficTreatment.builder()
268 + .setVlanId(subscriberVlan)
269 + .pushVlan()
270 + .setVlanId(deviceVlan)
271 + .setOutput(uplinkPort)
272 + .build();
273 +
274 + TrafficTreatment downstreamTreatment = DefaultTrafficTreatment.builder()
275 + .popVlan()
276 + .setVlanId(DEFAULT_VLAN)
277 + .setOutput(subscriberPort)
278 + .build();
279 +
280 +
281 + ForwardingObjective upFwd = DefaultForwardingObjective.builder()
282 + .withFlag(ForwardingObjective.Flag.VERSATILE)
283 + .withPriority(1000)
284 + .makePermanent()
285 + .withSelector(upstream)
286 + .fromApp(appId)
287 + .withTreatment(upstreamTreatment)
288 + .add();
289 +
290 + ForwardingObjective downFwd = DefaultForwardingObjective.builder()
291 + .withFlag(ForwardingObjective.Flag.VERSATILE)
292 + .withPriority(1000)
293 + .makePermanent()
294 + .withSelector(downstream)
295 + .fromApp(appId)
296 + .withTreatment(downstreamTreatment)
297 + .add();
298 +
299 + flowObjectiveService.forward(deviceId, upFwd);
300 + flowObjectiveService.forward(deviceId, downFwd);
301 + }
302 +
303 + @Override
304 + public void removeSubscriber(ConnectPoint port) {
305 + throw new UnsupportedOperationException("Not yet implemented");
202 } 306 }
203 307
204 private class InternalDeviceListener implements DeviceListener { 308 private class InternalDeviceListener implements DeviceListener {
...@@ -226,7 +330,27 @@ public class OLT { ...@@ -226,7 +330,27 @@ public class OLT {
226 } 330 }
227 } 331 }
228 332
333 + private class InternalNetworkConfigListener implements NetworkConfigListener {
334 + @Override
335 + public void event(NetworkConfigEvent event) {
336 + switch (event.type()) {
229 337
230 -} 338 + case CONFIG_ADDED:
231 - 339 + case CONFIG_UPDATED:
340 + if (event.configClass().equals(CONFIG_CLASS)) {
341 + AccessDeviceConfig config =
342 + networkConfig.getConfig((DeviceId) event.subject(), CONFIG_CLASS);
343 + if (config != null) {
344 + oltData.put(config.getOlt().deviceId(), config.getOlt());
345 + }
346 + }
347 + break;
348 + case CONFIG_UNREGISTERED:
349 + case CONFIG_REMOVED:
350 + default:
351 + break;
352 + }
353 + }
354 + }
232 355
356 +}
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.olt;
18 +
19 +import org.apache.karaf.shell.commands.Argument;
20 +import org.apache.karaf.shell.commands.Command;
21 +import org.onlab.packet.VlanId;
22 +import org.onosproject.cli.AbstractShellCommand;
23 +import org.onosproject.net.ConnectPoint;
24 +import org.onosproject.net.DeviceId;
25 +import org.onosproject.net.PortNumber;
26 +
27 +/**
28 + * Adds a subscriber to an access device.
29 + */
30 +@Command(scope = "onos", name = "add-subscriber-access",
31 + description = "Adds a subscriber to an access device")
32 +public class SubscriberAddCommand extends AbstractShellCommand {
33 +
34 + @Argument(index = 0, name = "deviceId", description = "Access device ID",
35 + required = true, multiValued = false)
36 + private String strDeviceId = null;
37 +
38 + @Argument(index = 1, name = "port", description = "Subscriber port number",
39 + required = true, multiValued = false)
40 + private String strPort = null;
41 +
42 + @Argument(index = 2, name = "vlanId",
43 + description = "VLAN ID to add",
44 + required = true, multiValued = false)
45 + private String strVlanId = null;
46 +
47 + @Override
48 + protected void execute() {
49 + AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
50 +
51 + DeviceId deviceId = DeviceId.deviceId(strDeviceId);
52 + PortNumber port = PortNumber.portNumber(strPort);
53 + VlanId vlan = VlanId.vlanId(Short.parseShort(strVlanId));
54 + ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
55 +
56 + service.provisionSubscriber(connectPoint, vlan);
57 + }
58 +}
1 +<!--
2 + ~ Copyright 2015 Open Networking Laboratory
3 + ~
4 + ~ Licensed under the Apache License, Version 2.0 (the "License");
5 + ~ you may not use this file except in compliance with the License.
6 + ~ You may obtain a copy of the License at
7 + ~
8 + ~ http://www.apache.org/licenses/LICENSE-2.0
9 + ~
10 + ~ Unless required by applicable law or agreed to in writing, software
11 + ~ distributed under the License is distributed on an "AS IS" BASIS,
12 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + ~ See the License for the specific language governing permissions and
14 + ~ limitations under the License.
15 + -->
16 +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
17 +
18 + <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
19 + <command>
20 + <action class="org.onosproject.olt.SubscriberAddCommand"/>
21 + <completers>
22 + <ref component-id="deviceIdCompleter"/>
23 + <null/>
24 + </completers>
25 + </command>
26 + </command-bundle>
27 +
28 + <bean id="deviceIdCompleter" class="org.onosproject.cli.net.DeviceIdCompleter"/>
29 +</blueprint>
...@@ -190,14 +190,14 @@ public interface TrafficTreatment { ...@@ -190,14 +190,14 @@ public interface TrafficTreatment {
190 /** 190 /**
191 * Push MPLS ether type. 191 * Push MPLS ether type.
192 * 192 *
193 - * @return a treatment builder. 193 + * @return a treatment builder
194 */ 194 */
195 Builder pushMpls(); 195 Builder pushMpls();
196 196
197 /** 197 /**
198 * Pops MPLS ether type. 198 * Pops MPLS ether type.
199 * 199 *
200 - * @return a treatment builder. 200 + * @return a treatment builder
201 */ 201 */
202 Builder popMpls(); 202 Builder popMpls();
203 203
...@@ -205,7 +205,7 @@ public interface TrafficTreatment { ...@@ -205,7 +205,7 @@ public interface TrafficTreatment {
205 * Pops MPLS ether type and set the new ethertype. 205 * Pops MPLS ether type and set the new ethertype.
206 * 206 *
207 * @param etherType an ether type 207 * @param etherType an ether type
208 - * @return a treatment builder. 208 + * @return a treatment builder
209 * @deprecated in Drake Release 209 * @deprecated in Drake Release
210 */ 210 */
211 @Deprecated 211 @Deprecated
...@@ -215,22 +215,22 @@ public interface TrafficTreatment { ...@@ -215,22 +215,22 @@ public interface TrafficTreatment {
215 * Pops MPLS ether type and set the new ethertype. 215 * Pops MPLS ether type and set the new ethertype.
216 * 216 *
217 * @param etherType an ether type 217 * @param etherType an ether type
218 - * @return a treatment builder. 218 + * @return a treatment builder
219 */ 219 */
220 Builder popMpls(EthType etherType); 220 Builder popMpls(EthType etherType);
221 221
222 /** 222 /**
223 * Sets the mpls label. 223 * Sets the mpls label.
224 * 224 *
225 - * @param mplsLabel MPLS label. 225 + * @param mplsLabel MPLS label
226 - * @return a treatment builder. 226 + * @return a treatment builder
227 */ 227 */
228 Builder setMpls(MplsLabel mplsLabel); 228 Builder setMpls(MplsLabel mplsLabel);
229 229
230 /** 230 /**
231 * Sets the mpls bottom-of-stack indicator bit. 231 * Sets the mpls bottom-of-stack indicator bit.
232 * 232 *
233 - * @param mplsBos boolean to set BOS=1 (true) or BOS=0 (false). 233 + * @param mplsBos boolean to set BOS=1 (true) or BOS=0 (false)
234 * @return a treatment builder. 234 * @return a treatment builder.
235 */ 235 */
236 Builder setMplsBos(boolean mplsBos); 236 Builder setMplsBos(boolean mplsBos);
...@@ -288,14 +288,14 @@ public interface TrafficTreatment { ...@@ -288,14 +288,14 @@ public interface TrafficTreatment {
288 /** 288 /**
289 * Pops outermost VLAN tag. 289 * Pops outermost VLAN tag.
290 * 290 *
291 - * @return a treatment builder. 291 + * @return a treatment builder
292 */ 292 */
293 Builder popVlan(); 293 Builder popVlan();
294 294
295 /** 295 /**
296 * Pushes a new VLAN tag. 296 * Pushes a new VLAN tag.
297 * 297 *
298 - * @return a treatment builder. 298 + * @return a treatment builder
299 */ 299 */
300 Builder pushVlan(); 300 Builder pushVlan();
301 301
...@@ -335,8 +335,8 @@ public interface TrafficTreatment { ...@@ -335,8 +335,8 @@ public interface TrafficTreatment {
335 /** 335 /**
336 * Sets the tunnel id. 336 * Sets the tunnel id.
337 * 337 *
338 - * @param tunnelId a tunnel id. 338 + * @param tunnelId a tunnel id
339 - * @return a treatment builder. 339 + * @return a treatment builder
340 */ 340 */
341 Builder setTunnelId(long tunnelId); 341 Builder setTunnelId(long tunnelId);
342 342
......
...@@ -30,7 +30,6 @@ import org.onosproject.net.device.DefaultDeviceDescription; ...@@ -30,7 +30,6 @@ import org.onosproject.net.device.DefaultDeviceDescription;
30 import org.onosproject.net.device.DeviceDescription; 30 import org.onosproject.net.device.DeviceDescription;
31 import org.onosproject.net.device.DeviceProvider; 31 import org.onosproject.net.device.DeviceProvider;
32 import org.onosproject.net.device.DeviceProviderRegistry; 32 import org.onosproject.net.device.DeviceProviderRegistry;
33 -import org.onosproject.net.device.DeviceProviderService;
34 import org.onosproject.net.device.DeviceService; 33 import org.onosproject.net.device.DeviceService;
35 import org.onosproject.net.driver.AbstractHandlerBehaviour; 34 import org.onosproject.net.driver.AbstractHandlerBehaviour;
36 import org.onosproject.net.flow.DefaultFlowRule; 35 import org.onosproject.net.flow.DefaultFlowRule;
...@@ -86,13 +85,13 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -86,13 +85,13 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
86 flowRuleService = serviceDirectory.get(FlowRuleService.class); 85 flowRuleService = serviceDirectory.get(FlowRuleService.class);
87 coreService = serviceDirectory.get(CoreService.class); 86 coreService = serviceDirectory.get(CoreService.class);
88 87
89 - try { 88 + /*try {
90 DeviceProviderService providerService = registry.register(provider); 89 DeviceProviderService providerService = registry.register(provider);
91 providerService.deviceConnected(deviceId, 90 providerService.deviceConnected(deviceId,
92 description(deviceId, DEVICE, OLT)); 91 description(deviceId, DEVICE, OLT));
93 } finally { 92 } finally {
94 registry.unregister(provider); 93 registry.unregister(provider);
95 - } 94 + }*/
96 95
97 appId = coreService.registerApplication( 96 appId = coreService.registerApplication(
98 "org.onosproject.driver.OLTPipeline"); 97 "org.onosproject.driver.OLTPipeline");
...@@ -109,12 +108,12 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -109,12 +108,12 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
109 PacketPriority.CONTROL.priorityValue(), 108 PacketPriority.CONTROL.priorityValue(),
110 appId, 0, true, null); 109 appId, 0, true, null);
111 110
112 - flowRuleService.applyFlowRules(flowRule); 111 + //flowRuleService.applyFlowRules(flowRule);
113 } 112 }
114 113
115 @Override 114 @Override
116 public void filter(FilteringObjective filter) { 115 public void filter(FilteringObjective filter) {
117 - throw new UnsupportedOperationException("Single table does not filter."); 116 + throw new UnsupportedOperationException("OLT does not filter.");
118 } 117 }
119 118
120 @Override 119 @Override
...@@ -140,19 +139,11 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -140,19 +139,11 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
140 139
141 TrafficSelector selector = fwd.selector(); 140 TrafficSelector selector = fwd.selector();
142 TrafficTreatment treatment = fwd.treatment(); 141 TrafficTreatment treatment = fwd.treatment();
143 - if ((fwd.treatment().deferred().size() == 0) &&
144 - (fwd.treatment().immediate().size() == 0) &&
145 - (fwd.treatment().tableTransition() == null) &&
146 - (!fwd.treatment().clearedDeferred())) {
147 - TrafficTreatment.Builder flowTreatment = DefaultTrafficTreatment.builder();
148 - flowTreatment.add(Instructions.createDrop());
149 - treatment = flowTreatment.build();
150 - }
151 142
152 FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() 143 FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
153 .forDevice(deviceId) 144 .forDevice(deviceId)
154 .withSelector(selector) 145 .withSelector(selector)
155 - .withTreatment(fwd.treatment()) 146 + .withTreatment(treatment)
156 .fromApp(fwd.appId()) 147 .fromApp(fwd.appId())
157 .withPriority(fwd.priority()); 148 .withPriority(fwd.priority());
158 149
...@@ -162,9 +153,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -162,9 +153,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
162 ruleBuilder.makeTemporary(fwd.timeout()); 153 ruleBuilder.makeTemporary(fwd.timeout());
163 } 154 }
164 155
165 -
166 switch (fwd.op()) { 156 switch (fwd.op()) {
167 -
168 case ADD: 157 case ADD:
169 flowBuilder.add(ruleBuilder.build()); 158 flowBuilder.add(ruleBuilder.build());
170 break; 159 break;
...@@ -190,16 +179,16 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -190,16 +179,16 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
190 } 179 }
191 } 180 }
192 })); 181 }));
193 -
194 } 182 }
195 183
196 @Override 184 @Override
197 public void next(NextObjective nextObjective) { 185 public void next(NextObjective nextObjective) {
198 - throw new UnsupportedOperationException("Single table does not next hop."); 186 + throw new UnsupportedOperationException("OLT does not next hop.");
199 } 187 }
200 188
201 /** 189 /**
202 * Build a device description. 190 * Build a device description.
191 + *
203 * @param deviceId a deviceId 192 * @param deviceId a deviceId
204 * @param key the key of the annotation 193 * @param key the key of the annotation
205 * @param value the value for the annotation 194 * @param value the value for the annotation
......
...@@ -45,7 +45,7 @@ public class EthType { ...@@ -45,7 +45,7 @@ public class EthType {
45 private final Deserializer<?> deserializer; 45 private final Deserializer<?> deserializer;
46 46
47 /** 47 /**
48 - * Constucts a new ethertype. 48 + * Constructs a new ethertype.
49 * 49 *
50 * @param ethType The actual ethertype 50 * @param ethType The actual ethertype
51 * @param type it's textual representation 51 * @param type it's textual representation
......