Committed by
Gerrit Code Review
[ONOS-4170] PCEP provider changes for LSPDB sync
Change-Id: I9229fec9d97dd46343cc809e33c92b9722ab7ed3
Showing
10 changed files
with
120 additions
and
32 deletions
... | @@ -95,18 +95,32 @@ public interface PcepClient { | ... | @@ -95,18 +95,32 @@ public interface PcepClient { |
95 | String channelId(); | 95 | String channelId(); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | - * To set the status of state synchronization. | 98 | + * Sets the status of LSP state synchronization. |
99 | * | 99 | * |
100 | - * @param value to set the synchronization status | 100 | + * @param syncStatus LSP synchronization status to be set |
101 | */ | 101 | */ |
102 | - void setIsSyncComplete(boolean value); | 102 | + void setLspDbSyncStatus(PcepSyncStatus syncStatus); |
103 | 103 | ||
104 | /** | 104 | /** |
105 | - * Indicates the state synchronization status of this pcc. | 105 | + * Indicates the LSP state synchronization status of this pcc. |
106 | * | 106 | * |
107 | - * @return true/false if the synchronization is completed/not completed | 107 | + * @return LSP state synchronization status. |
108 | */ | 108 | */ |
109 | - boolean isSyncComplete(); | 109 | + PcepSyncStatus lspDbSyncStatus(); |
110 | + | ||
111 | + /** | ||
112 | + * Sets the status of label DB synchronization. | ||
113 | + * | ||
114 | + * @param syncStatus label DB synchronization status to be set | ||
115 | + */ | ||
116 | + void setLabelDbSyncStatus(PcepSyncStatus syncStatus); | ||
117 | + | ||
118 | + /** | ||
119 | + * Indicates the label DB synchronization status of this pcc. | ||
120 | + * | ||
121 | + * @return label DB synchronization status. | ||
122 | + */ | ||
123 | + PcepSyncStatus labelDbSyncStatus(); | ||
110 | 124 | ||
111 | /** | 125 | /** |
112 | * Sets capability negotiated during open message exchange. | 126 | * Sets capability negotiated during open message exchange. | ... | ... |
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 | +/** | ||
19 | + * Representation of PCEP database sync status on session establishment. | ||
20 | + */ | ||
21 | +public enum PcepSyncStatus { | ||
22 | + | ||
23 | + /** | ||
24 | + * Specifies that the DB state is not synchronized. | ||
25 | + */ | ||
26 | + NOT_SYNCED(0), | ||
27 | + | ||
28 | + /** | ||
29 | + * Specifies that the DB state is currently undergoing synchronization. | ||
30 | + */ | ||
31 | + IN_SYNC(1), | ||
32 | + | ||
33 | + /** | ||
34 | + * Specifies that the DB state synchronization is completed. | ||
35 | + */ | ||
36 | + SYNCED(2); | ||
37 | + | ||
38 | + int value; | ||
39 | + | ||
40 | + /** | ||
41 | + * Assign val with the value as the sync status. | ||
42 | + * | ||
43 | + * @param val sync status | ||
44 | + */ | ||
45 | + PcepSyncStatus(int val) { | ||
46 | + value = val; | ||
47 | + } | ||
48 | +} |
... | @@ -169,6 +169,12 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -169,6 +169,12 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | + /* | ||
173 | + * If MPLS LSR id and PCEP session socket IP addresses are not same, | ||
174 | + * the MPLS LSR id will be encoded in separate TLV. | ||
175 | + * We always maintain session information based on LSR ids. | ||
176 | + * The socket IP is stored in channel. | ||
177 | + */ | ||
172 | LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv(); | 178 | LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv(); |
173 | for (PcepValueType optionalTlv : optionalTlvs) { | 179 | for (PcepValueType optionalTlv : optionalTlvs) { |
174 | if (optionalTlv instanceof NodeAttributesTlv) { | 180 | if (optionalTlv instanceof NodeAttributesTlv) { | ... | ... |
... | @@ -27,6 +27,7 @@ import org.onlab.packet.IpAddress; | ... | @@ -27,6 +27,7 @@ import org.onlab.packet.IpAddress; |
27 | import org.onosproject.pcep.controller.ClientCapability; | 27 | import org.onosproject.pcep.controller.ClientCapability; |
28 | import org.onosproject.pcep.controller.PccId; | 28 | import org.onosproject.pcep.controller.PccId; |
29 | import org.onosproject.pcep.controller.PcepPacketStats; | 29 | import org.onosproject.pcep.controller.PcepPacketStats; |
30 | +import org.onosproject.pcep.controller.PcepSyncStatus; | ||
30 | import org.onosproject.pcep.controller.driver.PcepAgent; | 31 | import org.onosproject.pcep.controller.driver.PcepAgent; |
31 | import org.onosproject.pcep.controller.driver.PcepClientDriver; | 32 | import org.onosproject.pcep.controller.driver.PcepClientDriver; |
32 | import org.onosproject.pcepio.protocol.PcepFactories; | 33 | import org.onosproject.pcepio.protocol.PcepFactories; |
... | @@ -52,9 +53,10 @@ public class PcepClientImpl implements PcepClientDriver { | ... | @@ -52,9 +53,10 @@ public class PcepClientImpl implements PcepClientDriver { |
52 | protected String channelId; | 53 | protected String channelId; |
53 | 54 | ||
54 | private boolean connected; | 55 | private boolean connected; |
55 | - protected boolean startDriverHandshakeCalled = false; | 56 | + protected boolean startDriverHandshakeCalled; |
56 | - protected boolean isHandShakeComplete = false; | 57 | + protected boolean isHandShakeComplete; |
57 | - protected boolean isSyncComplete = false; | 58 | + private PcepSyncStatus lspDbSyncStatus; |
59 | + private PcepSyncStatus labelDbSyncStatus; | ||
58 | private PccId pccId; | 60 | private PccId pccId; |
59 | private PcepAgent agent; | 61 | private PcepAgent agent; |
60 | 62 | ||
... | @@ -175,13 +177,23 @@ public class PcepClientImpl implements PcepClientDriver { | ... | @@ -175,13 +177,23 @@ public class PcepClientImpl implements PcepClientDriver { |
175 | } | 177 | } |
176 | 178 | ||
177 | @Override | 179 | @Override |
178 | - public void setIsSyncComplete(boolean value) { | 180 | + public void setLspDbSyncStatus(PcepSyncStatus syncStatus) { |
179 | - this.isSyncComplete = value; | 181 | + this.lspDbSyncStatus = syncStatus; |
180 | } | 182 | } |
181 | 183 | ||
182 | @Override | 184 | @Override |
183 | - public boolean isSyncComplete() { | 185 | + public PcepSyncStatus lspDbSyncStatus() { |
184 | - return isSyncComplete; | 186 | + return lspDbSyncStatus; |
187 | + } | ||
188 | + | ||
189 | + @Override | ||
190 | + public void setLabelDbSyncStatus(PcepSyncStatus syncStatus) { | ||
191 | + this.labelDbSyncStatus = syncStatus; | ||
192 | + } | ||
193 | + | ||
194 | + @Override | ||
195 | + public PcepSyncStatus labelDbSyncStatus() { | ||
196 | + return labelDbSyncStatus; | ||
185 | } | 197 | } |
186 | 198 | ||
187 | @Override | 199 | @Override | ... | ... |
... | @@ -48,7 +48,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -48,7 +48,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
48 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 48 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
49 | | Object-Class | OT |Res|P|I| Object Length (bytes) | | 49 | | Object-Class | OT |Res|P|I| Object Length (bytes) | |
50 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 50 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
51 | - | PLSP-ID | Flag C| O|A|R|S|D| | 51 | + | PLSP-ID | Flag |C| O|A|R|S|D| |
52 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 52 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
53 | // TLVs // | 53 | // TLVs // |
54 | | | | 54 | | | |
... | @@ -116,6 +116,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -116,6 +116,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
116 | * @param bRFlag R flag | 116 | * @param bRFlag R flag |
117 | * @param bSFlag S flag | 117 | * @param bSFlag S flag |
118 | * @param bDFlag D flag | 118 | * @param bDFlag D flag |
119 | + * @param bCFlag C flag | ||
119 | * @param llOptionalTlv list of optional tlv | 120 | * @param llOptionalTlv list of optional tlv |
120 | */ | 121 | */ |
121 | public PcepLspObjectVer1(PcepObjectHeader lspObjHeader, int iPlspId, byte yOFlag, boolean bAFlag, boolean bRFlag, | 122 | public PcepLspObjectVer1(PcepObjectHeader lspObjHeader, int iPlspId, byte yOFlag, boolean bAFlag, boolean bRFlag, |
... | @@ -294,6 +295,9 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -294,6 +295,9 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
294 | } | 295 | } |
295 | 296 | ||
296 | int iTemp = iPlspId << PLSPID_SHIFT_VALUE; | 297 | int iTemp = iPlspId << PLSPID_SHIFT_VALUE; |
298 | + | ||
299 | + iTemp = iTemp | (((bCFlag) ? BIT_SET : BIT_RESET) << CFLAG_SHIFT_VALUE); | ||
300 | + | ||
297 | iTemp = iTemp | (yOFlag << OFLAG_SHIFT_VALUE); | 301 | iTemp = iTemp | (yOFlag << OFLAG_SHIFT_VALUE); |
298 | byte bFlag; | 302 | byte bFlag; |
299 | iTemp = bAFlag ? (iTemp | AFLAG_TEMP_SHIFT_VALUE) : iTemp; | 303 | iTemp = bAFlag ? (iTemp | AFLAG_TEMP_SHIFT_VALUE) : iTemp; | ... | ... |
... | @@ -51,4 +51,9 @@ public final class PcepAnnotationKeys { | ... | @@ -51,4 +51,9 @@ public final class PcepAnnotationKeys { |
51 | * Annotation key for the LSP id assigned per tunnel. | 51 | * Annotation key for the LSP id assigned per tunnel. |
52 | */ | 52 | */ |
53 | public static final String LOCAL_LSP_ID = "localLspId"; | 53 | public static final String LOCAL_LSP_ID = "localLspId"; |
54 | + | ||
55 | + /** | ||
56 | + * Annotation key for the identification of initiated LSP. | ||
57 | + */ | ||
58 | + public static final String PCE_INIT = "pceInit"; | ||
54 | } | 59 | } | ... | ... |
... | @@ -18,7 +18,6 @@ package org.onosproject.provider.pcep.tunnel.impl; | ... | @@ -18,7 +18,6 @@ package org.onosproject.provider.pcep.tunnel.impl; |
18 | import java.util.HashMap; | 18 | import java.util.HashMap; |
19 | import java.util.Map; | 19 | import java.util.Map; |
20 | 20 | ||
21 | -import org.apache.commons.collections.map.MultiKeyMap; | ||
22 | import org.onosproject.incubator.net.tunnel.TunnelId; | 21 | import org.onosproject.incubator.net.tunnel.TunnelId; |
23 | import org.onosproject.incubator.net.tunnel.TunnelProviderService; | 22 | import org.onosproject.incubator.net.tunnel.TunnelProviderService; |
24 | import org.slf4j.Logger; | 23 | import org.slf4j.Logger; |
... | @@ -40,8 +39,6 @@ public class PcepTunnelApiMapper { | ... | @@ -40,8 +39,6 @@ public class PcepTunnelApiMapper { |
40 | private Map<Integer, PcepTunnelData> tunnelDB; | 39 | private Map<Integer, PcepTunnelData> tunnelDB; |
41 | // Map to store the tunnel ids, given by core and given by pcc. | 40 | // Map to store the tunnel ids, given by core and given by pcc. |
42 | private Map<TunnelId, Integer> tunnelIdMap; | 41 | private Map<TunnelId, Integer> tunnelIdMap; |
43 | - //Map to store all the learnt tunnels. | ||
44 | - private MultiKeyMap pccTunnelDB = new MultiKeyMap(); | ||
45 | 42 | ||
46 | TunnelProviderService tunnelApiMapperservice; | 43 | TunnelProviderService tunnelApiMapperservice; |
47 | 44 | ||
... | @@ -193,14 +190,4 @@ public class PcepTunnelApiMapper { | ... | @@ -193,14 +190,4 @@ public class PcepTunnelApiMapper { |
193 | boolean retValue = tunnelDB.containsKey((new Integer(value))); | 190 | boolean retValue = tunnelDB.containsKey((new Integer(value))); |
194 | return retValue; | 191 | return retValue; |
195 | } | 192 | } |
196 | - | ||
197 | - /** | ||
198 | - * Add Learnt tunnels to pcc tunnel DB. | ||
199 | - * | ||
200 | - * @param pcepTunnelData pcep tunnel data | ||
201 | - */ | ||
202 | - public void addPccTunnelDB(PcepTunnelData pcepTunnelData) { | ||
203 | - pccTunnelDB.put(pcepTunnelData.statefulIpv4IndentifierTlv().getTunnelId() & 0xFFFFL, | ||
204 | - pcepTunnelData.statefulIpv4IndentifierTlv().getIpv4IngressAddress(), pcepTunnelData); | ||
205 | - } | ||
206 | } | 193 | } | ... | ... |
This diff is collapsed. Click to expand it.
providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepClientAdapter.java
... | @@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel; | ... | @@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel; |
24 | import org.onosproject.pcep.controller.ClientCapability; | 24 | import org.onosproject.pcep.controller.ClientCapability; |
25 | import org.onosproject.pcep.controller.PccId; | 25 | import org.onosproject.pcep.controller.PccId; |
26 | import org.onosproject.pcep.controller.PcepClient; | 26 | import org.onosproject.pcep.controller.PcepClient; |
27 | +import org.onosproject.pcep.controller.PcepSyncStatus; | ||
27 | import org.onosproject.pcepio.protocol.PcepFactories; | 28 | import org.onosproject.pcepio.protocol.PcepFactories; |
28 | import org.onosproject.pcepio.protocol.PcepFactory; | 29 | import org.onosproject.pcepio.protocol.PcepFactory; |
29 | import org.onosproject.pcepio.protocol.PcepMessage; | 30 | import org.onosproject.pcepio.protocol.PcepMessage; |
... | @@ -42,7 +43,8 @@ public class PcepClientAdapter implements PcepClient { | ... | @@ -42,7 +43,8 @@ public class PcepClientAdapter implements PcepClient { |
42 | private ClientCapability capability; | 43 | private ClientCapability capability; |
43 | 44 | ||
44 | private PcepVersion pcepVersion; | 45 | private PcepVersion pcepVersion; |
45 | - private boolean syncCompleted; | 46 | + private PcepSyncStatus lspDbSyncStatus; |
47 | + private PcepSyncStatus labelDbSyncStatus; | ||
46 | 48 | ||
47 | /** | 49 | /** |
48 | * Initialize instance with specified parameters. | 50 | * Initialize instance with specified parameters. |
... | @@ -109,13 +111,23 @@ public class PcepClientAdapter implements PcepClient { | ... | @@ -109,13 +111,23 @@ public class PcepClientAdapter implements PcepClient { |
109 | } | 111 | } |
110 | 112 | ||
111 | @Override | 113 | @Override |
112 | - public final boolean isSyncComplete() { | 114 | + public void setLspDbSyncStatus(PcepSyncStatus syncStatus) { |
113 | - return syncCompleted; | 115 | + this.lspDbSyncStatus = syncStatus; |
114 | } | 116 | } |
115 | 117 | ||
116 | @Override | 118 | @Override |
117 | - public final void setIsSyncComplete(boolean value) { | 119 | + public PcepSyncStatus lspDbSyncStatus() { |
118 | - syncCompleted = value; | 120 | + return lspDbSyncStatus; |
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public void setLabelDbSyncStatus(PcepSyncStatus syncStatus) { | ||
125 | + this.labelDbSyncStatus = syncStatus; | ||
126 | + } | ||
127 | + | ||
128 | + @Override | ||
129 | + public PcepSyncStatus labelDbSyncStatus() { | ||
130 | + return labelDbSyncStatus; | ||
119 | } | 131 | } |
120 | 132 | ||
121 | @Override | 133 | @Override | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment