Committed by
Gerrit Code Review
Add Oplink attenuation extension and channel power drivers.
Change-Id: I2558595b03cbb6cc58237dc48b8a03e83357fe1f
Showing
10 changed files
with
308 additions
and
6 deletions
... | @@ -61,7 +61,8 @@ public final class ExtensionTreatmentType { | ... | @@ -61,7 +61,8 @@ public final class ExtensionTreatmentType { |
61 | NICIRA_ENCAP_ETH_SRC(121), | 61 | NICIRA_ENCAP_ETH_SRC(121), |
62 | NICIRA_ENCAP_ETH_DST(122), | 62 | NICIRA_ENCAP_ETH_DST(122), |
63 | NICIRA_ENCAP_ETH_TYPE(123), | 63 | NICIRA_ENCAP_ETH_TYPE(123), |
64 | - BMV2_ACTION(128); | 64 | + BMV2_ACTION(128), |
65 | + OPLINK_ATTENUATION(130); | ||
65 | 66 | ||
66 | private ExtensionTreatmentType type; | 67 | private ExtensionTreatmentType type; |
67 | 68 | ... | ... |
... | @@ -32,6 +32,7 @@ import org.onosproject.driver.extensions.NiciraSetNshSpi; | ... | @@ -32,6 +32,7 @@ import org.onosproject.driver.extensions.NiciraSetNshSpi; |
32 | import org.onosproject.driver.extensions.NiciraSetTunnelDst; | 32 | import org.onosproject.driver.extensions.NiciraSetTunnelDst; |
33 | import org.onosproject.driver.extensions.OfdpaMatchVlanVid; | 33 | import org.onosproject.driver.extensions.OfdpaMatchVlanVid; |
34 | import org.onosproject.driver.extensions.OfdpaSetVlanVid; | 34 | import org.onosproject.driver.extensions.OfdpaSetVlanVid; |
35 | +import org.onosproject.driver.extensions.OplinkAttenuation; | ||
35 | import org.onosproject.driver.extensions.codec.MoveExtensionTreatmentCodec; | 36 | import org.onosproject.driver.extensions.codec.MoveExtensionTreatmentCodec; |
36 | import org.onosproject.driver.extensions.codec.NiciraMatchNshSiCodec; | 37 | import org.onosproject.driver.extensions.codec.NiciraMatchNshSiCodec; |
37 | import org.onosproject.driver.extensions.codec.NiciraMatchNshSpiCodec; | 38 | import org.onosproject.driver.extensions.codec.NiciraMatchNshSpiCodec; |
... | @@ -43,6 +44,7 @@ import org.onosproject.driver.extensions.codec.NiciraSetNshSpiCodec; | ... | @@ -43,6 +44,7 @@ import org.onosproject.driver.extensions.codec.NiciraSetNshSpiCodec; |
43 | import org.onosproject.driver.extensions.codec.NiciraSetTunnelDstCodec; | 44 | import org.onosproject.driver.extensions.codec.NiciraSetTunnelDstCodec; |
44 | import org.onosproject.driver.extensions.codec.OfdpaMatchVlanVidCodec; | 45 | import org.onosproject.driver.extensions.codec.OfdpaMatchVlanVidCodec; |
45 | import org.onosproject.driver.extensions.codec.OfdpaSetVlanVidCodec; | 46 | import org.onosproject.driver.extensions.codec.OfdpaSetVlanVidCodec; |
47 | +import org.onosproject.driver.extensions.codec.OplinkAttenuationCodec; | ||
46 | import org.slf4j.Logger; | 48 | import org.slf4j.Logger; |
47 | 49 | ||
48 | import static org.slf4j.LoggerFactory.getLogger; | 50 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -71,6 +73,7 @@ public class DefaultCodecRegister { | ... | @@ -71,6 +73,7 @@ public class DefaultCodecRegister { |
71 | codecService.registerCodec(NiciraSetNshContextHeader.class, new NiciraSetNshContextHeaderCodec()); | 73 | codecService.registerCodec(NiciraSetNshContextHeader.class, new NiciraSetNshContextHeaderCodec()); |
72 | codecService.registerCodec(OfdpaMatchVlanVid.class, new OfdpaMatchVlanVidCodec()); | 74 | codecService.registerCodec(OfdpaMatchVlanVid.class, new OfdpaMatchVlanVidCodec()); |
73 | codecService.registerCodec(OfdpaSetVlanVid.class, new OfdpaSetVlanVidCodec()); | 75 | codecService.registerCodec(OfdpaSetVlanVid.class, new OfdpaSetVlanVidCodec()); |
76 | + codecService.registerCodec(OplinkAttenuation.class, new OplinkAttenuationCodec()); | ||
74 | log.info("Registered default driver codecs."); | 77 | log.info("Registered default driver codecs."); |
75 | } | 78 | } |
76 | 79 | ||
... | @@ -87,6 +90,7 @@ public class DefaultCodecRegister { | ... | @@ -87,6 +90,7 @@ public class DefaultCodecRegister { |
87 | codecService.unregisterCodec(NiciraSetNshContextHeader.class); | 90 | codecService.unregisterCodec(NiciraSetNshContextHeader.class); |
88 | codecService.unregisterCodec(OfdpaMatchVlanVid.class); | 91 | codecService.unregisterCodec(OfdpaMatchVlanVid.class); |
89 | codecService.unregisterCodec(OfdpaSetVlanVid.class); | 92 | codecService.unregisterCodec(OfdpaSetVlanVid.class); |
93 | + codecService.unregisterCodec(OplinkAttenuation.class); | ||
90 | log.info("Unregistered default driver codecs."); | 94 | log.info("Unregistered default driver codecs."); |
91 | } | 95 | } |
92 | } | 96 | } | ... | ... |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +package org.onosproject.driver.extensions; | ||
18 | + | ||
19 | +import com.google.common.base.MoreObjects; | ||
20 | +import com.google.common.collect.Maps; | ||
21 | +import org.onlab.util.KryoNamespace; | ||
22 | +import org.onosproject.net.flow.AbstractExtension; | ||
23 | +import org.onosproject.net.flow.instructions.ExtensionTreatment; | ||
24 | +import org.onosproject.net.flow.instructions.ExtensionTreatmentType; | ||
25 | + | ||
26 | +import java.util.Map; | ||
27 | +import java.util.Objects; | ||
28 | + | ||
29 | +/** | ||
30 | + * Instruction for Oplink channel attenuation. | ||
31 | + */ | ||
32 | +public class OplinkAttenuation extends AbstractExtension implements ExtensionTreatment { | ||
33 | + private static final String KEY_ATT = "attenuation"; | ||
34 | + | ||
35 | + private int attenuation; | ||
36 | + | ||
37 | + private final KryoNamespace appKryo = new KryoNamespace.Builder() | ||
38 | + .register(Map.class) | ||
39 | + .build("OplinkAttenuation"); | ||
40 | + | ||
41 | + /** | ||
42 | + * Creates new attenuation instruction. | ||
43 | + * @param attenuation attenuation value | ||
44 | + */ | ||
45 | + public OplinkAttenuation(int attenuation) { | ||
46 | + this.attenuation = attenuation; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Gets the attenuation value. | ||
51 | + * @return attenuation | ||
52 | + */ | ||
53 | + public int getAttenuation() { | ||
54 | + return attenuation; | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Modify the attenuation value. | ||
59 | + * @param attenuation new attenuation value | ||
60 | + */ | ||
61 | + public void setAttenuation(int attenuation) { | ||
62 | + this.attenuation = attenuation; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public ExtensionTreatmentType type() { | ||
67 | + return ExtensionTreatmentType.ExtensionTreatmentTypes.OPLINK_ATTENUATION.type(); | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public byte[] serialize() { | ||
72 | + Map<String, Object> values = Maps.newHashMap(); | ||
73 | + values.put(KEY_ATT, attenuation); | ||
74 | + return appKryo.serialize(values); | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public void deserialize(byte[] data) { | ||
79 | + Map<String, Object> values = appKryo.deserialize(data); | ||
80 | + attenuation = (int) values.get(KEY_ATT); | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public int hashCode() { | ||
85 | + return Objects.hash(attenuation); | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public boolean equals(Object obj) { | ||
90 | + if (this == obj) { | ||
91 | + return true; | ||
92 | + } | ||
93 | + if (obj instanceof OplinkAttenuation) { | ||
94 | + OplinkAttenuation that = (OplinkAttenuation) obj; | ||
95 | + return Objects.equals(attenuation, that.attenuation); | ||
96 | + } | ||
97 | + return false; | ||
98 | + } | ||
99 | + | ||
100 | + @Override | ||
101 | + public String toString() { | ||
102 | + return MoreObjects.toStringHelper(getClass()) | ||
103 | + .add(KEY_ATT, attenuation) | ||
104 | + .toString(); | ||
105 | + } | ||
106 | +} |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +package org.onosproject.driver.extensions; | ||
18 | + | ||
19 | +import org.onosproject.net.driver.AbstractHandlerBehaviour; | ||
20 | +import org.onosproject.net.flow.instructions.ExtensionTreatment; | ||
21 | +import org.onosproject.net.flow.instructions.ExtensionTreatmentType; | ||
22 | +import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter; | ||
23 | +import org.projectfloodlight.openflow.protocol.OFActionType; | ||
24 | +import org.projectfloodlight.openflow.protocol.OFFactory; | ||
25 | +import org.projectfloodlight.openflow.protocol.action.OFAction; | ||
26 | +import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter; | ||
27 | +import org.projectfloodlight.openflow.protocol.action.OFActionOplinkAtt; | ||
28 | +import org.projectfloodlight.openflow.protocol.oxm.OFOxm; | ||
29 | +import org.projectfloodlight.openflow.types.U32; | ||
30 | + | ||
31 | +/** | ||
32 | + * Interpreter for Oplink OpenFlow treatment extensions. | ||
33 | + */ | ||
34 | +public class OplinkExtensionTreatmentInterpreter extends AbstractHandlerBehaviour | ||
35 | + implements ExtensionTreatmentInterpreter { | ||
36 | + | ||
37 | + private static final long ATTENUATION_EXP = 0xff000088L; | ||
38 | + | ||
39 | + @Override | ||
40 | + public boolean supported(ExtensionTreatmentType extensionTreatmentType) { | ||
41 | + if (extensionTreatmentType.equals( | ||
42 | + ExtensionTreatmentType.ExtensionTreatmentTypes.OPLINK_ATTENUATION.type())) { | ||
43 | + return true; | ||
44 | + } | ||
45 | + return false; | ||
46 | + } | ||
47 | + | ||
48 | + @Override | ||
49 | + public OFAction mapInstruction(OFFactory factory, ExtensionTreatment extensionTreatment) { | ||
50 | + ExtensionTreatmentType type = extensionTreatment.type(); | ||
51 | + if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OPLINK_ATTENUATION.type())) { | ||
52 | + int att = ((OplinkAttenuation) extensionTreatment).getAttenuation(); | ||
53 | + return factory.actions().oplinkAtt(factory.oxms().ochSigatt(U32.ofRaw(att))); | ||
54 | + } | ||
55 | + return null; | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException { | ||
60 | + if (action.getType().equals(OFActionType.EXPERIMENTER)) { | ||
61 | + OFActionExperimenter actionExp = (OFActionExperimenter) action; | ||
62 | + if (actionExp.getExperimenter() == ATTENUATION_EXP) { | ||
63 | + OFActionOplinkAtt actionAtt = (OFActionOplinkAtt) action; | ||
64 | + return new OplinkAttenuation(((OFOxm<U32>) actionAtt.getField()).getValue().getRaw()); | ||
65 | + } | ||
66 | + } | ||
67 | + return null; | ||
68 | + } | ||
69 | +} |
drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OplinkAttenuationCodec.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +package org.onosproject.driver.extensions.codec; | ||
18 | + | ||
19 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
20 | +import org.onosproject.codec.CodecContext; | ||
21 | +import org.onosproject.codec.JsonCodec; | ||
22 | +import org.onosproject.driver.extensions.OplinkAttenuation; | ||
23 | + | ||
24 | +import static org.onlab.util.Tools.nullIsIllegal; | ||
25 | + | ||
26 | +/** | ||
27 | + * JSON Codec for OplinkAttenuation class. | ||
28 | + */ | ||
29 | +public class OplinkAttenuationCodec extends JsonCodec<OplinkAttenuation> { | ||
30 | + private static final String ATTENUATION = "attenuation"; | ||
31 | + private static final String MISSING_ATT = "Missing value for \"attenuation\""; | ||
32 | + | ||
33 | + @Override | ||
34 | + public OplinkAttenuation decode(ObjectNode json, CodecContext context) { | ||
35 | + if (json == null || !json.isObject()) { | ||
36 | + return null; | ||
37 | + } | ||
38 | + String att = nullIsIllegal(json.get(ATTENUATION), MISSING_ATT).asText(); | ||
39 | + return new OplinkAttenuation(Integer.valueOf(att)); | ||
40 | + } | ||
41 | +} |
1 | +package org.onosproject.driver.optical.extensions; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
4 | +import org.onlab.osgi.DefaultServiceDirectory; | ||
5 | +import org.onlab.osgi.ServiceDirectory; | ||
6 | +import org.onosproject.codec.CodecContext; | ||
7 | +import org.onosproject.codec.CodecService; | ||
8 | +import org.onosproject.codec.ExtensionTreatmentCodec; | ||
9 | +import org.onosproject.driver.extensions.OplinkAttenuation; | ||
10 | +import org.onosproject.net.driver.AbstractHandlerBehaviour; | ||
11 | +import org.onosproject.net.flow.instructions.ExtensionTreatment; | ||
12 | +import org.onosproject.net.flow.instructions.ExtensionTreatmentType; | ||
13 | + | ||
14 | +import static org.onlab.util.Tools.nullIsIllegal; | ||
15 | + | ||
16 | +/** | ||
17 | + * Codec for Oplink extensions. | ||
18 | + */ | ||
19 | +public class OplinkExtensionTreatmentCodec extends AbstractHandlerBehaviour | ||
20 | + implements ExtensionTreatmentCodec { | ||
21 | + | ||
22 | + private static final String TYPE = "type"; | ||
23 | + private static final String MISSING_TYPE = "Missing extension type"; | ||
24 | + private static final String UNSUPPORTED_TYPE = "Extension type is not supported: "; | ||
25 | + | ||
26 | + @Override | ||
27 | + public ExtensionTreatment decode(ObjectNode objectNode, CodecContext context) { | ||
28 | + if (objectNode == null || !objectNode.isObject()) { | ||
29 | + return null; | ||
30 | + } | ||
31 | + | ||
32 | + int typeInt = nullIsIllegal(objectNode.get(TYPE), MISSING_TYPE).asInt(); | ||
33 | + ExtensionTreatmentType type = new ExtensionTreatmentType(typeInt); | ||
34 | + | ||
35 | + if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OPLINK_ATTENUATION.type())) { | ||
36 | + return decodeTreatment(objectNode, context, OplinkAttenuation.class); | ||
37 | + } else { | ||
38 | + throw new UnsupportedOperationException(UNSUPPORTED_TYPE + type.toString()); | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + private <T extends ExtensionTreatment> ExtensionTreatment decodeTreatment( | ||
43 | + ObjectNode objectNode, CodecContext context, Class<T> entityClass) { | ||
44 | + if (context == null) { | ||
45 | + ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); | ||
46 | + return serviceDirectory.get(CodecService.class).getCodec(entityClass).decode(objectNode, null); | ||
47 | + } else { | ||
48 | + return context.codec(entityClass).decode(objectNode, context); | ||
49 | + } | ||
50 | + } | ||
51 | +} |
drivers/optical/src/main/java/org/onosproject/driver/optical/extensions/package-info.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +/** | ||
17 | + * Implementations of extension behaviours for optical devices. | ||
18 | + */ | ||
19 | +package org.onosproject.driver.optical.extensions; |
... | @@ -41,6 +41,7 @@ import org.onosproject.net.device.DefaultPortDescription; | ... | @@ -41,6 +41,7 @@ import org.onosproject.net.device.DefaultPortDescription; |
41 | import org.onosproject.net.device.DeviceService; | 41 | import org.onosproject.net.device.DeviceService; |
42 | import org.onosproject.net.device.PortDescription; | 42 | import org.onosproject.net.device.PortDescription; |
43 | import org.onosproject.net.link.DefaultLinkDescription; | 43 | import org.onosproject.net.link.DefaultLinkDescription; |
44 | +import org.onosproject.net.link.LinkService; | ||
44 | import org.onosproject.net.optical.OpticalAnnotations; | 45 | import org.onosproject.net.optical.OpticalAnnotations; |
45 | import org.onosproject.openflow.controller.Dpid; | 46 | import org.onosproject.openflow.controller.Dpid; |
46 | import org.onosproject.openflow.controller.OpenFlowOpticalSwitch; | 47 | import org.onosproject.openflow.controller.OpenFlowOpticalSwitch; |
... | @@ -190,17 +191,19 @@ public class OplinkRoadm extends AbstractOpenFlowSwitch implements OpenFlowOptic | ... | @@ -190,17 +191,19 @@ public class OplinkRoadm extends AbstractOpenFlowSwitch implements OpenFlowOptic |
190 | public final void sendMsg(OFMessage m) { | 191 | public final void sendMsg(OFMessage m) { |
191 | List<OFMessage> messages = new ArrayList<>(); | 192 | List<OFMessage> messages = new ArrayList<>(); |
192 | messages.add(m); | 193 | messages.add(m); |
194 | + | ||
193 | if (m.getType() == OFType.STATS_REQUEST) { | 195 | if (m.getType() == OFType.STATS_REQUEST) { |
194 | OFStatsRequest sr = (OFStatsRequest) m; | 196 | OFStatsRequest sr = (OFStatsRequest) m; |
195 | log.debug("OPLK ROADM rebuilding stats request type {}", sr.getStatsType()); | 197 | log.debug("OPLK ROADM rebuilding stats request type {}", sr.getStatsType()); |
196 | switch (sr.getStatsType()) { | 198 | switch (sr.getStatsType()) { |
197 | case PORT: | 199 | case PORT: |
198 | - //replace with Oplink experiment stats message to get the port current power | 200 | + //add Oplink experiment stats message to get the port's current power |
199 | OFOplinkPortPowerRequest powerRequest = this.factory().buildOplinkPortPowerRequest() | 201 | OFOplinkPortPowerRequest powerRequest = this.factory().buildOplinkPortPowerRequest() |
200 | .setXid(sr.getXid()) | 202 | .setXid(sr.getXid()) |
201 | .setFlags(sr.getFlags()) | 203 | .setFlags(sr.getFlags()) |
202 | .build(); | 204 | .build(); |
203 | messages.add(powerRequest); | 205 | messages.add(powerRequest); |
206 | + // add experiment message to get adjacent ports | ||
204 | OFExpPortAdjacencyRequest adjacencyRequest = this.factory().buildExpPortAdjacencyRequest() | 207 | OFExpPortAdjacencyRequest adjacencyRequest = this.factory().buildExpPortAdjacencyRequest() |
205 | .setXid(sr.getXid()) | 208 | .setXid(sr.getXid()) |
206 | .setFlags(sr.getFlags()) | 209 | .setFlags(sr.getFlags()) |
... | @@ -335,7 +338,7 @@ public class OplinkRoadm extends AbstractOpenFlowSwitch implements OpenFlowOptic | ... | @@ -335,7 +338,7 @@ public class OplinkRoadm extends AbstractOpenFlowSwitch implements OpenFlowOptic |
335 | 338 | ||
336 | private void addLink(PortNumber portNumber, OplinkPortAdjacency neighbor) { | 339 | private void addLink(PortNumber portNumber, OplinkPortAdjacency neighbor) { |
337 | ConnectPoint dst = new ConnectPoint(handler().data().deviceId(), portNumber); | 340 | ConnectPoint dst = new ConnectPoint(handler().data().deviceId(), portNumber); |
338 | - ConnectPoint src = new ConnectPoint(neighbor.getDeviceId(), neighbor.portNumber); | 341 | + ConnectPoint src = new ConnectPoint(neighbor.getDeviceId(), neighbor.getPort()); |
339 | OpticalAdjacencyLinkService adService = | 342 | OpticalAdjacencyLinkService adService = |
340 | this.handler().get(OpticalAdjacencyLinkService.class); | 343 | this.handler().get(OpticalAdjacencyLinkService.class); |
341 | adService.linkDetected(new DefaultLinkDescription(src, dst, Link.Type.OPTICAL)); | 344 | adService.linkDetected(new DefaultLinkDescription(src, dst, Link.Type.OPTICAL)); |
... | @@ -344,9 +347,13 @@ public class OplinkRoadm extends AbstractOpenFlowSwitch implements OpenFlowOptic | ... | @@ -344,9 +347,13 @@ public class OplinkRoadm extends AbstractOpenFlowSwitch implements OpenFlowOptic |
344 | // Remove incoming link with port if there are any. | 347 | // Remove incoming link with port if there are any. |
345 | private void removeLink(PortNumber portNumber) { | 348 | private void removeLink(PortNumber portNumber) { |
346 | ConnectPoint dst = new ConnectPoint(handler().data().deviceId(), portNumber); | 349 | ConnectPoint dst = new ConnectPoint(handler().data().deviceId(), portNumber); |
347 | - OpticalAdjacencyLinkService adService = | 350 | + // Check so only incoming links are removed |
348 | - this.handler().get(OpticalAdjacencyLinkService.class); | 351 | + Set<Link> links = this.handler().get(LinkService.class).getIngressLinks(dst); |
349 | - adService.linksVanished(dst); | 352 | + if (!links.isEmpty()) { |
353 | + OpticalAdjacencyLinkService adService = | ||
354 | + this.handler().get(OpticalAdjacencyLinkService.class); | ||
355 | + adService.linksVanished(dst); | ||
356 | + } | ||
350 | } | 357 | } |
351 | 358 | ||
352 | private class OplinkPortAdjacency { | 359 | private class OplinkPortAdjacency { | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -58,6 +58,10 @@ | ... | @@ -58,6 +58,10 @@ |
58 | impl="org.onosproject.net.optical.DefaultOpticalDevice"/> | 58 | impl="org.onosproject.net.optical.DefaultOpticalDevice"/> |
59 | <behaviour api="org.onosproject.net.behaviour.PowerConfig" | 59 | <behaviour api="org.onosproject.net.behaviour.PowerConfig" |
60 | impl="org.onosproject.driver.optical.power.OplinkRoadmPowerConfig"/> | 60 | impl="org.onosproject.driver.optical.power.OplinkRoadmPowerConfig"/> |
61 | + <behaviour api="org.onosproject.codec.ExtensionTreatmentCodec" | ||
62 | + impl="org.onosproject.driver.optical.extensions.OplinkExtensionTreatmentCodec"/> | ||
63 | + <behaviour api="org.onosproject.openflow.controller.ExtensionTreatmentInterpreter" | ||
64 | + impl="org.onosproject.driver.extensions.OplinkExtensionTreatmentInterpreter"/> | ||
61 | </driver> | 65 | </driver> |
62 | 66 | ||
63 | </drivers> | 67 | </drivers> | ... | ... |
-
Please register or login to post a comment