Committed by
Gerrit Code Review
[ONOS-4167] Identify the impacted tunnels based on network events, notify to PCE…
… app and trigger MBB flow. Change-Id: I1766f4afbc0ee2f4c05c75cf788c91f9df8aaa9a
Showing
19 changed files
with
323 additions
and
28 deletions
| ... | @@ -19,7 +19,6 @@ import static org.hamcrest.MatcherAssert.assertThat; | ... | @@ -19,7 +19,6 @@ import static org.hamcrest.MatcherAssert.assertThat; |
| 19 | import static org.hamcrest.Matchers.is; | 19 | import static org.hamcrest.Matchers.is; |
| 20 | import static org.hamcrest.Matchers.notNullValue; | 20 | import static org.hamcrest.Matchers.notNullValue; |
| 21 | import static org.hamcrest.Matchers.nullValue; | 21 | import static org.hamcrest.Matchers.nullValue; |
| 22 | - | ||
| 23 | import static org.onosproject.net.Link.Type.DIRECT; | 22 | import static org.onosproject.net.Link.Type.DIRECT; |
| 24 | 23 | ||
| 25 | import java.util.Iterator; | 24 | import java.util.Iterator; |
| ... | @@ -29,7 +28,6 @@ import java.util.LinkedList; | ... | @@ -29,7 +28,6 @@ import java.util.LinkedList; |
| 29 | import org.junit.After; | 28 | import org.junit.After; |
| 30 | import org.junit.Before; | 29 | import org.junit.Before; |
| 31 | import org.junit.Test; | 30 | import org.junit.Test; |
| 32 | - | ||
| 33 | import org.onlab.packet.IpAddress; | 31 | import org.onlab.packet.IpAddress; |
| 34 | import org.onosproject.core.ApplicationId; | 32 | import org.onosproject.core.ApplicationId; |
| 35 | import org.onosproject.core.CoreService; | 33 | import org.onosproject.core.CoreService; |
| ... | @@ -165,6 +163,7 @@ public class BasicPceccHandlerTest { | ... | @@ -165,6 +163,7 @@ public class BasicPceccHandlerTest { |
| 165 | 163 | ||
| 166 | @After | 164 | @After |
| 167 | public void tearDown() throws Exception { | 165 | public void tearDown() throws Exception { |
| 166 | + PceManagerTest.flowsDownloaded = 0; | ||
| 168 | } | 167 | } |
| 169 | 168 | ||
| 170 | /** | 169 | /** | ... | ... |
| ... | @@ -129,7 +129,7 @@ public class PceManagerTest { | ... | @@ -129,7 +129,7 @@ public class PceManagerTest { |
| 129 | private Device deviceD1, deviceD2, deviceD3, deviceD4; | 129 | private Device deviceD1, deviceD2, deviceD3, deviceD4; |
| 130 | private Device pcepDeviceD1, pcepDeviceD2, pcepDeviceD3, pcepDeviceD4; | 130 | private Device pcepDeviceD1, pcepDeviceD2, pcepDeviceD3, pcepDeviceD4; |
| 131 | private Link link1, link2, link3, link4; | 131 | private Link link1, link2, link3, link4; |
| 132 | - private static int flowsDownloaded; | 132 | + protected static int flowsDownloaded; |
| 133 | private TunnelListener tunnelListener; | 133 | private TunnelListener tunnelListener; |
| 134 | 134 | ||
| 135 | @Before | 135 | @Before | ... | ... |
| ... | @@ -158,6 +158,7 @@ public class PceccSrTeBeHandlerTest { | ... | @@ -158,6 +158,7 @@ public class PceccSrTeBeHandlerTest { |
| 158 | 158 | ||
| 159 | @After | 159 | @After |
| 160 | public void tearDown() throws Exception { | 160 | public void tearDown() throws Exception { |
| 161 | + PceManagerTest.flowsDownloaded = 0; | ||
| 161 | } | 162 | } |
| 162 | 163 | ||
| 163 | /** | 164 | /** | ... | ... |
| 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 | +package org.onosproject.pcep.controller; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import com.google.common.base.MoreObjects; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Representation of LSP info, it will be unique for each LSP. | ||
| 24 | + */ | ||
| 25 | +public class LspKey { | ||
| 26 | + private int plspId; | ||
| 27 | + private short localLspId; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Creates new instance of LspInfo. | ||
| 31 | + * | ||
| 32 | + * @param plspId LSP id assigned per tunnel per session | ||
| 33 | + * @param localLspId LSP id assigned per tunnel | ||
| 34 | + */ | ||
| 35 | + public LspKey(int plspId, short localLspId) { | ||
| 36 | + this.plspId = plspId; | ||
| 37 | + this.localLspId = localLspId; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * Obtains PLSP id. | ||
| 42 | + * | ||
| 43 | + * @return LSP id assigned per tunnel per session | ||
| 44 | + */ | ||
| 45 | + public int plspId() { | ||
| 46 | + return plspId; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Obtains local LSP id. | ||
| 51 | + * | ||
| 52 | + * @return LSP id assigned per tunnel | ||
| 53 | + */ | ||
| 54 | + public short localLspId() { | ||
| 55 | + return localLspId; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(plspId, localLspId); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + if (obj instanceof LspKey) { | ||
| 70 | + LspKey other = (LspKey) obj; | ||
| 71 | + return Objects.equals(plspId, other.plspId) | ||
| 72 | + && Objects.equals(localLspId, other.localLspId); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + return false; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + @Override | ||
| 79 | + public String toString() { | ||
| 80 | + return MoreObjects.toStringHelper(getClass()) | ||
| 81 | + .add("plspId", plspId) | ||
| 82 | + .add("localLspId", localLspId) | ||
| 83 | + .toString(); | ||
| 84 | + } | ||
| 85 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -149,4 +149,20 @@ public interface PcepClient { | ... | @@ -149,4 +149,20 @@ public interface PcepClient { |
| 149 | * @param pccId PCEP client ID | 149 | * @param pccId PCEP client ID |
| 150 | */ | 150 | */ |
| 151 | void deleteNode(PccId pccId); | 151 | void deleteNode(PccId pccId); |
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * Sets D flag for the given LSP and its LSP info. | ||
| 155 | + * | ||
| 156 | + * @param lspKey contains LSP info | ||
| 157 | + * @param dFlag delegation flag in LSP object | ||
| 158 | + */ | ||
| 159 | + void setLspAndDelegationInfo(LspKey lspKey, boolean dFlag); | ||
| 160 | + | ||
| 161 | + /** | ||
| 162 | + * Returns delegation flag for the given LSP info. | ||
| 163 | + * | ||
| 164 | + * @param lspKey contains LSP info | ||
| 165 | + * @return delegation flag | ||
| 166 | + */ | ||
| 167 | + Boolean delegationInfo(LspKey lspKey); | ||
| 152 | } | 168 | } | ... | ... |
| ... | @@ -20,11 +20,13 @@ import java.net.InetSocketAddress; | ... | @@ -20,11 +20,13 @@ import java.net.InetSocketAddress; |
| 20 | import java.net.SocketAddress; | 20 | import java.net.SocketAddress; |
| 21 | import java.util.Collections; | 21 | import java.util.Collections; |
| 22 | import java.util.List; | 22 | import java.util.List; |
| 23 | +import java.util.Map; | ||
| 23 | import java.util.concurrent.RejectedExecutionException; | 24 | import java.util.concurrent.RejectedExecutionException; |
| 24 | 25 | ||
| 25 | import org.jboss.netty.channel.Channel; | 26 | import org.jboss.netty.channel.Channel; |
| 26 | import org.onlab.packet.IpAddress; | 27 | import org.onlab.packet.IpAddress; |
| 27 | import org.onosproject.pcep.controller.ClientCapability; | 28 | import org.onosproject.pcep.controller.ClientCapability; |
| 29 | +import org.onosproject.pcep.controller.LspKey; | ||
| 28 | import org.onosproject.pcep.controller.PccId; | 30 | import org.onosproject.pcep.controller.PccId; |
| 29 | import org.onosproject.pcep.controller.PcepClient; | 31 | import org.onosproject.pcep.controller.PcepClient; |
| 30 | import org.onosproject.pcep.controller.PcepPacketStats; | 32 | import org.onosproject.pcep.controller.PcepPacketStats; |
| ... | @@ -67,6 +69,7 @@ public class PcepClientImpl implements PcepClientDriver { | ... | @@ -67,6 +69,7 @@ public class PcepClientImpl implements PcepClientDriver { |
| 67 | private byte deadTime; | 69 | private byte deadTime; |
| 68 | private byte sessionId; | 70 | private byte sessionId; |
| 69 | private PcepPacketStatsImpl pktStats; | 71 | private PcepPacketStatsImpl pktStats; |
| 72 | + private Map<LspKey, Boolean> lspDelegationInfo; | ||
| 70 | 73 | ||
| 71 | @Override | 74 | @Override |
| 72 | public void init(PccId pccId, PcepVersion pcepVersion, PcepPacketStats pktStats) { | 75 | public void init(PccId pccId, PcepVersion pcepVersion, PcepPacketStats pktStats) { |
| ... | @@ -241,6 +244,16 @@ public class PcepClientImpl implements PcepClientDriver { | ... | @@ -241,6 +244,16 @@ public class PcepClientImpl implements PcepClientDriver { |
| 241 | } | 244 | } |
| 242 | 245 | ||
| 243 | @Override | 246 | @Override |
| 247 | + public void setLspAndDelegationInfo(LspKey lspKey, boolean dFlag) { | ||
| 248 | + lspDelegationInfo.put(lspKey, dFlag); | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + @Override | ||
| 252 | + public Boolean delegationInfo(LspKey lspKey) { | ||
| 253 | + return lspDelegationInfo.get(lspKey); | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + @Override | ||
| 244 | public boolean isOptical() { | 257 | public boolean isOptical() { |
| 245 | return false; | 258 | return false; |
| 246 | } | 259 | } | ... | ... |
protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/PcepBandwidthObject.java
100755 → 100644
| ... | @@ -29,14 +29,14 @@ public interface PcepBandwidthObject { | ... | @@ -29,14 +29,14 @@ public interface PcepBandwidthObject { |
| 29 | * | 29 | * |
| 30 | * @return bandwidth value | 30 | * @return bandwidth value |
| 31 | */ | 31 | */ |
| 32 | - int getBandwidth(); | 32 | + float getBandwidth(); |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * Sets bandwidth with specified value. | 35 | * Sets bandwidth with specified value. |
| 36 | * | 36 | * |
| 37 | * @param iBandwidth Bandwidth's value | 37 | * @param iBandwidth Bandwidth's value |
| 38 | */ | 38 | */ |
| 39 | - void setBandwidth(int iBandwidth); | 39 | + void setBandwidth(float iBandwidth); |
| 40 | 40 | ||
| 41 | /** | 41 | /** |
| 42 | * Writes the BandwidthObject into channel buffer. | 42 | * Writes the BandwidthObject into channel buffer. | ... | ... |
| ... | @@ -51,6 +51,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -51,6 +51,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 51 | public static final byte BANDWIDTH_OBJ_TYPE = 1; | 51 | public static final byte BANDWIDTH_OBJ_TYPE = 1; |
| 52 | public static final byte BANDWIDTH_OBJ_CLASS = 5; | 52 | public static final byte BANDWIDTH_OBJ_CLASS = 5; |
| 53 | public static final byte BANDWIDTH_OBJECT_VERSION = 1; | 53 | public static final byte BANDWIDTH_OBJECT_VERSION = 1; |
| 54 | + public static final int NO_OF_BITS = 8; | ||
| 54 | public static final short BANDWIDTH_OBJ_MINIMUM_LENGTH = 8; | 55 | public static final short BANDWIDTH_OBJ_MINIMUM_LENGTH = 8; |
| 55 | 56 | ||
| 56 | static final PcepObjectHeader DEFAULT_BANDWIDTH_OBJECT_HEADER = new PcepObjectHeader(BANDWIDTH_OBJ_CLASS, | 57 | static final PcepObjectHeader DEFAULT_BANDWIDTH_OBJECT_HEADER = new PcepObjectHeader(BANDWIDTH_OBJ_CLASS, |
| ... | @@ -58,7 +59,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -58,7 +59,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 58 | BANDWIDTH_OBJ_MINIMUM_LENGTH); | 59 | BANDWIDTH_OBJ_MINIMUM_LENGTH); |
| 59 | 60 | ||
| 60 | private PcepObjectHeader bandwidthObjHeader; | 61 | private PcepObjectHeader bandwidthObjHeader; |
| 61 | - private int iBandwidth; | 62 | + private float iBandwidth; |
| 62 | 63 | ||
| 63 | /** | 64 | /** |
| 64 | * Constructor to bandwidth object header and bandwidth. | 65 | * Constructor to bandwidth object header and bandwidth. |
| ... | @@ -66,7 +67,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -66,7 +67,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 66 | * @param bandwidthObjHeader bandwidth object header | 67 | * @param bandwidthObjHeader bandwidth object header |
| 67 | * @param iBandwidth bandwidth value | 68 | * @param iBandwidth bandwidth value |
| 68 | */ | 69 | */ |
| 69 | - public PcepBandwidthObjectVer1(PcepObjectHeader bandwidthObjHeader, int iBandwidth) { | 70 | + public PcepBandwidthObjectVer1(PcepObjectHeader bandwidthObjHeader, float iBandwidth) { |
| 70 | this.bandwidthObjHeader = bandwidthObjHeader; | 71 | this.bandwidthObjHeader = bandwidthObjHeader; |
| 71 | this.iBandwidth = iBandwidth; | 72 | this.iBandwidth = iBandwidth; |
| 72 | } | 73 | } |
| ... | @@ -76,7 +77,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -76,7 +77,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 76 | * | 77 | * |
| 77 | * @param iBandwidth bandwidth value | 78 | * @param iBandwidth bandwidth value |
| 78 | */ | 79 | */ |
| 79 | - public PcepBandwidthObjectVer1(int iBandwidth) { | 80 | + public PcepBandwidthObjectVer1(float iBandwidth) { |
| 80 | this.bandwidthObjHeader = DEFAULT_BANDWIDTH_OBJECT_HEADER; | 81 | this.bandwidthObjHeader = DEFAULT_BANDWIDTH_OBJECT_HEADER; |
| 81 | this.iBandwidth = iBandwidth; | 82 | this.iBandwidth = iBandwidth; |
| 82 | } | 83 | } |
| ... | @@ -100,12 +101,12 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -100,12 +101,12 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | @Override | 103 | @Override |
| 103 | - public int getBandwidth() { | 104 | + public float getBandwidth() { |
| 104 | return this.iBandwidth; | 105 | return this.iBandwidth; |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | @Override | 108 | @Override |
| 108 | - public void setBandwidth(int iBandwidth) { | 109 | + public void setBandwidth(float iBandwidth) { |
| 109 | this.iBandwidth = iBandwidth; | 110 | this.iBandwidth = iBandwidth; |
| 110 | } | 111 | } |
| 111 | 112 | ||
| ... | @@ -119,12 +120,25 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -119,12 +120,25 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 119 | public static PcepBandwidthObject read(ChannelBuffer cb) throws PcepParseException { | 120 | public static PcepBandwidthObject read(ChannelBuffer cb) throws PcepParseException { |
| 120 | 121 | ||
| 121 | PcepObjectHeader bandwidthObjHeader; | 122 | PcepObjectHeader bandwidthObjHeader; |
| 122 | - int iBandwidth; | 123 | + float bandwidth; |
| 123 | 124 | ||
| 124 | bandwidthObjHeader = PcepObjectHeader.read(cb); | 125 | bandwidthObjHeader = PcepObjectHeader.read(cb); |
| 125 | - iBandwidth = cb.readInt(); | 126 | + bandwidth = ieeeToFloatRead(cb.readInt()) * NO_OF_BITS; |
| 126 | 127 | ||
| 127 | - return new PcepBandwidthObjectVer1(bandwidthObjHeader, iBandwidth); | 128 | + return new PcepBandwidthObjectVer1(bandwidthObjHeader, bandwidth); |
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * Parse the IEEE floating point notation and returns it in normal float. | ||
| 133 | + * | ||
| 134 | + * @param iVal IEEE floating point number | ||
| 135 | + * @return normal float | ||
| 136 | + */ | ||
| 137 | + public static float ieeeToFloatRead(int iVal) { | ||
| 138 | + iVal = (((iVal & 0xFF) << 24) | ((iVal & 0xFF00) << 8) | ||
| 139 | + | ((iVal & 0xFF0000) >> 8) | ((iVal >> 24) & 0xFF)); | ||
| 140 | + | ||
| 141 | + return Float.intBitsToFloat(iVal); | ||
| 128 | } | 142 | } |
| 129 | 143 | ||
| 130 | @Override | 144 | @Override |
| ... | @@ -138,7 +152,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -138,7 +152,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
| 138 | throw new PcepParseException("Failed to write bandwidth object header. Index " + objLenIndex); | 152 | throw new PcepParseException("Failed to write bandwidth object header. Index " + objLenIndex); |
| 139 | } | 153 | } |
| 140 | 154 | ||
| 141 | - cb.writeInt(iBandwidth); | 155 | + cb.writeInt(Float.floatToIntBits(iBandwidth)); |
| 142 | short hLength = (short) (cb.writerIndex() - objStartIndex); | 156 | short hLength = (short) (cb.writerIndex() - objStartIndex); |
| 143 | cb.setShort(objLenIndex, hLength); | 157 | cb.setShort(objLenIndex, hLength); |
| 144 | //will be helpful during print(). | 158 | //will be helpful during print(). | ... | ... |
| ... | @@ -16,8 +16,10 @@ | ... | @@ -16,8 +16,10 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.pcepio.protocol.ver1; | 17 | package org.onosproject.pcepio.protocol.ver1; |
| 18 | 18 | ||
| 19 | +import java.util.Iterator; | ||
| 19 | import java.util.LinkedList; | 20 | import java.util.LinkedList; |
| 20 | import java.util.ListIterator; | 21 | import java.util.ListIterator; |
| 22 | +import java.util.Objects; | ||
| 21 | 23 | ||
| 22 | import org.jboss.netty.buffer.ChannelBuffer; | 24 | import org.jboss.netty.buffer.ChannelBuffer; |
| 23 | import org.onosproject.pcepio.exceptions.PcepParseException; | 25 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| ... | @@ -399,10 +401,47 @@ public class PcepEroObjectVer1 implements PcepEroObject { | ... | @@ -399,10 +401,47 @@ public class PcepEroObjectVer1 implements PcepEroObject { |
| 399 | } | 401 | } |
| 400 | 402 | ||
| 401 | @Override | 403 | @Override |
| 404 | + public int hashCode() { | ||
| 405 | + return Objects.hash(eroObjHeader, subObjectList); | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + @Override | ||
| 402 | public String toString() { | 409 | public String toString() { |
| 403 | return MoreObjects.toStringHelper(getClass()).omitNullValues() | 410 | return MoreObjects.toStringHelper(getClass()).omitNullValues() |
| 404 | .add("EroObjHeader", eroObjHeader) | 411 | .add("EroObjHeader", eroObjHeader) |
| 405 | .add("SubObjects", subObjectList) | 412 | .add("SubObjects", subObjectList) |
| 406 | .toString(); | 413 | .toString(); |
| 407 | } | 414 | } |
| 415 | + | ||
| 416 | + @Override | ||
| 417 | + public boolean equals(Object obj) { | ||
| 418 | + if (this == obj) { | ||
| 419 | + return true; | ||
| 420 | + } | ||
| 421 | + | ||
| 422 | + if (obj instanceof PcepEroObjectVer1) { | ||
| 423 | + int countObjSubTlv = 0; | ||
| 424 | + int countOtherSubTlv = 0; | ||
| 425 | + boolean isCommonSubTlv = true; | ||
| 426 | + PcepEroObjectVer1 other = (PcepEroObjectVer1) obj; | ||
| 427 | + Iterator<PcepValueType> objListIterator = other.subObjectList.iterator(); | ||
| 428 | + countOtherSubTlv = other.subObjectList.size(); | ||
| 429 | + countObjSubTlv = subObjectList.size(); | ||
| 430 | + if (countObjSubTlv != countOtherSubTlv) { | ||
| 431 | + return false; | ||
| 432 | + } else { | ||
| 433 | + while (objListIterator.hasNext() && isCommonSubTlv) { | ||
| 434 | + PcepValueType subTlv = objListIterator.next(); | ||
| 435 | + if (subObjectList.contains(subTlv)) { | ||
| 436 | + isCommonSubTlv = Objects.equals(subObjectList.get(subObjectList.indexOf(subTlv)), | ||
| 437 | + other.subObjectList.get(other.subObjectList.indexOf(subTlv))); | ||
| 438 | + } else { | ||
| 439 | + isCommonSubTlv = false; | ||
| 440 | + } | ||
| 441 | + } | ||
| 442 | + return isCommonSubTlv && Objects.equals(eroObjHeader, other.eroObjHeader); | ||
| 443 | + } | ||
| 444 | + } | ||
| 445 | + return false; | ||
| 446 | + } | ||
| 408 | } | 447 | } | ... | ... |
| ... | @@ -16,6 +16,8 @@ | ... | @@ -16,6 +16,8 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.pcepio.types; | 17 | package org.onosproject.pcepio.types; |
| 18 | 18 | ||
| 19 | +import java.util.Objects; | ||
| 20 | + | ||
| 19 | import org.jboss.netty.buffer.ChannelBuffer; | 21 | import org.jboss.netty.buffer.ChannelBuffer; |
| 20 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
| 21 | import org.slf4j.LoggerFactory; | 23 | import org.slf4j.LoggerFactory; |
| ... | @@ -212,6 +214,27 @@ public class PcepObjectHeader { | ... | @@ -212,6 +214,27 @@ public class PcepObjectHeader { |
| 212 | } | 214 | } |
| 213 | 215 | ||
| 214 | @Override | 216 | @Override |
| 217 | + public int hashCode() { | ||
| 218 | + return Objects.hash(objClass, objType, bPFlag, bIFlag, objLen); | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + @Override | ||
| 222 | + public boolean equals(Object obj) { | ||
| 223 | + if (this == obj) { | ||
| 224 | + return true; | ||
| 225 | + } | ||
| 226 | + if (obj instanceof PcepObjectHeader) { | ||
| 227 | + PcepObjectHeader other = (PcepObjectHeader) obj; | ||
| 228 | + return Objects.equals(objClass, other.objClass) | ||
| 229 | + && Objects.equals(objType, other.objType) | ||
| 230 | + && Objects.equals(bPFlag, other.bPFlag) | ||
| 231 | + && Objects.equals(bIFlag, other.bIFlag) | ||
| 232 | + && Objects.equals(objLen, other.objLen); | ||
| 233 | + } | ||
| 234 | + return false; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + @Override | ||
| 215 | public String toString() { | 238 | public String toString() { |
| 216 | return MoreObjects.toStringHelper(getClass()) | 239 | return MoreObjects.toStringHelper(getClass()) |
| 217 | .add("ObjectClass", objClass) | 240 | .add("ObjectClass", objClass) | ... | ... |
| ... | @@ -17,12 +17,15 @@ package org.onosproject.provider.pcep.topology.impl; | ... | @@ -17,12 +17,15 @@ package org.onosproject.provider.pcep.topology.impl; |
| 17 | 17 | ||
| 18 | import static org.junit.Assert.assertNotNull; | 18 | import static org.junit.Assert.assertNotNull; |
| 19 | 19 | ||
| 20 | +import java.util.HashMap; | ||
| 20 | import java.util.List; | 21 | import java.util.List; |
| 22 | +import java.util.Map; | ||
| 21 | import java.util.concurrent.RejectedExecutionException; | 23 | import java.util.concurrent.RejectedExecutionException; |
| 22 | 24 | ||
| 23 | import org.jboss.netty.channel.Channel; | 25 | import org.jboss.netty.channel.Channel; |
| 24 | import org.onosproject.pcep.controller.ClientCapability; | 26 | import org.onosproject.pcep.controller.ClientCapability; |
| 25 | import org.onosproject.pcep.controller.PccId; | 27 | import org.onosproject.pcep.controller.PccId; |
| 28 | +import org.onosproject.pcep.controller.LspKey; | ||
| 26 | import org.onosproject.pcep.controller.PcepClient; | 29 | import org.onosproject.pcep.controller.PcepClient; |
| 27 | import org.onosproject.pcep.controller.PcepSyncStatus; | 30 | import org.onosproject.pcep.controller.PcepSyncStatus; |
| 28 | import org.onosproject.pcepio.protocol.PcepFactories; | 31 | import org.onosproject.pcepio.protocol.PcepFactories; |
| ... | @@ -45,6 +48,7 @@ public class PcepClientAdapter implements PcepClient { | ... | @@ -45,6 +48,7 @@ public class PcepClientAdapter implements PcepClient { |
| 45 | private PcepVersion pcepVersion; | 48 | private PcepVersion pcepVersion; |
| 46 | private PcepSyncStatus lspDbSyncStatus; | 49 | private PcepSyncStatus lspDbSyncStatus; |
| 47 | private PcepSyncStatus labelDbSyncStatus; | 50 | private PcepSyncStatus labelDbSyncStatus; |
| 51 | + private Map<LspKey, Boolean> lspDelegationInfo = new HashMap<>(); | ||
| 48 | 52 | ||
| 49 | /** | 53 | /** |
| 50 | * Initialize instance with specified parameters. | 54 | * Initialize instance with specified parameters. |
| ... | @@ -147,4 +151,14 @@ public class PcepClientAdapter implements PcepClient { | ... | @@ -147,4 +151,14 @@ public class PcepClientAdapter implements PcepClient { |
| 147 | @Override | 151 | @Override |
| 148 | public void deleteNode(PccId pccId) { | 152 | public void deleteNode(PccId pccId) { |
| 149 | } | 153 | } |
| 154 | + | ||
| 155 | + @Override | ||
| 156 | + public void setLspAndDelegationInfo(LspKey lspKey, boolean dFlag) { | ||
| 157 | + lspDelegationInfo.put(lspKey, dFlag); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + @Override | ||
| 161 | + public Boolean delegationInfo(LspKey lspKey) { | ||
| 162 | + return lspDelegationInfo.get(lspKey); | ||
| 163 | + } | ||
| 150 | } | 164 | } | ... | ... |
This diff is collapsed. Click to expand it.
providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepClientAdapter.java
| ... | @@ -17,11 +17,14 @@ package org.onosproject.provider.pcep.tunnel.impl; | ... | @@ -17,11 +17,14 @@ package org.onosproject.provider.pcep.tunnel.impl; |
| 17 | 17 | ||
| 18 | import static org.junit.Assert.assertNotNull; | 18 | import static org.junit.Assert.assertNotNull; |
| 19 | 19 | ||
| 20 | +import java.util.HashMap; | ||
| 20 | import java.util.List; | 21 | import java.util.List; |
| 22 | +import java.util.Map; | ||
| 21 | import java.util.concurrent.RejectedExecutionException; | 23 | import java.util.concurrent.RejectedExecutionException; |
| 22 | 24 | ||
| 23 | import org.jboss.netty.channel.Channel; | 25 | import org.jboss.netty.channel.Channel; |
| 24 | import org.onosproject.pcep.controller.ClientCapability; | 26 | import org.onosproject.pcep.controller.ClientCapability; |
| 27 | +import org.onosproject.pcep.controller.LspKey; | ||
| 25 | import org.onosproject.pcep.controller.PccId; | 28 | import org.onosproject.pcep.controller.PccId; |
| 26 | import org.onosproject.pcep.controller.PcepClient; | 29 | import org.onosproject.pcep.controller.PcepClient; |
| 27 | import org.onosproject.pcep.controller.PcepSyncStatus; | 30 | import org.onosproject.pcep.controller.PcepSyncStatus; |
| ... | @@ -45,6 +48,7 @@ public class PcepClientAdapter implements PcepClient { | ... | @@ -45,6 +48,7 @@ public class PcepClientAdapter implements PcepClient { |
| 45 | private PcepVersion pcepVersion; | 48 | private PcepVersion pcepVersion; |
| 46 | private PcepSyncStatus lspDbSyncStatus; | 49 | private PcepSyncStatus lspDbSyncStatus; |
| 47 | private PcepSyncStatus labelDbSyncStatus; | 50 | private PcepSyncStatus labelDbSyncStatus; |
| 51 | + private Map<LspKey, Boolean> lspDelegationInfo = new HashMap<>(); | ||
| 48 | 52 | ||
| 49 | /** | 53 | /** |
| 50 | * Initialize instance with specified parameters. | 54 | * Initialize instance with specified parameters. |
| ... | @@ -147,4 +151,14 @@ public class PcepClientAdapter implements PcepClient { | ... | @@ -147,4 +151,14 @@ public class PcepClientAdapter implements PcepClient { |
| 147 | @Override | 151 | @Override |
| 148 | public void deleteNode(PccId pccId) { | 152 | public void deleteNode(PccId pccId) { |
| 149 | } | 153 | } |
| 154 | + | ||
| 155 | + @Override | ||
| 156 | + public void setLspAndDelegationInfo(LspKey lspKey, boolean dFlag) { | ||
| 157 | + lspDelegationInfo.put(lspKey, dFlag); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + @Override | ||
| 161 | + public Boolean delegationInfo(LspKey lspKey) { | ||
| 162 | + return lspDelegationInfo.get(lspKey); | ||
| 163 | + } | ||
| 150 | } | 164 | } | ... | ... |
| ... | @@ -24,8 +24,6 @@ import java.util.concurrent.ConcurrentHashMap; | ... | @@ -24,8 +24,6 @@ import java.util.concurrent.ConcurrentHashMap; |
| 24 | 24 | ||
| 25 | import org.apache.felix.scr.annotations.Activate; | 25 | import org.apache.felix.scr.annotations.Activate; |
| 26 | import org.apache.felix.scr.annotations.Deactivate; | 26 | import org.apache.felix.scr.annotations.Deactivate; |
| 27 | -import org.onlab.packet.IpAddress; | ||
| 28 | -import org.onosproject.pcep.controller.ClientCapability; | ||
| 29 | import org.onosproject.pcep.controller.PccId; | 27 | import org.onosproject.pcep.controller.PccId; |
| 30 | import org.onosproject.pcep.controller.PcepClient; | 28 | import org.onosproject.pcep.controller.PcepClient; |
| 31 | import org.onosproject.pcep.controller.PcepClientController; | 29 | import org.onosproject.pcep.controller.PcepClientController; |
| ... | @@ -75,16 +73,11 @@ public class PcepClientControllerAdapter implements PcepClientController { | ... | @@ -75,16 +73,11 @@ public class PcepClientControllerAdapter implements PcepClientController { |
| 75 | 73 | ||
| 76 | @Override | 74 | @Override |
| 77 | public PcepClient getClient(PccId pccId) { | 75 | public PcepClient getClient(PccId pccId) { |
| 78 | - if (null != connectedClients.get(pccId)) { | 76 | + if (connectedClients.get(pccId) != null) { |
| 79 | return connectedClients.get(pccId); | 77 | return connectedClients.get(pccId); |
| 80 | } | 78 | } |
| 81 | PcepClientAdapter pc = new PcepClientAdapter(); | 79 | PcepClientAdapter pc = new PcepClientAdapter(); |
| 82 | - if (pccId.ipAddress().equals(IpAddress.valueOf(0xC010103)) | 80 | + |
| 83 | - || pccId.ipAddress().equals(IpAddress.valueOf(0xB6024E22))) { | ||
| 84 | - pc.setCapability(new ClientCapability(true, false, false, false, false)); | ||
| 85 | - } else { | ||
| 86 | - pc.setCapability(new ClientCapability(true, true, true, false, false)); | ||
| 87 | - } | ||
| 88 | pc.init(PccId.pccId(pccId.ipAddress()), PcepVersion.PCEP_1); | 81 | pc.init(PccId.pccId(pccId.ipAddress()), PcepVersion.PCEP_1); |
| 89 | connectedClients.put(pccId, pc); | 82 | connectedClients.put(pccId, pc); |
| 90 | return pc; | 83 | return pc; | ... | ... |
| ... | @@ -40,6 +40,7 @@ import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; | ... | @@ -40,6 +40,7 @@ import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; |
| 40 | import org.onosproject.incubator.net.tunnel.Tunnel; | 40 | import org.onosproject.incubator.net.tunnel.Tunnel; |
| 41 | import org.onosproject.incubator.net.tunnel.TunnelId; | 41 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 42 | import org.onosproject.incubator.net.tunnel.TunnelName; | 42 | import org.onosproject.incubator.net.tunnel.TunnelName; |
| 43 | +import org.onosproject.mastership.MastershipServiceAdapter; | ||
| 43 | import org.onosproject.net.Annotations; | 44 | import org.onosproject.net.Annotations; |
| 44 | import org.onosproject.net.ConnectPoint; | 45 | import org.onosproject.net.ConnectPoint; |
| 45 | import org.onosproject.net.DefaultAnnotations; | 46 | import org.onosproject.net.DefaultAnnotations; |
| ... | @@ -49,7 +50,10 @@ import org.onosproject.net.IpElementId; | ... | @@ -49,7 +50,10 @@ import org.onosproject.net.IpElementId; |
| 49 | import org.onosproject.net.Link; | 50 | import org.onosproject.net.Link; |
| 50 | import org.onosproject.net.Path; | 51 | import org.onosproject.net.Path; |
| 51 | import org.onosproject.net.PortNumber; | 52 | import org.onosproject.net.PortNumber; |
| 53 | +import org.onosproject.net.device.DeviceServiceAdapter; | ||
| 52 | import org.onosproject.net.provider.ProviderId; | 54 | import org.onosproject.net.provider.ProviderId; |
| 55 | +import org.onosproject.pcep.controller.ClientCapability; | ||
| 56 | +import org.onosproject.pcep.controller.PccId; | ||
| 53 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; | 57 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; |
| 54 | 58 | ||
| 55 | /** | 59 | /** |
| ... | @@ -64,12 +68,16 @@ public class PcepReleaseTunnelProviderTest { | ... | @@ -64,12 +68,16 @@ public class PcepReleaseTunnelProviderTest { |
| 64 | private final PcepControllerAdapter ctl = new PcepControllerAdapter(); | 68 | private final PcepControllerAdapter ctl = new PcepControllerAdapter(); |
| 65 | private final PcepTunnelApiMapper pcepTunnelAPIMapper = new PcepTunnelApiMapper(); | 69 | private final PcepTunnelApiMapper pcepTunnelAPIMapper = new PcepTunnelApiMapper(); |
| 66 | private final TunnelServiceAdapter tunnelService = new TunnelServiceAdapter(); | 70 | private final TunnelServiceAdapter tunnelService = new TunnelServiceAdapter(); |
| 71 | + private final DeviceServiceAdapter deviceService = new DeviceServiceAdapter(); | ||
| 72 | + private final MastershipServiceAdapter mastershipService = new MastershipServiceAdapter(); | ||
| 67 | 73 | ||
| 68 | @Before | 74 | @Before |
| 69 | public void setUp() throws IOException { | 75 | public void setUp() throws IOException { |
| 70 | tunnelProvider.tunnelProviderRegistry = registry; | 76 | tunnelProvider.tunnelProviderRegistry = registry; |
| 71 | tunnelProvider.pcepClientController = controller; | 77 | tunnelProvider.pcepClientController = controller; |
| 72 | tunnelProvider.controller = ctl; | 78 | tunnelProvider.controller = ctl; |
| 79 | + tunnelProvider.deviceService = deviceService; | ||
| 80 | + tunnelProvider.mastershipService = mastershipService; | ||
| 73 | tunnelProvider.tunnelService = tunnelService; | 81 | tunnelProvider.tunnelService = tunnelService; |
| 74 | tunnelProvider.pcepTunnelApiMapper = pcepTunnelAPIMapper; | 82 | tunnelProvider.pcepTunnelApiMapper = pcepTunnelAPIMapper; |
| 75 | tunnelProvider.cfgService = new ComponentConfigAdapter(); | 83 | tunnelProvider.cfgService = new ComponentConfigAdapter(); |
| ... | @@ -125,6 +133,8 @@ public class PcepReleaseTunnelProviderTest { | ... | @@ -125,6 +133,8 @@ public class PcepReleaseTunnelProviderTest { |
| 125 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); | 133 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); |
| 126 | 134 | ||
| 127 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 135 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 136 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xB6024E20))).setCapability( | ||
| 137 | + new ClientCapability(true, true, true, true, true)); | ||
| 128 | 138 | ||
| 129 | tunnelProvider.releaseTunnel(tunnel); | 139 | tunnelProvider.releaseTunnel(tunnel); |
| 130 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 140 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| ... | @@ -179,6 +189,8 @@ public class PcepReleaseTunnelProviderTest { | ... | @@ -179,6 +189,8 @@ public class PcepReleaseTunnelProviderTest { |
| 179 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); | 189 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); |
| 180 | 190 | ||
| 181 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 191 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 192 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xB6024E22))).setCapability( | ||
| 193 | + new ClientCapability(true, false, false, true, true)); | ||
| 182 | 194 | ||
| 183 | tunnelProvider.releaseTunnel(tunnel); | 195 | tunnelProvider.releaseTunnel(tunnel); |
| 184 | assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false)); | 196 | assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false)); |
| ... | @@ -233,6 +245,8 @@ public class PcepReleaseTunnelProviderTest { | ... | @@ -233,6 +245,8 @@ public class PcepReleaseTunnelProviderTest { |
| 233 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); | 245 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); |
| 234 | 246 | ||
| 235 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 247 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 248 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xB6024E20))).setCapability( | ||
| 249 | + new ClientCapability(true, true, true, true, true)); | ||
| 236 | 250 | ||
| 237 | tunnelProvider.releaseTunnel(tunnel); | 251 | tunnelProvider.releaseTunnel(tunnel); |
| 238 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 252 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| ... | @@ -287,6 +301,8 @@ public class PcepReleaseTunnelProviderTest { | ... | @@ -287,6 +301,8 @@ public class PcepReleaseTunnelProviderTest { |
| 287 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); | 301 | tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData); |
| 288 | 302 | ||
| 289 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 303 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 304 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xB6024E20))).setCapability( | ||
| 305 | + new ClientCapability(true, true, true, true, true)); | ||
| 290 | 306 | ||
| 291 | tunnelProvider.releaseTunnel(tunnel); | 307 | tunnelProvider.releaseTunnel(tunnel); |
| 292 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 308 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| ... | @@ -298,5 +314,7 @@ public class PcepReleaseTunnelProviderTest { | ... | @@ -298,5 +314,7 @@ public class PcepReleaseTunnelProviderTest { |
| 298 | tunnelProvider.controller = null; | 314 | tunnelProvider.controller = null; |
| 299 | tunnelProvider.pcepClientController = null; | 315 | tunnelProvider.pcepClientController = null; |
| 300 | tunnelProvider.tunnelProviderRegistry = null; | 316 | tunnelProvider.tunnelProviderRegistry = null; |
| 317 | + tunnelProvider.deviceService = null; | ||
| 318 | + tunnelProvider.mastershipService = null; | ||
| 301 | } | 319 | } |
| 302 | } | 320 | } | ... | ... |
| ... | @@ -40,6 +40,7 @@ import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; | ... | @@ -40,6 +40,7 @@ import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; |
| 40 | import org.onosproject.incubator.net.tunnel.Tunnel; | 40 | import org.onosproject.incubator.net.tunnel.Tunnel; |
| 41 | import org.onosproject.incubator.net.tunnel.TunnelId; | 41 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 42 | import org.onosproject.incubator.net.tunnel.TunnelName; | 42 | import org.onosproject.incubator.net.tunnel.TunnelName; |
| 43 | +import org.onosproject.mastership.MastershipServiceAdapter; | ||
| 43 | import org.onosproject.net.Annotations; | 44 | import org.onosproject.net.Annotations; |
| 44 | import org.onosproject.net.ConnectPoint; | 45 | import org.onosproject.net.ConnectPoint; |
| 45 | import org.onosproject.net.DefaultAnnotations; | 46 | import org.onosproject.net.DefaultAnnotations; |
| ... | @@ -49,7 +50,10 @@ import org.onosproject.net.IpElementId; | ... | @@ -49,7 +50,10 @@ import org.onosproject.net.IpElementId; |
| 49 | import org.onosproject.net.Link; | 50 | import org.onosproject.net.Link; |
| 50 | import org.onosproject.net.Path; | 51 | import org.onosproject.net.Path; |
| 51 | import org.onosproject.net.PortNumber; | 52 | import org.onosproject.net.PortNumber; |
| 53 | +import org.onosproject.net.device.DeviceServiceAdapter; | ||
| 52 | import org.onosproject.net.provider.ProviderId; | 54 | import org.onosproject.net.provider.ProviderId; |
| 55 | +import org.onosproject.pcep.controller.ClientCapability; | ||
| 56 | +import org.onosproject.pcep.controller.PccId; | ||
| 53 | 57 | ||
| 54 | /** | 58 | /** |
| 55 | * Test for PCEP setup tunnel. | 59 | * Test for PCEP setup tunnel. |
| ... | @@ -62,12 +66,16 @@ public class PcepSetupTunnelProviderTest { | ... | @@ -62,12 +66,16 @@ public class PcepSetupTunnelProviderTest { |
| 62 | private final PcepClientControllerAdapter controller = new PcepClientControllerAdapter(); | 66 | private final PcepClientControllerAdapter controller = new PcepClientControllerAdapter(); |
| 63 | private final PcepControllerAdapter ctl = new PcepControllerAdapter(); | 67 | private final PcepControllerAdapter ctl = new PcepControllerAdapter(); |
| 64 | private final TunnelServiceAdapter tunnelService = new TunnelServiceAdapter(); | 68 | private final TunnelServiceAdapter tunnelService = new TunnelServiceAdapter(); |
| 69 | + private final DeviceServiceAdapter deviceService = new DeviceServiceAdapter(); | ||
| 70 | + private final MastershipServiceAdapter mastershipService = new MastershipServiceAdapter(); | ||
| 65 | 71 | ||
| 66 | @Before | 72 | @Before |
| 67 | public void setUp() throws IOException { | 73 | public void setUp() throws IOException { |
| 68 | tunnelProvider.tunnelProviderRegistry = registry; | 74 | tunnelProvider.tunnelProviderRegistry = registry; |
| 69 | tunnelProvider.pcepClientController = controller; | 75 | tunnelProvider.pcepClientController = controller; |
| 70 | tunnelProvider.controller = ctl; | 76 | tunnelProvider.controller = ctl; |
| 77 | + tunnelProvider.deviceService = deviceService; | ||
| 78 | + tunnelProvider.mastershipService = mastershipService; | ||
| 71 | tunnelProvider.cfgService = new ComponentConfigAdapter(); | 79 | tunnelProvider.cfgService = new ComponentConfigAdapter(); |
| 72 | tunnelProvider.tunnelService = tunnelService; | 80 | tunnelProvider.tunnelService = tunnelService; |
| 73 | tunnelProvider.activate(); | 81 | tunnelProvider.activate(); |
| ... | @@ -111,6 +119,8 @@ public class PcepSetupTunnelProviderTest { | ... | @@ -111,6 +119,8 @@ public class PcepSetupTunnelProviderTest { |
| 111 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 119 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| 112 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), | 120 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), |
| 113 | path, annotations); | 121 | path, annotations); |
| 122 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xC010101))).setCapability( | ||
| 123 | + new ClientCapability(true, true, true, true, true)); | ||
| 114 | 124 | ||
| 115 | tunnelProvider.setupTunnel(tunnel, path); | 125 | tunnelProvider.setupTunnel(tunnel, path); |
| 116 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 126 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| ... | @@ -154,6 +164,8 @@ public class PcepSetupTunnelProviderTest { | ... | @@ -154,6 +164,8 @@ public class PcepSetupTunnelProviderTest { |
| 154 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 164 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| 155 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), | 165 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), |
| 156 | path, annotations); | 166 | path, annotations); |
| 167 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xC010103))).setCapability( | ||
| 168 | + new ClientCapability(true, true, true, true, true)); | ||
| 157 | 169 | ||
| 158 | tunnelProvider.setupTunnel(tunnel, path); | 170 | tunnelProvider.setupTunnel(tunnel, path); |
| 159 | assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false)); | 171 | assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false)); |
| ... | @@ -197,6 +209,8 @@ public class PcepSetupTunnelProviderTest { | ... | @@ -197,6 +209,8 @@ public class PcepSetupTunnelProviderTest { |
| 197 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 209 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| 198 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), | 210 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), |
| 199 | path, annotations); | 211 | path, annotations); |
| 212 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xC010101))).setCapability( | ||
| 213 | + new ClientCapability(true, true, true, true, true)); | ||
| 200 | 214 | ||
| 201 | tunnelProvider.setupTunnel(tunnel, path); | 215 | tunnelProvider.setupTunnel(tunnel, path); |
| 202 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 216 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| ... | @@ -240,6 +254,8 @@ public class PcepSetupTunnelProviderTest { | ... | @@ -240,6 +254,8 @@ public class PcepSetupTunnelProviderTest { |
| 240 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 254 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| 241 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), | 255 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), |
| 242 | path, annotations); | 256 | path, annotations); |
| 257 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xC010101))).setCapability( | ||
| 258 | + new ClientCapability(true, true, true, true, true)); | ||
| 243 | 259 | ||
| 244 | tunnelProvider.setupTunnel(tunnel, path); | 260 | tunnelProvider.setupTunnel(tunnel, path); |
| 245 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 261 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| ... | @@ -251,5 +267,7 @@ public class PcepSetupTunnelProviderTest { | ... | @@ -251,5 +267,7 @@ public class PcepSetupTunnelProviderTest { |
| 251 | tunnelProvider.controller = null; | 267 | tunnelProvider.controller = null; |
| 252 | tunnelProvider.pcepClientController = null; | 268 | tunnelProvider.pcepClientController = null; |
| 253 | tunnelProvider.tunnelProviderRegistry = null; | 269 | tunnelProvider.tunnelProviderRegistry = null; |
| 270 | + tunnelProvider.deviceService = null; | ||
| 271 | + tunnelProvider.mastershipService = null; | ||
| 254 | } | 272 | } |
| 255 | } | 273 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -35,6 +35,7 @@ import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; | ... | @@ -35,6 +35,7 @@ import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; |
| 35 | import org.onosproject.incubator.net.tunnel.Tunnel; | 35 | import org.onosproject.incubator.net.tunnel.Tunnel; |
| 36 | import org.onosproject.incubator.net.tunnel.TunnelId; | 36 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 37 | import org.onosproject.incubator.net.tunnel.TunnelName; | 37 | import org.onosproject.incubator.net.tunnel.TunnelName; |
| 38 | +import org.onosproject.mastership.MastershipServiceAdapter; | ||
| 38 | import org.onosproject.net.Annotations; | 39 | import org.onosproject.net.Annotations; |
| 39 | import org.onosproject.net.ConnectPoint; | 40 | import org.onosproject.net.ConnectPoint; |
| 40 | import org.onosproject.net.DefaultAnnotations; | 41 | import org.onosproject.net.DefaultAnnotations; |
| ... | @@ -44,7 +45,10 @@ import org.onosproject.net.IpElementId; | ... | @@ -44,7 +45,10 @@ import org.onosproject.net.IpElementId; |
| 44 | import org.onosproject.net.Link; | 45 | import org.onosproject.net.Link; |
| 45 | import org.onosproject.net.Path; | 46 | import org.onosproject.net.Path; |
| 46 | import org.onosproject.net.PortNumber; | 47 | import org.onosproject.net.PortNumber; |
| 48 | +import org.onosproject.net.device.DeviceServiceAdapter; | ||
| 47 | import org.onosproject.net.provider.ProviderId; | 49 | import org.onosproject.net.provider.ProviderId; |
| 50 | +import org.onosproject.pcep.controller.ClientCapability; | ||
| 51 | +import org.onosproject.pcep.controller.PccId; | ||
| 48 | import org.onosproject.cfg.ComponentConfigAdapter; | 52 | import org.onosproject.cfg.ComponentConfigAdapter; |
| 49 | 53 | ||
| 50 | public class PcepTunnelProviderTest { | 54 | public class PcepTunnelProviderTest { |
| ... | @@ -55,6 +59,8 @@ public class PcepTunnelProviderTest { | ... | @@ -55,6 +59,8 @@ public class PcepTunnelProviderTest { |
| 55 | private final PcepClientControllerAdapter controller = new PcepClientControllerAdapter(); | 59 | private final PcepClientControllerAdapter controller = new PcepClientControllerAdapter(); |
| 56 | private final PcepControllerAdapter ctl = new PcepControllerAdapter(); | 60 | private final PcepControllerAdapter ctl = new PcepControllerAdapter(); |
| 57 | private final TunnelServiceAdapter tunnelService = new TunnelServiceAdapter(); | 61 | private final TunnelServiceAdapter tunnelService = new TunnelServiceAdapter(); |
| 62 | + private final DeviceServiceAdapter deviceService = new DeviceServiceAdapter(); | ||
| 63 | + private final MastershipServiceAdapter mastershipService = new MastershipServiceAdapter(); | ||
| 58 | 64 | ||
| 59 | @Test | 65 | @Test |
| 60 | public void testCasePcepSetupTunnel() { | 66 | public void testCasePcepSetupTunnel() { |
| ... | @@ -62,6 +68,8 @@ public class PcepTunnelProviderTest { | ... | @@ -62,6 +68,8 @@ public class PcepTunnelProviderTest { |
| 62 | tunnelProvider.tunnelProviderRegistry = registry; | 68 | tunnelProvider.tunnelProviderRegistry = registry; |
| 63 | tunnelProvider.pcepClientController = controller; | 69 | tunnelProvider.pcepClientController = controller; |
| 64 | tunnelProvider.controller = ctl; | 70 | tunnelProvider.controller = ctl; |
| 71 | + tunnelProvider.deviceService = deviceService; | ||
| 72 | + tunnelProvider.mastershipService = mastershipService; | ||
| 65 | tunnelProvider.cfgService = new ComponentConfigAdapter(); | 73 | tunnelProvider.cfgService = new ComponentConfigAdapter(); |
| 66 | tunnelProvider.tunnelService = tunnelService; | 74 | tunnelProvider.tunnelService = tunnelService; |
| 67 | tunnelProvider.activate(); | 75 | tunnelProvider.activate(); |
| ... | @@ -99,6 +107,8 @@ public class PcepTunnelProviderTest { | ... | @@ -99,6 +107,8 @@ public class PcepTunnelProviderTest { |
| 99 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 107 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| 100 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), | 108 | new DefaultGroupId(0), TunnelId.valueOf("1"), TunnelName.tunnelName("T123"), |
| 101 | path, annotations); | 109 | path, annotations); |
| 110 | + controller.getClient(PccId.pccId(IpAddress.valueOf(0xC010101))).setCapability( | ||
| 111 | + new ClientCapability(true, true, true, true, true)); | ||
| 102 | 112 | ||
| 103 | tunnelProvider.setupTunnel(tunnel, path); | 113 | tunnelProvider.setupTunnel(tunnel, path); |
| 104 | 114 | ||
| ... | @@ -109,6 +119,8 @@ public class PcepTunnelProviderTest { | ... | @@ -109,6 +119,8 @@ public class PcepTunnelProviderTest { |
| 109 | public void tearDown() throws IOException { | 119 | public void tearDown() throws IOException { |
| 110 | tunnelProvider.deactivate(); | 120 | tunnelProvider.deactivate(); |
| 111 | tunnelProvider.controller = null; | 121 | tunnelProvider.controller = null; |
| 122 | + tunnelProvider.deviceService = null; | ||
| 123 | + tunnelProvider.mastershipService = null; | ||
| 112 | tunnelProvider.pcepClientController = null; | 124 | tunnelProvider.pcepClientController = null; |
| 113 | tunnelProvider.tunnelProviderRegistry = null; | 125 | tunnelProvider.tunnelProviderRegistry = null; |
| 114 | } | 126 | } | ... | ... |
| ... | @@ -47,6 +47,10 @@ import org.onosproject.net.Link; | ... | @@ -47,6 +47,10 @@ import org.onosproject.net.Link; |
| 47 | import org.onosproject.net.Path; | 47 | import org.onosproject.net.Path; |
| 48 | import org.onosproject.net.PortNumber; | 48 | import org.onosproject.net.PortNumber; |
| 49 | import org.onosproject.net.provider.ProviderId; | 49 | import org.onosproject.net.provider.ProviderId; |
| 50 | +import org.onosproject.pcep.controller.ClientCapability; | ||
| 51 | +import org.onosproject.pcep.controller.LspKey; | ||
| 52 | +import org.onosproject.pcep.controller.PccId; | ||
| 53 | +import org.onosproject.pcepio.protocol.PcepVersion; | ||
| 50 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; | 54 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; |
| 51 | 55 | ||
| 52 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 56 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; |
| ... | @@ -99,7 +103,7 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -99,7 +103,7 @@ public class PcepUpdateTunnelProviderTest { |
| 99 | 103 | ||
| 100 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); | 104 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); |
| 101 | 105 | ||
| 102 | - ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023)); | 106 | + ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024)); |
| 103 | 107 | ||
| 104 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) | 108 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) |
| 105 | .type(Link.Type.DIRECT).build(); | 109 | .type(Link.Type.DIRECT).build(); |
| ... | @@ -108,6 +112,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -108,6 +112,8 @@ public class PcepUpdateTunnelProviderTest { |
| 108 | path = new DefaultPath(pid, links, 20, EMPTY); | 112 | path = new DefaultPath(pid, links, 20, EMPTY); |
| 109 | 113 | ||
| 110 | Annotations annotations = DefaultAnnotations.builder() | 114 | Annotations annotations = DefaultAnnotations.builder() |
| 115 | + .set(PcepAnnotationKeys.PLSP_ID, "1") | ||
| 116 | + .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | ||
| 111 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) | 117 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) |
| 112 | .build(); | 118 | .build(); |
| 113 | 119 | ||
| ... | @@ -124,6 +130,12 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -124,6 +130,12 @@ public class PcepUpdateTunnelProviderTest { |
| 124 | 130 | ||
| 125 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 131 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 126 | 132 | ||
| 133 | + PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101)); | ||
| 134 | + PcepClientAdapter pc = new PcepClientAdapter(); | ||
| 135 | + pc.init(pccId, PcepVersion.PCEP_1); | ||
| 136 | + controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true); | ||
| 137 | + controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true)); | ||
| 138 | + | ||
| 127 | tunnelProvider.updateTunnel(tunnel, path); | 139 | tunnelProvider.updateTunnel(tunnel, path); |
| 128 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 140 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| 129 | } | 141 | } |
| ... | @@ -137,7 +149,7 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -137,7 +149,7 @@ public class PcepUpdateTunnelProviderTest { |
| 137 | Path path; | 149 | Path path; |
| 138 | ProviderId pid = new ProviderId("pcep", PROVIDER_ID); | 150 | ProviderId pid = new ProviderId("pcep", PROVIDER_ID); |
| 139 | List<Link> links = new ArrayList<>(); | 151 | List<Link> links = new ArrayList<>(); |
| 140 | - IpAddress srcIp = IpAddress.valueOf(0xC010103); | 152 | + IpAddress srcIp = IpAddress.valueOf(0xD010101); |
| 141 | IpElementId srcElementId = IpElementId.ipElement(srcIp); | 153 | IpElementId srcElementId = IpElementId.ipElement(srcIp); |
| 142 | 154 | ||
| 143 | IpAddress dstIp = IpAddress.valueOf(0xD010102); | 155 | IpAddress dstIp = IpAddress.valueOf(0xD010102); |
| ... | @@ -151,7 +163,7 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -151,7 +163,7 @@ public class PcepUpdateTunnelProviderTest { |
| 151 | 163 | ||
| 152 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); | 164 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); |
| 153 | 165 | ||
| 154 | - ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023)); | 166 | + ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024)); |
| 155 | 167 | ||
| 156 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) | 168 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) |
| 157 | .type(Link.Type.DIRECT).build(); | 169 | .type(Link.Type.DIRECT).build(); |
| ... | @@ -161,6 +173,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -161,6 +173,8 @@ public class PcepUpdateTunnelProviderTest { |
| 161 | 173 | ||
| 162 | Annotations annotations = DefaultAnnotations.builder() | 174 | Annotations annotations = DefaultAnnotations.builder() |
| 163 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) | 175 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) |
| 176 | + .set(PcepAnnotationKeys.PLSP_ID, "1") | ||
| 177 | + .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | ||
| 164 | .build(); | 178 | .build(); |
| 165 | 179 | ||
| 166 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 180 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| ... | @@ -176,6 +190,12 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -176,6 +190,12 @@ public class PcepUpdateTunnelProviderTest { |
| 176 | 190 | ||
| 177 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 191 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 178 | 192 | ||
| 193 | + PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101)); | ||
| 194 | + PcepClientAdapter pc = new PcepClientAdapter(); | ||
| 195 | + pc.init(pccId, PcepVersion.PCEP_1); | ||
| 196 | + controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true); | ||
| 197 | + controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true)); | ||
| 198 | + | ||
| 179 | tunnelProvider.updateTunnel(tunnel, path); | 199 | tunnelProvider.updateTunnel(tunnel, path); |
| 180 | assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false)); | 200 | assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false)); |
| 181 | } | 201 | } |
| ... | @@ -203,7 +223,7 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -203,7 +223,7 @@ public class PcepUpdateTunnelProviderTest { |
| 203 | 223 | ||
| 204 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); | 224 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); |
| 205 | 225 | ||
| 206 | - ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023)); | 226 | + ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024)); |
| 207 | 227 | ||
| 208 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) | 228 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) |
| 209 | .type(Link.Type.DIRECT).build(); | 229 | .type(Link.Type.DIRECT).build(); |
| ... | @@ -213,6 +233,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -213,6 +233,8 @@ public class PcepUpdateTunnelProviderTest { |
| 213 | 233 | ||
| 214 | Annotations annotations = DefaultAnnotations.builder() | 234 | Annotations annotations = DefaultAnnotations.builder() |
| 215 | .set(LSP_SIG_TYPE, SR_WITHOUT_SIGNALLING.name()) | 235 | .set(LSP_SIG_TYPE, SR_WITHOUT_SIGNALLING.name()) |
| 236 | + .set(PcepAnnotationKeys.PLSP_ID, "1") | ||
| 237 | + .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | ||
| 216 | .build(); | 238 | .build(); |
| 217 | 239 | ||
| 218 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 240 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| ... | @@ -228,6 +250,12 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -228,6 +250,12 @@ public class PcepUpdateTunnelProviderTest { |
| 228 | 250 | ||
| 229 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 251 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 230 | 252 | ||
| 253 | + PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101)); | ||
| 254 | + PcepClientAdapter pc = new PcepClientAdapter(); | ||
| 255 | + pc.init(pccId, PcepVersion.PCEP_1); | ||
| 256 | + controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true); | ||
| 257 | + controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true)); | ||
| 258 | + | ||
| 231 | tunnelProvider.updateTunnel(tunnel, path); | 259 | tunnelProvider.updateTunnel(tunnel, path); |
| 232 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 260 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| 233 | } | 261 | } |
| ... | @@ -255,7 +283,7 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -255,7 +283,7 @@ public class PcepUpdateTunnelProviderTest { |
| 255 | 283 | ||
| 256 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); | 284 | ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023)); |
| 257 | 285 | ||
| 258 | - ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023)); | 286 | + ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024)); |
| 259 | 287 | ||
| 260 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) | 288 | Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst) |
| 261 | .type(Link.Type.DIRECT).build(); | 289 | .type(Link.Type.DIRECT).build(); |
| ... | @@ -265,6 +293,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -265,6 +293,8 @@ public class PcepUpdateTunnelProviderTest { |
| 265 | 293 | ||
| 266 | Annotations annotations = DefaultAnnotations.builder() | 294 | Annotations annotations = DefaultAnnotations.builder() |
| 267 | .set(LSP_SIG_TYPE, WITHOUT_SIGNALLING_AND_WITHOUT_SR.name()) | 295 | .set(LSP_SIG_TYPE, WITHOUT_SIGNALLING_AND_WITHOUT_SR.name()) |
| 296 | + .set(PcepAnnotationKeys.PLSP_ID, "1") | ||
| 297 | + .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | ||
| 268 | .build(); | 298 | .build(); |
| 269 | 299 | ||
| 270 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 300 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
| ... | @@ -280,6 +310,12 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -280,6 +310,12 @@ public class PcepUpdateTunnelProviderTest { |
| 280 | 310 | ||
| 281 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); | 311 | tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData); |
| 282 | 312 | ||
| 313 | + PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101)); | ||
| 314 | + PcepClientAdapter pc = new PcepClientAdapter(); | ||
| 315 | + pc.init(pccId, PcepVersion.PCEP_1); | ||
| 316 | + controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true); | ||
| 317 | + controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true)); | ||
| 318 | + | ||
| 283 | tunnelProvider.updateTunnel(tunnel, path); | 319 | tunnelProvider.updateTunnel(tunnel, path); |
| 284 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); | 320 | assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue())); |
| 285 | } | 321 | } | ... | ... |
-
Please register or login to post a comment