Committed by
Gerrit Code Review
Low level openflow drivers have been promoted to the driver subsystem.
All new device drivers should provide a handshaking behaviour as well as well as a pipeline behaviour. Change-Id: I883830b074e5d254a8cc6100e6c4fa0023594a36
Showing
30 changed files
with
392 additions
and
1150 deletions
drivers/features.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
18 | + <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository> | ||
19 | + <feature name="${project.artifactId}" version="${project.version}" | ||
20 | + description="${project.description}"> | ||
21 | + <feature>onos-api</feature> | ||
22 | + <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> | ||
23 | + <bundle>mvn:${project.groupId}/onos-of-api/${project.version}</bundle> | ||
24 | + </feature> | ||
25 | +</features> |
... | @@ -48,6 +48,11 @@ | ... | @@ -48,6 +48,11 @@ |
48 | </dependency> | 48 | </dependency> |
49 | 49 | ||
50 | <dependency> | 50 | <dependency> |
51 | + <groupId>org.onosproject</groupId> | ||
52 | + <artifactId>onos-of-api</artifactId> | ||
53 | + </dependency> | ||
54 | + | ||
55 | + <dependency> | ||
51 | <groupId>org.easymock</groupId> | 56 | <groupId>org.easymock</groupId> |
52 | <artifactId>easymock</artifactId> | 57 | <artifactId>easymock</artifactId> |
53 | <scope>test</scope> | 58 | <scope>test</scope> | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.driver.pipeline; | 16 | +package org.onosproject.driver; |
17 | 17 | ||
18 | import org.apache.felix.scr.annotations.Activate; | 18 | import org.apache.felix.scr.annotations.Activate; |
19 | import org.apache.felix.scr.annotations.Component; | 19 | import org.apache.felix.scr.annotations.Component; | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2014-2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -13,88 +13,58 @@ | ... | @@ -13,88 +13,58 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.openflow.drivers; | 16 | +package org.onosproject.driver.handshaker; |
17 | 17 | ||
18 | -import java.util.Collections; | ||
19 | -import java.util.List; | ||
20 | - | ||
21 | -import org.onosproject.openflow.controller.Dpid; | ||
22 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | 18 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; |
23 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
24 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; | 19 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; |
25 | import org.projectfloodlight.openflow.protocol.OFMessage; | 20 | import org.projectfloodlight.openflow.protocol.OFMessage; |
26 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 21 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
27 | -import org.projectfloodlight.openflow.types.TableId; | 22 | +import org.projectfloodlight.openflow.protocol.OFVersion; |
23 | + | ||
24 | +import java.util.Collections; | ||
25 | +import java.util.List; | ||
26 | +import java.util.stream.Collectors; | ||
28 | 27 | ||
29 | /** | 28 | /** |
30 | - * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make | 29 | + * Default driver to fallback on if no other driver is available. |
31 | - * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software : | ||
32 | - * 1.11.90 (or whatever version + build) Serial : None | ||
33 | */ | 30 | */ |
34 | -public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch { | 31 | +public class DefaultSwitchHandShaker extends AbstractOpenFlowSwitch { |
35 | 32 | ||
36 | private static final int LOWEST_PRIORITY = 0; | 33 | private static final int LOWEST_PRIORITY = 0; |
37 | 34 | ||
38 | - public OFSwitchImplOVS10(Dpid dpid, OFDescStatsReply desc) { | ||
39 | - super(dpid); | ||
40 | - setSwitchDescription(desc); | ||
41 | - | ||
42 | - } | ||
43 | - | ||
44 | - /* (non-Javadoc) | ||
45 | - * @see java.lang.Object#toString() | ||
46 | - */ | ||
47 | - @Override | ||
48 | - public String toString() { | ||
49 | - return "OFSwitchImplOVS10 [" + ((channel != null) | ||
50 | - ? channel.getRemoteAddress() : "?") | ||
51 | - + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]"; | ||
52 | - } | ||
53 | - | ||
54 | @Override | 35 | @Override |
55 | public Boolean supportNxRole() { | 36 | public Boolean supportNxRole() { |
56 | - return true; | 37 | + if (this.factory().getVersion() == OFVersion.OF_10) { |
38 | + return true; | ||
39 | + } | ||
40 | + return false; | ||
57 | } | 41 | } |
58 | 42 | ||
59 | @Override | 43 | @Override |
60 | public void startDriverHandshake() { | 44 | public void startDriverHandshake() { |
61 | - OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd(); | 45 | + if (factory().getVersion() == OFVersion.OF_10) { |
62 | - fmBuilder.setPriority(LOWEST_PRIORITY); | 46 | + OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd(); |
63 | - write(fmBuilder.build()); | 47 | + fmBuilder.setPriority(LOWEST_PRIORITY); |
64 | - } | 48 | + sendMsg(fmBuilder.build()); |
65 | - | 49 | + } |
66 | - @Override | ||
67 | - public boolean isDriverHandshakeComplete() { | ||
68 | - return true; | ||
69 | } | 50 | } |
70 | 51 | ||
71 | @Override | 52 | @Override |
72 | public void processDriverHandshakeMessage(OFMessage m) {} | 53 | public void processDriverHandshakeMessage(OFMessage m) {} |
73 | 54 | ||
74 | @Override | 55 | @Override |
75 | - public void write(OFMessage msg) { | 56 | + public boolean isDriverHandshakeComplete() { |
76 | - channel.write(Collections.singletonList(msg)); | 57 | + return true; |
77 | - } | ||
78 | - | ||
79 | - @Override | ||
80 | - public void write(List<OFMessage> msgs) { | ||
81 | - channel.write(msgs); | ||
82 | } | 58 | } |
83 | 59 | ||
84 | @Override | 60 | @Override |
85 | public List<OFPortDesc> getPorts() { | 61 | public List<OFPortDesc> getPorts() { |
86 | - return Collections.unmodifiableList(features.getPorts()); | 62 | + if (this.factory().getVersion() == OFVersion.OF_10) { |
63 | + return Collections.unmodifiableList(features.getPorts()); | ||
64 | + } else { | ||
65 | + return Collections.unmodifiableList( | ||
66 | + ports.stream().flatMap(p -> p.getEntries().stream()) | ||
67 | + .collect(Collectors.toList())); | ||
68 | + } | ||
87 | } | 69 | } |
88 | - | ||
89 | - @Override | ||
90 | - public TableType getTableType(TableId tid) { | ||
91 | - return TableType.NONE; | ||
92 | - } | ||
93 | - | ||
94 | - @Override | ||
95 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
96 | - // TODO Auto-generated method stub | ||
97 | - | ||
98 | - } | ||
99 | - | ||
100 | } | 70 | } | ... | ... |
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 | +package org.onosproject.driver.handshaker; | ||
17 | + | ||
18 | +import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | ||
19 | +import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; | ||
20 | +import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; | ||
21 | +import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; | ||
22 | +import org.projectfloodlight.openflow.protocol.OFBarrierRequest; | ||
23 | +import org.projectfloodlight.openflow.protocol.OFFlowMod; | ||
24 | +import org.projectfloodlight.openflow.protocol.OFMessage; | ||
25 | +import org.projectfloodlight.openflow.protocol.OFType; | ||
26 | +import org.projectfloodlight.openflow.types.OFGroup; | ||
27 | +import org.projectfloodlight.openflow.types.TableId; | ||
28 | + | ||
29 | +import java.util.Collections; | ||
30 | +import java.util.concurrent.atomic.AtomicBoolean; | ||
31 | + | ||
32 | +//import java.util.ArrayList; | ||
33 | + | ||
34 | +/** | ||
35 | + * Corsa switch driver for BGP Router deployment. | ||
36 | + */ | ||
37 | +public class OFCorsaSwitchDriver extends AbstractOpenFlowSwitch { | ||
38 | + | ||
39 | + private AtomicBoolean handShakeComplete = new AtomicBoolean(false); | ||
40 | + | ||
41 | + private int barrierXid; | ||
42 | + | ||
43 | + | ||
44 | + @Override | ||
45 | + public Boolean supportNxRole() { | ||
46 | + return false; | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public void startDriverHandshake() { | ||
51 | + if (startDriverHandshakeCalled) { | ||
52 | + throw new SwitchDriverSubHandshakeAlreadyStarted(); | ||
53 | + } | ||
54 | + startDriverHandshakeCalled = true; | ||
55 | + OFFlowMod fm = factory().buildFlowDelete() | ||
56 | + .setTableId(TableId.ALL) | ||
57 | + .setOutGroup(OFGroup.ANY) | ||
58 | + .build(); | ||
59 | + | ||
60 | + sendMsg(Collections.singletonList(fm)); | ||
61 | + | ||
62 | + barrierXid = getNextTransactionId(); | ||
63 | + OFBarrierRequest barrier = factory().buildBarrierRequest() | ||
64 | + .setXid(barrierXid).build(); | ||
65 | + | ||
66 | + | ||
67 | + sendMsg(Collections.singletonList(barrier)); | ||
68 | + | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public boolean isDriverHandshakeComplete() { | ||
73 | + if (!startDriverHandshakeCalled) { | ||
74 | + throw new SwitchDriverSubHandshakeAlreadyStarted(); | ||
75 | + } | ||
76 | + return handShakeComplete.get(); | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public void processDriverHandshakeMessage(OFMessage m) { | ||
81 | + if (!startDriverHandshakeCalled) { | ||
82 | + throw new SwitchDriverSubHandshakeNotStarted(); | ||
83 | + } | ||
84 | + if (handShakeComplete.get()) { | ||
85 | + throw new SwitchDriverSubHandshakeCompleted(m); | ||
86 | + } | ||
87 | + if (m.getType() == OFType.BARRIER_REPLY && | ||
88 | + m.getXid() == barrierXid) { | ||
89 | + handShakeComplete.set(true); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | +} |
1 | /* | 1 | /* |
2 | - * Copyright 2014 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -13,8 +13,8 @@ | ... | @@ -13,8 +13,8 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | +package org.onosproject.driver.handshaker; | ||
16 | 17 | ||
17 | -/** | 18 | +public class OFOVSSwitchCorsaTTP extends OFCorsaSwitchDriver { |
18 | - * OpenFlow base switch drivers implementations. | 19 | + |
19 | - */ | 20 | +} |
20 | -package org.onosproject.openflow.drivers; | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2014-2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -13,9 +13,8 @@ | ... | @@ -13,9 +13,8 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.openflow.drivers; | 16 | +package org.onosproject.driver.handshaker; |
17 | 17 | ||
18 | -import org.onosproject.openflow.controller.Dpid; | ||
19 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | 18 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; |
20 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; | 19 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; |
21 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; | 20 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; |
... | @@ -23,14 +22,12 @@ import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotSta | ... | @@ -23,14 +22,12 @@ import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotSta |
23 | import org.projectfloodlight.openflow.protocol.OFCircuitPortStatus; | 22 | import org.projectfloodlight.openflow.protocol.OFCircuitPortStatus; |
24 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsReply; | 23 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsReply; |
25 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsRequest; | 24 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsRequest; |
26 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
27 | import org.projectfloodlight.openflow.protocol.OFMessage; | 25 | import org.projectfloodlight.openflow.protocol.OFMessage; |
28 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 26 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
29 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; | 27 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; |
30 | import org.projectfloodlight.openflow.protocol.OFPortOptical; | 28 | import org.projectfloodlight.openflow.protocol.OFPortOptical; |
31 | import org.projectfloodlight.openflow.protocol.OFStatsReply; | 29 | import org.projectfloodlight.openflow.protocol.OFStatsReply; |
32 | import org.projectfloodlight.openflow.protocol.OFStatsType; | 30 | import org.projectfloodlight.openflow.protocol.OFStatsType; |
33 | -import org.projectfloodlight.openflow.types.TableId; | ||
34 | 31 | ||
35 | import java.io.IOException; | 32 | import java.io.IOException; |
36 | import java.util.ArrayList; | 33 | import java.util.ArrayList; |
... | @@ -44,24 +41,11 @@ import java.util.concurrent.atomic.AtomicBoolean; | ... | @@ -44,24 +41,11 @@ import java.util.concurrent.atomic.AtomicBoolean; |
44 | */ | 41 | */ |
45 | public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | 42 | public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
46 | 43 | ||
47 | - private final AtomicBoolean driverHandshakeComplete; | 44 | + private final AtomicBoolean driverHandshakeComplete = new AtomicBoolean(false); |
48 | private long barrierXidToWaitFor = -1; | 45 | private long barrierXidToWaitFor = -1; |
49 | 46 | ||
50 | private OFPortDescStatsReply wPorts; | 47 | private OFPortDescStatsReply wPorts; |
51 | 48 | ||
52 | - OFOpticalSwitchImplLINC13(Dpid dpid, OFDescStatsReply desc) { | ||
53 | - super(dpid); | ||
54 | - driverHandshakeComplete = new AtomicBoolean(false); | ||
55 | - setSwitchDescription(desc); | ||
56 | - } | ||
57 | - | ||
58 | - @Override | ||
59 | - public String toString() { | ||
60 | - return "OFOpticalSwitchImplLINC13 [" + ((channel != null) | ||
61 | - ? channel.getRemoteAddress() : "?") | ||
62 | - + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]"; | ||
63 | - } | ||
64 | - | ||
65 | @Override | 49 | @Override |
66 | public void startDriverHandshake() { | 50 | public void startDriverHandshake() { |
67 | log.warn("Starting driver handshake for sw {}", getStringId()); | 51 | log.warn("Starting driver handshake for sw {}", getStringId()); |
... | @@ -177,7 +161,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -177,7 +161,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
177 | "message " + | 161 | "message " + |
178 | "{}", | 162 | "{}", |
179 | circuitPortsRequest.toString()); | 163 | circuitPortsRequest.toString()); |
180 | - this.write(Collections.<OFMessage>singletonList(circuitPortsRequest)); | 164 | + this.sendMsg(Collections.<OFMessage>singletonList(circuitPortsRequest)); |
181 | } | 165 | } |
182 | 166 | ||
183 | @Override | 167 | @Override |
... | @@ -190,15 +174,6 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -190,15 +174,6 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
190 | return Collections.unmodifiableList(portEntries); | 174 | return Collections.unmodifiableList(portEntries); |
191 | } | 175 | } |
192 | 176 | ||
193 | - @Override | ||
194 | - public void write(OFMessage msg) { | ||
195 | - this.channel.write(Collections.singletonList(msg)); | ||
196 | - } | ||
197 | - | ||
198 | - @Override | ||
199 | - public void write(List<OFMessage> msgs) { | ||
200 | - this.channel.write(msgs); | ||
201 | - } | ||
202 | 177 | ||
203 | @Override | 178 | @Override |
204 | public Boolean supportNxRole() { | 179 | public Boolean supportNxRole() { |
... | @@ -210,15 +185,4 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -210,15 +185,4 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
210 | return true; | 185 | return true; |
211 | } | 186 | } |
212 | 187 | ||
213 | - @Override | ||
214 | - public TableType getTableType(TableId tid) { | ||
215 | - return TableType.NONE; | ||
216 | - } | ||
217 | - | ||
218 | - @Override | ||
219 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
220 | - // TODO Auto-generated method stub | ||
221 | - | ||
222 | - } | ||
223 | - | ||
224 | } | 188 | } | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2014-2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -13,19 +13,9 @@ | ... | @@ -13,19 +13,9 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.openflow.drivers; | 16 | +package org.onosproject.driver.handshaker; |
17 | 17 | ||
18 | -import java.io.IOException; | ||
19 | -import java.util.ArrayList; | ||
20 | -import java.util.Collections; | ||
21 | -import java.util.List; | ||
22 | -import java.util.Map; | ||
23 | -import java.util.concurrent.ConcurrentHashMap; | ||
24 | -import java.util.concurrent.atomic.AtomicBoolean; | ||
25 | - | ||
26 | -import org.onosproject.openflow.controller.Dpid; | ||
27 | import org.onosproject.openflow.controller.RoleState; | 18 | import org.onosproject.openflow.controller.RoleState; |
28 | -import org.onosproject.openflow.controller.OpenFlowSwitch.TableType; | ||
29 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | 19 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; |
30 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; | 20 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; |
31 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; | 21 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; |
... | @@ -33,7 +23,6 @@ import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotSta | ... | @@ -33,7 +23,6 @@ import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotSta |
33 | import org.projectfloodlight.openflow.protocol.OFAsyncGetReply; | 23 | import org.projectfloodlight.openflow.protocol.OFAsyncGetReply; |
34 | import org.projectfloodlight.openflow.protocol.OFBarrierRequest; | 24 | import org.projectfloodlight.openflow.protocol.OFBarrierRequest; |
35 | import org.projectfloodlight.openflow.protocol.OFBucket; | 25 | import org.projectfloodlight.openflow.protocol.OFBucket; |
36 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
37 | import org.projectfloodlight.openflow.protocol.OFFactory; | 26 | import org.projectfloodlight.openflow.protocol.OFFactory; |
38 | import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply; | 27 | import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply; |
39 | import org.projectfloodlight.openflow.protocol.OFGroupFeaturesStatsReply; | 28 | import org.projectfloodlight.openflow.protocol.OFGroupFeaturesStatsReply; |
... | @@ -66,6 +55,14 @@ import org.projectfloodlight.openflow.types.U32; | ... | @@ -66,6 +55,14 @@ import org.projectfloodlight.openflow.types.U32; |
66 | import org.projectfloodlight.openflow.types.U64; | 55 | import org.projectfloodlight.openflow.types.U64; |
67 | import org.projectfloodlight.openflow.util.HexString; | 56 | import org.projectfloodlight.openflow.util.HexString; |
68 | 57 | ||
58 | +import java.io.IOException; | ||
59 | +import java.util.ArrayList; | ||
60 | +import java.util.Collections; | ||
61 | +import java.util.List; | ||
62 | +import java.util.Map; | ||
63 | +import java.util.concurrent.ConcurrentHashMap; | ||
64 | +import java.util.concurrent.atomic.AtomicBoolean; | ||
65 | + | ||
69 | /** | 66 | /** |
70 | * OFDescriptionStatistics Vendor (Manufacturer Desc.): Stanford University, | 67 | * OFDescriptionStatistics Vendor (Manufacturer Desc.): Stanford University, |
71 | * Ericsson Research and CPqD Research. Make (Hardware Desc.) : OpenFlow 1.3 | 68 | * Ericsson Research and CPqD Research. Make (Hardware Desc.) : OpenFlow 1.3 |
... | @@ -75,7 +72,7 @@ import org.projectfloodlight.openflow.util.HexString; | ... | @@ -75,7 +72,7 @@ import org.projectfloodlight.openflow.util.HexString; |
75 | public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { | 72 | public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { |
76 | 73 | ||
77 | private static final int VLAN_ID_OFFSET = 16; | 74 | private static final int VLAN_ID_OFFSET = 16; |
78 | - private final AtomicBoolean driverHandshakeComplete; | 75 | + private final AtomicBoolean driverHandshakeComplete = new AtomicBoolean(false); |
79 | private OFFactory factory; | 76 | private OFFactory factory; |
80 | private static final int OFPCML_NO_BUFFER = 0xffff; | 77 | private static final int OFPCML_NO_BUFFER = 0xffff; |
81 | // Configuration of asynch messages to controller. We need different | 78 | // Configuration of asynch messages to controller. We need different |
... | @@ -106,24 +103,8 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { | ... | @@ -106,24 +103,8 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { |
106 | private static final short MIN_PRIORITY = 0x0; | 103 | private static final short MIN_PRIORITY = 0x0; |
107 | private static final U64 METADATA_MASK = U64.of(Long.MAX_VALUE << 1 | 0x1); | 104 | private static final U64 METADATA_MASK = U64.of(Long.MAX_VALUE << 1 | 0x1); |
108 | 105 | ||
109 | - private final Map<Integer, OFGroup> l2groups; | 106 | + private final Map<Integer, OFGroup> l2groups = new ConcurrentHashMap<>(); |
110 | - | ||
111 | - public OFSwitchImplCPqD13(Dpid dpid, OFDescStatsReply desc) { | ||
112 | - super(dpid); | ||
113 | - driverHandshakeComplete = new AtomicBoolean(false); | ||
114 | - l2groups = new ConcurrentHashMap<Integer, OFGroup>(); | ||
115 | - setSwitchDescription(desc); | ||
116 | - } | ||
117 | 107 | ||
118 | - /* (non-Javadoc) | ||
119 | - * @see java.lang.Object#toString() | ||
120 | - */ | ||
121 | - @Override | ||
122 | - public String toString() { | ||
123 | - return "OFSwitchImplCPqD13 [" + ((channel != null) | ||
124 | - ? channel.getRemoteAddress() : "?") | ||
125 | - + " DPID[" + ((this.getStringId() != null) ? this.getStringId() : "?") + "]]"; | ||
126 | - } | ||
127 | 108 | ||
128 | @Override | 109 | @Override |
129 | public void startDriverHandshake() { | 110 | public void startDriverHandshake() { |
... | @@ -1185,7 +1166,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { | ... | @@ -1185,7 +1166,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { |
1185 | .setXid(getNextTransactionId()) | 1166 | .setXid(getNextTransactionId()) |
1186 | .build(); | 1167 | .build(); |
1187 | 1168 | ||
1188 | - write(tableMissEntry); | 1169 | + sendMsg(tableMissEntry); |
1189 | } | 1170 | } |
1190 | 1171 | ||
1191 | private void sendBarrier(boolean finalBarrier) { | 1172 | private void sendBarrier(boolean finalBarrier) { |
... | @@ -1198,34 +1179,11 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { | ... | @@ -1198,34 +1179,11 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { |
1198 | .setXid(xid) | 1179 | .setXid(xid) |
1199 | .build(); | 1180 | .build(); |
1200 | 1181 | ||
1201 | - write(br); | 1182 | + sendMsg(br); |
1202 | } | 1183 | } |
1203 | 1184 | ||
1204 | @Override | 1185 | @Override |
1205 | public Boolean supportNxRole() { | 1186 | public Boolean supportNxRole() { |
1206 | return false; | 1187 | return false; |
1207 | } | 1188 | } |
1208 | - | ||
1209 | - @Override | ||
1210 | - public void write(OFMessage msg) { | ||
1211 | - this.channel.write(Collections.singletonList(msg)); | ||
1212 | - | ||
1213 | - } | ||
1214 | - | ||
1215 | - @Override | ||
1216 | - public void write(List<OFMessage> msgs) { | ||
1217 | - this.channel.write(msgs); | ||
1218 | - } | ||
1219 | - | ||
1220 | - | ||
1221 | - @Override | ||
1222 | - public TableType getTableType(TableId tid) { | ||
1223 | - return TableType.NONE; // XXX this needs to be fixed | ||
1224 | - } | ||
1225 | - | ||
1226 | - @Override | ||
1227 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
1228 | - // TODO Auto-generated method stub | ||
1229 | - | ||
1230 | - } | ||
1231 | } | 1189 | } | ... | ... |
... | @@ -13,74 +13,29 @@ | ... | @@ -13,74 +13,29 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.openflow.drivers; | 16 | +package org.onosproject.driver.handshaker; |
17 | 17 | ||
18 | -import com.google.common.collect.Lists; | ||
19 | -import org.onosproject.openflow.controller.Dpid; | ||
20 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | 18 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; |
21 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; | 19 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; |
22 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; | 20 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; |
23 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; | 21 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; |
24 | -import org.projectfloodlight.openflow.protocol.OFFlowMod; | ||
25 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
26 | import org.projectfloodlight.openflow.protocol.OFFactory; | 22 | import org.projectfloodlight.openflow.protocol.OFFactory; |
27 | import org.projectfloodlight.openflow.protocol.OFMessage; | 23 | import org.projectfloodlight.openflow.protocol.OFMessage; |
28 | -import org.projectfloodlight.openflow.protocol.OFType; | ||
29 | -import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; | ||
30 | -import org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable; | ||
31 | -import org.projectfloodlight.openflow.types.TableId; | ||
32 | 24 | ||
33 | -import java.util.Collections; | ||
34 | -import java.util.List; | ||
35 | import java.util.concurrent.atomic.AtomicBoolean; | 25 | import java.util.concurrent.atomic.AtomicBoolean; |
36 | 26 | ||
37 | -//TODO: Knock-off this class as we don't need any switch/app specific | ||
38 | -//drivers in the south bound layers. | ||
39 | public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch { | 27 | public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch { |
40 | 28 | ||
41 | private OFFactory factory; | 29 | private OFFactory factory; |
42 | 30 | ||
43 | - private final AtomicBoolean driverHandshakeComplete; | 31 | + private final AtomicBoolean driverHandshakeComplete = new AtomicBoolean(false); |
44 | - private AtomicBoolean haltStateMachine; | ||
45 | - | ||
46 | - /* Default table ID - compatible with CpqD switch */ | ||
47 | - private static final int TABLE_VLAN = 0; | ||
48 | - private static final int TABLE_TMAC = 1; | ||
49 | - private static final int TABLE_IPV4_UNICAST = 2; | ||
50 | - private static final int TABLE_MPLS = 3; | ||
51 | - private static final int TABLE_ACL = 5; | ||
52 | - | ||
53 | - /* | ||
54 | - * Set the default values. These variables will get overwritten based on the | ||
55 | - * switch vendor type | ||
56 | - */ | ||
57 | - protected int vlanTableId = TABLE_VLAN; | ||
58 | - protected int tmacTableId = TABLE_TMAC; | ||
59 | - protected int ipv4UnicastTableId = TABLE_IPV4_UNICAST; | ||
60 | - protected int mplsTableId = TABLE_MPLS; | ||
61 | - protected int aclTableId = TABLE_ACL; | ||
62 | - | ||
63 | - protected OFSwitchImplSpringOpenTTP(Dpid dpid, OFDescStatsReply desc) { | ||
64 | - super(dpid); | ||
65 | - driverHandshakeComplete = new AtomicBoolean(false); | ||
66 | - haltStateMachine = new AtomicBoolean(false); | ||
67 | - setSwitchDescription(desc); | ||
68 | - } | ||
69 | - | ||
70 | - @Override | ||
71 | - public String toString() { | ||
72 | - return "OFSwitchImplSpringOpenTTP [" | ||
73 | - + ((channel != null) ? channel.getRemoteAddress() : "?") | ||
74 | - + " DPID[" | ||
75 | - + ((this.getStringId() != null) ? this.getStringId() : "?") | ||
76 | - + "]]"; | ||
77 | - } | ||
78 | 32 | ||
79 | @Override | 33 | @Override |
80 | public Boolean supportNxRole() { | 34 | public Boolean supportNxRole() { |
81 | - return null; | 35 | + return false; |
82 | } | 36 | } |
83 | 37 | ||
38 | + | ||
84 | @Override | 39 | @Override |
85 | public void startDriverHandshake() { | 40 | public void startDriverHandshake() { |
86 | log.debug("Starting driver handshake for sw {}", getStringId()); | 41 | log.debug("Starting driver handshake for sw {}", getStringId()); |
... | @@ -103,6 +58,8 @@ public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch { | ... | @@ -103,6 +58,8 @@ public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch { |
103 | return driverHandshakeComplete.get(); | 58 | return driverHandshakeComplete.get(); |
104 | } | 59 | } |
105 | 60 | ||
61 | + | ||
62 | + | ||
106 | @Override | 63 | @Override |
107 | public void processDriverHandshakeMessage(OFMessage m) { | 64 | public void processDriverHandshakeMessage(OFMessage m) { |
108 | if (!startDriverHandshakeCalled) { | 65 | if (!startDriverHandshakeCalled) { |
... | @@ -113,82 +70,4 @@ public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch { | ... | @@ -113,82 +70,4 @@ public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch { |
113 | } | 70 | } |
114 | } | 71 | } |
115 | 72 | ||
116 | - @Override | ||
117 | - public void write(OFMessage msg) { | ||
118 | - channel.write(Collections.singletonList(msg)); | ||
119 | - } | ||
120 | - | ||
121 | - @Override | ||
122 | - public void write(List<OFMessage> msgs) { | ||
123 | - channel.write(msgs); | ||
124 | - } | ||
125 | - | ||
126 | - @Override | ||
127 | - public void transformAndSendMsg(OFMessage msg, TableType type) { | ||
128 | - if (msg.getType() == OFType.FLOW_MOD) { | ||
129 | - OFFlowMod flowMod = (OFFlowMod) msg; | ||
130 | - OFFlowMod.Builder builder = flowMod.createBuilder(); | ||
131 | - List<OFInstruction> instructions = flowMod.getInstructions(); | ||
132 | - List<OFInstruction> newInstructions = Lists.newArrayList(); | ||
133 | - for (OFInstruction i : instructions) { | ||
134 | - if (i instanceof OFInstructionGotoTable) { | ||
135 | - OFInstructionGotoTable gotoTable = (OFInstructionGotoTable) i; | ||
136 | - TableType tid = TableType.values()[gotoTable.getTableId() | ||
137 | - .getValue()]; | ||
138 | - newInstructions.add(gotoTable.createBuilder() | ||
139 | - .setTableId(getTableId(tid)).build()); | ||
140 | - } else { | ||
141 | - newInstructions.add(i); | ||
142 | - } | ||
143 | - } | ||
144 | - builder.setTableId(getTableId(type)); | ||
145 | - builder.setInstructions(newInstructions); | ||
146 | - OFMessage msgnew = builder.build(); | ||
147 | - channel.write(Collections.singletonList(msgnew)); | ||
148 | - log.trace("Installed {}", msgnew); | ||
149 | - | ||
150 | - } else { | ||
151 | - channel.write(Collections.singletonList(msg)); | ||
152 | - } | ||
153 | - } | ||
154 | - | ||
155 | - @Override | ||
156 | - public TableType getTableType(TableId tid) { | ||
157 | - switch (tid.getValue()) { | ||
158 | - case TABLE_IPV4_UNICAST: | ||
159 | - return TableType.IP; | ||
160 | - case TABLE_MPLS: | ||
161 | - return TableType.MPLS; | ||
162 | - case TABLE_ACL: | ||
163 | - return TableType.ACL; | ||
164 | - case TABLE_VLAN: | ||
165 | - return TableType.VLAN; | ||
166 | - case TABLE_TMAC: | ||
167 | - return TableType.ETHER; | ||
168 | - default: | ||
169 | - log.error("Table type for Table id {} is not supported in the driver", | ||
170 | - tid); | ||
171 | - return TableType.NONE; | ||
172 | - } | ||
173 | - } | ||
174 | - | ||
175 | - private TableId getTableId(TableType tableType) { | ||
176 | - switch (tableType) { | ||
177 | - case IP: | ||
178 | - return TableId.of(ipv4UnicastTableId); | ||
179 | - case MPLS: | ||
180 | - return TableId.of(mplsTableId); | ||
181 | - case ACL: | ||
182 | - return TableId.of(aclTableId); | ||
183 | - case VLAN: | ||
184 | - return TableId.of(vlanTableId); | ||
185 | - case ETHER: | ||
186 | - return TableId.of(tmacTableId); | ||
187 | - default: { | ||
188 | - log.error("Table type {} is not supported in the driver", tableType); | ||
189 | - return TableId.NONE; | ||
190 | - } | ||
191 | - } | ||
192 | - } | ||
193 | - | ||
194 | } | 73 | } | ... | ... |
... | @@ -15,10 +15,7 @@ | ... | @@ -15,10 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.driver.pipeline; | 16 | package org.onosproject.driver.pipeline; |
17 | 17 | ||
18 | -import com.google.common.util.concurrent.SettableFuture; | ||
19 | - | ||
20 | import org.onlab.osgi.ServiceDirectory; | 18 | import org.onlab.osgi.ServiceDirectory; |
21 | -import org.onosproject.core.DefaultGroupId; | ||
22 | import org.onosproject.net.DeviceId; | 19 | import org.onosproject.net.DeviceId; |
23 | import org.onosproject.net.behaviour.Pipeliner; | 20 | import org.onosproject.net.behaviour.Pipeliner; |
24 | import org.onosproject.net.behaviour.PipelinerContext; | 21 | import org.onosproject.net.behaviour.PipelinerContext; |
... | @@ -84,27 +81,32 @@ public class DefaultSingleTablePipeline extends AbstractHandlerBehaviour impleme | ... | @@ -84,27 +81,32 @@ public class DefaultSingleTablePipeline extends AbstractHandlerBehaviour impleme |
84 | treatment = flowTreatment.build(); | 81 | treatment = flowTreatment.build(); |
85 | } | 82 | } |
86 | 83 | ||
87 | - FlowRule rule = new DefaultFlowRule(deviceId, selector, | 84 | + FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() |
88 | - treatment, | 85 | + .forDevice(deviceId) |
89 | - fwd.priority(), fwd.appId(), | 86 | + .withSelector(selector) |
90 | - new DefaultGroupId(fwd.id()), | 87 | + .withTreatment(fwd.treatment()) |
91 | - fwd.timeout(), fwd.permanent()); | 88 | + .fromApp(fwd.appId()) |
89 | + .withPriority(fwd.priority()); | ||
90 | + | ||
91 | + if (fwd.permanent()) { | ||
92 | + ruleBuilder.makePermanent(); | ||
93 | + } else { | ||
94 | + ruleBuilder.makeTemporary(fwd.timeout()); | ||
95 | + } | ||
96 | + | ||
92 | 97 | ||
93 | switch (fwd.op()) { | 98 | switch (fwd.op()) { |
94 | 99 | ||
95 | case ADD: | 100 | case ADD: |
96 | - flowBuilder.add(rule); | 101 | + flowBuilder.add(ruleBuilder.build()); |
97 | break; | 102 | break; |
98 | case REMOVE: | 103 | case REMOVE: |
99 | - flowBuilder.remove(rule); | 104 | + flowBuilder.remove(ruleBuilder.build()); |
100 | break; | 105 | break; |
101 | default: | 106 | default: |
102 | log.warn("Unknown operation {}", fwd.op()); | 107 | log.warn("Unknown operation {}", fwd.op()); |
103 | } | 108 | } |
104 | 109 | ||
105 | - | ||
106 | - SettableFuture<Boolean> future = SettableFuture.create(); | ||
107 | - | ||
108 | flowRuleService.apply(flowBuilder.build(new FlowRuleOperationsContext() { | 110 | flowRuleService.apply(flowBuilder.build(new FlowRuleOperationsContext() { |
109 | @Override | 111 | @Override |
110 | public void onSuccess(FlowRuleOperations ops) { | 112 | public void onSuccess(FlowRuleOperations ops) { | ... | ... |
... | @@ -18,10 +18,14 @@ | ... | @@ -18,10 +18,14 @@ |
18 | <driver name="default" manufacturer="ON.Lab" hwVersion="0.0.1" swVersion="0.0.1"> | 18 | <driver name="default" manufacturer="ON.Lab" hwVersion="0.0.1" swVersion="0.0.1"> |
19 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" | 19 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" |
20 | impl="org.onosproject.driver.pipeline.DefaultSingleTablePipeline"/> | 20 | impl="org.onosproject.driver.pipeline.DefaultSingleTablePipeline"/> |
21 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
22 | + impl="org.onosproject.driver.handshaker.DefaultSwitchHandShaker"/> | ||
21 | </driver> | 23 | </driver> |
22 | <driver name="ovs-corsa" manufacturer="Corsa" hwVersion="emulation" swVersion="0.0.0"> | 24 | <driver name="ovs-corsa" manufacturer="Corsa" hwVersion="emulation" swVersion="0.0.0"> |
23 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" | 25 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" |
24 | impl="org.onosproject.driver.pipeline.OVSCorsaPipeline"/> | 26 | impl="org.onosproject.driver.pipeline.OVSCorsaPipeline"/> |
27 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
28 | + impl="org.onosproject.driver.handshaker.OFOVSSwitchCorsaTTP"/> | ||
25 | </driver> | 29 | </driver> |
26 | <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=".*"> |
27 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" | 31 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" |
... | @@ -31,4 +35,25 @@ | ... | @@ -31,4 +35,25 @@ |
31 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" | 35 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" |
32 | impl="org.onosproject.driver.pipeline.SpringOpenTTPDell"/> | 36 | impl="org.onosproject.driver.pipeline.SpringOpenTTPDell"/> |
33 | </driver> | 37 | </driver> |
38 | + <driver name="cpqd" manufacturer="Stanford University, Ericsson Research and CPqD Research" | ||
39 | + hwVersion="OpenFlow 1.3 Reference Userspace Switch" swVersion=".*"> | ||
40 | + <behaviour api="org.onosproject.net.behaviour.Pipeliner" | ||
41 | + impl="org.onosproject.driver.pipeline.DefaultSingleTablePipeline"/> | ||
42 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
43 | + impl="org.onosproject.driver.handshaker.OFSwitchImplSpringOpenTTP"/> | ||
44 | + </driver> | ||
45 | + <driver name="linc-oe" manufacturer="FlowForwarding.org" hwVersion="Unknown" | ||
46 | + swVersion="LINC-OE OpenFlow Software Switch 1.1"> | ||
47 | + <behaviour api="org.onosproject.net.behaviour.Pipeliner" | ||
48 | + impl="org.onosproject.driver.pipeline.DefaultSingleTablePipeline"/> | ||
49 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
50 | + impl="org.onosproject.driver.handshaker.OFOpticalSwitchImplLINC13"/> | ||
51 | + </driver> | ||
52 | + <driver name="corsa" manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1"> | ||
53 | + <behaviour api="org.onosproject.net.behaviour.Pipeliner" | ||
54 | + impl="org.onosproject.driver.pipeline.OVSCorsaPipeline"/> | ||
55 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
56 | + impl="org.onosproject.driver.handshaker.OFCorsaSwitchDriver"/> | ||
57 | + </driver> | ||
34 | </drivers> | 58 | </drivers> |
59 | + | ... | ... |
... | @@ -42,6 +42,11 @@ | ... | @@ -42,6 +42,11 @@ |
42 | <groupId>io.netty</groupId> | 42 | <groupId>io.netty</groupId> |
43 | <artifactId>netty</artifactId> | 43 | <artifactId>netty</artifactId> |
44 | </dependency> | 44 | </dependency> |
45 | + <dependency> | ||
46 | + <groupId>org.onosproject</groupId> | ||
47 | + <artifactId>onos-api</artifactId> | ||
48 | + </dependency> | ||
49 | + | ||
45 | </dependencies> | 50 | </dependencies> |
46 | 51 | ||
47 | <build> | 52 | <build> | ... | ... |
... | @@ -15,12 +15,11 @@ | ... | @@ -15,12 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.openflow.controller; | 16 | package org.onosproject.openflow.controller; |
17 | 17 | ||
18 | -import java.util.List; | ||
19 | - | ||
20 | import org.projectfloodlight.openflow.protocol.OFFactory; | 18 | import org.projectfloodlight.openflow.protocol.OFFactory; |
21 | import org.projectfloodlight.openflow.protocol.OFMessage; | 19 | import org.projectfloodlight.openflow.protocol.OFMessage; |
22 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 20 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
23 | -import org.projectfloodlight.openflow.types.TableId; | 21 | + |
22 | +import java.util.List; | ||
24 | 23 | ||
25 | /** | 24 | /** |
26 | * Represents to provider facing side of a switch. | 25 | * Represents to provider facing side of a switch. |
... | @@ -28,38 +27,6 @@ import org.projectfloodlight.openflow.types.TableId; | ... | @@ -28,38 +27,6 @@ import org.projectfloodlight.openflow.types.TableId; |
28 | public interface OpenFlowSwitch { | 27 | public interface OpenFlowSwitch { |
29 | 28 | ||
30 | /** | 29 | /** |
31 | - * The TableType is used to determine in which table (TableID) each flow rule | ||
32 | - * needs to be put for multi-table support switch. | ||
33 | - * It is used only for multi-table support switch. | ||
34 | - */ | ||
35 | - public static enum TableType { | ||
36 | - /* VLAN-to-MPLS table */ | ||
37 | - VLAN_MPLS, | ||
38 | - | ||
39 | - /* VLAN table */ | ||
40 | - VLAN, | ||
41 | - | ||
42 | - /* Ethertype table */ | ||
43 | - ETHER, | ||
44 | - | ||
45 | - /* Class of Service table */ | ||
46 | - COS, | ||
47 | - | ||
48 | - /* IP table */ | ||
49 | - IP, | ||
50 | - /* MPLS table */ | ||
51 | - MPLS, | ||
52 | - /* ACL table */ | ||
53 | - ACL, | ||
54 | - /* Single table */ | ||
55 | - NONE, | ||
56 | - /* First table in multi-table */ | ||
57 | - FIRST, | ||
58 | - | ||
59 | - | ||
60 | - } | ||
61 | - | ||
62 | - /** | ||
63 | * Writes the message to the driver. | 30 | * Writes the message to the driver. |
64 | * | 31 | * |
65 | * @param msg the message to write | 32 | * @param msg the message to write |
... | @@ -74,17 +41,6 @@ public interface OpenFlowSwitch { | ... | @@ -74,17 +41,6 @@ public interface OpenFlowSwitch { |
74 | public void sendMsg(List<OFMessage> msgs); | 41 | public void sendMsg(List<OFMessage> msgs); |
75 | 42 | ||
76 | /** | 43 | /** |
77 | - * Transforms FlowMod messages by setting the correct table-ids and sending | ||
78 | - * them to the switch. TableType is used to determine the table ID for the OFMessage. | ||
79 | - * Switch drivers that supports multi-table pipelines should implement this | ||
80 | - * method. | ||
81 | - * | ||
82 | - * @param msg the message to be written | ||
83 | - * @param tableType the type of table in which the FlowMods need to be inserted | ||
84 | - */ | ||
85 | - public void transformAndSendMsg(OFMessage msg, TableType tableType); | ||
86 | - | ||
87 | - /** | ||
88 | * Handle a message from the switch. | 44 | * Handle a message from the switch. |
89 | * @param fromSwitch the message to handle | 45 | * @param fromSwitch the message to handle |
90 | */ | 46 | */ |
... | @@ -192,12 +148,4 @@ public interface OpenFlowSwitch { | ... | @@ -192,12 +148,4 @@ public interface OpenFlowSwitch { |
192 | * @return string representation of the connection to the device | 148 | * @return string representation of the connection to the device |
193 | */ | 149 | */ |
194 | public String channelId(); | 150 | public String channelId(); |
195 | - | ||
196 | - /** | ||
197 | - * Returns the TableType corresponding to the TableId used to identify | ||
198 | - * a table in an OpenFlow switch. | ||
199 | - * @param tid identifies a table in an OpenFlow switch using TableId | ||
200 | - * @return TableType corresponding to 'tid' identifying the type of table | ||
201 | - */ | ||
202 | - public TableType getTableType(TableId tid); | ||
203 | } | 151 | } | ... | ... |
... | @@ -20,6 +20,7 @@ import java.io.IOException; | ... | @@ -20,6 +20,7 @@ import java.io.IOException; |
20 | import java.net.InetSocketAddress; | 20 | import java.net.InetSocketAddress; |
21 | import java.net.SocketAddress; | 21 | import java.net.SocketAddress; |
22 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
23 | +import java.util.Collections; | ||
23 | import java.util.List; | 24 | import java.util.List; |
24 | import java.util.concurrent.RejectedExecutionException; | 25 | import java.util.concurrent.RejectedExecutionException; |
25 | import java.util.concurrent.atomic.AtomicInteger; | 26 | import java.util.concurrent.atomic.AtomicInteger; |
... | @@ -27,6 +28,7 @@ import java.util.stream.Collectors; | ... | @@ -27,6 +28,7 @@ import java.util.stream.Collectors; |
27 | 28 | ||
28 | import org.jboss.netty.channel.Channel; | 29 | import org.jboss.netty.channel.Channel; |
29 | import org.onlab.packet.IpAddress; | 30 | import org.onlab.packet.IpAddress; |
31 | +import org.onosproject.net.driver.AbstractHandlerBehaviour; | ||
30 | import org.onosproject.openflow.controller.Dpid; | 32 | import org.onosproject.openflow.controller.Dpid; |
31 | import org.onosproject.openflow.controller.RoleState; | 33 | import org.onosproject.openflow.controller.RoleState; |
32 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | 34 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; |
... | @@ -36,10 +38,12 @@ import org.projectfloodlight.openflow.protocol.OFFactories; | ... | @@ -36,10 +38,12 @@ import org.projectfloodlight.openflow.protocol.OFFactories; |
36 | import org.projectfloodlight.openflow.protocol.OFFactory; | 38 | import org.projectfloodlight.openflow.protocol.OFFactory; |
37 | import org.projectfloodlight.openflow.protocol.OFFeaturesReply; | 39 | import org.projectfloodlight.openflow.protocol.OFFeaturesReply; |
38 | import org.projectfloodlight.openflow.protocol.OFMessage; | 40 | import org.projectfloodlight.openflow.protocol.OFMessage; |
41 | +import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleRequest; | ||
39 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 42 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
40 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; | 43 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; |
41 | import org.projectfloodlight.openflow.protocol.OFPortStatus; | 44 | import org.projectfloodlight.openflow.protocol.OFPortStatus; |
42 | import org.projectfloodlight.openflow.protocol.OFRoleReply; | 45 | import org.projectfloodlight.openflow.protocol.OFRoleReply; |
46 | +import org.projectfloodlight.openflow.protocol.OFRoleRequest; | ||
43 | import org.projectfloodlight.openflow.protocol.OFVersion; | 47 | import org.projectfloodlight.openflow.protocol.OFVersion; |
44 | import org.slf4j.Logger; | 48 | import org.slf4j.Logger; |
45 | import org.slf4j.LoggerFactory; | 49 | import org.slf4j.LoggerFactory; |
... | @@ -48,18 +52,19 @@ import org.slf4j.LoggerFactory; | ... | @@ -48,18 +52,19 @@ import org.slf4j.LoggerFactory; |
48 | * An abstract representation of an OpenFlow switch. Can be extended by others | 52 | * An abstract representation of an OpenFlow switch. Can be extended by others |
49 | * to serve as a base for their vendor specific representation of a switch. | 53 | * to serve as a base for their vendor specific representation of a switch. |
50 | */ | 54 | */ |
51 | -public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { | 55 | +public abstract class AbstractOpenFlowSwitch extends AbstractHandlerBehaviour |
56 | + implements OpenFlowSwitchDriver { | ||
52 | 57 | ||
53 | protected final Logger log = LoggerFactory.getLogger(getClass()); | 58 | protected final Logger log = LoggerFactory.getLogger(getClass()); |
54 | 59 | ||
55 | private static final String SHUTDOWN_MSG = "Worker has already been shutdown"; | 60 | private static final String SHUTDOWN_MSG = "Worker has already been shutdown"; |
56 | 61 | ||
57 | - protected Channel channel; | 62 | + private Channel channel; |
58 | protected String channelId; | 63 | protected String channelId; |
59 | 64 | ||
60 | private boolean connected; | 65 | private boolean connected; |
61 | protected boolean startDriverHandshakeCalled = false; | 66 | protected boolean startDriverHandshakeCalled = false; |
62 | - private final Dpid dpid; | 67 | + private Dpid dpid; |
63 | private OpenFlowAgent agent; | 68 | private OpenFlowAgent agent; |
64 | private final AtomicInteger xidCounter = new AtomicInteger(0); | 69 | private final AtomicInteger xidCounter = new AtomicInteger(0); |
65 | 70 | ||
... | @@ -76,17 +81,11 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { | ... | @@ -76,17 +81,11 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { |
76 | protected OFFeaturesReply features; | 81 | protected OFFeaturesReply features; |
77 | protected OFDescStatsReply desc; | 82 | protected OFDescStatsReply desc; |
78 | 83 | ||
79 | - /** | 84 | + @Override |
80 | - * Given a dpid build this switch. | 85 | + public void init(Dpid dpid, OFDescStatsReply desc, OFVersion ofv) { |
81 | - * @param dp the dpid | ||
82 | - */ | ||
83 | - protected AbstractOpenFlowSwitch(Dpid dp) { | ||
84 | - this.dpid = dp; | ||
85 | - } | ||
86 | - | ||
87 | - public AbstractOpenFlowSwitch(Dpid dpid, OFDescStatsReply desc) { | ||
88 | this.dpid = dpid; | 86 | this.dpid = dpid; |
89 | this.desc = desc; | 87 | this.desc = desc; |
88 | + this.ofVersion = ofv; | ||
90 | } | 89 | } |
91 | 90 | ||
92 | //************************ | 91 | //************************ |
... | @@ -102,7 +101,7 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { | ... | @@ -102,7 +101,7 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { |
102 | public final void sendMsg(OFMessage m) { | 101 | public final void sendMsg(OFMessage m) { |
103 | if (role == RoleState.MASTER) { | 102 | if (role == RoleState.MASTER) { |
104 | try { | 103 | try { |
105 | - this.write(m); | 104 | + channel.write(Collections.singletonList(m)); |
106 | } catch (RejectedExecutionException e) { | 105 | } catch (RejectedExecutionException e) { |
107 | log.warn(e.getMessage()); | 106 | log.warn(e.getMessage()); |
108 | if (!e.getMessage().contains(SHUTDOWN_MSG)) { | 107 | if (!e.getMessage().contains(SHUTDOWN_MSG)) { |
... | @@ -116,7 +115,7 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { | ... | @@ -116,7 +115,7 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { |
116 | public final void sendMsg(List<OFMessage> msgs) { | 115 | public final void sendMsg(List<OFMessage> msgs) { |
117 | if (role == RoleState.MASTER) { | 116 | if (role == RoleState.MASTER) { |
118 | try { | 117 | try { |
119 | - this.write(msgs); | 118 | + channel.write(msgs); |
120 | } catch (RejectedExecutionException e) { | 119 | } catch (RejectedExecutionException e) { |
121 | log.warn(e.getMessage()); | 120 | log.warn(e.getMessage()); |
122 | if (!e.getMessage().contains(SHUTDOWN_MSG)) { | 121 | if (!e.getMessage().contains(SHUTDOWN_MSG)) { |
... | @@ -127,10 +126,15 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { | ... | @@ -127,10 +126,15 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { |
127 | } | 126 | } |
128 | 127 | ||
129 | @Override | 128 | @Override |
130 | - public abstract void write(OFMessage msg); | 129 | + public final void sendRoleRequest(OFMessage msg) { |
131 | - | 130 | + if (msg instanceof OFRoleRequest || |
132 | - @Override | 131 | + msg instanceof OFNiciraControllerRoleRequest) { |
133 | - public abstract void write(List<OFMessage> msgs); | 132 | + channel.write(Collections.singletonList(msg)); |
133 | + return; | ||
134 | + } | ||
135 | + throw new IllegalArgumentException("Someone is trying to send " + | ||
136 | + "a non role request message"); | ||
137 | + } | ||
134 | 138 | ||
135 | @Override | 139 | @Override |
136 | public final boolean isConnected() { | 140 | public final boolean isConnected() { |
... | @@ -418,11 +422,20 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { | ... | @@ -418,11 +422,20 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver { |
418 | return this.desc.getSerialNum(); | 422 | return this.desc.getSerialNum(); |
419 | } | 423 | } |
420 | 424 | ||
425 | + | ||
421 | @Override | 426 | @Override |
422 | public boolean isOptical() { | 427 | public boolean isOptical() { |
423 | return false; | 428 | return false; |
424 | } | 429 | } |
425 | 430 | ||
426 | 431 | ||
432 | + @Override | ||
433 | + public String toString() { | ||
434 | + return this.getClass().getName() + " [" + ((channel != null) | ||
435 | + ? channel.getRemoteAddress() : "?") | ||
436 | + + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]"; | ||
437 | + } | ||
438 | + | ||
439 | + | ||
427 | 440 | ||
428 | } | 441 | } | ... | ... |
... | @@ -15,9 +15,9 @@ | ... | @@ -15,9 +15,9 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.openflow.controller.driver; | 16 | package org.onosproject.openflow.controller.driver; |
17 | 17 | ||
18 | -import java.util.List; | ||
19 | - | ||
20 | import org.jboss.netty.channel.Channel; | 18 | import org.jboss.netty.channel.Channel; |
19 | +import org.onosproject.net.driver.HandlerBehaviour; | ||
20 | +import org.onosproject.openflow.controller.Dpid; | ||
21 | import org.onosproject.openflow.controller.OpenFlowSwitch; | 21 | import org.onosproject.openflow.controller.OpenFlowSwitch; |
22 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | 22 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; |
23 | import org.projectfloodlight.openflow.protocol.OFErrorMsg; | 23 | import org.projectfloodlight.openflow.protocol.OFErrorMsg; |
... | @@ -26,12 +26,14 @@ import org.projectfloodlight.openflow.protocol.OFMessage; | ... | @@ -26,12 +26,14 @@ import org.projectfloodlight.openflow.protocol.OFMessage; |
26 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; | 26 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; |
27 | import org.projectfloodlight.openflow.protocol.OFVersion; | 27 | import org.projectfloodlight.openflow.protocol.OFVersion; |
28 | 28 | ||
29 | +import java.util.List; | ||
30 | + | ||
29 | /** | 31 | /** |
30 | * Represents the driver side of an OpenFlow switch. | 32 | * Represents the driver side of an OpenFlow switch. |
31 | * This interface should never be exposed to consumers. | 33 | * This interface should never be exposed to consumers. |
32 | * | 34 | * |
33 | */ | 35 | */ |
34 | -public interface OpenFlowSwitchDriver extends OpenFlowSwitch { | 36 | +public interface OpenFlowSwitchDriver extends OpenFlowSwitch, HandlerBehaviour { |
35 | 37 | ||
36 | /** | 38 | /** |
37 | * Sets the OpenFlow agent to be used. This method | 39 | * Sets the OpenFlow agent to be used. This method |
... | @@ -79,23 +81,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { | ... | @@ -79,23 +81,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { |
79 | public void handleRole(OFMessage m) throws SwitchStateException; | 81 | public void handleRole(OFMessage m) throws SwitchStateException; |
80 | 82 | ||
81 | /** | 83 | /** |
82 | - * Starts the driver specific handshake process. | ||
83 | - */ | ||
84 | - public void startDriverHandshake(); | ||
85 | - | ||
86 | - /** | ||
87 | - * Checks whether the driver specific handshake is complete. | ||
88 | - * @return true is finished, false if not. | ||
89 | - */ | ||
90 | - public boolean isDriverHandshakeComplete(); | ||
91 | - | ||
92 | - /** | ||
93 | - * Process a message during the driver specific handshake. | ||
94 | - * @param m the message to process. | ||
95 | - */ | ||
96 | - public void processDriverHandshakeMessage(OFMessage m); | ||
97 | - | ||
98 | - /** | ||
99 | * Announce to the OpenFlow agent that this switch has connected. | 84 | * Announce to the OpenFlow agent that this switch has connected. |
100 | * @return true if successful, false if duplicate switch. | 85 | * @return true if successful, false if duplicate switch. |
101 | */ | 86 | */ |
... | @@ -162,12 +147,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { | ... | @@ -162,12 +147,6 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { |
162 | 147 | ||
163 | 148 | ||
164 | /** | 149 | /** |
165 | - * Does this switch support Nicira Role messages. | ||
166 | - * @return true if supports, false otherwise. | ||
167 | - */ | ||
168 | - public Boolean supportNxRole(); | ||
169 | - | ||
170 | - /** | ||
171 | * Sets the OF version for this switch. | 150 | * Sets the OF version for this switch. |
172 | * @param ofV the version to set. | 151 | * @param ofV the version to set. |
173 | */ | 152 | */ |
... | @@ -193,19 +172,42 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { | ... | @@ -193,19 +172,42 @@ public interface OpenFlowSwitchDriver extends OpenFlowSwitch { |
193 | public void setConnected(boolean connected); | 172 | public void setConnected(boolean connected); |
194 | 173 | ||
195 | /** | 174 | /** |
196 | - * Writes the message to the output stream | 175 | + * Initialises the behaviour. |
197 | - * in a driver specific manner. | 176 | + * @param dpid a dpid |
198 | - * | 177 | + * @param desc a switch description |
199 | - * @param msg the message to write | 178 | + * @param ofv OpenFlow version |
179 | + */ | ||
180 | + void init(Dpid dpid, OFDescStatsReply desc, OFVersion ofv); | ||
181 | + | ||
182 | + /** | ||
183 | + * Does this switch support Nicira Role messages. | ||
184 | + * @return true if supports, false otherwise. | ||
185 | + */ | ||
186 | + Boolean supportNxRole(); | ||
187 | + | ||
188 | + | ||
189 | + /** | ||
190 | + * Starts the driver specific handshake process. | ||
191 | + */ | ||
192 | + void startDriverHandshake(); | ||
193 | + | ||
194 | + /** | ||
195 | + * Checks whether the driver specific handshake is complete. | ||
196 | + * @return true is finished, false if not. | ||
197 | + */ | ||
198 | + boolean isDriverHandshakeComplete(); | ||
199 | + | ||
200 | + /** | ||
201 | + * Process a message during the driver specific handshake. | ||
202 | + * @param m the message to process. | ||
200 | */ | 203 | */ |
201 | - public void write(OFMessage msg); | 204 | + void processDriverHandshakeMessage(OFMessage m); |
202 | 205 | ||
203 | /** | 206 | /** |
204 | - * Writes to the OFMessage list to the output stream | 207 | + * Sends only role request messages. |
205 | - * in a driver specific manner. | ||
206 | * | 208 | * |
207 | - * @param msgs the messages to be written | 209 | + * @param message a role request message. |
208 | */ | 210 | */ |
209 | - public void write(List<OFMessage> msgs); | 211 | + void sendRoleRequest(OFMessage message); |
210 | 212 | ||
211 | } | 213 | } | ... | ... |
... | @@ -36,11 +36,6 @@ | ... | @@ -36,11 +36,6 @@ |
36 | <artifactId>onos-of-api</artifactId> | 36 | <artifactId>onos-of-api</artifactId> |
37 | </dependency> | 37 | </dependency> |
38 | <dependency> | 38 | <dependency> |
39 | - <groupId>org.onosproject</groupId> | ||
40 | - <artifactId>onos-of-drivers</artifactId> | ||
41 | - <version>${project.version}</version> | ||
42 | - </dependency> | ||
43 | - <dependency> | ||
44 | <groupId>io.netty</groupId> | 39 | <groupId>io.netty</groupId> |
45 | <artifactId>netty</artifactId> | 40 | <artifactId>netty</artifactId> |
46 | </dependency> | 41 | </dependency> | ... | ... |
... | @@ -21,10 +21,13 @@ import org.jboss.netty.channel.ChannelPipelineFactory; | ... | @@ -21,10 +21,13 @@ import org.jboss.netty.channel.ChannelPipelineFactory; |
21 | import org.jboss.netty.channel.group.ChannelGroup; | 21 | import org.jboss.netty.channel.group.ChannelGroup; |
22 | import org.jboss.netty.channel.group.DefaultChannelGroup; | 22 | import org.jboss.netty.channel.group.DefaultChannelGroup; |
23 | import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; | 23 | import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; |
24 | +import org.onosproject.net.driver.DefaultDriverData; | ||
25 | +import org.onosproject.net.driver.DefaultDriverHandler; | ||
26 | +import org.onosproject.net.driver.Driver; | ||
27 | +import org.onosproject.net.driver.DriverService; | ||
24 | import org.onosproject.openflow.controller.Dpid; | 28 | import org.onosproject.openflow.controller.Dpid; |
25 | import org.onosproject.openflow.controller.driver.OpenFlowAgent; | 29 | import org.onosproject.openflow.controller.driver.OpenFlowAgent; |
26 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; | 30 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; |
27 | -import org.onosproject.openflow.drivers.DriverManager; | ||
28 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | 31 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; |
29 | import org.projectfloodlight.openflow.protocol.OFFactories; | 32 | import org.projectfloodlight.openflow.protocol.OFFactories; |
30 | import org.projectfloodlight.openflow.protocol.OFFactory; | 33 | import org.projectfloodlight.openflow.protocol.OFFactory; |
... | @@ -70,6 +73,7 @@ public class Controller { | ... | @@ -70,6 +73,7 @@ public class Controller { |
70 | 73 | ||
71 | // Perf. related configuration | 74 | // Perf. related configuration |
72 | protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024; | 75 | protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024; |
76 | + private DriverService driverService; | ||
73 | 77 | ||
74 | // *************** | 78 | // *************** |
75 | // Getters/Setters | 79 | // Getters/Setters |
... | @@ -152,15 +156,7 @@ public class Controller { | ... | @@ -152,15 +156,7 @@ public class Controller { |
152 | if (ofPort != null) { | 156 | if (ofPort != null) { |
153 | this.openFlowPort = Integer.parseInt(ofPort); | 157 | this.openFlowPort = Integer.parseInt(ofPort); |
154 | } | 158 | } |
155 | - String corsaDpid = configParams.get("corsaDpid"); | 159 | + |
156 | - if (corsaDpid != null) { | ||
157 | - try { | ||
158 | - DriverManager.setCorsaDpid(new Dpid(corsaDpid)); | ||
159 | - log.info("Corsa DPID set to {}", corsaDpid); | ||
160 | - } catch (NumberFormatException e) { | ||
161 | - log.warn("Malformed Corsa DPID string", e); | ||
162 | - } | ||
163 | - } | ||
164 | log.debug("OpenFlow port set to {}", this.openFlowPort); | 160 | log.debug("OpenFlow port set to {}", this.openFlowPort); |
165 | String threads = configParams.get("workerthreads"); | 161 | String threads = configParams.get("workerthreads"); |
166 | this.workerThreads = threads != null ? Integer.parseInt(threads) : 16; | 162 | this.workerThreads = threads != null ? Integer.parseInt(threads) : 16; |
... | @@ -206,17 +202,28 @@ public class Controller { | ... | @@ -206,17 +202,28 @@ public class Controller { |
206 | * @return switch instance | 202 | * @return switch instance |
207 | */ | 203 | */ |
208 | protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, | 204 | protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid, |
209 | - OFDescStatsReply desc, OFVersion ofv) { | 205 | + OFDescStatsReply desc, |
210 | - OpenFlowSwitchDriver sw = DriverManager.getSwitch(new Dpid(dpid), | 206 | + OFVersion ofv) { |
211 | - desc, ofv); | 207 | + Driver driver = driverService |
212 | - sw.setAgent(agent); | 208 | + .getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); |
213 | - sw.setRoleHandler(new RoleManager(sw)); | 209 | + |
214 | - return sw; | 210 | + if (driver.hasBehaviour(OpenFlowSwitchDriver.class)) { |
211 | + OpenFlowSwitchDriver ofSwitchDriver = driver.createBehaviour(new DefaultDriverHandler( | ||
212 | + new DefaultDriverData(driver)), OpenFlowSwitchDriver.class); | ||
213 | + ofSwitchDriver.init(new Dpid(dpid), desc, ofv); | ||
214 | + ofSwitchDriver.setAgent(agent); | ||
215 | + ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver)); | ||
216 | + return ofSwitchDriver; | ||
217 | + } | ||
218 | + log.error("No OpenFlow driver for {} : {}", dpid, desc); | ||
219 | + return null; | ||
220 | + | ||
215 | } | 221 | } |
216 | 222 | ||
217 | - public void start(OpenFlowAgent ag) { | 223 | + public void start(OpenFlowAgent ag, DriverService driverService) { |
218 | log.info("Starting OpenFlow IO"); | 224 | log.info("Starting OpenFlow IO"); |
219 | this.agent = ag; | 225 | this.agent = ag; |
226 | + this.driverService = driverService; | ||
220 | this.init(); | 227 | this.init(); |
221 | this.run(); | 228 | this.run(); |
222 | } | 229 | } | ... | ... |
... | @@ -23,7 +23,10 @@ import org.apache.felix.scr.annotations.Activate; | ... | @@ -23,7 +23,10 @@ import org.apache.felix.scr.annotations.Activate; |
23 | import org.apache.felix.scr.annotations.Component; | 23 | import org.apache.felix.scr.annotations.Component; |
24 | import org.apache.felix.scr.annotations.Deactivate; | 24 | import org.apache.felix.scr.annotations.Deactivate; |
25 | import org.apache.felix.scr.annotations.Modified; | 25 | import org.apache.felix.scr.annotations.Modified; |
26 | +import org.apache.felix.scr.annotations.Reference; | ||
27 | +import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
26 | import org.apache.felix.scr.annotations.Service; | 28 | import org.apache.felix.scr.annotations.Service; |
29 | +import org.onosproject.net.driver.DriverService; | ||
27 | import org.onosproject.openflow.controller.DefaultOpenFlowPacketContext; | 30 | import org.onosproject.openflow.controller.DefaultOpenFlowPacketContext; |
28 | import org.onosproject.openflow.controller.Dpid; | 31 | import org.onosproject.openflow.controller.Dpid; |
29 | import org.onosproject.openflow.controller.OpenFlowController; | 32 | import org.onosproject.openflow.controller.OpenFlowController; |
... | @@ -76,6 +79,9 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -76,6 +79,9 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
76 | private static final Logger log = | 79 | private static final Logger log = |
77 | LoggerFactory.getLogger(OpenFlowControllerImpl.class); | 80 | LoggerFactory.getLogger(OpenFlowControllerImpl.class); |
78 | 81 | ||
82 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
83 | + protected DriverService driverService; | ||
84 | + | ||
79 | private final ExecutorService executorMsgs = | 85 | private final ExecutorService executorMsgs = |
80 | Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d")); | 86 | Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d")); |
81 | 87 | ||
... | @@ -115,7 +121,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -115,7 +121,7 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
115 | public void activate(ComponentContext context) { | 121 | public void activate(ComponentContext context) { |
116 | Map<String, String> properties = readComponentConfiguration(context); | 122 | Map<String, String> properties = readComponentConfiguration(context); |
117 | ctrl.setConfigParams(properties); | 123 | ctrl.setConfigParams(properties); |
118 | - ctrl.start(agent); | 124 | + ctrl.start(agent, driverService); |
119 | } | 125 | } |
120 | 126 | ||
121 | @Deactivate | 127 | @Deactivate | ... | ... |
... | @@ -15,10 +15,8 @@ | ... | @@ -15,10 +15,8 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.openflow.controller.impl; | 16 | package org.onosproject.openflow.controller.impl; |
17 | 17 | ||
18 | -import java.io.IOException; | 18 | +import com.google.common.cache.Cache; |
19 | -import java.util.Collections; | 19 | +import com.google.common.cache.CacheBuilder; |
20 | -import java.util.concurrent.TimeUnit; | ||
21 | - | ||
22 | import org.onosproject.openflow.controller.RoleState; | 20 | import org.onosproject.openflow.controller.RoleState; |
23 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; | 21 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; |
24 | import org.onosproject.openflow.controller.driver.RoleHandler; | 22 | import org.onosproject.openflow.controller.driver.RoleHandler; |
... | @@ -30,7 +28,6 @@ import org.projectfloodlight.openflow.protocol.OFErrorMsg; | ... | @@ -30,7 +28,6 @@ import org.projectfloodlight.openflow.protocol.OFErrorMsg; |
30 | import org.projectfloodlight.openflow.protocol.OFErrorType; | 28 | import org.projectfloodlight.openflow.protocol.OFErrorType; |
31 | import org.projectfloodlight.openflow.protocol.OFExperimenter; | 29 | import org.projectfloodlight.openflow.protocol.OFExperimenter; |
32 | import org.projectfloodlight.openflow.protocol.OFFactories; | 30 | import org.projectfloodlight.openflow.protocol.OFFactories; |
33 | -import org.projectfloodlight.openflow.protocol.OFMessage; | ||
34 | import org.projectfloodlight.openflow.protocol.OFNiciraControllerRole; | 31 | import org.projectfloodlight.openflow.protocol.OFNiciraControllerRole; |
35 | import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleReply; | 32 | import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleReply; |
36 | import org.projectfloodlight.openflow.protocol.OFRoleReply; | 33 | import org.projectfloodlight.openflow.protocol.OFRoleReply; |
... | @@ -42,8 +39,8 @@ import org.projectfloodlight.openflow.types.U64; | ... | @@ -42,8 +39,8 @@ import org.projectfloodlight.openflow.types.U64; |
42 | import org.slf4j.Logger; | 39 | import org.slf4j.Logger; |
43 | import org.slf4j.LoggerFactory; | 40 | import org.slf4j.LoggerFactory; |
44 | 41 | ||
45 | -import com.google.common.cache.Cache; | 42 | +import java.io.IOException; |
46 | -import com.google.common.cache.CacheBuilder; | 43 | +import java.util.concurrent.TimeUnit; |
47 | 44 | ||
48 | 45 | ||
49 | /** | 46 | /** |
... | @@ -103,7 +100,7 @@ class RoleManager implements RoleHandler { | ... | @@ -103,7 +100,7 @@ class RoleManager implements RoleHandler { |
103 | .setXid(xid) | 100 | .setXid(xid) |
104 | .setRole(roleToSend) | 101 | .setRole(roleToSend) |
105 | .build(); | 102 | .build(); |
106 | - sw.write(Collections.<OFMessage>singletonList(roleRequest)); | 103 | + sw.sendRoleRequest(roleRequest); |
107 | return xid; | 104 | return xid; |
108 | } | 105 | } |
109 | 106 | ||
... | @@ -133,7 +130,8 @@ class RoleManager implements RoleHandler { | ... | @@ -133,7 +130,8 @@ class RoleManager implements RoleHandler { |
133 | //FIXME fix below when we actually use generation ids | 130 | //FIXME fix below when we actually use generation ids |
134 | .setGenerationId(U64.ZERO) | 131 | .setGenerationId(U64.ZERO) |
135 | .build(); | 132 | .build(); |
136 | - sw.write(rrm); | 133 | + |
134 | + sw.sendRoleRequest(rrm); | ||
137 | return xid; | 135 | return xid; |
138 | } | 136 | } |
139 | 137 | ... | ... |
... | @@ -15,15 +15,14 @@ | ... | @@ -15,15 +15,14 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.openflow.controller.impl; | 16 | package org.onosproject.openflow.controller.impl; |
17 | 17 | ||
18 | -import java.io.IOException; | ||
19 | -import java.util.List; | ||
20 | - | ||
21 | import org.jboss.netty.channel.Channel; | 18 | import org.jboss.netty.channel.Channel; |
22 | import org.junit.After; | 19 | import org.junit.After; |
23 | import org.junit.Before; | 20 | import org.junit.Before; |
24 | import org.junit.Test; | 21 | import org.junit.Test; |
22 | +import org.onosproject.net.driver.DriverData; | ||
23 | +import org.onosproject.net.driver.DriverHandler; | ||
24 | +import org.onosproject.openflow.controller.Dpid; | ||
25 | import org.onosproject.openflow.controller.RoleState; | 25 | import org.onosproject.openflow.controller.RoleState; |
26 | -import org.onosproject.openflow.controller.OpenFlowSwitch.TableType; | ||
27 | import org.onosproject.openflow.controller.driver.OpenFlowAgent; | 26 | import org.onosproject.openflow.controller.driver.OpenFlowAgent; |
28 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; | 27 | import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; |
29 | import org.onosproject.openflow.controller.driver.RoleHandler; | 28 | import org.onosproject.openflow.controller.driver.RoleHandler; |
... | @@ -39,12 +38,16 @@ import org.projectfloodlight.openflow.protocol.OFMessage; | ... | @@ -39,12 +38,16 @@ import org.projectfloodlight.openflow.protocol.OFMessage; |
39 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 38 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
40 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; | 39 | import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; |
41 | import org.projectfloodlight.openflow.protocol.OFVersion; | 40 | import org.projectfloodlight.openflow.protocol.OFVersion; |
42 | -import org.projectfloodlight.openflow.types.TableId; | ||
43 | import org.projectfloodlight.openflow.types.U64; | 41 | import org.projectfloodlight.openflow.types.U64; |
44 | 42 | ||
43 | +import java.io.IOException; | ||
44 | +import java.util.List; | ||
45 | + | ||
45 | import static org.junit.Assert.assertEquals; | 46 | import static org.junit.Assert.assertEquals; |
46 | -import static org.onosproject.openflow.controller.RoleState.*; | 47 | +import static org.onosproject.openflow.controller.RoleState.MASTER; |
47 | -import static org.onosproject.openflow.controller.driver.RoleRecvStatus.*; | 48 | +import static org.onosproject.openflow.controller.RoleState.SLAVE; |
49 | +import static org.onosproject.openflow.controller.driver.RoleRecvStatus.MATCHED_CURRENT_ROLE; | ||
50 | +import static org.onosproject.openflow.controller.driver.RoleRecvStatus.OTHER_EXPECTATION; | ||
48 | 51 | ||
49 | public class RoleManagerTest { | 52 | public class RoleManagerTest { |
50 | 53 | ||
... | @@ -112,9 +115,6 @@ public class RoleManagerTest { | ... | @@ -112,9 +115,6 @@ public class RoleManagerTest { |
112 | public void sendMsg(List<OFMessage> msgs) { | 115 | public void sendMsg(List<OFMessage> msgs) { |
113 | } | 116 | } |
114 | 117 | ||
115 | - @Override | ||
116 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
117 | - } | ||
118 | 118 | ||
119 | @Override | 119 | @Override |
120 | public void handleMessage(OFMessage fromSwitch) { | 120 | public void handleMessage(OFMessage fromSwitch) { |
... | @@ -224,6 +224,11 @@ public class RoleManagerTest { | ... | @@ -224,6 +224,11 @@ public class RoleManagerTest { |
224 | } | 224 | } |
225 | 225 | ||
226 | @Override | 226 | @Override |
227 | + public void sendRoleRequest(OFMessage message) { | ||
228 | + | ||
229 | + } | ||
230 | + | ||
231 | + @Override | ||
227 | public boolean connectSwitch() { | 232 | public boolean connectSwitch() { |
228 | return false; | 233 | return false; |
229 | } | 234 | } |
... | @@ -293,16 +298,13 @@ public class RoleManagerTest { | ... | @@ -293,16 +298,13 @@ public class RoleManagerTest { |
293 | } | 298 | } |
294 | 299 | ||
295 | @Override | 300 | @Override |
296 | - public boolean isConnected() { | 301 | + public void init(Dpid dpid, OFDescStatsReply desc, OFVersion ofv) { |
297 | - return false; | ||
298 | - } | ||
299 | 302 | ||
300 | - @Override | ||
301 | - public void write(OFMessage msg) { | ||
302 | } | 303 | } |
303 | 304 | ||
304 | @Override | 305 | @Override |
305 | - public void write(List<OFMessage> msgs) { | 306 | + public boolean isConnected() { |
307 | + return false; | ||
306 | } | 308 | } |
307 | 309 | ||
308 | @Override | 310 | @Override |
... | @@ -316,9 +318,23 @@ public class RoleManagerTest { | ... | @@ -316,9 +318,23 @@ public class RoleManagerTest { |
316 | } | 318 | } |
317 | 319 | ||
318 | @Override | 320 | @Override |
319 | - public TableType getTableType(TableId tid) { | 321 | + public DriverHandler handler() { |
320 | - return TableType.NONE; | 322 | + return null; |
323 | + } | ||
324 | + | ||
325 | + @Override | ||
326 | + public void setHandler(DriverHandler handler) { | ||
327 | + | ||
321 | } | 328 | } |
322 | 329 | ||
330 | + @Override | ||
331 | + public DriverData data() { | ||
332 | + return null; | ||
333 | + } | ||
334 | + | ||
335 | + @Override | ||
336 | + public void setData(DriverData data) { | ||
337 | + | ||
338 | + } | ||
323 | } | 339 | } |
324 | } | 340 | } | ... | ... |
openflow/drivers/pom.xml
deleted
100644 → 0
1 | -<!-- | ||
2 | - ~ Copyright 2014 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 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
17 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
18 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
19 | - <modelVersion>4.0.0</modelVersion> | ||
20 | - | ||
21 | - <parent> | ||
22 | - <groupId>org.onosproject</groupId> | ||
23 | - <artifactId>onos-of</artifactId> | ||
24 | - <version>1.2.0-SNAPSHOT</version> | ||
25 | - <relativePath>../pom.xml</relativePath> | ||
26 | - </parent> | ||
27 | - | ||
28 | - <artifactId>onos-of-drivers</artifactId> | ||
29 | - <packaging>bundle</packaging> | ||
30 | - | ||
31 | - <description>ONOS OpenFlow switch drivers & factory</description> | ||
32 | - | ||
33 | - <dependencies> | ||
34 | - <dependency> | ||
35 | - <groupId>org.onosproject</groupId> | ||
36 | - <artifactId>onos-of-api</artifactId> | ||
37 | - </dependency> | ||
38 | - </dependencies> | ||
39 | -</project> |
openflow/drivers/src/main/java/org/onosproject/openflow/drivers/DriverManager.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2014-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 | -package org.onosproject.openflow.drivers; | ||
17 | - | ||
18 | - | ||
19 | -import org.onosproject.openflow.controller.Dpid; | ||
20 | -import org.onosproject.openflow.controller.RoleState; | ||
21 | -import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | ||
22 | -import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver; | ||
23 | -import org.onosproject.openflow.controller.driver.OpenFlowSwitchDriverFactory; | ||
24 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
25 | -import org.projectfloodlight.openflow.protocol.OFFlowAdd; | ||
26 | -import org.projectfloodlight.openflow.protocol.OFMessage; | ||
27 | -import org.projectfloodlight.openflow.protocol.OFPortDesc; | ||
28 | -import org.projectfloodlight.openflow.protocol.OFVersion; | ||
29 | -import org.projectfloodlight.openflow.types.TableId; | ||
30 | -import org.slf4j.Logger; | ||
31 | -import org.slf4j.LoggerFactory; | ||
32 | - | ||
33 | -import java.util.Collections; | ||
34 | -import java.util.List; | ||
35 | -import java.util.stream.Collectors; | ||
36 | - | ||
37 | -/** | ||
38 | - * A simple implementation of a driver manager that differentiates between | ||
39 | - * connected switches using the OF Description Statistics Reply message. | ||
40 | - */ | ||
41 | -public final class DriverManager implements OpenFlowSwitchDriverFactory { | ||
42 | - | ||
43 | - private static final Logger log = LoggerFactory.getLogger(DriverManager.class); | ||
44 | - | ||
45 | - private static final int LOWEST_PRIORITY = 0; | ||
46 | - | ||
47 | - private static Dpid corsaDpid = new Dpid(); | ||
48 | - | ||
49 | - /** | ||
50 | - * Return an IOFSwitch object based on switch's manufacturer description | ||
51 | - * from OFDescStatsReply. | ||
52 | - * | ||
53 | - * @param desc DescriptionStatistics reply from the switch | ||
54 | - * @return A IOFSwitch instance if the driver found an implementation for | ||
55 | - * the given description. Otherwise it returns OFSwitchImplBase | ||
56 | - */ | ||
57 | - @Override | ||
58 | - public OpenFlowSwitchDriver getOFSwitchImpl(Dpid dpid, | ||
59 | - OFDescStatsReply desc, OFVersion ofv) { | ||
60 | - String vendor = desc.getMfrDesc(); | ||
61 | - String hw = desc.getHwDesc(); | ||
62 | - String sw = desc.getSwDesc(); | ||
63 | - | ||
64 | - if (dpid.equals(corsaDpid)) { | ||
65 | - if (hw.startsWith("Open vSwitch")) { | ||
66 | - return new OFOVSSwitchCorsaTTP(dpid, desc); | ||
67 | - } else { | ||
68 | - return new OFCorsaSwitchDriver(dpid, desc); | ||
69 | - } | ||
70 | - } | ||
71 | - | ||
72 | - if (vendor.startsWith("Stanford University, Ericsson Research and CPqD Research") | ||
73 | - && | ||
74 | - hw.startsWith("OpenFlow 1.3 Reference Userspace Switch")) { | ||
75 | - return new OFSwitchImplSpringOpenTTP(dpid, desc); | ||
76 | - } | ||
77 | - | ||
78 | - //TODO: Temporary work around until the configuration based | ||
79 | - // driver manager framework is ready | ||
80 | - if (vendor.contains("Dell") | ||
81 | - && | ||
82 | - hw.contains("OpenFlow switch HW ver. 1.0")) { | ||
83 | - return new OFSwitchImplSpringOpenTTPDellOSR(dpid, desc); | ||
84 | - } | ||
85 | - | ||
86 | - if (hw.startsWith("Open vSwitch")) { | ||
87 | - if (ofv == OFVersion.OF_10) { | ||
88 | - return new OFSwitchImplOVS10(dpid, desc); | ||
89 | - } else if (ofv == OFVersion.OF_13) { | ||
90 | - return new OFSwitchImplOVS13(dpid, desc); | ||
91 | - } | ||
92 | - } | ||
93 | - | ||
94 | - if (vendor.equals("Pica8, Inc.") && sw.startsWith("PicOS") && | ||
95 | - ofv == OFVersion.OF_13) { | ||
96 | - return new OFSwitchImplOVS13(dpid, desc); | ||
97 | - } | ||
98 | - | ||
99 | - | ||
100 | - if (sw.startsWith("LINC-OE")) { | ||
101 | - log.warn("Optical Emulator LINC-OE with DPID:{} found..", dpid); | ||
102 | - return new OFOpticalSwitchImplLINC13(dpid, desc); | ||
103 | - } | ||
104 | - | ||
105 | - if (vendor.startsWith("Corsa") && hw.startsWith("Corsa Element") | ||
106 | - && sw.startsWith("2.3.1")) { | ||
107 | - log.warn("Corsa Switch 2.3.1 found"); | ||
108 | - return new OFCorsaSwitchDriver(dpid, desc); | ||
109 | - } | ||
110 | - | ||
111 | - log.warn("DriverManager could not identify switch desc: {}. " | ||
112 | - + "Assigning AbstractOpenFlowSwich", desc); | ||
113 | - return new AbstractOpenFlowSwitch(dpid, desc) { | ||
114 | - | ||
115 | - @Override | ||
116 | - public void setRole(RoleState state) { | ||
117 | - this.role = RoleState.MASTER; | ||
118 | - } | ||
119 | - | ||
120 | - @Override | ||
121 | - public void write(List<OFMessage> msgs) { | ||
122 | - channel.write(msgs); | ||
123 | - } | ||
124 | - | ||
125 | - @Override | ||
126 | - public void write(OFMessage msg) { | ||
127 | - channel.write(Collections.singletonList(msg)); | ||
128 | - | ||
129 | - } | ||
130 | - | ||
131 | - @Override | ||
132 | - public Boolean supportNxRole() { | ||
133 | - return false; | ||
134 | - } | ||
135 | - | ||
136 | - @Override | ||
137 | - public void startDriverHandshake() { | ||
138 | - if (factory().getVersion() == OFVersion.OF_10) { | ||
139 | - OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd(); | ||
140 | - fmBuilder.setPriority(LOWEST_PRIORITY); | ||
141 | - write(fmBuilder.build()); | ||
142 | - } | ||
143 | - } | ||
144 | - | ||
145 | - @Override | ||
146 | - public void processDriverHandshakeMessage(OFMessage m) {} | ||
147 | - | ||
148 | - @Override | ||
149 | - public boolean isDriverHandshakeComplete() { | ||
150 | - return true; | ||
151 | - } | ||
152 | - | ||
153 | - @Override | ||
154 | - public List<OFPortDesc> getPorts() { | ||
155 | - if (this.factory().getVersion() == OFVersion.OF_10) { | ||
156 | - return Collections.unmodifiableList(features.getPorts()); | ||
157 | - } else { | ||
158 | - return Collections.unmodifiableList(this.ports.stream() | ||
159 | - .flatMap((portReply) -> (portReply.getEntries().stream())) | ||
160 | - .collect(Collectors.toList())); | ||
161 | - } | ||
162 | - } | ||
163 | - | ||
164 | - @Override | ||
165 | - public TableType getTableType(TableId tid) { | ||
166 | - return TableType.NONE; | ||
167 | - } | ||
168 | - | ||
169 | - @Override | ||
170 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
171 | - // TODO Auto-generated method stub | ||
172 | - | ||
173 | - } | ||
174 | - }; | ||
175 | - } | ||
176 | - | ||
177 | - /** | ||
178 | - * Private constructor to avoid instantiation. | ||
179 | - */ | ||
180 | - private DriverManager() { | ||
181 | - } | ||
182 | - | ||
183 | - public static OpenFlowSwitchDriver getSwitch(Dpid dpid, | ||
184 | - OFDescStatsReply desc, OFVersion ofv) { | ||
185 | - return new DriverManager().getOFSwitchImpl(dpid, desc, ofv); | ||
186 | - } | ||
187 | - | ||
188 | - public static void setCorsaDpid(Dpid dpid) { | ||
189 | - corsaDpid = dpid; | ||
190 | - } | ||
191 | - | ||
192 | -} |
openflow/drivers/src/main/java/org/onosproject/openflow/drivers/OFCorsaSwitchDriver.java
deleted
100644 → 0
This diff is collapsed. Click to expand it.
openflow/drivers/src/main/java/org/onosproject/openflow/drivers/OFOVSSwitchCorsaTTP.java
deleted
100644 → 0
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 | -package org.onosproject.openflow.drivers; | ||
17 | - | ||
18 | -import org.onosproject.openflow.controller.Dpid; | ||
19 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
20 | -import org.projectfloodlight.openflow.protocol.OFMessage; | ||
21 | -/*import com.google.common.collect.Lists; | ||
22 | -import org.projectfloodlight.openflow.protocol.OFFlowMod; | ||
23 | -import org.projectfloodlight.openflow.protocol.OFType; | ||
24 | -import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; | ||
25 | -import org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable; | ||
26 | -import org.projectfloodlight.openflow.types.TableId; | ||
27 | -import java.util.List; | ||
28 | -*/ | ||
29 | -import java.util.Collections; | ||
30 | - | ||
31 | -public class OFOVSSwitchCorsaTTP extends OFCorsaSwitchDriver { | ||
32 | - | ||
33 | - OFOVSSwitchCorsaTTP(Dpid dpid, OFDescStatsReply desc) { | ||
34 | - super(dpid, desc); | ||
35 | - } | ||
36 | - | ||
37 | - @Override | ||
38 | - public void transformAndSendMsg(OFMessage msg, TableType type) { | ||
39 | - /*log.trace("Trying to send {} of TableType {}", msg, type); | ||
40 | - if (msg.getType() == OFType.FLOW_MOD) { | ||
41 | - OFFlowMod flowMod = (OFFlowMod) msg; | ||
42 | - OFFlowMod.Builder builder = flowMod.createBuilder(); | ||
43 | - List<OFInstruction> instructions = flowMod.getInstructions(); | ||
44 | - List<OFInstruction> newInstructions = Lists.newArrayList(); | ||
45 | - for (OFInstruction i : instructions) { | ||
46 | - if (i instanceof OFInstructionGotoTable) { | ||
47 | - OFInstructionGotoTable gotoTable = (OFInstructionGotoTable) i; | ||
48 | - TableType tid = TableType.values()[gotoTable.getTableId().getValue()]; | ||
49 | - switch (tid) { | ||
50 | - case VLAN_MPLS: | ||
51 | - newInstructions.add( | ||
52 | - gotoTable.createBuilder() | ||
53 | - .setTableId(TableId.of(VLAN_MPLS_TABLE)).build()); | ||
54 | - break; | ||
55 | - case VLAN: | ||
56 | - newInstructions.add( | ||
57 | - gotoTable.createBuilder() | ||
58 | - .setTableId(TableId.of(VLAN_TABLE)).build()); | ||
59 | - break; | ||
60 | - case ETHER: | ||
61 | - newInstructions.add( | ||
62 | - gotoTable.createBuilder() | ||
63 | - .setTableId(TableId.of(ETHER_TABLE)).build()); | ||
64 | - break; | ||
65 | - case COS: | ||
66 | - newInstructions.add( | ||
67 | - gotoTable.createBuilder() | ||
68 | - .setTableId(TableId.of(COS_MAP_TABLE)).build()); | ||
69 | - break; | ||
70 | - case IP: | ||
71 | - newInstructions.add( | ||
72 | - gotoTable.createBuilder() | ||
73 | - .setTableId(TableId.of(FIB_TABLE)).build()); | ||
74 | - break; | ||
75 | - case MPLS: | ||
76 | - newInstructions.add( | ||
77 | - gotoTable.createBuilder() | ||
78 | - .setTableId(TableId.of(MPLS_TABLE)).build()); | ||
79 | - break; | ||
80 | - case ACL: | ||
81 | - newInstructions.add( | ||
82 | - gotoTable.createBuilder() | ||
83 | - .setTableId(TableId.of(LOCAL_TABLE)).build()); | ||
84 | - break; | ||
85 | - case NONE: | ||
86 | - log.error("Should never have to go to Table 0"); | ||
87 | - newInstructions.add( | ||
88 | - gotoTable.createBuilder() | ||
89 | - .setTableId(TableId.of(0)).build()); | ||
90 | - | ||
91 | - break; | ||
92 | - default: | ||
93 | - log.warn("Unknown table type: {}", tid); | ||
94 | - } | ||
95 | - } else { | ||
96 | - newInstructions.add(i); | ||
97 | - } | ||
98 | - } | ||
99 | - switch (type) { | ||
100 | - case VLAN_MPLS: | ||
101 | - builder.setTableId(TableId.of(VLAN_MPLS_TABLE)); | ||
102 | - break; | ||
103 | - case VLAN: | ||
104 | - builder.setTableId(TableId.of(VLAN_TABLE)); | ||
105 | - break; | ||
106 | - case ETHER: | ||
107 | - builder.setTableId(TableId.of(ETHER_TABLE)); | ||
108 | - break; | ||
109 | - case COS: | ||
110 | - builder.setTableId(TableId.of(COS_MAP_TABLE)); | ||
111 | - break; | ||
112 | - case IP: | ||
113 | - builder.setTableId(TableId.of(FIB_TABLE)); | ||
114 | - break; | ||
115 | - case MPLS: | ||
116 | - builder.setTableId(TableId.of(MPLS_TABLE)); | ||
117 | - break; | ||
118 | - case ACL: | ||
119 | - builder.setTableId(TableId.of(LOCAL_TABLE)); | ||
120 | - break; | ||
121 | - case FIRST: | ||
122 | - builder.setTableId(TableId.of(FIRST_TABLE)); | ||
123 | - break; | ||
124 | - case NONE: | ||
125 | - builder.setTableId(TableId.of(LOCAL_TABLE)); | ||
126 | - break; | ||
127 | - default: | ||
128 | - log.warn("Unknown table type: {}", type); | ||
129 | - } | ||
130 | - builder.setInstructions(newInstructions); | ||
131 | - OFMessage msgnew = builder.build(); | ||
132 | - channel.write(Collections.singletonList(msgnew)); | ||
133 | - log.debug("Installed {}", msgnew); | ||
134 | - | ||
135 | - } else { | ||
136 | - channel.write(Collections.singletonList(msg)); | ||
137 | - }*/ | ||
138 | - channel.write(Collections.singletonList(msg)); | ||
139 | - } | ||
140 | -} |
openflow/drivers/src/main/java/org/onosproject/openflow/drivers/OFSwitchImplOVS13.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2014-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 | -package org.onosproject.openflow.drivers; | ||
17 | - | ||
18 | -import java.util.ArrayList; | ||
19 | -import java.util.Collections; | ||
20 | -import java.util.List; | ||
21 | -import java.util.concurrent.atomic.AtomicBoolean; | ||
22 | - | ||
23 | -import org.onosproject.openflow.controller.Dpid; | ||
24 | -import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | ||
25 | -import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; | ||
26 | -import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; | ||
27 | -import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; | ||
28 | -import org.projectfloodlight.openflow.protocol.OFBarrierRequest; | ||
29 | -import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
30 | -import org.projectfloodlight.openflow.protocol.OFFactory; | ||
31 | -import org.projectfloodlight.openflow.protocol.OFMatchV3; | ||
32 | -import org.projectfloodlight.openflow.protocol.OFMessage; | ||
33 | -import org.projectfloodlight.openflow.protocol.OFOxmList; | ||
34 | -import org.projectfloodlight.openflow.protocol.action.OFAction; | ||
35 | -import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; | ||
36 | -import org.projectfloodlight.openflow.types.OFBufferId; | ||
37 | -import org.projectfloodlight.openflow.types.OFPort; | ||
38 | -import org.projectfloodlight.openflow.types.TableId; | ||
39 | - | ||
40 | -/** | ||
41 | - * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make | ||
42 | - * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software : | ||
43 | - * 2.1.0 (or whatever version + build) Serial : None | ||
44 | - */ | ||
45 | -public class OFSwitchImplOVS13 extends AbstractOpenFlowSwitch { | ||
46 | - | ||
47 | - private final AtomicBoolean driverHandshakeComplete; | ||
48 | - private OFFactory factory; | ||
49 | - private long barrierXidToWaitFor = -1; | ||
50 | - | ||
51 | - private static final short MIN_PRIORITY = 0x0; | ||
52 | - private static final int OFPCML_NO_BUFFER = 0xffff; | ||
53 | - | ||
54 | - public OFSwitchImplOVS13(Dpid dpid, OFDescStatsReply desc) { | ||
55 | - super(dpid); | ||
56 | - driverHandshakeComplete = new AtomicBoolean(false); | ||
57 | - setSwitchDescription(desc); | ||
58 | - } | ||
59 | - | ||
60 | - @Override | ||
61 | - public String toString() { | ||
62 | - return "OFSwitchImplOVS13 [" + ((channel != null) | ||
63 | - ? channel.getRemoteAddress() : "?") | ||
64 | - + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]"; | ||
65 | - } | ||
66 | - | ||
67 | - @Override | ||
68 | - public void startDriverHandshake() { | ||
69 | - log.debug("Starting driver handshake for sw {}", getStringId()); | ||
70 | - if (startDriverHandshakeCalled) { | ||
71 | - throw new SwitchDriverSubHandshakeAlreadyStarted(); | ||
72 | - } | ||
73 | - startDriverHandshakeCalled = true; | ||
74 | - factory = factory(); | ||
75 | - configureSwitch(); | ||
76 | - } | ||
77 | - | ||
78 | - @Override | ||
79 | - public boolean isDriverHandshakeComplete() { | ||
80 | - if (!startDriverHandshakeCalled) { | ||
81 | - throw new SwitchDriverSubHandshakeNotStarted(); | ||
82 | - } | ||
83 | - return driverHandshakeComplete.get(); | ||
84 | - } | ||
85 | - | ||
86 | - @Override | ||
87 | - public void processDriverHandshakeMessage(OFMessage m) { | ||
88 | - if (!startDriverHandshakeCalled) { | ||
89 | - throw new SwitchDriverSubHandshakeNotStarted(); | ||
90 | - } | ||
91 | - if (driverHandshakeComplete.get()) { | ||
92 | - throw new SwitchDriverSubHandshakeCompleted(m); | ||
93 | - } | ||
94 | - | ||
95 | - switch (m.getType()) { | ||
96 | - case BARRIER_REPLY: | ||
97 | - if (m.getXid() == barrierXidToWaitFor) { | ||
98 | - driverHandshakeComplete.set(true); | ||
99 | - } | ||
100 | - break; | ||
101 | - | ||
102 | - case ERROR: | ||
103 | - log.error("Switch {} Error {}", getStringId(), m); | ||
104 | - break; | ||
105 | - | ||
106 | - case FEATURES_REPLY: | ||
107 | - break; | ||
108 | - case FLOW_REMOVED: | ||
109 | - break; | ||
110 | - case GET_ASYNC_REPLY: | ||
111 | - // OFAsyncGetReply asrep = (OFAsyncGetReply)m; | ||
112 | - // decodeAsyncGetReply(asrep); | ||
113 | - break; | ||
114 | - | ||
115 | - case PACKET_IN: | ||
116 | - break; | ||
117 | - case PORT_STATUS: | ||
118 | - break; | ||
119 | - case QUEUE_GET_CONFIG_REPLY: | ||
120 | - break; | ||
121 | - case ROLE_REPLY: | ||
122 | - break; | ||
123 | - | ||
124 | - case STATS_REPLY: | ||
125 | - // processStatsReply((OFStatsReply) m); | ||
126 | - break; | ||
127 | - | ||
128 | - default: | ||
129 | - log.debug("Received message {} during switch-driver subhandshake " | ||
130 | - + "from switch {} ... Ignoring message", m, getStringId()); | ||
131 | - | ||
132 | - } | ||
133 | - } | ||
134 | - | ||
135 | - private void configureSwitch() { | ||
136 | - sendBarrier(true); | ||
137 | - } | ||
138 | - | ||
139 | - private void sendBarrier(boolean finalBarrier) { | ||
140 | - int xid = getNextTransactionId(); | ||
141 | - if (finalBarrier) { | ||
142 | - barrierXidToWaitFor = xid; | ||
143 | - } | ||
144 | - OFBarrierRequest br = factory | ||
145 | - .buildBarrierRequest() | ||
146 | - .setXid(xid) | ||
147 | - .build(); | ||
148 | - write(br); | ||
149 | - } | ||
150 | - | ||
151 | - @Override | ||
152 | - public Boolean supportNxRole() { | ||
153 | - return false; | ||
154 | - } | ||
155 | - | ||
156 | - @Override | ||
157 | - public void write(OFMessage msg) { | ||
158 | - channel.write(Collections.singletonList(msg)); | ||
159 | - | ||
160 | - } | ||
161 | - | ||
162 | - @Override | ||
163 | - public void write(List<OFMessage> msgs) { | ||
164 | - channel.write(msgs); | ||
165 | - } | ||
166 | - | ||
167 | - /** | ||
168 | - * By default if none of the booleans in the call are set, then the | ||
169 | - * table-miss entry is added with no instructions, which means that pipeline | ||
170 | - * execution will stop, and the action set associated with the packet will | ||
171 | - * be executed. | ||
172 | - * | ||
173 | - * @param tableToAdd | ||
174 | - * @param toControllerNow as an APPLY_ACTION instruction | ||
175 | - * @param toControllerWrite as a WRITE_ACITION instruction | ||
176 | - * @param toTable as a GOTO_TABLE instruction | ||
177 | - * @param tableToSend | ||
178 | - */ | ||
179 | - @SuppressWarnings("unchecked") | ||
180 | - private void populateTableMissEntry(int tableToAdd, boolean toControllerNow, | ||
181 | - boolean toControllerWrite, | ||
182 | - boolean toTable, int tableToSend) { | ||
183 | - OFOxmList oxmList = OFOxmList.EMPTY; | ||
184 | - OFMatchV3 match = factory.buildMatchV3() | ||
185 | - .setOxmList(oxmList) | ||
186 | - .build(); | ||
187 | - OFAction outc = factory.actions() | ||
188 | - .buildOutput() | ||
189 | - .setPort(OFPort.CONTROLLER) | ||
190 | - .setMaxLen(OFPCML_NO_BUFFER) | ||
191 | - .build(); | ||
192 | - List<OFInstruction> instructions = new ArrayList<OFInstruction>(); | ||
193 | - if (toControllerNow) { | ||
194 | - // table-miss instruction to send to controller immediately | ||
195 | - OFInstruction instr = factory.instructions() | ||
196 | - .buildApplyActions() | ||
197 | - .setActions(Collections.singletonList(outc)) | ||
198 | - .build(); | ||
199 | - instructions.add(instr); | ||
200 | - } | ||
201 | - | ||
202 | - if (toControllerWrite) { | ||
203 | - // table-miss instruction to write-action to send to controller | ||
204 | - // this will be executed whenever the action-set gets executed | ||
205 | - OFInstruction instr = factory.instructions() | ||
206 | - .buildWriteActions() | ||
207 | - .setActions(Collections.singletonList(outc)) | ||
208 | - .build(); | ||
209 | - instructions.add(instr); | ||
210 | - } | ||
211 | - | ||
212 | - if (toTable) { | ||
213 | - // table-miss instruction to goto-table x | ||
214 | - OFInstruction instr = factory.instructions() | ||
215 | - .gotoTable(TableId.of(tableToSend)); | ||
216 | - instructions.add(instr); | ||
217 | - } | ||
218 | - | ||
219 | - if (!toControllerNow && !toControllerWrite && !toTable) { | ||
220 | - // table-miss has no instruction - at which point action-set will be | ||
221 | - // executed - if there is an action to output/group in the action | ||
222 | - // set | ||
223 | - // the packet will be sent there, otherwise it will be dropped. | ||
224 | - instructions = Collections.EMPTY_LIST; | ||
225 | - } | ||
226 | - | ||
227 | - OFMessage tableMissEntry = factory.buildFlowAdd() | ||
228 | - .setTableId(TableId.of(tableToAdd)) | ||
229 | - .setMatch(match) // match everything | ||
230 | - .setInstructions(instructions) | ||
231 | - .setPriority(MIN_PRIORITY) | ||
232 | - .setBufferId(OFBufferId.NO_BUFFER) | ||
233 | - .setIdleTimeout(0) | ||
234 | - .setHardTimeout(0) | ||
235 | - .setXid(getNextTransactionId()) | ||
236 | - .build(); | ||
237 | - write(tableMissEntry); | ||
238 | - } | ||
239 | - | ||
240 | - @Override | ||
241 | - public TableType getTableType(TableId tid) { | ||
242 | - return TableType.NONE; | ||
243 | - } | ||
244 | - | ||
245 | - @Override | ||
246 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
247 | - // TODO Auto-generated method stub | ||
248 | - | ||
249 | - } | ||
250 | - | ||
251 | -} |
... | @@ -21,7 +21,6 @@ | ... | @@ -21,7 +21,6 @@ |
21 | <feature>onos-api</feature> | 21 | <feature>onos-api</feature> |
22 | <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> | 22 | <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> |
23 | <bundle>mvn:${project.groupId}/onos-of-api/${project.version}</bundle> | 23 | <bundle>mvn:${project.groupId}/onos-of-api/${project.version}</bundle> |
24 | - <bundle>mvn:${project.groupId}/onos-of-drivers/${project.version}</bundle> | ||
25 | <bundle>mvn:${project.groupId}/onos-of-ctl/${project.version}</bundle> | 24 | <bundle>mvn:${project.groupId}/onos-of-ctl/${project.version}</bundle> |
26 | 25 | ||
27 | <bundle>mvn:${project.groupId}/onos-lldp-provider/${project.version}</bundle> | 26 | <bundle>mvn:${project.groupId}/onos-lldp-provider/${project.version}</bundle> | ... | ... |
... | @@ -15,21 +15,9 @@ | ... | @@ -15,21 +15,9 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.provider.of.device.impl; | 16 | package org.onosproject.provider.of.device.impl; |
17 | 17 | ||
18 | -import static org.junit.Assert.assertEquals; | 18 | +import com.google.common.collect.HashMultimap; |
19 | -import static org.junit.Assert.assertNotNull; | 19 | +import com.google.common.collect.Lists; |
20 | -import static org.junit.Assert.assertNull; | 20 | +import com.google.common.collect.Multimap; |
21 | -import static org.junit.Assert.assertTrue; | ||
22 | -import static org.onosproject.net.Device.Type.*; | ||
23 | -import static org.onosproject.net.MastershipRole.*; | ||
24 | - | ||
25 | -import java.util.ArrayList; | ||
26 | -import java.util.Collection; | ||
27 | -import java.util.HashMap; | ||
28 | -import java.util.HashSet; | ||
29 | -import java.util.List; | ||
30 | -import java.util.Map; | ||
31 | -import java.util.Set; | ||
32 | - | ||
33 | import org.junit.After; | 21 | import org.junit.After; |
34 | import org.junit.Before; | 22 | import org.junit.Before; |
35 | import org.junit.Test; | 23 | import org.junit.Test; |
... | @@ -51,7 +39,6 @@ import org.onosproject.openflow.controller.OpenFlowSwitch; | ... | @@ -51,7 +39,6 @@ import org.onosproject.openflow.controller.OpenFlowSwitch; |
51 | import org.onosproject.openflow.controller.OpenFlowSwitchListener; | 39 | import org.onosproject.openflow.controller.OpenFlowSwitchListener; |
52 | import org.onosproject.openflow.controller.PacketListener; | 40 | import org.onosproject.openflow.controller.PacketListener; |
53 | import org.onosproject.openflow.controller.RoleState; | 41 | import org.onosproject.openflow.controller.RoleState; |
54 | -import org.onosproject.openflow.controller.OpenFlowSwitch.TableType; | ||
55 | import org.projectfloodlight.openflow.protocol.OFFactory; | 42 | import org.projectfloodlight.openflow.protocol.OFFactory; |
56 | import org.projectfloodlight.openflow.protocol.OFMessage; | 43 | import org.projectfloodlight.openflow.protocol.OFMessage; |
57 | import org.projectfloodlight.openflow.protocol.OFPortDesc; | 44 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
... | @@ -59,11 +46,18 @@ import org.projectfloodlight.openflow.protocol.OFPortReason; | ... | @@ -59,11 +46,18 @@ import org.projectfloodlight.openflow.protocol.OFPortReason; |
59 | import org.projectfloodlight.openflow.protocol.OFPortStatus; | 46 | import org.projectfloodlight.openflow.protocol.OFPortStatus; |
60 | import org.projectfloodlight.openflow.protocol.ver10.OFFactoryVer10; | 47 | import org.projectfloodlight.openflow.protocol.ver10.OFFactoryVer10; |
61 | import org.projectfloodlight.openflow.types.OFPort; | 48 | import org.projectfloodlight.openflow.types.OFPort; |
62 | -import org.projectfloodlight.openflow.types.TableId; | ||
63 | 49 | ||
64 | -import com.google.common.collect.HashMultimap; | 50 | +import java.util.ArrayList; |
65 | -import com.google.common.collect.Lists; | 51 | +import java.util.Collection; |
66 | -import com.google.common.collect.Multimap; | 52 | +import java.util.HashMap; |
53 | +import java.util.HashSet; | ||
54 | +import java.util.List; | ||
55 | +import java.util.Map; | ||
56 | +import java.util.Set; | ||
57 | + | ||
58 | +import static org.junit.Assert.*; | ||
59 | +import static org.onosproject.net.Device.Type.SWITCH; | ||
60 | +import static org.onosproject.net.MastershipRole.*; | ||
67 | 61 | ||
68 | public class OpenFlowDeviceProviderTest { | 62 | public class OpenFlowDeviceProviderTest { |
69 | 63 | ||
... | @@ -400,17 +394,6 @@ public class OpenFlowDeviceProviderTest { | ... | @@ -400,17 +394,6 @@ public class OpenFlowDeviceProviderTest { |
400 | return "1.2.3.4:1"; | 394 | return "1.2.3.4:1"; |
401 | } | 395 | } |
402 | 396 | ||
403 | - @Override | ||
404 | - public TableType getTableType(TableId tid) { | ||
405 | - return TableType.NONE; | ||
406 | - } | ||
407 | - | ||
408 | - @Override | ||
409 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
410 | - // TODO Auto-generated method stub | ||
411 | - } | ||
412 | - | ||
413 | - | ||
414 | } | 397 | } |
415 | 398 | ||
416 | } | 399 | } | ... | ... |
1 | package org.onosproject.provider.of.group.impl; | 1 | package org.onosproject.provider.of.group.impl; |
2 | 2 | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | - | ||
5 | import org.junit.After; | 4 | import org.junit.After; |
6 | import org.junit.Before; | 5 | import org.junit.Before; |
7 | import org.junit.Test; | 6 | import org.junit.Test; |
... | @@ -42,15 +41,12 @@ import org.projectfloodlight.openflow.protocol.OFPortDesc; | ... | @@ -42,15 +41,12 @@ import org.projectfloodlight.openflow.protocol.OFPortDesc; |
42 | import org.projectfloodlight.openflow.protocol.OFVersion; | 41 | import org.projectfloodlight.openflow.protocol.OFVersion; |
43 | import org.projectfloodlight.openflow.protocol.errormsg.OFGroupModFailedErrorMsg; | 42 | import org.projectfloodlight.openflow.protocol.errormsg.OFGroupModFailedErrorMsg; |
44 | import org.projectfloodlight.openflow.types.OFGroup; | 43 | import org.projectfloodlight.openflow.types.OFGroup; |
45 | -import org.projectfloodlight.openflow.types.TableId; | ||
46 | 44 | ||
47 | import java.util.Collection; | 45 | import java.util.Collection; |
48 | import java.util.List; | 46 | import java.util.List; |
49 | import java.util.Set; | 47 | import java.util.Set; |
50 | 48 | ||
51 | -import static org.junit.Assert.assertEquals; | 49 | +import static org.junit.Assert.*; |
52 | -import static org.junit.Assert.assertNotNull; | ||
53 | -import static org.junit.Assert.assertNull; | ||
54 | 50 | ||
55 | public class OpenFlowGroupProviderTest { | 51 | public class OpenFlowGroupProviderTest { |
56 | 52 | ||
... | @@ -396,14 +392,5 @@ public class OpenFlowGroupProviderTest { | ... | @@ -396,14 +392,5 @@ public class OpenFlowGroupProviderTest { |
396 | return null; | 392 | return null; |
397 | } | 393 | } |
398 | 394 | ||
399 | - @Override | ||
400 | - public TableType getTableType(TableId tid) { | ||
401 | - return TableType.NONE; | ||
402 | - } | ||
403 | - | ||
404 | - @Override | ||
405 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
406 | - // TODO Auto-generated method stub | ||
407 | - } | ||
408 | } | 395 | } |
409 | } | 396 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,18 +15,13 @@ | ... | @@ -15,18 +15,13 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.provider.of.packet.impl; | 16 | package org.onosproject.provider.of.packet.impl; |
17 | 17 | ||
18 | -import static org.junit.Assert.assertEquals; | 18 | +import com.google.common.collect.Lists; |
19 | -import static org.junit.Assert.assertNotNull; | 19 | +import com.google.common.collect.Sets; |
20 | -import static org.junit.Assert.assertNull; | ||
21 | - | ||
22 | -import java.nio.ByteBuffer; | ||
23 | -import java.util.ArrayList; | ||
24 | -import java.util.List; | ||
25 | -import java.util.Set; | ||
26 | - | ||
27 | import org.junit.After; | 20 | import org.junit.After; |
28 | import org.junit.Before; | 21 | import org.junit.Before; |
29 | import org.junit.Test; | 22 | import org.junit.Test; |
23 | +import org.onlab.packet.ARP; | ||
24 | +import org.onlab.packet.Ethernet; | ||
30 | import org.onosproject.net.DeviceId; | 25 | import org.onosproject.net.DeviceId; |
31 | import org.onosproject.net.PortNumber; | 26 | import org.onosproject.net.PortNumber; |
32 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 27 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
... | @@ -49,9 +44,6 @@ import org.onosproject.openflow.controller.OpenFlowSwitch; | ... | @@ -49,9 +44,6 @@ import org.onosproject.openflow.controller.OpenFlowSwitch; |
49 | import org.onosproject.openflow.controller.OpenFlowSwitchListener; | 44 | import org.onosproject.openflow.controller.OpenFlowSwitchListener; |
50 | import org.onosproject.openflow.controller.PacketListener; | 45 | import org.onosproject.openflow.controller.PacketListener; |
51 | import org.onosproject.openflow.controller.RoleState; | 46 | import org.onosproject.openflow.controller.RoleState; |
52 | -import org.onosproject.openflow.controller.OpenFlowSwitch.TableType; | ||
53 | -import org.onlab.packet.ARP; | ||
54 | -import org.onlab.packet.Ethernet; | ||
55 | import org.projectfloodlight.openflow.protocol.OFFactory; | 47 | import org.projectfloodlight.openflow.protocol.OFFactory; |
56 | import org.projectfloodlight.openflow.protocol.OFMessage; | 48 | import org.projectfloodlight.openflow.protocol.OFMessage; |
57 | import org.projectfloodlight.openflow.protocol.OFPacketIn; | 49 | import org.projectfloodlight.openflow.protocol.OFPacketIn; |
... | @@ -61,10 +53,13 @@ import org.projectfloodlight.openflow.protocol.ver10.OFFactoryVer10; | ... | @@ -61,10 +53,13 @@ import org.projectfloodlight.openflow.protocol.ver10.OFFactoryVer10; |
61 | import org.projectfloodlight.openflow.types.MacAddress; | 53 | import org.projectfloodlight.openflow.types.MacAddress; |
62 | import org.projectfloodlight.openflow.types.OFBufferId; | 54 | import org.projectfloodlight.openflow.types.OFBufferId; |
63 | import org.projectfloodlight.openflow.types.OFPort; | 55 | import org.projectfloodlight.openflow.types.OFPort; |
64 | -import org.projectfloodlight.openflow.types.TableId; | ||
65 | 56 | ||
66 | -import com.google.common.collect.Lists; | 57 | +import java.nio.ByteBuffer; |
67 | -import com.google.common.collect.Sets; | 58 | +import java.util.ArrayList; |
59 | +import java.util.List; | ||
60 | +import java.util.Set; | ||
61 | + | ||
62 | +import static org.junit.Assert.*; | ||
68 | 63 | ||
69 | 64 | ||
70 | public class OpenFlowPacketProviderTest { | 65 | public class OpenFlowPacketProviderTest { |
... | @@ -430,16 +425,6 @@ public class OpenFlowPacketProviderTest { | ... | @@ -430,16 +425,6 @@ public class OpenFlowPacketProviderTest { |
430 | return "1.2.3.4:1"; | 425 | return "1.2.3.4:1"; |
431 | } | 426 | } |
432 | 427 | ||
433 | - @Override | ||
434 | - public TableType getTableType(TableId tid) { | ||
435 | - return TableType.NONE; | ||
436 | - } | ||
437 | - | ||
438 | - @Override | ||
439 | - public void transformAndSendMsg(OFMessage msg, TableType tableType) { | ||
440 | - // TODO Auto-generated method stub | ||
441 | - | ||
442 | - } | ||
443 | 428 | ||
444 | } | 429 | } |
445 | 430 | ... | ... |
-
Please register or login to post a comment