Avantika-Huawei
Committed by Gerrit Code Review

[ONOS-4165] Add C flag to LSP object

Change-Id: I92047990d5d7ba460d215490e3e905eb14405d99
...@@ -57,6 +57,20 @@ public interface PcepLspObject { ...@@ -57,6 +57,20 @@ public interface PcepLspObject {
57 void setOFlag(byte value); 57 void setOFlag(byte value);
58 58
59 /** 59 /**
60 + * Returns C flag in LSP Object.
61 + *
62 + * @return C flag in LSP Object
63 + */
64 + boolean getCFlag();
65 +
66 + /**
67 + * Sets C flag with specified value.
68 + *
69 + * @param value C flag
70 + */
71 + void setCFlag(boolean value);
72 +
73 + /**
60 * Returns A flag in LSP Object. 74 * Returns A flag in LSP Object.
61 * 75 *
62 * @return A flag in LSP Object 76 * @return A flag in LSP Object
...@@ -178,6 +192,21 @@ public interface PcepLspObject { ...@@ -178,6 +192,21 @@ public interface PcepLspObject {
178 Builder setPlspId(int value); 192 Builder setPlspId(int value);
179 193
180 /** 194 /**
195 + * Returns C flag in LSP Object.
196 + *
197 + * @return C flag in LSP Object
198 + */
199 + boolean getCFlag();
200 +
201 + /**
202 + * Sets C flag with specific value and return its builder.
203 + *
204 + * @param value C flag
205 + * @return Builder by setting C flag
206 + */
207 + Builder setCFlag(boolean value);
208 +
209 + /**
181 * Returns O flag in LSP Object. 210 * Returns O flag in LSP Object.
182 * 211 *
183 * @return O flag in LSP Object 212 * @return O flag in LSP Object
......
...@@ -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 | O|A|R|S|D| 51 + | PLSP-ID | Flag C| O|A|R|S|D|
52 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 52 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 // TLVs // 53 // TLVs //
54 | | 54 | |
...@@ -71,13 +71,16 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -71,13 +71,16 @@ public class PcepLspObjectVer1 implements PcepLspObject {
71 public static final boolean DEFAULT_RFLAG = false; 71 public static final boolean DEFAULT_RFLAG = false;
72 public static final boolean DEFAULT_SFLAG = false; 72 public static final boolean DEFAULT_SFLAG = false;
73 public static final boolean DEFAULT_DFLAG = false; 73 public static final boolean DEFAULT_DFLAG = false;
74 + public static final boolean DEFAULT_CFLAG = false;
74 public static final int OBJECT_HEADER_LENGTH = 4; 75 public static final int OBJECT_HEADER_LENGTH = 4;
75 public static final int PLSPID_SHIFT_VALUE = 12; 76 public static final int PLSPID_SHIFT_VALUE = 12;
77 + public static final int CFLAG_SHIFT_VALUE = 7;
76 public static final int OFLAG_SHIFT_VALUE = 4; 78 public static final int OFLAG_SHIFT_VALUE = 4;
77 public static final int AFLAG_SHIFT_VALUE = 3; 79 public static final int AFLAG_SHIFT_VALUE = 3;
78 public static final int RFLAG_SHIFT_VALUE = 2; 80 public static final int RFLAG_SHIFT_VALUE = 2;
79 public static final int SFLAG_SHIFT_VALUE = 1; 81 public static final int SFLAG_SHIFT_VALUE = 1;
80 public static final int PLSPID_TEMP_SHIFT_VALUE = 0xFFFFF000; 82 public static final int PLSPID_TEMP_SHIFT_VALUE = 0xFFFFF000;
83 + public static final int CFLAG_TEMP_SHIFT_VALUE = 0x80;
81 public static final int OFLAG_TEMP_SHIFT_VALUE = 0x70; 84 public static final int OFLAG_TEMP_SHIFT_VALUE = 0x70;
82 public static final int AFLAG_TEMP_SHIFT_VALUE = 0x08; 85 public static final int AFLAG_TEMP_SHIFT_VALUE = 0x08;
83 public static final int RFLAG_TEMP_SHIFT_VALUE = 0x04; 86 public static final int RFLAG_TEMP_SHIFT_VALUE = 0x04;
...@@ -98,6 +101,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -98,6 +101,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
98 private boolean bRFlag; 101 private boolean bRFlag;
99 private boolean bSFlag; 102 private boolean bSFlag;
100 private boolean bDFlag; 103 private boolean bDFlag;
104 + private boolean bCFlag;
101 105
102 // Optional TLV 106 // Optional TLV
103 private LinkedList<PcepValueType> llOptionalTlv; 107 private LinkedList<PcepValueType> llOptionalTlv;
...@@ -115,7 +119,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -115,7 +119,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
115 * @param llOptionalTlv list of optional tlv 119 * @param llOptionalTlv list of optional tlv
116 */ 120 */
117 public PcepLspObjectVer1(PcepObjectHeader lspObjHeader, int iPlspId, byte yOFlag, boolean bAFlag, boolean bRFlag, 121 public PcepLspObjectVer1(PcepObjectHeader lspObjHeader, int iPlspId, byte yOFlag, boolean bAFlag, boolean bRFlag,
118 - boolean bSFlag, boolean bDFlag, LinkedList<PcepValueType> llOptionalTlv) { 122 + boolean bSFlag, boolean bDFlag, boolean bCFlag, LinkedList<PcepValueType> llOptionalTlv) {
119 123
120 this.lspObjHeader = lspObjHeader; 124 this.lspObjHeader = lspObjHeader;
121 this.iPlspId = iPlspId; 125 this.iPlspId = iPlspId;
...@@ -124,6 +128,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -124,6 +128,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
124 this.bRFlag = bRFlag; 128 this.bRFlag = bRFlag;
125 this.bSFlag = bSFlag; 129 this.bSFlag = bSFlag;
126 this.bDFlag = bDFlag; 130 this.bDFlag = bDFlag;
131 + this.bCFlag = bCFlag;
127 this.llOptionalTlv = llOptionalTlv; 132 this.llOptionalTlv = llOptionalTlv;
128 } 133 }
129 134
...@@ -142,6 +147,11 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -142,6 +147,11 @@ public class PcepLspObjectVer1 implements PcepLspObject {
142 } 147 }
143 148
144 @Override 149 @Override
150 + public void setCFlag(boolean bCFlag) {
151 + this.bCFlag = bCFlag;
152 + }
153 +
154 + @Override
145 public void setOFlag(byte yOFlag) { 155 public void setOFlag(byte yOFlag) {
146 this.yOFlag = yOFlag; 156 this.yOFlag = yOFlag;
147 } 157 }
...@@ -181,6 +191,11 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -181,6 +191,11 @@ public class PcepLspObjectVer1 implements PcepLspObject {
181 } 191 }
182 192
183 @Override 193 @Override
194 + public boolean getCFlag() {
195 + return this.bCFlag;
196 + }
197 +
198 + @Override
184 public byte getOFlag() { 199 public byte getOFlag() {
185 return this.yOFlag; 200 return this.yOFlag;
186 } 201 }
...@@ -232,6 +247,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -232,6 +247,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
232 boolean bRFlag; 247 boolean bRFlag;
233 boolean bSFlag; 248 boolean bSFlag;
234 boolean bDFlag; 249 boolean bDFlag;
250 + boolean bCFlag;
235 251
236 // Optional TLV 252 // Optional TLV
237 LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>(); 253 LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
...@@ -246,6 +262,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -246,6 +262,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
246 262
247 Integer iTemp = tempCb.readInt(); 263 Integer iTemp = tempCb.readInt();
248 iPlspId = (iTemp & PLSPID_TEMP_SHIFT_VALUE) >> PLSPID_SHIFT_VALUE; 264 iPlspId = (iTemp & PLSPID_TEMP_SHIFT_VALUE) >> PLSPID_SHIFT_VALUE;
265 + bCFlag = ((iTemp & CFLAG_TEMP_SHIFT_VALUE) >> CFLAG_SHIFT_VALUE) > 0;
249 Integer iX = (iTemp & OFLAG_TEMP_SHIFT_VALUE) >> OFLAG_SHIFT_VALUE; 266 Integer iX = (iTemp & OFLAG_TEMP_SHIFT_VALUE) >> OFLAG_SHIFT_VALUE;
250 yOFlag = iX.byteValue(); 267 yOFlag = iX.byteValue();
251 iX = (iTemp & AFLAG_TEMP_SHIFT_VALUE) >> AFLAG_SHIFT_VALUE; 268 iX = (iTemp & AFLAG_TEMP_SHIFT_VALUE) >> AFLAG_SHIFT_VALUE;
...@@ -260,7 +277,8 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -260,7 +277,8 @@ public class PcepLspObjectVer1 implements PcepLspObject {
260 // parse optional TLV 277 // parse optional TLV
261 llOptionalTlv = parseOptionalTlv(tempCb); 278 llOptionalTlv = parseOptionalTlv(tempCb);
262 279
263 - return new PcepLspObjectVer1(lspObjHeader, iPlspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, llOptionalTlv); 280 + return new PcepLspObjectVer1(lspObjHeader, iPlspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, bCFlag,
281 + llOptionalTlv);
264 } 282 }
265 283
266 @Override 284 @Override
...@@ -410,6 +428,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -410,6 +428,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
410 private boolean bIsAFlagSet = false; 428 private boolean bIsAFlagSet = false;
411 private boolean bIsDFlagSet = false; 429 private boolean bIsDFlagSet = false;
412 private boolean bIsSFlagSet = false; 430 private boolean bIsSFlagSet = false;
431 + private boolean bIsCFlagSet = false;
413 432
414 private PcepObjectHeader lspObjHeader; 433 private PcepObjectHeader lspObjHeader;
415 private byte yOFlag; 434 private byte yOFlag;
...@@ -417,6 +436,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -417,6 +436,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
417 private boolean bDFlag; 436 private boolean bDFlag;
418 private boolean bSFlag; 437 private boolean bSFlag;
419 private boolean bRFlag; 438 private boolean bRFlag;
439 + private boolean bCFlag;
420 LinkedList<PcepValueType> llOptionalTlv = null; 440 LinkedList<PcepValueType> llOptionalTlv = null;
421 441
422 private int plspId; 442 private int plspId;
...@@ -437,6 +457,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -437,6 +457,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
437 boolean bRFlag = this.bIsRFlagSet ? this.bRFlag : DEFAULT_RFLAG; 457 boolean bRFlag = this.bIsRFlagSet ? this.bRFlag : DEFAULT_RFLAG;
438 boolean bSFlag = this.bIsSFlagSet ? this.bSFlag : DEFAULT_SFLAG; 458 boolean bSFlag = this.bIsSFlagSet ? this.bSFlag : DEFAULT_SFLAG;
439 boolean bDFlag = this.bIsDFlagSet ? this.bDFlag : DEFAULT_DFLAG; 459 boolean bDFlag = this.bIsDFlagSet ? this.bDFlag : DEFAULT_DFLAG;
460 + boolean bCFlag = this.bIsCFlagSet ? this.bCFlag : DEFAULT_CFLAG;
440 461
441 if (bIsPFlagSet) { 462 if (bIsPFlagSet) {
442 lspObjHeader.setPFlag(bPFlag); 463 lspObjHeader.setPFlag(bPFlag);
...@@ -446,7 +467,8 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -446,7 +467,8 @@ public class PcepLspObjectVer1 implements PcepLspObject {
446 lspObjHeader.setIFlag(bIFlag); 467 lspObjHeader.setIFlag(bIFlag);
447 } 468 }
448 469
449 - return new PcepLspObjectVer1(lspObjHeader, plspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, llOptionalTlv); 470 + return new PcepLspObjectVer1(lspObjHeader, plspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, bCFlag,
471 + llOptionalTlv);
450 } 472 }
451 473
452 @Override 474 @Override
...@@ -474,6 +496,18 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -474,6 +496,18 @@ public class PcepLspObjectVer1 implements PcepLspObject {
474 } 496 }
475 497
476 @Override 498 @Override
499 + public boolean getCFlag() {
500 + return this.bCFlag;
501 + }
502 +
503 + @Override
504 + public Builder setCFlag(boolean value) {
505 + this.bCFlag = value;
506 + this.bIsCFlagSet = true;
507 + return this;
508 + }
509 +
510 + @Override
477 public byte getOFlag() { 511 public byte getOFlag() {
478 return this.yOFlag; 512 return this.yOFlag;
479 } 513 }
...@@ -564,6 +598,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { ...@@ -564,6 +598,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
564 public String toString() { 598 public String toString() {
565 return MoreObjects.toStringHelper(getClass()) 599 return MoreObjects.toStringHelper(getClass())
566 .add("PlspIDValue", iPlspId) 600 .add("PlspIDValue", iPlspId)
601 + .add("CFlag", bCFlag)
567 .add("OFlag", yOFlag) 602 .add("OFlag", yOFlag)
568 .add("AFlag", bAFlag) 603 .add("AFlag", bAFlag)
569 .add("RFlag", bRFlag) 604 .add("RFlag", bRFlag)
......