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 {
void setOFlag(byte value);
/**
* Returns C flag in LSP Object.
*
* @return C flag in LSP Object
*/
boolean getCFlag();
/**
* Sets C flag with specified value.
*
* @param value C flag
*/
void setCFlag(boolean value);
/**
* Returns A flag in LSP Object.
*
* @return A flag in LSP Object
......@@ -178,6 +192,21 @@ public interface PcepLspObject {
Builder setPlspId(int value);
/**
* Returns C flag in LSP Object.
*
* @return C flag in LSP Object
*/
boolean getCFlag();
/**
* Sets C flag with specific value and return its builder.
*
* @param value C flag
* @return Builder by setting C flag
*/
Builder setCFlag(boolean value);
/**
* Returns O flag in LSP Object.
*
* @return O flag in LSP Object
......
......@@ -48,7 +48,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Object-Class | OT |Res|P|I| Object Length (bytes) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PLSP-ID | Flag | O|A|R|S|D|
| PLSP-ID | Flag C| O|A|R|S|D|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// TLVs //
| |
......@@ -71,13 +71,16 @@ public class PcepLspObjectVer1 implements PcepLspObject {
public static final boolean DEFAULT_RFLAG = false;
public static final boolean DEFAULT_SFLAG = false;
public static final boolean DEFAULT_DFLAG = false;
public static final boolean DEFAULT_CFLAG = false;
public static final int OBJECT_HEADER_LENGTH = 4;
public static final int PLSPID_SHIFT_VALUE = 12;
public static final int CFLAG_SHIFT_VALUE = 7;
public static final int OFLAG_SHIFT_VALUE = 4;
public static final int AFLAG_SHIFT_VALUE = 3;
public static final int RFLAG_SHIFT_VALUE = 2;
public static final int SFLAG_SHIFT_VALUE = 1;
public static final int PLSPID_TEMP_SHIFT_VALUE = 0xFFFFF000;
public static final int CFLAG_TEMP_SHIFT_VALUE = 0x80;
public static final int OFLAG_TEMP_SHIFT_VALUE = 0x70;
public static final int AFLAG_TEMP_SHIFT_VALUE = 0x08;
public static final int RFLAG_TEMP_SHIFT_VALUE = 0x04;
......@@ -98,6 +101,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
private boolean bRFlag;
private boolean bSFlag;
private boolean bDFlag;
private boolean bCFlag;
// Optional TLV
private LinkedList<PcepValueType> llOptionalTlv;
......@@ -115,7 +119,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
* @param llOptionalTlv list of optional tlv
*/
public PcepLspObjectVer1(PcepObjectHeader lspObjHeader, int iPlspId, byte yOFlag, boolean bAFlag, boolean bRFlag,
boolean bSFlag, boolean bDFlag, LinkedList<PcepValueType> llOptionalTlv) {
boolean bSFlag, boolean bDFlag, boolean bCFlag, LinkedList<PcepValueType> llOptionalTlv) {
this.lspObjHeader = lspObjHeader;
this.iPlspId = iPlspId;
......@@ -124,6 +128,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
this.bRFlag = bRFlag;
this.bSFlag = bSFlag;
this.bDFlag = bDFlag;
this.bCFlag = bCFlag;
this.llOptionalTlv = llOptionalTlv;
}
......@@ -142,6 +147,11 @@ public class PcepLspObjectVer1 implements PcepLspObject {
}
@Override
public void setCFlag(boolean bCFlag) {
this.bCFlag = bCFlag;
}
@Override
public void setOFlag(byte yOFlag) {
this.yOFlag = yOFlag;
}
......@@ -181,6 +191,11 @@ public class PcepLspObjectVer1 implements PcepLspObject {
}
@Override
public boolean getCFlag() {
return this.bCFlag;
}
@Override
public byte getOFlag() {
return this.yOFlag;
}
......@@ -232,6 +247,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
boolean bRFlag;
boolean bSFlag;
boolean bDFlag;
boolean bCFlag;
// Optional TLV
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
......@@ -246,6 +262,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
Integer iTemp = tempCb.readInt();
iPlspId = (iTemp & PLSPID_TEMP_SHIFT_VALUE) >> PLSPID_SHIFT_VALUE;
bCFlag = ((iTemp & CFLAG_TEMP_SHIFT_VALUE) >> CFLAG_SHIFT_VALUE) > 0;
Integer iX = (iTemp & OFLAG_TEMP_SHIFT_VALUE) >> OFLAG_SHIFT_VALUE;
yOFlag = iX.byteValue();
iX = (iTemp & AFLAG_TEMP_SHIFT_VALUE) >> AFLAG_SHIFT_VALUE;
......@@ -260,7 +277,8 @@ public class PcepLspObjectVer1 implements PcepLspObject {
// parse optional TLV
llOptionalTlv = parseOptionalTlv(tempCb);
return new PcepLspObjectVer1(lspObjHeader, iPlspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, llOptionalTlv);
return new PcepLspObjectVer1(lspObjHeader, iPlspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, bCFlag,
llOptionalTlv);
}
@Override
......@@ -410,6 +428,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
private boolean bIsAFlagSet = false;
private boolean bIsDFlagSet = false;
private boolean bIsSFlagSet = false;
private boolean bIsCFlagSet = false;
private PcepObjectHeader lspObjHeader;
private byte yOFlag;
......@@ -417,6 +436,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
private boolean bDFlag;
private boolean bSFlag;
private boolean bRFlag;
private boolean bCFlag;
LinkedList<PcepValueType> llOptionalTlv = null;
private int plspId;
......@@ -437,6 +457,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
boolean bRFlag = this.bIsRFlagSet ? this.bRFlag : DEFAULT_RFLAG;
boolean bSFlag = this.bIsSFlagSet ? this.bSFlag : DEFAULT_SFLAG;
boolean bDFlag = this.bIsDFlagSet ? this.bDFlag : DEFAULT_DFLAG;
boolean bCFlag = this.bIsCFlagSet ? this.bCFlag : DEFAULT_CFLAG;
if (bIsPFlagSet) {
lspObjHeader.setPFlag(bPFlag);
......@@ -446,7 +467,8 @@ public class PcepLspObjectVer1 implements PcepLspObject {
lspObjHeader.setIFlag(bIFlag);
}
return new PcepLspObjectVer1(lspObjHeader, plspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, llOptionalTlv);
return new PcepLspObjectVer1(lspObjHeader, plspId, yOFlag, bAFlag, bRFlag, bSFlag, bDFlag, bCFlag,
llOptionalTlv);
}
@Override
......@@ -474,6 +496,18 @@ public class PcepLspObjectVer1 implements PcepLspObject {
}
@Override
public boolean getCFlag() {
return this.bCFlag;
}
@Override
public Builder setCFlag(boolean value) {
this.bCFlag = value;
this.bIsCFlagSet = true;
return this;
}
@Override
public byte getOFlag() {
return this.yOFlag;
}
......@@ -564,6 +598,7 @@ public class PcepLspObjectVer1 implements PcepLspObject {
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("PlspIDValue", iPlspId)
.add("CFlag", bCFlag)
.add("OFlag", yOFlag)
.add("AFlag", bAFlag)
.add("RFlag", bRFlag)
......