Mahesh Poojary S
Committed by Gerrit Code Review

PCEP modificaton to support PCEP-LS

Change-Id: Ic829dd17b0398ad76ec412b4e8293de564b5b56b
Showing 111 changed files with 1103 additions and 891 deletions
......@@ -22,6 +22,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException;
import org.onosproject.pcepio.protocol.PcepFactories;
import org.onosproject.pcepio.protocol.PcepMessage;
import org.onosproject.pcepio.protocol.PcepMessageReader;
......@@ -49,20 +50,31 @@ public class PcepMessageDecoder extends FrameDecoder {
HexDump.pcepHexDump(buffer);
// Note that a single call to decode results in reading a single
// PcepMessage from the channel buffer, which is passed on to, and processed
// by, the controller (in PcepChannelHandler).
// This is different from earlier behavior (with the original pcepIO),
// where we parsed all the messages in the buffer, before passing on
// a list of the parsed messages to the controller.
// The performance *may or may not* not be as good as before.
// Buffer can contain multiple messages, also may contain out of bound message.
// Read the message one by one from buffer and parse it. If it encountered out of bound message,
// then mark the reader index and again take the next chunk of messages from the channel
// and parse again from the marked reader index.
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
List<PcepMessage> msgList = new LinkedList<>();
List<PcepMessage> msgList = (List<PcepMessage>) ctx.getAttachment();
if (msgList == null) {
msgList = new LinkedList<>();
}
try {
while (buffer.readableBytes() > 0) {
buffer.markReaderIndex();
PcepMessage message = reader.readFrom(buffer);
msgList.add(message);
}
ctx.setAttachment(null);
return msgList;
} catch (PcepOutOfBoundMessageException e) {
log.debug("PCEP message decode error");
buffer.resetReaderIndex();
buffer.discardReadBytes();
ctx.setAttachment(msgList);
}
return null;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.pcepio.exceptions;
/**
* Custom exception for message out-of-bound.
*/
public class PcepOutOfBoundMessageException extends Exception {
private static final long serialVersionUID = 3L;
/**
* Default constructor to create a new exception.
*/
public PcepOutOfBoundMessageException() {
super();
}
/**
* Constructor to create exception from message and cause.
*
* @param message the detail of exception in string
* @param cause underlying cause of the error
*/
public PcepOutOfBoundMessageException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* Constructor to create exception from message.
*
* @param message the detail of exception in string
*/
public PcepOutOfBoundMessageException(final String message) {
super(message);
}
/**
* Constructor to create exception from cause.
*
* @param cause underlying cause of the error
*/
public PcepOutOfBoundMessageException(final Throwable cause) {
super(cause);
}
}
......@@ -21,7 +21,7 @@ package org.onosproject.pcepio.exceptions;
*/
public class PcepParseException extends Exception {
private static final long serialVersionUID = 7960991379951448423L;
private static final long serialVersionUID = 1L;
private byte errType = 0;
private byte errValue = 0;
......
......@@ -21,7 +21,7 @@ package org.onosproject.pcepio.exceptions;
*/
public class PcepTunnelAttributeException extends Exception {
private static final long serialVersionUID = 7860981378961458434L;
private static final long serialVersionUID = 2L;
/**
* Default constructor to create a new exception.
......
......@@ -15,7 +15,7 @@
*/
package org.onosproject.pcepio.protocol;
import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
......@@ -30,42 +30,42 @@ public interface PcepError {
*
* @return list of type PcepRPObject
*/
LinkedList<PcepRPObject> getRPObjList();
List<PcepRPObject> getRPObjList();
/**
* Sets the RP Objects lists.
*
* @param llRPObjList list of type PcepRPObject
* @param rpObjList list of type PcepRPObject
*/
void setRPObjList(LinkedList<PcepRPObject> llRPObjList);
void setRPObjList(List<PcepRPObject> rpObjList);
/**
* Returns the PcepTEObject List.
* Returns the PcepLSObject List.
*
* @return list of type PcepTEObject
* @return list of type PcepLSObject
*/
LinkedList<PcepTEObject> getTEObjList();
List<PcepLSObject> getLSObjList();
/**
* Sets the TE Objects lists.
* Sets the LS Objects lists.
*
* @param llTEObjList list of type PcepTEObject
* @param lsObjList list of type PcepLSObject
*/
void setTEObjList(LinkedList<PcepTEObject> llTEObjList);
void setLSObjList(List<PcepLSObject> lsObjList);
/**
* Returns the PcepErrorObject.
*
* @return list of type PcepErrorObject
*/
LinkedList<PcepErrorObject> getErrorObjList();
List<PcepErrorObject> getErrorObjList();
/**
* Sets the Error Objects lists.
*
* @param llErrorObjList list of type PcepErrorObject
* @param errorObjList list of type PcepErrorObject
*/
void setErrorObjList(LinkedList<PcepErrorObject> llErrorObjList);
void setErrorObjList(List<PcepErrorObject> errorObjList);
/**
* Writes the byte stream of PCEP error to the channel buffer.
......@@ -93,44 +93,44 @@ public interface PcepError {
*
* @return list of type PcepRPObject
*/
LinkedList<PcepRPObject> getRPObjList();
List<PcepRPObject> getRPObjList();
/**
* Sets RP Object lists and returns its builder.
*
* @param llRPObjList list of type PcepRpObject
* @param rpObjList list of type PcepRpObject
* @return builder by setting Linked list of RP Object
*/
Builder setRPObjList(LinkedList<PcepRPObject> llRPObjList);
Builder setRPObjList(List<PcepRPObject> rpObjList);
/**
* Returns the PcepTEObject.
* Returns the PcepLSObject.
*
* @return llTEObjList of type PcepTEObject
* @return lsObjList of type PcepLSObject
*/
LinkedList<PcepTEObject> getTEObjList();
List<PcepLSObject> getLSObjList();
/**
* Sets TE Object lists and returns its builder.
* Sets LS Object lists and returns its builder.
*
* @param llTEObjList list of type PcepTEObject
* @return builder by setting list of type PcepTEObject
* @param lsObjList list of type PcepLSObject
* @return builder by setting list of type PcepLSObject
*/
Builder setTEObjList(LinkedList<PcepTEObject> llTEObjList);
Builder setLSObjList(List<PcepLSObject> lsObjList);
/**
* Returns the PcepErrorObject.
*
* @return list of type PcepErrorObject
*/
LinkedList<PcepErrorObject> getErrorObjList();
List<PcepErrorObject> getErrorObjList();
/**
* Sets Error Object lists and returns its builder.
*
* @param llErrorObjList list of type PcepErrorObject
* @param errorObjList list of type PcepErrorObject
* @return builder by setting list of type PcepErrorObject
*/
Builder setErrorObjList(LinkedList<PcepErrorObject> llErrorObjList);
Builder setErrorObjList(List<PcepErrorObject> errorObjList);
}
}
......
......@@ -15,7 +15,7 @@
*/
package org.onosproject.pcepio.protocol;
import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
......@@ -54,14 +54,14 @@ public interface PcepErrorInfo {
*
* @return list of Error Value in PCEP-ERROR Object
*/
LinkedList<Integer> getErrorValue();
List<Integer> getErrorValue();
/**
* Returns Error Type in PCEP-ERROR Object.
*
* @return list of Error Type in PCEP-ERROR Object
*/
LinkedList<Integer> getErrorType();
List<Integer> getErrorType();
/**
* Builder interface with get and set functions to build ErrorInfo.
......@@ -80,7 +80,7 @@ public interface PcepErrorInfo {
*
* @return list of PcepError
*/
LinkedList<PcepError> getPcepErrorList();
List<PcepError> getPcepErrorList();
/**
* Sets PcepError lists and returns its builder.
......@@ -88,6 +88,6 @@ public interface PcepErrorInfo {
* @param llPcepErrorList list of PcepError
* @return builder by setting list of PcepError.
*/
Builder setPcepErrorList(LinkedList<PcepError> llPcepErrorList);
Builder setPcepErrorList(List<PcepError> llPcepErrorList);
}
}
......
......@@ -17,6 +17,7 @@
package org.onosproject.pcepio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.ver1.PcepFactoryVer1;
import org.slf4j.Logger;
......@@ -54,7 +55,7 @@ public final class PcepFactories {
private static class GenericReader implements PcepMessageReader<PcepMessage> {
@Override
public PcepMessage readFrom(ChannelBuffer bb) throws PcepParseException {
public PcepMessage readFrom(ChannelBuffer bb) throws PcepParseException, PcepOutOfBoundMessageException {
if (!bb.readable()) {
throw new PcepParseException("Empty message received");
......
/*
* Copyright 2015 Open Networking Laboratory
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -15,7 +15,7 @@
*/
package org.onosproject.pcepio.protocol;
import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
......@@ -23,218 +23,218 @@ import org.onosproject.pcepio.types.PcepObjectHeader;
import org.onosproject.pcepio.types.PcepValueType;
/**
* Abstraction of an entity providing PCEP TE Object.
* Abstraction of an entity providing PCEP LS Object.
*/
public interface PcepTEObject {
public interface PcepLSObject {
/**
* Returns TE object header.
* Returns LS object header.
*
* @return TE object header
* @return LS object header
*/
PcepObjectHeader getTEObjHeader();
PcepObjectHeader getLSObjHeader();
/**
* Sets TE Object header.
* Sets LS Object header.
*
* @param obj TE Object header
* @param obj LS Object header
*/
void setTEObjHeader(PcepObjectHeader obj);
void setLSObjHeader(PcepObjectHeader obj);
/**
* Returns ProtocolId in TE Object.
* Returns ProtocolId in LS Object.
*
* @return ProtocolId in TE Object
* @return ProtocolId in LS Object
*/
byte getProtocolId();
/**
* Sets ProtocolId in TE Object.
* Sets ProtocolId in LS Object.
*
* @param yProtId ProtocolId in TE Object
* @param protId ProtocolId in LS Object
*/
void setProtocolId(byte yProtId);
void setProtocolId(byte protId);
/**
* Returns R flag in TE Object.
* Returns R flag in LS Object.
*
* @return R flag in TE Object
* @return R flag in LS Object
*/
boolean getRFlag();
boolean getRemoveFlag();
/**
* Sets R flag in TE Object.
* Sets R flag in LS Object.
*
* @param bRFlag R flag in TE Object
* @param removeFlag R flag in LS Object
*/
void setRFlag(boolean bRFlag);
void setRemoveFlag(boolean removeFlag);
/**
* Returns S flag in TE Object.
* Returns sync flag in LS Object.
*
* @return S flag in TE Object
* @return sync flag in LS Object
*/
boolean getSFlag();
boolean getSyncFlag();
/**
* Sets S flag in TE Object.
* Sets sync flag in LS Object.
*
* @param bSFlag S flag in TE Object
* @param syncFlag sync flag in LS Object
*/
void setSFlag(boolean bSFlag);
void setSyncFlag(boolean syncFlag);
/**
* Returns TE ID in TE Object.
* Returns LS ID in LS Object.
*
* @return TE ID in TE Object
* @return LS ID in LS Object
*/
int getTEId();
long getLSId();
/**
* Sets TE ID in TE Object.
* Sets LS ID in LS Object.
*
* @param iTEId TE ID in TE Object
* @param lsId LS ID in LS Object
*/
void setTEId(int iTEId);
void setLSId(long lsId);
/**
* Returns list of Optional Tlvs in TE Object.
* Returns list of Optional Tlvs in LS Object.
*
* @return list of Optional Tlvs
*/
LinkedList<PcepValueType> getOptionalTlv();
List<PcepValueType> getOptionalTlv();
/**
* Sets list of Optional Tlvs in TE Object.
* Sets list of Optional Tlvs in LS Object.
*
* @param llOptionalTlv list of Optional Tlvs
* @param optionalTlvList list of Optional Tlvs
*/
void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
void setOptionalTlv(List<PcepValueType> optionalTlvList);
/**
* Writes the TE Object into channel buffer.
* Writes the LS Object into channel buffer.
*
* @param bb channel buffer
* @return Returns the writerIndex of this buffer
* @throws PcepParseException when obj header is not written to channel buffer
* @throws PcepParseException when object header is not written to channel buffer
*/
int write(ChannelBuffer bb) throws PcepParseException;
/**
* Builder interface with get and set functions to build TE object.
* Builder interface with get and set functions to build LS object.
*/
interface Builder {
/**
* Builds TE Object.
* Builds LS Object.
*
* @return TE Object
* @return LS Object
*/
PcepTEObject build();
PcepLSObject build();
/**
* Returns TE object header.
* Returns LS object header.
*
* @return TE object header
* @return LS object header
*/
PcepObjectHeader getTEObjHeader();
PcepObjectHeader getLSObjHeader();
/**
* Sets TE object header and returns its builder.
* Sets LS object header and returns its builder.
*
* @param obj TE object header
* @return Builder by setting TE object header
* @param obj LS object header
* @return Builder by setting LS object header
*/
Builder setTEObjHeader(PcepObjectHeader obj);
Builder setLSObjHeader(PcepObjectHeader obj);
/**
* Returns ProtocolId in TE Object.
* Returns ProtocolId in LS Object.
*
* @return ProtocolId in TE Object
* @return ProtocolId in LS Object
*/
byte getProtocolId();
/**
* Sets ProtocolId in TE Object and returns its builder.
* Sets ProtocolId in LS Object and returns its builder.
*
* @param yProtId ProtocolId in TE Object
* @param protId ProtocolId in LS Object
* @return Builder by setting ProtocolId
*/
Builder setProtocolId(byte yProtId);
Builder setProtocolId(byte protId);
/**
* Returns R flag in TE Object.
* Returns R flag in LS Object.
*
* @return R flag in TE Object
* @return R flag in LS Object
*/
boolean getRFlag();
boolean getRemoveFlag();
/**
* Sets R flag in TE Object and returns its builder.
* Sets R flag in LS Object and returns its builder.
*
* @param bRFlag R flag in TE Object
* @param removeFlag R flag in LS Object
* @return Builder by setting R flag
*/
Builder setRFlag(boolean bRFlag);
Builder setRemoveFlag(boolean removeFlag);
/**
* Returns S flag in TE Object.
* Returns sync flag in LS Object.
*
* @return S flag in TE Object
* @return sync flag in LS Object
*/
boolean getSFlag();
boolean getSyncFlag();
/**
* Sets S flag in TE Object and returns its builder.
* Sets sync flag in LS Object and returns its builder.
*
* @param bSFlag S flag in TE Object
* @return Builder by setting S flag
* @param syncFlag sync flag in LS Object
* @return Builder by setting sync flag
*/
Builder setSFlag(boolean bSFlag);
Builder setSyncFlag(boolean syncFlag);
/**
* Returns TE ID in TE Object.
* Returns LS ID in LS Object.
*
* @return TE ID in TE Object
* @return LS ID in LS Object
*/
int getTEId();
long getLSId();
/**
* Sets TE ID in TE Object and returns its builder.
* Sets LS ID in LS Object and returns its builder.
*
* @param iTEId TE ID in TE Object
* @return Builder by setting TE ID
* @param lsId LS ID in LS Object
* @return Builder by setting LS ID
*/
Builder setTEId(int iTEId);
Builder setLSId(long lsId);
/**
* Returns list of Optional Tlvs in TE Object.
* Returns list of Optional Tlvs in LS Object.
*
* @return list of Optional Tlvs
*/
LinkedList<PcepValueType> getOptionalTlv();
List<PcepValueType> getOptionalTlv();
/**
* Sets list of Optional Tlvs in TE Object and returns its builder.
* Sets list of Optional Tlvs in LS Object and returns its builder.
*
* @param llOptionalTlv list of Optional Tlvs
* @param optionalTlvList list of Optional Tlvs
* @return Builder by setting list of Optional Tlvs
*/
Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
Builder setOptionalTlv(List<PcepValueType> optionalTlvList);
/**
* Sets P flag in TE object header and returns its builder.
* Sets Processing rule flag in LS object header and returns its builder.
*
* @param value boolean value to set P flag
* @return Builder by setting P flag
* @param value boolean value to set Processing rule flag
* @return Builder by setting Processing rule flag
*/
Builder setPFlag(boolean value);
/**
* Sets I flag in TE object header and returns its builder.
* Sets Ignore flag in LS object header and returns its builder.
*
* @param value boolean value to set I flag
* @return Builder by setting I flag
* @param value boolean value to set Ignore flag
* @return Builder by setting Ignore flag
*/
Builder setIFlag(boolean value);
}
......
......@@ -16,15 +16,15 @@
package org.onosproject.pcepio.protocol;
import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
/**
* Abstraction of an entity providing PCEP TE Report Message.
* Abstraction of an entity providing PCEP LS-Report Message.
*/
public interface PcepTEReportMsg extends PcepObject, PcepMessage {
public interface PcepLSReportMsg extends PcepObject, PcepMessage {
@Override
PcepVersion getVersion();
......@@ -33,29 +33,29 @@ public interface PcepTEReportMsg extends PcepObject, PcepMessage {
PcepType getType();
/**
* Returns list of PCEP TE Objects.
* Returns list of PCEP LS Objects.
*
* @return list of PCEP TE Objects
* @return list of PCEP LS Objects
*/
LinkedList<PcepTEObject> getTEReportList();
List<PcepLSObject> getLSReportList();
/**
* Sets list of Optional Tlvs in TE Report Message.
* Sets list of Optional Tlvs in LS-Report Message.
*
* @param llTEReportList list of optional Tlvs
* @param lsReportList list of optional Tlvs
*/
void setTEReportList(LinkedList<PcepTEObject> llTEReportList);
void setLSReportList(List<PcepLSObject> lsReportList);
@Override
void writeTo(ChannelBuffer channelBuffer) throws PcepParseException;
/**
* Builder interface with get and set functions to build TE Report message.
* Builder interface with get and set functions to build LS-Report message.
*/
interface Builder extends PcepMessage.Builder {
@Override
PcepTEReportMsg build();
PcepLSReportMsg build();
@Override
PcepVersion getVersion();
......@@ -64,18 +64,18 @@ public interface PcepTEReportMsg extends PcepObject, PcepMessage {
PcepType getType();
/**
* Returns list of Optional Tlv in TE Report Message.
* Returns list of LS Object in LS Report Message.
*
* @return list of Optional Tlv
* @return list of LS Objects
*/
LinkedList<PcepTEObject> getTEReportList();
List<PcepLSObject> getLSReportList();
/**
* Sets list of Optional Tlvs and returns its builder.
* Sets list of LS Objects and returns its builder.
*
* @param llTEReportList list of Optional Tlvs
* @return Builder object for TE report message
* @param lsReportList list of LS Objects
* @return Builder object for LS-Report message
*/
Builder setTEReportList(LinkedList<PcepTEObject> llTEReportList);
Builder setLSReportList(List<PcepLSObject> lsReportList);
}
}
......
......@@ -17,6 +17,7 @@
package org.onosproject.pcepio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException;
import org.onosproject.pcepio.exceptions.PcepParseException;
/**
......@@ -32,5 +33,5 @@ public interface PcepMessageReader<T> {
* @throws PcepParseException while parsing PCEP message.
* @throws PcepParseException when received message is empty
*/
T readFrom(ChannelBuffer bb) throws PcepParseException;
T readFrom(ChannelBuffer bb) throws PcepParseException, PcepOutOfBoundMessageException;
}
......
......@@ -22,8 +22,8 @@ package org.onosproject.pcepio.protocol;
public enum PcepType {
NONE(0), OPEN(1), KEEP_ALIVE(2), PATH_COMPUTATION_REQUEST(3), PATH_COMPUTATION_REPLY(4),
NOTIFICATION(5), ERROR(6), CLOSE(7), REPORT(10), UPDATE(11), INITIATE(12), LABEL_UPDATE(13),
TE_REPORT(14), LABEL_RANGE_RESERV(15), MAX(16), END(17);
NOTIFICATION(5), ERROR(6), CLOSE(7), REPORT(10), UPDATE(11), INITIATE(12),
LS_REPORT(224), LABEL_RANGE_RESERV(225), LABEL_UPDATE(226), MAX(227), END(228);
int iValue;
......
......@@ -22,7 +22,7 @@ import java.util.ListIterator;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepEroObject;
import org.onosproject.pcepio.types.AutonomousSystemTlv;
import org.onosproject.pcepio.types.AutonomousSystemNumberSubObject;
import org.onosproject.pcepio.types.IPv4SubObject;
import org.onosproject.pcepio.types.IPv6SubObject;
import org.onosproject.pcepio.types.PathKeySubObject;
......@@ -147,32 +147,32 @@ public class PcepEroObjectVer1 implements PcepEroObject {
public static final int LABEL_SUB_OBJ_TYPE = 3;
public static final int SR_ERO_SUB_OBJ_TYPE = 96;
public static final int OBJECT_HEADER_LENGTH = 4;
public static final int YTYPE_SHIFT_VALUE = 0x7F;
public static final int TYPE_SHIFT_VALUE = 0x7F;
static final PcepObjectHeader DEFAULT_ERO_OBJECT_HEADER = new PcepObjectHeader(ERO_OBJ_CLASS, ERO_OBJ_TYPE,
public static final PcepObjectHeader DEFAULT_ERO_OBJECT_HEADER = new PcepObjectHeader(ERO_OBJ_CLASS, ERO_OBJ_TYPE,
PcepObjectHeader.REQ_OBJ_OPTIONAL_PROCESS, PcepObjectHeader.RSP_OBJ_PROCESSED, ERO_OBJ_MINIMUM_LENGTH);
private PcepObjectHeader eroObjHeader;
private LinkedList<PcepValueType> llSubObjects = new LinkedList<>();
private LinkedList<PcepValueType> subObjectList = new LinkedList<>();
/**
* reset variables.
*/
public PcepEroObjectVer1() {
this.eroObjHeader = null;
this.llSubObjects = null;
this.subObjectList = null;
}
/**
* Constructor to initialize parameters of ERO object.
*
* @param eroObjHeader ERO object header
* @param llSubObjects list of sub objects.
* @param subObjectList list of sub objects.
*/
public PcepEroObjectVer1(PcepObjectHeader eroObjHeader, LinkedList<PcepValueType> llSubObjects) {
public PcepEroObjectVer1(PcepObjectHeader eroObjHeader, LinkedList<PcepValueType> subObjectList) {
this.eroObjHeader = eroObjHeader;
this.llSubObjects = llSubObjects;
this.subObjectList = subObjectList;
}
/**
......@@ -195,12 +195,12 @@ public class PcepEroObjectVer1 implements PcepEroObject {
@Override
public LinkedList<PcepValueType> getSubObjects() {
return this.llSubObjects;
return this.subObjectList;
}
@Override
public void setSubObjects(LinkedList<PcepValueType> llSubObjects) {
this.llSubObjects = llSubObjects;
public void setSubObjects(LinkedList<PcepValueType> subObjectList) {
this.subObjectList = subObjectList;
}
/**
......@@ -213,7 +213,7 @@ public class PcepEroObjectVer1 implements PcepEroObject {
public static PcepEroObject read(ChannelBuffer cb) throws PcepParseException {
PcepObjectHeader eroObjHeader;
LinkedList<PcepValueType> llSubObjects = new LinkedList<>();
LinkedList<PcepValueType> subObjectList = new LinkedList<>();
eroObjHeader = PcepObjectHeader.read(cb);
......@@ -225,9 +225,9 @@ public class PcepEroObjectVer1 implements PcepEroObject {
if (eroObjHeader.getObjLen() > OBJECT_HEADER_LENGTH) {
ChannelBuffer tempCb = cb.readBytes(eroObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);
llSubObjects = parseSubObjects(tempCb);
subObjectList = parseSubObjects(tempCb);
}
return new PcepEroObjectVer1(eroObjHeader, llSubObjects);
return new PcepEroObjectVer1(eroObjHeader, subObjectList);
}
/**
......@@ -239,18 +239,18 @@ public class PcepEroObjectVer1 implements PcepEroObject {
*/
protected static LinkedList<PcepValueType> parseSubObjects(ChannelBuffer cb) throws PcepParseException {
LinkedList<PcepValueType> llSubObjects = new LinkedList<>();
LinkedList<PcepValueType> subObjectList = new LinkedList<>();
while (0 < cb.readableBytes()) {
//check the Type of the TLV
byte yType = cb.readByte();
yType = (byte) (yType & (YTYPE_SHIFT_VALUE));
short type = cb.readByte();
type = (short) (type & (TYPE_SHIFT_VALUE));
byte hLength = cb.readByte();
PcepValueType subObj;
switch (yType) {
switch (type) {
case IPv4SubObject.TYPE:
subObj = IPv4SubObject.read(cb);
......@@ -260,8 +260,8 @@ public class PcepEroObjectVer1 implements PcepEroObject {
cb.readBytes(ipv6Value, 0, IPv6SubObject.VALUE_LENGTH);
subObj = new IPv6SubObject(ipv6Value);
break;
case AutonomousSystemTlv.TYPE:
subObj = AutonomousSystemTlv.read(cb);
case AutonomousSystemNumberSubObject.TYPE:
subObj = AutonomousSystemNumberSubObject.read(cb);
break;
case PathKeySubObject.TYPE:
subObj = PathKeySubObject.read(cb);
......@@ -270,7 +270,7 @@ public class PcepEroObjectVer1 implements PcepEroObject {
subObj = SrEroSubObject.read(cb);
break;
default:
throw new PcepParseException("Unexpected sub object. Type: " + (int) yType);
throw new PcepParseException("Unexpected sub object. Type: " + (int) type);
}
// Check for the padding
int pad = hLength % 4;
......@@ -281,12 +281,12 @@ public class PcepEroObjectVer1 implements PcepEroObject {
}
}
llSubObjects.add(subObj);
subObjectList.add(subObj);
}
if (0 < cb.readableBytes()) {
throw new PcepParseException("Subobject parsing error. Extra bytes received.");
}
return llSubObjects;
return subObjectList;
}
@Override
......@@ -301,7 +301,7 @@ public class PcepEroObjectVer1 implements PcepEroObject {
throw new PcepParseException("Failed to write ERO object header. Index " + objLenIndex);
}
ListIterator<PcepValueType> listIterator = llSubObjects.listIterator();
ListIterator<PcepValueType> listIterator = subObjectList.listIterator();
while (listIterator.hasNext()) {
listIterator.next().write(cb);
......@@ -342,7 +342,7 @@ public class PcepEroObjectVer1 implements PcepEroObject {
private boolean bIFlag;
private PcepObjectHeader eroObjHeader;
LinkedList<PcepValueType> llSubObjects = new LinkedList<>();
LinkedList<PcepValueType> subObjectList = new LinkedList<>();
@Override
public PcepEroObject build() {
......@@ -357,7 +357,7 @@ public class PcepEroObjectVer1 implements PcepEroObject {
eroObjHeader.setIFlag(bIFlag);
}
return new PcepEroObjectVer1(eroObjHeader, this.llSubObjects);
return new PcepEroObjectVer1(eroObjHeader, this.subObjectList);
}
@Override
......@@ -374,12 +374,12 @@ public class PcepEroObjectVer1 implements PcepEroObject {
@Override
public LinkedList<PcepValueType> getSubObjects() {
return this.llSubObjects;
return this.subObjectList;
}
@Override
public Builder setSubObjects(LinkedList<PcepValueType> llSubObjects) {
this.llSubObjects = llSubObjects;
public Builder setSubObjects(LinkedList<PcepValueType> subObjectList) {
this.subObjectList = subObjectList;
return this;
}
......@@ -400,8 +400,9 @@ public class PcepEroObjectVer1 implements PcepEroObject {
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("EroObjHeader", eroObjHeader).add("SubObjects", llSubObjects)
return MoreObjects.toStringHelper(getClass()).omitNullValues()
.add("EroObjHeader", eroObjHeader)
.add("SubObjects", subObjectList)
.toString();
}
}
......
......@@ -16,6 +16,7 @@
package org.onosproject.pcepio.protocol.ver1;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.jboss.netty.buffer.ChannelBuffer;
......@@ -24,7 +25,7 @@ import org.onosproject.pcepio.protocol.PcepError;
import org.onosproject.pcepio.protocol.PcepErrorInfo;
import org.onosproject.pcepio.protocol.PcepErrorObject;
import org.onosproject.pcepio.protocol.PcepRPObject;
import org.onosproject.pcepio.protocol.PcepTEObject;
import org.onosproject.pcepio.protocol.PcepLSObject;
import org.onosproject.pcepio.types.PcepObjectHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -33,26 +34,26 @@ import com.google.common.base.MoreObjects;
/**
* Provides PCEP Error Info.
* Reference :PCEP Extension for Transporting TE Data draft-dhodylee-pce-pcep-te-data-extn-02.
* Reference : draft-dhodylee-pce-pcep-ls-01, section 8.2.
*/
public class PcepErrorInfoVer1 implements PcepErrorInfo {
protected static final Logger log = LoggerFactory.getLogger(PcepErrorInfoVer1.class);
//Error list is optional
private LinkedList<PcepError> errList;
private List<PcepError> errList;
/**
* Constructor to add PCEP error object to the list.
*
* @param llRPObjList list of PCEP RP object
* @param llTEObjList list of PCEP TE object
* @param llLSObjList list of PCEP LS object
* @param llErrObjList list of PCEP error object
*/
public PcepErrorInfoVer1(LinkedList<PcepRPObject> llRPObjList, LinkedList<PcepTEObject> llTEObjList,
LinkedList<PcepErrorObject> llErrObjList) {
public PcepErrorInfoVer1(List<PcepRPObject> llRPObjList, List<PcepLSObject> llLSObjList,
List<PcepErrorObject> llErrObjList) {
this.errList = new LinkedList<>();
if ((llErrObjList != null) && (!llErrObjList.isEmpty())) {
this.errList.add(new PcepErrorVer1(llRPObjList, llTEObjList, llErrObjList));
this.errList.add(new PcepErrorVer1(llRPObjList, llLSObjList, llErrObjList));
}
}
......@@ -61,7 +62,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
*
* @param errll linked list or pcep error
*/
public PcepErrorInfoVer1(LinkedList<PcepError> errll) {
public PcepErrorInfoVer1(List<PcepError> errll) {
this.errList = errll;
}
......@@ -79,7 +80,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
tempObjHeader = PcepObjectHeader.read(cb);
cb.resetReaderIndex();
byte yObjClass = tempObjHeader.getObjClass();
if ((yObjClass != PcepRPObjectVer1.RP_OBJ_CLASS) && (yObjClass != PcepTEObjectVer1.TE_OBJ_CLASS)
if ((yObjClass != PcepRPObjectVer1.RP_OBJ_CLASS) && (yObjClass != PcepLSObjectVer1.LS_OBJ_CLASS)
&& (yObjClass != PcepErrorObjectVer1.ERROR_OBJ_CLASS)) {
throw new PcepParseException("Unknown Object is present in PCEP-ERROR. Object Class: " + yObjClass);
}
......@@ -96,7 +97,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
PcepError pcepError = listIterator.next();
//RP Object list is optional
LinkedList<PcepRPObject> llRPObjList = pcepError.getRPObjList();
List<PcepRPObject> llRPObjList = pcepError.getRPObjList();
if (llRPObjList != null) {
ListIterator<PcepRPObject> rpListIterator = llRPObjList.listIterator();
while (rpListIterator.hasNext()) {
......@@ -104,10 +105,10 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
}
}
//TE Object list is optional
LinkedList<PcepTEObject> llTEObjList = pcepError.getTEObjList();
if (llTEObjList != null) {
ListIterator<PcepTEObject> teListIterator = llTEObjList.listIterator();
//LS Object list is optional
List<PcepLSObject> llLSObjList = pcepError.getLSObjList();
if (llLSObjList != null) {
ListIterator<PcepLSObject> teListIterator = llLSObjList.listIterator();
while (teListIterator.hasNext()) {
teListIterator.next().write(cb);
}
......@@ -116,7 +117,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
// <error-obj-list> is mandatory
boolean bIsErrorObjListFound = false;
LinkedList<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
List<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
if (llErrObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llErrObjList.listIterator();
while (errObjListIterator.hasNext()) {
......@@ -132,14 +133,14 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
}
@Override
public LinkedList<Integer> getErrorType() {
LinkedList<Integer> errorType = new LinkedList<>();
public List<Integer> getErrorType() {
List<Integer> errorType = new LinkedList<>();
ListIterator<PcepError> listIterator = errList.listIterator();
PcepErrorObject errObj;
int error;
while (listIterator.hasNext()) {
PcepError pcepError = listIterator.next();
LinkedList<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
List<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
if (llErrObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llErrObjList.listIterator();
while (errObjListIterator.hasNext()) {
......@@ -153,14 +154,14 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
}
@Override
public LinkedList<Integer> getErrorValue() {
LinkedList<Integer> errorValue = new LinkedList<>();
public List<Integer> getErrorValue() {
List<Integer> errorValue = new LinkedList<>();
ListIterator<PcepError> listIterator = errList.listIterator();
PcepErrorObject errObj;
int error;
while (listIterator.hasNext()) {
PcepError pcepError = listIterator.next();
LinkedList<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
List<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
if (llErrObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llErrObjList.listIterator();
while (errObjListIterator.hasNext()) {
......@@ -177,7 +178,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
* Builder class for PCEP error info.
*/
public static class Builder implements PcepErrorInfo.Builder {
private LinkedList<PcepError> errll;
private List<PcepError> errll;
@Override
public PcepErrorInfo build() {
......@@ -185,12 +186,12 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
}
@Override
public LinkedList<PcepError> getPcepErrorList() {
public List<PcepError> getPcepErrorList() {
return this.errll;
}
@Override
public Builder setPcepErrorList(LinkedList<PcepError> errll) {
public Builder setPcepErrorList(List<PcepError> errll) {
this.errll = errll;
return this;
}
......
......@@ -16,6 +16,7 @@
package org.onosproject.pcepio.protocol.ver1;
import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
......@@ -42,6 +43,7 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
/*
* PCE Error message format.
Reference: draft-dhodylee-pce-pcep-ls-01, section 8.2.
<PCErr Message> ::= <Common Header>
( <error-obj-list> [<Open>] ) | <error>
......@@ -49,12 +51,12 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
<error-obj-list> ::=<PCEP-ERROR>[<error-obj-list>]
<error> ::=[<request-id-list> | <te-id-list>]
<error> ::=[<request-id-list> | <ls-id-list>]
<error-obj-list>
<request-id-list> ::=<RP>[<request-id-list>]
<te-id-list> ::=<TE>[<te-id-list>]
<ls-id-list> ::=<LS>[<ls-id-list>]
<error-list> ::=<error>[<error-list>]
*/
......@@ -71,7 +73,7 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
public static final PcepErrorMsgVer1.Reader READER = new Reader();
/**
* constructor to initialize variables.
* Constructor to initialize variables.
*/
public PcepErrorMsgVer1() {
errObjListWithOpen = null;
......@@ -128,7 +130,7 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
//parse <PCErr Message>
parsePCErrMsg(cb);
// If other than RP or TE or PCEP-ERROR present then it is error.
// If other than RP or LS or PCEP-ERROR present then it is error.
if (0 < cb.readableBytes()) {
PcepObjectHeader tempObjHeader = PcepObjectHeader.read(cb);
throw new PcepParseException("Unexpected Object found. Object Class : " + tempObjHeader.getObjClass());
......@@ -147,10 +149,10 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
public void parsePCErrMsg(ChannelBuffer cb) throws PcepParseException {
//If PCEP-ERROR list is followed by OPEN Object then store into ErrorObjListWithOpen.
// ( <error-obj-list> [<Open>]
//If PCEP-ERROR list is followed by RP or TE Object then store into errInfo. <error> [<error-list>]
//If PCEP-ERROR list is followed by RP or LS Object then store into errInfo. <error> [<error-list>]
//If only PCEP-ERROR list is present then store into ErrorObjListWithOpen.
PcepObjectHeader tempObjHeader;
LinkedList<PcepErrorObject> llErrObjList;
List<PcepErrorObject> llErrObjList;
if (0 >= cb.readableBytes()) {
throw new PcepParseException("PCEP-ERROR message came with empty objects.");
......@@ -171,9 +173,9 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
PcepOpenObject pcepOpenObj = PcepOpenObjectVer1.read(cb);
this.errObjListWithOpen = new ErrorObjListWithOpen(llErrObjList, pcepOpenObj);
} else if ((tempObjHeader != null) //check whether RP or TE Object is present.
} else if ((tempObjHeader != null) //check whether RP or LS Object is present.
&& ((tempObjHeader.getObjClass() == PcepRPObjectVer1.RP_OBJ_CLASS)
|| (tempObjHeader.getObjClass() == PcepTEObjectVer1.TE_OBJ_CLASS))) {
|| (tempObjHeader.getObjClass() == PcepLSObjectVer1.LS_OBJ_CLASS))) {
this.errInfo = new PcepErrorInfoVer1(null, null, llErrObjList);
this.errInfo.read(cb);
......@@ -194,7 +196,7 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
* @throws PcepParseException if mandatory fields are missing
* @return error object header
*/
public PcepObjectHeader parseErrorObjectList(LinkedList<PcepErrorObject> llErrObjList, ChannelBuffer cb)
public PcepObjectHeader parseErrorObjectList(List<PcepErrorObject> llErrObjList, ChannelBuffer cb)
throws PcepParseException {
PcepObjectHeader tempObjHeader = null;
......@@ -337,8 +339,8 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
*
* @return error types list
*/
public LinkedList<Integer> getErrorType() {
LinkedList<Integer> llErrorType = new LinkedList<>();
public List<Integer> getErrorType() {
List<Integer> llErrorType = new LinkedList<>();
if ((errObjListWithOpen != null)
&& (errObjListWithOpen.isErrorObjListWithOpenPresent())) {
llErrorType = errObjListWithOpen.getErrorType();
......@@ -354,8 +356,8 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
*
* @return error value list
*/
public LinkedList<Integer> getErrorValue() {
LinkedList<Integer> llErrorValue = new LinkedList<>();
public List<Integer> getErrorValue() {
List<Integer> llErrorValue = new LinkedList<>();
if ((errObjListWithOpen != null)
&& (errObjListWithOpen.isErrorObjListWithOpenPresent())) {
llErrorValue = errObjListWithOpen.getErrorValue();
......@@ -368,7 +370,7 @@ public class PcepErrorMsgVer1 implements PcepErrorMsg {
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()).omitNullValues();
if ((errObjListWithOpen != null)
&& (errObjListWithOpen.isErrorObjListWithOpenPresent())) {
......
......@@ -60,25 +60,25 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
ERROR_OBJ_MINIMUM_LENGTH);
private PcepObjectHeader errorObjHeader;
private byte yErrorType;
private byte yErrorValue;
private LinkedList<PcepValueType> llOptionalTlv; // Optional TLV
private byte errorType;
private byte errorValue;
private LinkedList<PcepValueType> optionalTlv; // Optional TLV
/**
* Constructor to initialize variables.
*
* @param errorObjHeader ERROR Object header
* @param yErrorType Error Type
* @param yErrorValue Error Value
* @param llOptionalTlv list of optional TLV
* @param errorType Error Type
* @param errorValue Error Value
* @param optionalTlv list of optional TLV
*/
public PcepErrorObjectVer1(PcepObjectHeader errorObjHeader, byte yErrorType, byte yErrorValue,
LinkedList<PcepValueType> llOptionalTlv) {
public PcepErrorObjectVer1(PcepObjectHeader errorObjHeader, byte errorType, byte errorValue,
LinkedList<PcepValueType> optionalTlv) {
this.errorObjHeader = errorObjHeader;
this.yErrorType = yErrorType;
this.yErrorValue = yErrorValue;
this.llOptionalTlv = llOptionalTlv;
this.errorType = errorType;
this.errorValue = errorValue;
this.optionalTlv = optionalTlv;
}
/**
......@@ -91,13 +91,13 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
}
@Override
public void setErrorType(byte yErrorType) {
this.yErrorType = yErrorType;
public void setErrorType(byte errorType) {
this.errorType = errorType;
}
@Override
public void setErrorValue(byte yErrorValue) {
this.yErrorValue = yErrorValue;
public void setErrorValue(byte errorValue) {
this.errorValue = errorValue;
}
/**
......@@ -111,22 +111,22 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
@Override
public int getErrorType() {
return this.yErrorType;
return this.errorType;
}
@Override
public byte getErrorValue() {
return this.yErrorValue;
return this.errorValue;
}
@Override
public LinkedList<PcepValueType> getOptionalTlv() {
return this.llOptionalTlv;
return this.optionalTlv;
}
@Override
public void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv) {
this.llOptionalTlv = llOptionalTlv;
public void setOptionalTlv(LinkedList<PcepValueType> optionalTlv) {
this.optionalTlv = optionalTlv;
}
/**
......@@ -138,9 +138,9 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
public static PcepErrorObject read(ChannelBuffer cb) {
PcepObjectHeader errorObjHeader;
byte yErrorType;
byte yErrorValue;
LinkedList<PcepValueType> llOptionalTlv;
byte errorType;
byte errorValue;
LinkedList<PcepValueType> optionalTlv;
errorObjHeader = PcepObjectHeader.read(cb);
......@@ -148,12 +148,12 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
ChannelBuffer tempCb = cb.readBytes(errorObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);
tempCb.readByte(); //ignore Reserved
tempCb.readByte(); //ignore Flags
yErrorType = tempCb.readByte();
yErrorValue = tempCb.readByte();
errorType = tempCb.readByte();
errorValue = tempCb.readByte();
llOptionalTlv = parseOptionalTlv(tempCb);
optionalTlv = parseOptionalTlv(tempCb);
return new PcepErrorObjectVer1(errorObjHeader, yErrorType, yErrorValue, llOptionalTlv);
return new PcepErrorObjectVer1(errorObjHeader, errorType, errorValue, optionalTlv);
}
/**
......@@ -189,8 +189,8 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
//write Flags
cb.writeByte(0);
//write ErrorType and ErrorValue
cb.writeByte(this.yErrorType);
cb.writeByte(this.yErrorValue);
cb.writeByte(this.errorType);
cb.writeByte(this.errorValue);
// Add optional TLV
packOptionalTlv(cb);
......@@ -222,7 +222,7 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
*/
protected int packOptionalTlv(ChannelBuffer cb) {
ListIterator<PcepValueType> listIterator = llOptionalTlv.listIterator();
ListIterator<PcepValueType> listIterator = optionalTlv.listIterator();
int startIndex = cb.writerIndex();
while (listIterator.hasNext()) {
PcepValueType tlv = listIterator.next();
......@@ -245,8 +245,8 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
private boolean bIsHeaderSet = false;
private PcepObjectHeader errorObjHeader;
private byte yErrorType;
private byte yErrorValue;
private byte errorType;
private byte errorValue;
private boolean bIsPFlagSet = false;
private boolean bPFlag;
......@@ -254,7 +254,7 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
private boolean bIsIFlagSet = false;
private boolean bIFlag;
private LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
private LinkedList<PcepValueType> optionalTlv = new LinkedList<>();
@Override
public PcepErrorObject build() {
......@@ -269,7 +269,7 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
errorObjHeader.setIFlag(bIFlag);
}
return new PcepErrorObjectVer1(errorObjHeader, yErrorType, yErrorValue, llOptionalTlv);
return new PcepErrorObjectVer1(errorObjHeader, errorType, errorValue, optionalTlv);
}
@Override
......@@ -286,35 +286,35 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
@Override
public int getErrorType() {
return this.yErrorType;
return this.errorType;
}
@Override
public Builder setErrorType(byte value) {
this.yErrorType = value;
this.errorType = value;
return this;
}
@Override
public byte getErrorValue() {
return this.yErrorValue;
return this.errorValue;
}
@Override
public Builder setErrorValue(byte value) {
this.yErrorValue = value;
this.errorValue = value;
return this;
}
@Override
public Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv) {
this.llOptionalTlv = llOptionalTlv;
public Builder setOptionalTlv(LinkedList<PcepValueType> optionalTlv) {
this.optionalTlv = optionalTlv;
return this;
}
@Override
public LinkedList<PcepValueType> getOptionalTlv() {
return this.llOptionalTlv;
return this.optionalTlv;
}
@Override
......@@ -335,7 +335,7 @@ public class PcepErrorObjectVer1 implements PcepErrorObject {
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("ObjectHeader", errorObjHeader).add("ErrorType", yErrorType)
.add("ErrorValue", yErrorValue).add("OptionalTlv", llOptionalTlv).toString();
.add("ObjectHeader", errorObjHeader).add("ErrorType", errorType)
.add("ErrorValue", errorValue).add("OptionalTlv", optionalTlv).toString();
}
}
......
......@@ -47,12 +47,12 @@ public class PcepFecObjectIPv4AdjacencyVer1 implements PcepFecObjectIPv4Adjacenc
protected static final Logger log = LoggerFactory.getLogger(PcepFecObjectIPv4AdjacencyVer1.class);
public static final byte FEC_OBJ_TYPE = 3;
public static final byte FEC_OBJ_CLASS = 36; //to be defined
public static final byte FEC_OBJ_CLASS = (byte) 226;
public static final byte FEC_OBJECT_VERSION = 1;
public static final short FEC_OBJ_MINIMUM_LENGTH = 12;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
static final PcepObjectHeader DEFAULT_FEC_OBJECT_HEADER = new PcepObjectHeader(FEC_OBJ_CLASS, FEC_OBJ_TYPE,
public static final PcepObjectHeader DEFAULT_FEC_OBJECT_HEADER = new PcepObjectHeader(FEC_OBJ_CLASS, FEC_OBJ_TYPE,
PcepObjectHeader.REQ_OBJ_OPTIONAL_PROCESS, PcepObjectHeader.RSP_OBJ_PROCESSED, FEC_OBJ_MINIMUM_LENGTH);
private PcepObjectHeader fecObjHeader;
......
......@@ -51,7 +51,7 @@ public class PcepFecObjectIPv4UnnumberedAdjacencyVer1 implements PcepFecObjectIP
protected static final Logger log = LoggerFactory.getLogger(PcepFecObjectIPv4UnnumberedAdjacencyVer1.class);
public static final byte FEC_OBJ_TYPE = 5;
public static final byte FEC_OBJ_CLASS = 63; //to be defined
public static final byte FEC_OBJ_CLASS = (byte) 226;
public static final byte FEC_OBJECT_VERSION = 1;
public static final short FEC_OBJ_MINIMUM_LENGTH = 20;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
......
......@@ -45,7 +45,7 @@ public class PcepFecObjectIPv4Ver1 implements PcepFecObjectIPv4 {
protected static final Logger log = LoggerFactory.getLogger(PcepFecObjectIPv4Ver1.class);
public static final byte FEC_OBJ_TYPE = 1;
public static final byte FEC_OBJ_CLASS = 63; //to be defined
public static final byte FEC_OBJ_CLASS = (byte) 226;
public static final byte FEC_OBJECT_VERSION = 1;
public static final short FEC_OBJ_MINIMUM_LENGTH = 8;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
......
......@@ -51,7 +51,7 @@ public class PcepFecObjectIPv6AdjacencyVer1 implements PcepFecObjectIPv6Adjacenc
protected static final Logger log = LoggerFactory.getLogger(PcepFecObjectIPv6AdjacencyVer1.class);
public static final byte FEC_OBJ_TYPE = 4;
public static final byte FEC_OBJ_CLASS = 63; //to be defined
public static final byte FEC_OBJ_CLASS = (byte) 226;
public static final byte FEC_OBJECT_VERSION = 1;
public static final short FEC_OBJ_MINIMUM_LENGTH = 36;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
......
......@@ -47,7 +47,7 @@ public class PcepFecObjectIPv6Ver1 implements PcepFecObjectIPv6 {
protected static final Logger log = LoggerFactory.getLogger(PcepFecObjectIPv6Ver1.class);
public static final byte FEC_OBJ_TYPE = 2;
public static final byte FEC_OBJ_CLASS = 63; //to be defined
public static final byte FEC_OBJ_CLASS = (byte) 226;
public static final byte FEC_OBJECT_VERSION = 1;
public static final short FEC_OBJ_MINIMUM_LENGTH = 20;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
......
......@@ -16,6 +16,7 @@
package org.onosproject.pcepio.protocol.ver1;
import java.util.List;
import java.util.LinkedList;
import java.util.ListIterator;
......@@ -23,8 +24,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepMessageReader;
import org.onosproject.pcepio.protocol.PcepMessageWriter;
import org.onosproject.pcepio.protocol.PcepTEObject;
import org.onosproject.pcepio.protocol.PcepTEReportMsg;
import org.onosproject.pcepio.protocol.PcepLSObject;
import org.onosproject.pcepio.protocol.PcepLSReportMsg;
import org.onosproject.pcepio.protocol.PcepType;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
......@@ -33,43 +34,43 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides PCEP TE Report Message.
* Provides PCEP LS (link-state) Report Message.
*/
class PcepTEReportMsgVer1 implements PcepTEReportMsg {
class PcepLSReportMsgVer1 implements PcepLSReportMsg {
/*
* Ref : draft-dhodylee-pce-pcep-te-data-extn-02, section 8.1
* Ref : draft-dhodylee-pce-pcep-ls-01, section 8.1
<TERpt Message> ::= <Common Header>
<te-report-list>
<LSRpt Message> ::= <Common Header>
<ls-report-list>
Where:
<te-report-list> ::= <TE>[<te-report-list>]
<ls-report-list> ::= <LS>[<ls-report-list>]
*/
private static final Logger log = LoggerFactory.getLogger(PcepTEReportMsgVer1.class);
//PACKET_MINIMUM_LENGTH = CommonHeaderLen(4)+TEObjMinLen(12)
private static final Logger log = LoggerFactory.getLogger(PcepLSReportMsgVer1.class);
//PACKET_MINIMUM_LENGTH = CommonHeaderLen(4)+LSObjMinLen(12)
public static final int PACKET_MINIMUM_LENGTH = 16;
public static final PcepType MSG_TYPE = PcepType.TE_REPORT;
// <te-report-list>
private LinkedList<PcepTEObject> teReportList;
public static final PcepType MSG_TYPE = PcepType.LS_REPORT;
// <ls-report-list>
private List<PcepLSObject> lsReportList;
public static final PcepTEReportMsgVer1.Reader READER = new Reader();
public static final PcepLSReportMsgVer1.Reader READER = new Reader();
/**
* Reader class for reading PCPE te report message form channel buffer.
* Reader class for reading PCEP LS-Report message form channel buffer.
*/
static class Reader implements PcepMessageReader<PcepTEReportMsg> {
static class Reader implements PcepMessageReader<PcepLSReportMsg> {
LinkedList<PcepTEObject> teReportList;
List<PcepLSObject> lsReportList;
@Override
public PcepTEReportMsg readFrom(ChannelBuffer cb) throws PcepParseException {
public PcepLSReportMsg readFrom(ChannelBuffer cb) throws PcepParseException {
if (cb.readableBytes() < PACKET_MINIMUM_LENGTH) {
return null;
}
teReportList = new LinkedList<>();
lsReportList = new LinkedList<>();
byte version = cb.readByte();
version = (byte) (version >> PcepMessageVer1.SHIFT_FLAG);
......@@ -79,7 +80,7 @@ class PcepTEReportMsgVer1 implements PcepTEReportMsg {
byte type = cb.readByte();
if (type != MSG_TYPE.getType()) {
throw new PcepParseException("Wrong type. Expected=PcepType.TE_REPORT(14), got=" + type);
throw new PcepParseException("Wrong type. Expected=PcepType.LS_REPORT(224), got=" + type);
}
short length = cb.readShort();
......@@ -88,45 +89,45 @@ class PcepTEReportMsgVer1 implements PcepTEReportMsg {
"Wrong length. Expected to be >= " + PACKET_MINIMUM_LENGTH + ", is: " + length);
}
// Parse state report list
parseTEReportList(cb);
// Parse <ls-report-list>
parseLSReportList(cb);
return new PcepTEReportMsgVer1(teReportList);
return new PcepLSReportMsgVer1(lsReportList);
}
/**
* Parse te-report-list.
* Parse ls-report-list.
*
* @param cb input Channel Buffer
* @throws PcepParseException when fails to parse TE Report list.
* @throws PcepParseException when fails to parse LS-Report list.
*/
public void parseTEReportList(ChannelBuffer cb) throws PcepParseException {
// <te-report-list> ::= <TE>[<te-report-list>]
public void parseLSReportList(ChannelBuffer cb) throws PcepParseException {
// <ls-report-list> ::= <LS>[<ls-report-list>]
while (0 < cb.readableBytes()) {
//store TE objectS
if (!teReportList.add(PcepTEObjectVer1.read(cb))) {
throw new PcepParseException("Failed to add TE object to TE report list");
//store LS objects
if (!lsReportList.add(PcepLSObjectVer1.read(cb))) {
throw new PcepParseException("Failed to add LS object to LS-Report list");
}
}
}
}
/**
* Constructor to initialize TE Report List.
* Constructor to initialize LS-Report list.
*
* @param teReportList list of PCEP TE Object
* @param lsReportList list of PCEP LS Object
*/
PcepTEReportMsgVer1(LinkedList<PcepTEObject> teReportList) {
this.teReportList = teReportList;
PcepLSReportMsgVer1(List<PcepLSObject> lsReportList) {
this.lsReportList = lsReportList;
}
/**
* Builder class for PCEP te report message.
* Builder class for PCEP LS-Report message.
*/
static class Builder implements PcepTEReportMsg.Builder {
// PCEP TE Report message fields
LinkedList<PcepTEObject> teReportList;
static class Builder implements PcepLSReportMsg.Builder {
// PCEP LS Report message fields
List<PcepLSObject> lsReportList;
@Override
public PcepVersion getVersion() {
......@@ -135,22 +136,22 @@ class PcepTEReportMsgVer1 implements PcepTEReportMsg {
@Override
public PcepType getType() {
return PcepType.TE_REPORT;
return PcepType.LS_REPORT;
}
@Override
public PcepTEReportMsg build() {
return new PcepTEReportMsgVer1(this.teReportList);
public PcepLSReportMsg build() {
return new PcepLSReportMsgVer1(this.lsReportList);
}
@Override
public LinkedList<PcepTEObject> getTEReportList() {
return this.teReportList;
public List<PcepLSObject> getLSReportList() {
return this.lsReportList;
}
@Override
public Builder setTEReportList(LinkedList<PcepTEObject> ll) {
this.teReportList = ll;
public Builder setLSReportList(List<PcepLSObject> ll) {
this.lsReportList = ll;
return this;
}
}
......@@ -163,12 +164,12 @@ class PcepTEReportMsgVer1 implements PcepTEReportMsg {
static final Writer WRITER = new Writer();
/**
* Writer class for writing PCEP te report message to channel buffer.
* Writer class for writing PCEP LS-Report message to channel buffer.
*/
static class Writer implements PcepMessageWriter<PcepTEReportMsgVer1> {
static class Writer implements PcepMessageWriter<PcepLSReportMsgVer1> {
@Override
public void write(ChannelBuffer bb, PcepTEReportMsgVer1 message) throws PcepParseException {
public void write(ChannelBuffer bb, PcepLSReportMsgVer1 message) throws PcepParseException {
int startIndex = bb.writerIndex();
......@@ -183,11 +184,11 @@ class PcepTEReportMsgVer1 implements PcepTEReportMsg {
int msgLenIndex = bb.writerIndex();
bb.writeShort((short) 0);
ListIterator<PcepTEObject> listIterator = message.teReportList.listIterator();
ListIterator<PcepLSObject> listIterator = message.lsReportList.listIterator();
while (listIterator.hasNext()) {
PcepTEObject teObj = listIterator.next();
teObj.write(bb);
PcepLSObject lsObj = listIterator.next();
lsObj.write(bb);
}
// update message length field
......@@ -207,19 +208,19 @@ class PcepTEReportMsgVer1 implements PcepTEReportMsg {
}
@Override
public LinkedList<PcepTEObject> getTEReportList() {
return this.teReportList;
public List<PcepLSObject> getLSReportList() {
return this.lsReportList;
}
@Override
public void setTEReportList(LinkedList<PcepTEObject> ll) {
this.teReportList = ll;
public void setLSReportList(List<PcepLSObject> ll) {
this.lsReportList = ll;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("TeReportList", teReportList)
.add("LSReportList", lsReportList)
.toString();
}
}
......
......@@ -56,7 +56,7 @@ public class PcepLabelObjectVer1 implements PcepLabelObject {
protected static final Logger log = LoggerFactory.getLogger(PcepLspObjectVer1.class);
public static final byte LABEL_OBJ_TYPE = 1;
public static final byte LABEL_OBJ_CLASS = 35; //TBD : to be defined
public static final byte LABEL_OBJ_CLASS = (byte) 225;
public static final byte LABEL_OBJECT_VERSION = 1;
public static final byte OBJECT_HEADER_LENGTH = 4;
public static final boolean DEFAULT_OFLAG = false;
......
......@@ -17,10 +17,12 @@
package org.onosproject.pcepio.protocol.ver1;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepFactories;
import org.onosproject.pcepio.protocol.PcepMessage;
import org.onosproject.pcepio.protocol.PcepMessageReader;
import org.onosproject.pcepio.protocol.PcepType;
import org.onosproject.pcepio.types.PcepErrorDetailInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -33,21 +35,11 @@ public abstract class PcepMessageVer1 {
protected static final Logger log = LoggerFactory.getLogger(PcepFactories.class);
// version: 1.0
static final byte WIRE_VERSION = 1;
static final int MINIMUM_LENGTH = 4;
static final int PACKET_VERSION = 1;
static final byte OPEN_MSG_TYPE = 0x1;
static final byte KEEPALIVE_MSG_TYPE = 0x2;
static final byte REPORT_MSG_TYPE = 0xa;
static final byte TE_REPORT_MSG_TYPE = 0xe;
static final byte UPDATE_MSG_TYPE = 0xb;
static final byte INITIATE_MSG_TYPE = 0xc;
static final byte CLOSE_MSG_TYPE = 0x7;
static final byte ERROR_MSG_TYPE = 0x6;
static final byte LABEL_UPDATE_MSG_TYPE = 0xD;
static final byte LABEL_RANGE_RESV_MSG_TYPE = 0xF;
public static final byte WIRE_VERSION = 1;
public static final int MINIMUM_LENGTH = 4;
public static final int PACKET_VERSION = 1;
public static final int SHIFT_FLAG = 5;
static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
public static final PcepMessageVer1.Reader READER = new Reader();
......@@ -56,7 +48,7 @@ public abstract class PcepMessageVer1 {
*/
static class Reader implements PcepMessageReader<PcepMessage> {
@Override
public PcepMessage readFrom(ChannelBuffer cb) throws PcepParseException {
public PcepMessage readFrom(ChannelBuffer cb) throws PcepParseException, PcepOutOfBoundMessageException {
if (cb.readableBytes() < MINIMUM_LENGTH) {
throw new PcepParseException("Packet should have minimum length: " + MINIMUM_LENGTH);
......@@ -75,53 +67,43 @@ public abstract class PcepMessageVer1 {
short length = cb.readShort();
cb.readerIndex(start);
switch (type) {
// Check the out-of-bound message.
// If the message is out-of-bound then throw PcepOutOfBoundException.
if ((length - MINIMUM_COMMON_HEADER_LENGTH) > cb.readableBytes()) {
throw new PcepOutOfBoundMessageException("Message is out-of-bound.");
}
case OPEN_MSG_TYPE:
if (type == (byte) PcepType.OPEN.getType()) {
log.debug("OPEN MESSAGE is received");
// message type value 1 means it is open message
return PcepOpenMsgVer1.READER.readFrom(cb.readBytes(length));
case KEEPALIVE_MSG_TYPE:
} else if (type == (byte) PcepType.KEEP_ALIVE.getType()) {
log.debug("KEEPALIVE MESSAGE is received");
// message type value 2 means it is Keepalive message
return PcepKeepaliveMsgVer1.READER.readFrom(cb.readBytes(length));
case ERROR_MSG_TYPE:
} else if (type == (byte) PcepType.ERROR.getType()) {
log.debug("ERROR MESSAGE is received");
// message type value 6 means it is error message
return PcepErrorMsgVer1.READER.readFrom(cb.readBytes(length));
case REPORT_MSG_TYPE:
} else if (type == (byte) PcepType.CLOSE.getType()) {
log.debug("CLOSE MESSAGE is received");
return PcepCloseMsgVer1.READER.readFrom(cb.readBytes(length));
} else if (type == (byte) PcepType.REPORT.getType()) {
log.debug("REPORT MESSAGE is received");
// message type value 10 means it is Report message
// return
return PcepReportMsgVer1.READER.readFrom(cb.readBytes(length));
case UPDATE_MSG_TYPE:
} else if (type == (byte) PcepType.UPDATE.getType()) {
log.debug("UPDATE MESSAGE is received");
//message type value 11 means it is Update message
return PcepUpdateMsgVer1.READER.readFrom(cb.readBytes(length));
case INITIATE_MSG_TYPE:
} else if (type == (byte) PcepType.INITIATE.getType()) {
log.debug("INITIATE MESSAGE is received");
//message type value 12 means it is PcInitiate message
return PcepInitiateMsgVer1.READER.readFrom(cb.readBytes(length));
case CLOSE_MSG_TYPE:
log.debug("CLOSE MESSAGE is received");
// message type value 7 means it is Close message
return PcepCloseMsgVer1.READER.readFrom(cb.readBytes(length));
case TE_REPORT_MSG_TYPE:
log.debug("TE REPORT MESSAGE is received");
// message type value 14 means it is TE REPORT message
// return
return PcepTEReportMsgVer1.READER.readFrom(cb.readBytes(length));
case LABEL_UPDATE_MSG_TYPE:
log.debug("LABEL UPDATE MESSAGE is received");
// message type value 13 means it is LABEL UPDATE message
// return
return PcepLabelUpdateMsgVer1.READER.readFrom(cb.readBytes(length));
case LABEL_RANGE_RESV_MSG_TYPE:
} else if (type == (byte) PcepType.LS_REPORT.getType()) {
log.debug("LS REPORT MESSAGE is received");
return PcepLSReportMsgVer1.READER.readFrom(cb.readBytes(length));
} else if (type == (byte) PcepType.LABEL_RANGE_RESERV.getType()) {
log.debug("LABEL RANGE RESERVE MESSAGE is received");
// message type value 15 means it is LABEL RANGE RESERVE message
// return
return PcepLabelRangeResvMsgVer1.READER.readFrom(cb.readBytes(length));
default:
} else if (type == (byte) PcepType.LABEL_UPDATE.getType()) {
log.debug("LABEL UPDATE MESSAGE is received");
return PcepLabelUpdateMsgVer1.READER.readFrom(cb.readBytes(length));
} else {
throw new PcepParseException("ERROR: UNKNOWN MESSAGE is received. Msg Type: " + type);
}
} catch (IndexOutOfBoundsException e) {
......
......@@ -31,7 +31,7 @@ import org.onosproject.pcepio.types.PcepObjectHeader;
import org.onosproject.pcepio.types.PcepValueType;
import org.onosproject.pcepio.types.StatefulLspDbVerTlv;
import org.onosproject.pcepio.types.StatefulPceCapabilityTlv;
import org.onosproject.pcepio.types.TedCapabilityTlv;
import org.onosproject.pcepio.types.LsCapabilityTlv;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -252,13 +252,13 @@ public class PcepOpenObjectVer1 implements PcepOpenObject {
long lValue = cb.readLong();
tlv = new StatefulLspDbVerTlv(lValue);
break;
case TedCapabilityTlv.TYPE:
log.debug("TedCapabilityTlv");
if (TedCapabilityTlv.LENGTH != hLength) {
throw new PcepParseException("Invalid length received for TedCapabilityTlv.");
case LsCapabilityTlv.TYPE:
log.debug("LsCapabilityTlv");
if (LsCapabilityTlv.LENGTH != hLength) {
throw new PcepParseException("Invalid length received for LsCapabilityTlv.");
}
iValue = cb.readInt();
tlv = new TedCapabilityTlv(iValue);
tlv = new LsCapabilityTlv(iValue);
break;
case PcepLabelDbVerTlv.TYPE:
log.debug("PcepLabelDbVerTlv");
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Administrative Group Tlv which contains value (32 Bit ).
*/
public class AdministrativeGroupTlv implements PcepValueType {
public class AdministrativeGroupSubTlv implements PcepValueType {
/* REFERENCE :[RFC5305]/3.1
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class AdministrativeGroupTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AdministrativeGroupTlv.class);
protected static final Logger log = LoggerFactory.getLogger(AdministrativeGroupSubTlv.class);
public static final short TYPE = 3; //TDB33
public static final short TYPE = 22;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -51,7 +51,7 @@ public class AdministrativeGroupTlv implements PcepValueType {
*
* @param rawValue of Administrative-Group-Tlv.
*/
public AdministrativeGroupTlv(int rawValue) {
public AdministrativeGroupSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -61,8 +61,8 @@ public class AdministrativeGroupTlv implements PcepValueType {
* @param raw value.
* @return object of Administrative-Group-Tlv
*/
public static AdministrativeGroupTlv of(final int raw) {
return new AdministrativeGroupTlv(raw);
public static AdministrativeGroupSubTlv of(final int raw) {
return new AdministrativeGroupSubTlv(raw);
}
/**
......@@ -99,8 +99,8 @@ public class AdministrativeGroupTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof AdministrativeGroupTlv) {
AdministrativeGroupTlv other = (AdministrativeGroupTlv) obj;
if (obj instanceof AdministrativeGroupSubTlv) {
AdministrativeGroupSubTlv other = (AdministrativeGroupSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -121,8 +121,8 @@ public class AdministrativeGroupTlv implements PcepValueType {
* @param c input channel buffer
* @return object of Administrative-Group-Tlv
*/
public static AdministrativeGroupTlv read(ChannelBuffer c) {
return AdministrativeGroupTlv.of(c.readInt());
public static AdministrativeGroupSubTlv read(ChannelBuffer c) {
return AdministrativeGroupSubTlv.of(c.readInt());
}
@Override
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author b00295750
*
*/
package org.onosproject.pcepio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides Autonomous system number sub object.
*/
public class AutonomousSystemNumberSubObject implements PcepValueType {
/*Reference : RFC 3209 : 4.3.3.4
* 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|L| Type | Length | AS number (2-octet) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemNumberSubObject.class);
public static final byte TYPE = (byte) 0x32;
public static final byte LENGTH = 4;
public static final byte VALUE_LENGTH = 2;
public static final byte OBJ_LENGTH = 4;
public static final byte LBIT = 0;
public static final int SHIFT_LBIT_POSITION = 7;
private short asNumber;
/**
* Constructor to initialize AS number.
*
* @param asNumber AS number
*/
public AutonomousSystemNumberSubObject(short asNumber) {
this.asNumber = asNumber;
}
/**
* Returns a new instance of AutonomousSystemNumberSubObject.
*
* @param asNumber AS number
* @return object of AutonomousSystemNumberSubObject
*/
public static AutonomousSystemNumberSubObject of(short asNumber) {
return new AutonomousSystemNumberSubObject(asNumber);
}
/**
* Returns value of AS number.
*
* @return value of AS number
*/
public short getAsNumber() {
return asNumber;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return LENGTH;
}
@Override
public int hashCode() {
return Objects.hash(asNumber);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AutonomousSystemNumberSubObject) {
AutonomousSystemNumberSubObject other = (AutonomousSystemNumberSubObject) obj;
return Objects.equals(this.asNumber, other.asNumber);
}
return false;
}
/**
* Reads the channel buffer and returns object of AutonomousSystemNumberSubObject.
*
* @param c type of channel buffer
* @return object of AutonomousSystemNumberSubObject
*/
public static PcepValueType read(ChannelBuffer c) {
short asNumber = c.readShort();
return new AutonomousSystemNumberSubObject(asNumber);
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
byte bValue = LBIT;
bValue = (byte) (bValue << SHIFT_LBIT_POSITION);
bValue = (byte) (bValue | TYPE);
c.writeByte(bValue);
c.writeByte(OBJ_LENGTH);
c.writeShort(asNumber);
return c.writerIndex() - iLenStartIndex;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("AsNumber", asNumber)
.toString();
}
}
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Autonomous-System-Tlv which contains opaque value (32 Bit AS Number).
*/
public class AutonomousSystemTlv implements PcepValueType {
public class AutonomousSystemSubTlv implements PcepValueType {
/* Reference :RFC3209
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class AutonomousSystemTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemTlv.class);
protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemSubTlv.class);
public static final short TYPE = 100; //TODD:change this TBD10
public static final short TYPE = 1;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -51,7 +51,7 @@ public class AutonomousSystemTlv implements PcepValueType {
*
* @param rawValue Autonomous-System-Tlv
*/
public AutonomousSystemTlv(int rawValue) {
public AutonomousSystemSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -61,8 +61,8 @@ public class AutonomousSystemTlv implements PcepValueType {
* @param raw value of opaque.
* @return object of Autonomous-System-Tlv
*/
public static AutonomousSystemTlv of(final int raw) {
return new AutonomousSystemTlv(raw);
public static AutonomousSystemSubTlv of(final int raw) {
return new AutonomousSystemSubTlv(raw);
}
/**
......@@ -99,8 +99,8 @@ public class AutonomousSystemTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof AutonomousSystemTlv) {
AutonomousSystemTlv other = (AutonomousSystemTlv) obj;
if (obj instanceof AutonomousSystemSubTlv) {
AutonomousSystemSubTlv other = (AutonomousSystemSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -121,8 +121,8 @@ public class AutonomousSystemTlv implements PcepValueType {
* @param c input channel buffer
* @return object of Autonomous-System-Tlv
*/
public static AutonomousSystemTlv read(ChannelBuffer c) {
return AutonomousSystemTlv.of(c.readInt());
public static AutonomousSystemSubTlv read(ChannelBuffer c) {
return AutonomousSystemSubTlv.of(c.readInt());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides BGP LS identifier which contains opaque value (32 Bit ID).
*/
public class BgpLsIdentifierTlv implements PcepValueType {
public class BgpLsIdentifierSubTlv implements PcepValueType {
/* Reference :draft-ietf-idr-ls-distribution-10
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class BgpLsIdentifierTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(BgpLsIdentifierTlv.class);
protected static final Logger log = LoggerFactory.getLogger(BgpLsIdentifierSubTlv.class);
public static final short TYPE = 17; //TODD:change this TBD11
public static final short TYPE = 2;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -51,7 +51,7 @@ public class BgpLsIdentifierTlv implements PcepValueType {
*
* @param rawValue BGP LS identifier Tlv
*/
public BgpLsIdentifierTlv(int rawValue) {
public BgpLsIdentifierSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -61,8 +61,8 @@ public class BgpLsIdentifierTlv implements PcepValueType {
* @param raw value
* @return object of BGPLSidentifierTlv
*/
public static BgpLsIdentifierTlv of(final int raw) {
return new BgpLsIdentifierTlv(raw);
public static BgpLsIdentifierSubTlv of(final int raw) {
return new BgpLsIdentifierSubTlv(raw);
}
/**
......@@ -99,8 +99,8 @@ public class BgpLsIdentifierTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof BgpLsIdentifierTlv) {
BgpLsIdentifierTlv other = (BgpLsIdentifierTlv) obj;
if (obj instanceof BgpLsIdentifierSubTlv) {
BgpLsIdentifierSubTlv other = (BgpLsIdentifierSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -121,8 +121,8 @@ public class BgpLsIdentifierTlv implements PcepValueType {
* @param c input channel buffer
* @return object of BGP LS identifier Tlv
*/
public static BgpLsIdentifierTlv read(ChannelBuffer c) {
return BgpLsIdentifierTlv.of(c.readInt());
public static BgpLsIdentifierSubTlv read(ChannelBuffer c) {
return BgpLsIdentifierSubTlv.of(c.readInt());
}
@Override
......
......@@ -16,6 +16,7 @@
package org.onosproject.pcepio.types;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.jboss.netty.buffer.ChannelBuffer;
......@@ -32,7 +33,7 @@ import com.google.common.base.MoreObjects;
*/
public class ErrorObjListWithOpen {
//errorObjList is mandatory
private LinkedList<PcepErrorObject> llerrorObjList;
private List<PcepErrorObject> llerrorObjList;
// openObject is optional
private PcepOpenObject openObject;
// flag to check if open object is set or not
......@@ -45,7 +46,7 @@ public class ErrorObjListWithOpen {
* @param errObj ERROR object list
* @param openObj OPEN object
*/
public ErrorObjListWithOpen(LinkedList<PcepErrorObject> errObj, PcepOpenObject openObj) {
public ErrorObjListWithOpen(List<PcepErrorObject> errObj, PcepOpenObject openObj) {
this.llerrorObjList = errObj;
this.openObject = openObj;
if (openObj != null) {
......@@ -60,7 +61,7 @@ public class ErrorObjListWithOpen {
*
* @param errObj ERROR Object list
*/
public ErrorObjListWithOpen(LinkedList<PcepErrorObject> errObj) {
public ErrorObjListWithOpen(List<PcepErrorObject> errObj) {
this.llerrorObjList = errObj;
this.openObject = null;
isOpenObjectSet = false;
......@@ -71,8 +72,8 @@ public class ErrorObjListWithOpen {
*
* @return error types list
*/
public LinkedList<Integer> getErrorType() {
LinkedList<Integer> errorType = new LinkedList<>();
public List<Integer> getErrorType() {
List<Integer> errorType = new LinkedList<>();
if (llerrorObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llerrorObjList.listIterator();
int error;
......@@ -91,8 +92,8 @@ public class ErrorObjListWithOpen {
*
* @return error values list
*/
public LinkedList<Integer> getErrorValue() {
LinkedList<Integer> errorValue = new LinkedList<>();
public List<Integer> getErrorValue() {
List<Integer> errorValue = new LinkedList<>();
if (llerrorObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llerrorObjList.listIterator();
int error;
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides IPv4 Interface Address .
*/
public class IPv4InterfaceAddressTlv implements PcepValueType {
public class IPv4InterfaceAddressSubTlv implements PcepValueType {
/*
* reference :[RFC5305]/3.2
......@@ -40,9 +40,9 @@ public class IPv4InterfaceAddressTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4InterfaceAddressTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IPv4InterfaceAddressSubTlv.class);
public static final short TYPE = 6;
public static final short TYPE = 7;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -52,7 +52,7 @@ public class IPv4InterfaceAddressTlv implements PcepValueType {
*
* @param rawValue of IPv4-Interface-Address.
*/
public IPv4InterfaceAddressTlv(int rawValue) {
public IPv4InterfaceAddressSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -62,8 +62,8 @@ public class IPv4InterfaceAddressTlv implements PcepValueType {
* @param raw value of IPv4-Interface-Address
* @return object of IPv4-Interface-Address-Tlv
*/
public static IPv4InterfaceAddressTlv of(final int raw) {
return new IPv4InterfaceAddressTlv(raw);
public static IPv4InterfaceAddressSubTlv of(final int raw) {
return new IPv4InterfaceAddressSubTlv(raw);
}
/**
......@@ -100,8 +100,8 @@ public class IPv4InterfaceAddressTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv4InterfaceAddressTlv) {
IPv4InterfaceAddressTlv other = (IPv4InterfaceAddressTlv) obj;
if (obj instanceof IPv4InterfaceAddressSubTlv) {
IPv4InterfaceAddressSubTlv other = (IPv4InterfaceAddressSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -122,8 +122,8 @@ public class IPv4InterfaceAddressTlv implements PcepValueType {
* @param c input channel buffer
* @return object of IPv4-Interface-Address-Tlv
*/
public static IPv4InterfaceAddressTlv read(ChannelBuffer c) {
return IPv4InterfaceAddressTlv.of(c.readInt());
public static IPv4InterfaceAddressSubTlv read(ChannelBuffer c) {
return IPv4InterfaceAddressSubTlv.of(c.readInt());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides IPv4 Neighbor Address .
*/
public class IPv4NeighborAddressTlv implements PcepValueType {
public class IPv4NeighborAddressSubTlv implements PcepValueType {
/* Reference :[RFC5305]/3.3
0 1 2 3
......@@ -39,7 +39,7 @@ public class IPv4NeighborAddressTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4NeighborAddressTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IPv4NeighborAddressSubTlv.class);
public static final short TYPE = 8;
public static final short LENGTH = 4;
......@@ -51,7 +51,7 @@ public class IPv4NeighborAddressTlv implements PcepValueType {
*
* @param rawValue IPv4-Neighbor-Address-Tlv
*/
public IPv4NeighborAddressTlv(int rawValue) {
public IPv4NeighborAddressSubTlv(int rawValue) {
log.debug("IPv4NeighborAddressTlv");
this.rawValue = rawValue;
}
......@@ -62,8 +62,8 @@ public class IPv4NeighborAddressTlv implements PcepValueType {
* @param raw value of IPv4-Neighbor-Address
* @return object of IPv4NeighborAddressTlv
*/
public static IPv4NeighborAddressTlv of(final int raw) {
return new IPv4NeighborAddressTlv(raw);
public static IPv4NeighborAddressSubTlv of(final int raw) {
return new IPv4NeighborAddressSubTlv(raw);
}
/**
......@@ -100,8 +100,8 @@ public class IPv4NeighborAddressTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv4NeighborAddressTlv) {
IPv4NeighborAddressTlv other = (IPv4NeighborAddressTlv) obj;
if (obj instanceof IPv4NeighborAddressSubTlv) {
IPv4NeighborAddressSubTlv other = (IPv4NeighborAddressSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -122,8 +122,8 @@ public class IPv4NeighborAddressTlv implements PcepValueType {
* @param c input channel buffer
* @return object of IPv4-Neighbor-Address-Tlv
*/
public static IPv4NeighborAddressTlv read(ChannelBuffer c) {
return IPv4NeighborAddressTlv.of(c.readInt());
public static IPv4NeighborAddressSubTlv read(ChannelBuffer c) {
return IPv4NeighborAddressSubTlv.of(c.readInt());
}
@Override
......
......@@ -25,9 +25,9 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides IPv4 TE Router Id Of Local Node.
* Provides IPv4 Router Id Of Local Node.
*/
public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
public class IPv4RouterIdOfLocalNodeSubTlv implements PcepValueType {
/* Reference:[RFC5305]/4.3
* 0 1 2 3
......@@ -35,13 +35,13 @@ public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB25] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 TE Router Id Of Local Node |
| IPv4 Router Id Of Local Node |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfLocalNodeTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IPv4RouterIdOfLocalNodeSubTlv.class);
public static final short TYPE = 134; //TDB25
public static final short TYPE = 17;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -49,26 +49,26 @@ public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4-TE-RouterId-Of-Local-Node-Tlv
* @param rawValue IPv4-RouterId-Of-Local-Node-Tlv
*/
public IPv4TERouterIdOfLocalNodeTlv(int rawValue) {
public IPv4RouterIdOfLocalNodeSubTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4TERouterIdOfLocalNodeTlv object.
* Returns newly created IPv4RouterIdOfLocalNodeTlv object.
*
* @param raw value of IPv4-TE-RouterId-Of-Local-Node
* @return object of IPv4TERouterIdOfLocalNodeTlv
* @param raw value of IPv4-RouterId-Of-Local-Node
* @return object of IPv4RouterIdOfLocalNodeTlv
*/
public static IPv4TERouterIdOfLocalNodeTlv of(final int raw) {
return new IPv4TERouterIdOfLocalNodeTlv(raw);
public static IPv4RouterIdOfLocalNodeSubTlv of(final int raw) {
return new IPv4RouterIdOfLocalNodeSubTlv(raw);
}
/**
* Returns value of IPv4 TE Router Id Of Local Node.
* Returns value of IPv4 Router Id Of Local Node.
*
* @return rawValue IPv4 TE Router Id Of Local Node
* @return rawValue IPv4 Router Id Of Local Node
*/
public int getInt() {
return rawValue;
......@@ -99,8 +99,8 @@ public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv4TERouterIdOfLocalNodeTlv) {
IPv4TERouterIdOfLocalNodeTlv other = (IPv4TERouterIdOfLocalNodeTlv) obj;
if (obj instanceof IPv4RouterIdOfLocalNodeSubTlv) {
IPv4RouterIdOfLocalNodeSubTlv other = (IPv4RouterIdOfLocalNodeSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -116,13 +116,13 @@ public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
}
/**
* Reads the channel buffer and returns object of IPv4TERouterIdOfLocalNodeTlv.
* Reads the channel buffer and returns object of IPv4RouterIdOfLocalNodeTlv.
*
* @param c input channel buffer
* @return object of IPv4TERouterIdOfLocalNodeTlv
* @return object of IPv4RouterIdOfLocalNodeTlv
*/
public static IPv4TERouterIdOfLocalNodeTlv read(ChannelBuffer c) {
return IPv4TERouterIdOfLocalNodeTlv.of(c.readInt());
public static IPv4RouterIdOfLocalNodeSubTlv read(ChannelBuffer c) {
return IPv4RouterIdOfLocalNodeSubTlv.of(c.readInt());
}
@Override
......
......@@ -25,9 +25,9 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides IPv4 TE Router Id Of Remote Node.
* Provides IPv4 Router Id Of Remote Node.
*/
public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
public class IPv4RouterIdOfRemoteNodeSubTlv implements PcepValueType {
/* Reference :[RFC5305]/4.3
* 0 1 2 3
......@@ -35,13 +35,13 @@ public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB28] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 TE Router Id Of Remote Node |
| IPv4 Router Id Of Remote Node |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfRemoteNodeTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IPv4RouterIdOfRemoteNodeSubTlv.class);
public static final short TYPE = 1340; //TDB28
public static final short TYPE = 19;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -49,27 +49,27 @@ public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4 TE RouterId Of Remote Node Tlv
* @param rawValue IPv4 RouterId Of Remote Node Tlv
*/
public IPv4TERouterIdOfRemoteNodeTlv(int rawValue) {
log.debug("IPv4TERouterIdOfRemoteNodeTlv");
public IPv4RouterIdOfRemoteNodeSubTlv(int rawValue) {
log.debug("IPv4RouterIdOfRemoteNodeTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4TERouterIdOfRemoteNodeTlv object.
* Returns newly created IPv4RouterIdOfRemoteNodeTlv object.
*
* @param raw IPv4 TE RouterId Of Remote Node
* @return object of IPv4TERouterIdOfRemoteNodeTlv
* @param raw IPv4 RouterId Of Remote Node
* @return object of IPv4RouterIdOfRemoteNodeTlv
*/
public static IPv4TERouterIdOfRemoteNodeTlv of(final int raw) {
return new IPv4TERouterIdOfRemoteNodeTlv(raw);
public static IPv4RouterIdOfRemoteNodeSubTlv of(final int raw) {
return new IPv4RouterIdOfRemoteNodeSubTlv(raw);
}
/**
* Returns value of IPv4 TE Router Id Of Remote Node.
* Returns value of IPv4 Router Id Of Remote Node.
*
* @return rawValue IPv4 TE Router Id Of Remote Node
* @return rawValue IPv4 Router Id Of Remote Node
*/
public int getInt() {
return rawValue;
......@@ -100,8 +100,8 @@ public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv4TERouterIdOfRemoteNodeTlv) {
IPv4TERouterIdOfRemoteNodeTlv other = (IPv4TERouterIdOfRemoteNodeTlv) obj;
if (obj instanceof IPv4RouterIdOfRemoteNodeSubTlv) {
IPv4RouterIdOfRemoteNodeSubTlv other = (IPv4RouterIdOfRemoteNodeSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -117,13 +117,13 @@ public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
}
/**
* Reads the channel buffer and returns object of IPv4TERouterIdOfRemoteNodeTlv.
* Reads the channel buffer and returns object of IPv4RouterIdOfRemoteNodeTlv.
*
* @param c input channel buffer
* @return object of IPv4TERouterIdOfRemoteNodeTlv
* @return object of IPv4RouterIdOfRemoteNodeTlv
*/
public static IPv4TERouterIdOfRemoteNodeTlv read(ChannelBuffer c) {
return IPv4TERouterIdOfRemoteNodeTlv.of(c.readInt());
public static IPv4RouterIdOfRemoteNodeSubTlv read(ChannelBuffer c) {
return IPv4RouterIdOfRemoteNodeSubTlv.of(c.readInt());
}
@Override
......
......@@ -27,22 +27,22 @@ import java.util.Arrays;
/**
* Provides IPv6 Interface Address. REFERENCE :[RFC6119]/4.2.
*/
public class IPv6InterfaceAddressTlv implements PcepValueType {
public class IPv6InterfaceAddressSubTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6InterfaceAddressTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IPv6InterfaceAddressSubTlv.class);
public static final short TYPE = 12; //TDB18
public static final short TYPE = 9;
public static final short LENGTH = 20;
public static final byte VALUE_LENGTH = 18;
private static final byte[] NONE_VAL = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public static final IPv6InterfaceAddressTlv NONE = new IPv6InterfaceAddressTlv(NONE_VAL);
public static final IPv6InterfaceAddressSubTlv NONE = new IPv6InterfaceAddressSubTlv(NONE_VAL);
private static final byte[] NO_MASK_VAL = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
public static final IPv6InterfaceAddressTlv NO_MASK = new IPv6InterfaceAddressTlv(NO_MASK_VAL);
public static final IPv6InterfaceAddressTlv FULL_MASK = NONE;
public static final IPv6InterfaceAddressSubTlv NO_MASK = new IPv6InterfaceAddressSubTlv(NO_MASK_VAL);
public static final IPv6InterfaceAddressSubTlv FULL_MASK = NONE;
private final byte[] rawValue;
......@@ -51,7 +51,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
*
* @param rawValue IPv6 Interface Address Tlv
*/
public IPv6InterfaceAddressTlv(byte[] rawValue) {
public IPv6InterfaceAddressSubTlv(byte[] rawValue) {
log.debug("IPv6InterfaceAddressTlv");
this.rawValue = rawValue;
}
......@@ -62,7 +62,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
* @param raw IPv6 Interface Address
* @return object of IPv6InterfaceAddressTlv
*/
public static IPv6InterfaceAddressTlv of(final byte[] raw) {
public static IPv6InterfaceAddressSubTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNone = true;
//value starts from 3rd byte.
......@@ -88,7 +88,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
return NO_MASK;
}
return new IPv6InterfaceAddressTlv(raw);
return new IPv6InterfaceAddressSubTlv(raw);
}
/**
......@@ -134,8 +134,8 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv6InterfaceAddressTlv) {
IPv6InterfaceAddressTlv other = (IPv6InterfaceAddressTlv) obj;
if (obj instanceof IPv6InterfaceAddressSubTlv) {
IPv6InterfaceAddressSubTlv other = (IPv6InterfaceAddressSubTlv) obj;
return Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -156,10 +156,10 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
* @param c input channel buffer
* @return object of IPv6InterfaceAddressTlv
*/
public static IPv6InterfaceAddressTlv read20Bytes(ChannelBuffer c) {
public static IPv6InterfaceAddressSubTlv read20Bytes(ChannelBuffer c) {
byte[] yTemp = new byte[20];
c.readBytes(yTemp, 0, 20);
return IPv6InterfaceAddressTlv.of(yTemp);
return IPv6InterfaceAddressSubTlv.of(yTemp);
}
@Override
......
......@@ -27,21 +27,21 @@ import java.util.Arrays;
/**
* Provides IPv6 Neighbor Address. Reference :[RFC6119]/4.3.
*/
public class IPv6NeighborAddressTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6NeighborAddressTlv.class);
public class IPv6NeighborAddressSubTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6NeighborAddressSubTlv.class);
public static final short TYPE = 13; // TDB19
public static final short TYPE = 10;
public static final short LENGTH = 20;
public static final byte VALUE_LENGTH = 18;
private static final byte[] NONE_VAL = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public static final IPv6NeighborAddressTlv NONE = new IPv6NeighborAddressTlv(NONE_VAL);
public static final IPv6NeighborAddressSubTlv NONE = new IPv6NeighborAddressSubTlv(NONE_VAL);
private static final byte[] NO_MASK_VAL = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
public static final IPv6NeighborAddressTlv NO_MASK = new IPv6NeighborAddressTlv(NO_MASK_VAL);
public static final IPv6NeighborAddressTlv FULL_MASK = NONE;
public static final IPv6NeighborAddressSubTlv NO_MASK = new IPv6NeighborAddressSubTlv(NO_MASK_VAL);
public static final IPv6NeighborAddressSubTlv FULL_MASK = NONE;
private final byte[] rawValue;
......@@ -50,7 +50,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
*
* @param rawValue IPv6 Neighbor Address Tlv
*/
public IPv6NeighborAddressTlv(byte[] rawValue) {
public IPv6NeighborAddressSubTlv(byte[] rawValue) {
this.rawValue = rawValue;
}
......@@ -60,7 +60,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
* @param raw IPv6 Neighbor Address
* @return object of IPv6 Neighbor Address Tlv
*/
public static IPv6NeighborAddressTlv of(final byte[] raw) {
public static IPv6NeighborAddressSubTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNone = true;
//value starts from 3rd byte.
......@@ -86,7 +86,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
return NO_MASK;
}
return new IPv6NeighborAddressTlv(raw);
return new IPv6NeighborAddressSubTlv(raw);
}
/**
......@@ -132,8 +132,8 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv6NeighborAddressTlv) {
IPv6NeighborAddressTlv other = (IPv6NeighborAddressTlv) obj;
if (obj instanceof IPv6NeighborAddressSubTlv) {
IPv6NeighborAddressSubTlv other = (IPv6NeighborAddressSubTlv) obj;
return Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -154,10 +154,10 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
* @param c input channel buffer
* @return object of IPv6NeighborAddressTlv
*/
public static IPv6NeighborAddressTlv read20Bytes(ChannelBuffer c) {
public static IPv6NeighborAddressSubTlv read20Bytes(ChannelBuffer c) {
byte[] yTemp = new byte[20];
c.readBytes(yTemp, 0, 20);
return IPv6NeighborAddressTlv.of(yTemp);
return IPv6NeighborAddressSubTlv.of(yTemp);
}
@Override
......
......@@ -27,40 +27,40 @@ import java.util.Arrays;
/**
* Provides IPv6 TE Router Id of Local Node. Reference :[RFC6119]/4.1.
*/
public class IPv6TERouterIdofLocalNodeTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6TERouterIdofLocalNodeTlv.class);
public class IPv6RouterIdofLocalNodeSubTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6RouterIdofLocalNodeSubTlv.class);
public static final short TYPE = 140; //TDB26
public static final short TYPE = 18;
public static final short LENGTH = 20;
public static final byte VALUE_LENGTH = 18;
private static final byte[] NONE_VAL = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
public static final IPv6TERouterIdofLocalNodeTlv NONE = new IPv6TERouterIdofLocalNodeTlv(NONE_VAL);
public static final IPv6RouterIdofLocalNodeSubTlv NONE = new IPv6RouterIdofLocalNodeSubTlv(NONE_VAL);
private static final byte[] NO_MASK_VAL = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
public static final IPv6TERouterIdofLocalNodeTlv NO_MASK = new IPv6TERouterIdofLocalNodeTlv(NO_MASK_VAL);
public static final IPv6TERouterIdofLocalNodeTlv FULL_MASK = NONE;
public static final IPv6RouterIdofLocalNodeSubTlv NO_MASK = new IPv6RouterIdofLocalNodeSubTlv(NO_MASK_VAL);
public static final IPv6RouterIdofLocalNodeSubTlv FULL_MASK = NONE;
private final byte[] rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv6TERouterIdofLocalNodeTlv
* @param rawValue IPv6RouterIdofLocalNodeTlv
*/
public IPv6TERouterIdofLocalNodeTlv(byte[] rawValue) {
public IPv6RouterIdofLocalNodeSubTlv(byte[] rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created IPv6TERouterIdofLocalNodeTlv object.
* Returns newly created IPv6RouterIdofLocalNodeTlv object.
*
* @param raw IPv6 TE Router Id of Local Node
* @return object of IPv6TERouterIdofLocalNodeTlv
* @return object of IPv6RouterIdofLocalNodeTlv
*/
public static IPv6TERouterIdofLocalNodeTlv of(final byte[] raw) {
public static IPv6RouterIdofLocalNodeSubTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNone = true;
//value starts from 3rd byte.
......@@ -86,7 +86,7 @@ public class IPv6TERouterIdofLocalNodeTlv implements PcepValueType {
return NO_MASK;
}
return new IPv6TERouterIdofLocalNodeTlv(raw);
return new IPv6RouterIdofLocalNodeSubTlv(raw);
}
/**
......@@ -132,8 +132,8 @@ public class IPv6TERouterIdofLocalNodeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv6TERouterIdofLocalNodeTlv) {
IPv6TERouterIdofLocalNodeTlv other = (IPv6TERouterIdofLocalNodeTlv) obj;
if (obj instanceof IPv6RouterIdofLocalNodeSubTlv) {
IPv6RouterIdofLocalNodeSubTlv other = (IPv6RouterIdofLocalNodeSubTlv) obj;
return Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -149,15 +149,15 @@ public class IPv6TERouterIdofLocalNodeTlv implements PcepValueType {
}
/**
* Reads the channel buffer and returns object of IPv6TERouterIdofLocalNodeTlv.
* Reads the channel buffer and returns object of IPv6RouterIdofLocalNodeTlv.
*
* @param c input channel buffer
* @return object of IPv6TERouterIdofLocalNodeTlv
* @return object of IPv6RouterIdofLocalNodeTlv
*/
public static IPv6TERouterIdofLocalNodeTlv read20Bytes(ChannelBuffer c) {
public static IPv6RouterIdofLocalNodeSubTlv read20Bytes(ChannelBuffer c) {
byte[] yTemp = new byte[20];
c.readBytes(yTemp, 0, 20);
return IPv6TERouterIdofLocalNodeTlv.of(yTemp);
return IPv6RouterIdofLocalNodeSubTlv.of(yTemp);
}
@Override
......
......@@ -27,41 +27,41 @@ import java.util.Arrays;
/**
* Provides IPv6 TE Router Id of Remote Node. Reference :[RFC6119]/4.1.
*/
public class IPv6TERouterIdofRemoteNodeTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6TERouterIdofRemoteNodeTlv.class);
public class IPv6RouterIdofRemoteNodeSubTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(IPv6RouterIdofRemoteNodeSubTlv.class);
public static final short TYPE = 1400; //TDB29
public static final short TYPE = 20;
public static final short LENGTH = 20;
public static final byte VALUE_LENGTH = 18;
private static final byte[] NONE_VAL = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public static final IPv6TERouterIdofRemoteNodeTlv NONE = new IPv6TERouterIdofRemoteNodeTlv(NONE_VAL);
public static final IPv6RouterIdofRemoteNodeSubTlv NONE = new IPv6RouterIdofRemoteNodeSubTlv(NONE_VAL);
private static final byte[] NO_MASK_VAL = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
public static final IPv6TERouterIdofRemoteNodeTlv NO_MASK = new IPv6TERouterIdofRemoteNodeTlv(NO_MASK_VAL);
public static final IPv6TERouterIdofRemoteNodeTlv FULL_MASK = NONE;
public static final IPv6RouterIdofRemoteNodeSubTlv NO_MASK = new IPv6RouterIdofRemoteNodeSubTlv(NO_MASK_VAL);
public static final IPv6RouterIdofRemoteNodeSubTlv FULL_MASK = NONE;
private final byte[] rawValue;
/**
* constructor to initialize rawValue.
*
* @param rawValue IPv6TERouterIdofRemoteNodeTlv
* @param rawValue IPv6RouterIdofRemoteNodeTlv
*/
public IPv6TERouterIdofRemoteNodeTlv(byte[] rawValue) {
log.debug("IPv6TERouterIdofRemoteNodeTlv");
public IPv6RouterIdofRemoteNodeSubTlv(byte[] rawValue) {
log.debug("IPv6RouterIdofRemoteNodeTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created IPv6TERouterIdofRemoteNodeTlv object.
* Returns newly created IPv6RouterIdofRemoteNodeTlv object.
*
* @param raw IPv6 TE Router Id of RemoteNode
* @return object of IPv6TERouterIdofRemoteNodeTlv
* @return object of IPv6RouterIdofRemoteNodeTlv
*/
public static IPv6TERouterIdofRemoteNodeTlv of(final byte[] raw) {
public static IPv6RouterIdofRemoteNodeSubTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNone = true;
//value starts from 3rd byte.
......@@ -87,7 +87,7 @@ public class IPv6TERouterIdofRemoteNodeTlv implements PcepValueType {
return NO_MASK;
}
return new IPv6TERouterIdofRemoteNodeTlv(raw);
return new IPv6RouterIdofRemoteNodeSubTlv(raw);
}
/**
......@@ -124,8 +124,8 @@ public class IPv6TERouterIdofRemoteNodeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IPv6TERouterIdofRemoteNodeTlv) {
IPv6TERouterIdofRemoteNodeTlv other = (IPv6TERouterIdofRemoteNodeTlv) obj;
if (obj instanceof IPv6RouterIdofRemoteNodeSubTlv) {
IPv6RouterIdofRemoteNodeSubTlv other = (IPv6RouterIdofRemoteNodeSubTlv) obj;
return Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -141,15 +141,15 @@ public class IPv6TERouterIdofRemoteNodeTlv implements PcepValueType {
}
/**
* Reads the channel buffer and returns object of IPv6TERouterIdofRemoteNodeTlv.
* Reads the channel buffer and returns object of IPv6RouterIdofRemoteNodeTlv.
*
* @param c input channel buffer
* @return object of IPv6TERouterIdofRemoteNodeTlv
* @return object of IPv6RouterIdofRemoteNodeTlv
*/
public static IPv6TERouterIdofRemoteNodeTlv read20Bytes(ChannelBuffer c) {
public static IPv6RouterIdofRemoteNodeSubTlv read20Bytes(ChannelBuffer c) {
byte[] yTemp = new byte[20];
c.readBytes(yTemp, 0, 20);
return IPv6TERouterIdofRemoteNodeTlv.of(yTemp);
return IPv6RouterIdofRemoteNodeSubTlv.of(yTemp);
}
@Override
......
......@@ -27,7 +27,7 @@ import java.util.Arrays;
/**
* Provides IGP Link Metric .
*/
public class IgpMetricTlv implements PcepValueType {
public class IgpMetricSubTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr-ls-distribution] /3.3.2.4
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class IgpMetricTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IgpMetricTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IgpMetricSubTlv.class);
public static final short TYPE = 1095; //TODO:NEED TO HANDLE TDB40
public static final short TYPE = 29;
private short hLength;
private final byte[] rawValue;
......@@ -52,7 +52,7 @@ public class IgpMetricTlv implements PcepValueType {
* @param rawValue IGP Link Metric
* @param hLength length
*/
public IgpMetricTlv(byte[] rawValue, short hLength) {
public IgpMetricSubTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
this.hLength = hLength;
}
......@@ -64,8 +64,8 @@ public class IgpMetricTlv implements PcepValueType {
* @param hLength length
* @return object of IGPMetricTlv
*/
public static IgpMetricTlv of(final byte[] raw, short hLength) {
return new IgpMetricTlv(raw, hLength);
public static IgpMetricSubTlv of(final byte[] raw, short hLength) {
return new IgpMetricSubTlv(raw, hLength);
}
/**
......@@ -102,8 +102,8 @@ public class IgpMetricTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IgpMetricTlv) {
IgpMetricTlv other = (IgpMetricTlv) obj;
if (obj instanceof IgpMetricSubTlv) {
IgpMetricSubTlv other = (IgpMetricSubTlv) obj;
return Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -128,7 +128,7 @@ public class IgpMetricTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iIgpMetric = new byte[hLength];
c.readBytes(iIgpMetric, 0, hLength);
return new IgpMetricTlv(iIgpMetric, hLength);
return new IgpMetricSubTlv(iIgpMetric, hLength);
}
@Override
......
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides router id.
*/
public class RouterIDSubTlv implements PcepValueType {
public class IgpRouterIdSubTlv implements PcepValueType {
/* reference :I-D.ietf-idr-ls-distribution.
* 0 1 2 3
......@@ -40,9 +40,9 @@ public class RouterIDSubTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(RouterIDSubTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IgpRouterIdSubTlv.class);
public static final short TYPE = 1000; //TODD:change this TBD13
public static final short TYPE = 4;
private final short hLength;
private final byte[] rawValue;
......@@ -53,7 +53,7 @@ public class RouterIDSubTlv implements PcepValueType {
* @param rawValue raw value
* @param hLength length
*/
public RouterIDSubTlv(byte[] rawValue, short hLength) {
public IgpRouterIdSubTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
if (0 == hLength) {
this.hLength = (short) rawValue.length;
......@@ -69,8 +69,8 @@ public class RouterIDSubTlv implements PcepValueType {
* @param hLength length
* @return object of Router ID Sub Tlv
*/
public static RouterIDSubTlv of(final byte[] raw, short hLength) {
return new RouterIDSubTlv(raw, hLength);
public static IgpRouterIdSubTlv of(final byte[] raw, short hLength) {
return new IgpRouterIdSubTlv(raw, hLength);
}
/**
......@@ -107,8 +107,8 @@ public class RouterIDSubTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof RouterIDSubTlv) {
RouterIDSubTlv other = (RouterIDSubTlv) obj;
if (obj instanceof IgpRouterIdSubTlv) {
IgpRouterIdSubTlv other = (IgpRouterIdSubTlv) obj;
return Arrays.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -124,16 +124,16 @@ public class RouterIDSubTlv implements PcepValueType {
}
/**
* Reads channel buffer and returns object of RouterIDSubTlv.
* Reads channel buffer and returns object of IgpRouterIDTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of RouterIDSubTlv
* @return object of IgpRouterIDTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iOpaqueValue = new byte[hLength];
c.readBytes(iOpaqueValue, 0, hLength);
return new RouterIDSubTlv(iOpaqueValue, hLength);
return new IgpRouterIdSubTlv(iOpaqueValue, hLength);
}
@Override
......
......@@ -28,7 +28,7 @@ import java.util.Objects;
/**
* Provides ISIS Area Identifier.
*/
public class IsisAreaIdentifierTlv implements PcepValueType {
public class IsisAreaIdentifierSubTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution]/3.3.1.2
* 0 1 2 3
......@@ -40,9 +40,9 @@ public class IsisAreaIdentifierTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IsisAreaIdentifierTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IsisAreaIdentifierSubTlv.class);
public static final short TYPE = 107; //TODO:NEED TO HANDLE TBD24
public static final short TYPE = 16;
private short hLength;
private final byte[] rawValue;
......@@ -53,7 +53,7 @@ public class IsisAreaIdentifierTlv implements PcepValueType {
* @param rawValue ISIS-Area-Identifier
* @param hLength length
*/
public IsisAreaIdentifierTlv(byte[] rawValue, short hLength) {
public IsisAreaIdentifierSubTlv(byte[] rawValue, short hLength) {
log.debug("ISISAreaIdentifierTlv");
this.rawValue = rawValue;
if (0 == hLength) {
......@@ -70,8 +70,8 @@ public class IsisAreaIdentifierTlv implements PcepValueType {
* @param hLength length
* @return object of ISISAreaIdentifierTlv
*/
public static IsisAreaIdentifierTlv of(final byte[] raw, short hLength) {
return new IsisAreaIdentifierTlv(raw, hLength);
public static IsisAreaIdentifierSubTlv of(final byte[] raw, short hLength) {
return new IsisAreaIdentifierSubTlv(raw, hLength);
}
/**
......@@ -108,8 +108,8 @@ public class IsisAreaIdentifierTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IsisAreaIdentifierTlv) {
IsisAreaIdentifierTlv other = (IsisAreaIdentifierTlv) obj;
if (obj instanceof IsisAreaIdentifierSubTlv) {
IsisAreaIdentifierSubTlv other = (IsisAreaIdentifierSubTlv) obj;
return Objects.equals(hLength, other.hLength) && Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -134,7 +134,7 @@ public class IsisAreaIdentifierTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iIsisAreaIdentifier = new byte[hLength];
c.readBytes(iIsisAreaIdentifier, 0, hLength);
return new IsisAreaIdentifierTlv(iIsisAreaIdentifier, hLength);
return new IsisAreaIdentifierSubTlv(iIsisAreaIdentifier, hLength);
}
@Override
......
......@@ -17,6 +17,7 @@ package org.onosproject.pcepio.types;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
......@@ -29,12 +30,12 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides TELinkAttributesTlv.
* Provides LinkAttributesTlv.
*/
public class TELinkAttributesTlv implements PcepValueType {
public class LinkAttributesTlv implements PcepValueType {
/*
* Reference :PCEP Extension for Transporting TE Data draft-dhodylee-pce-pcep-te-data-extn-02
* Reference :draft-dhodylee-pce-pcep-ls-01, section 9.2.8.2.
* 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
......@@ -46,22 +47,22 @@ public class TELinkAttributesTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(TELinkAttributesTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LinkAttributesTlv.class);
public static final short TYPE = 1897; //TODD:change this TBD27
public static final short TYPE = (short) 65286;
public short hLength;
public static final int TLV_HEADER_LENGTH = 4;
// LinkDescriptors Sub-TLVs (variable)
private LinkedList<PcepValueType> llLinkAttributesSubTLVs;
private List<PcepValueType> llLinkAttributesSubTLVs;
/**
* Constructor to initialize Link Attributes Sub TLVs.
*
* @param llLinkAttributesSubTLVs linked list of PcepValueType
*/
public TELinkAttributesTlv(LinkedList<PcepValueType> llLinkAttributesSubTLVs) {
public LinkAttributesTlv(List<PcepValueType> llLinkAttributesSubTLVs) {
this.llLinkAttributesSubTLVs = llLinkAttributesSubTLVs;
}
......@@ -69,10 +70,10 @@ public class TELinkAttributesTlv implements PcepValueType {
* Returns object of TE Link Attributes TLV.
*
* @param llLinkAttributesSubTLVs linked list of Link Attribute of Sub TLV
* @return object of TELinkAttributesTlv
* @return object of LinkAttributesTlv
*/
public static TELinkAttributesTlv of(final LinkedList<PcepValueType> llLinkAttributesSubTLVs) {
return new TELinkAttributesTlv(llLinkAttributesSubTLVs);
public static LinkAttributesTlv of(final List<PcepValueType> llLinkAttributesSubTLVs) {
return new LinkAttributesTlv(llLinkAttributesSubTLVs);
}
/**
......@@ -80,7 +81,7 @@ public class TELinkAttributesTlv implements PcepValueType {
*
* @return llLinkAttributesSubTLVs linked list of Link Attribute of Sub TLV
*/
public LinkedList<PcepValueType> getllLinkAttributesSubTLVs() {
public List<PcepValueType> getllLinkAttributesSubTLVs() {
return llLinkAttributesSubTLVs;
}
......@@ -117,13 +118,13 @@ public class TELinkAttributesTlv implements PcepValueType {
* the size, if both are same then we should check for the subtlv objects otherwise
* we should return false.
*/
if (obj instanceof TELinkAttributesTlv) {
if (obj instanceof LinkAttributesTlv) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
TELinkAttributesTlv other = (TELinkAttributesTlv) obj;
Iterator<PcepValueType> objListIterator = ((TELinkAttributesTlv) obj).llLinkAttributesSubTLVs.iterator();
countObjSubTlv = ((TELinkAttributesTlv) obj).llLinkAttributesSubTLVs.size();
LinkAttributesTlv other = (LinkAttributesTlv) obj;
Iterator<PcepValueType> objListIterator = ((LinkAttributesTlv) obj).llLinkAttributesSubTLVs.iterator();
countObjSubTlv = ((LinkAttributesTlv) obj).llLinkAttributesSubTLVs.size();
countOtherSubTlv = other.llLinkAttributesSubTLVs.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
......@@ -180,13 +181,13 @@ public class TELinkAttributesTlv implements PcepValueType {
*
* @param c input channel buffer
* @param hLength length
* @return object of TELinkAttributesTlv
* @return object of LinkAttributesTlv
* @throws PcepParseException if mandatory fields are missing
*/
public static PcepValueType read(ChannelBuffer c, short hLength) throws PcepParseException {
// Node Descriptor Sub-TLVs (variable)
LinkedList<PcepValueType> llLinkAttributesSubTLVs = new LinkedList<>();
List<PcepValueType> llLinkAttributesSubTLVs = new LinkedList<>();
ChannelBuffer tempCb = c.readBytes(hLength);
......@@ -198,65 +199,65 @@ public class TELinkAttributesTlv implements PcepValueType {
short length = tempCb.readShort();
switch (hType) {
case IPv4TERouterIdOfLocalNodeTlv.TYPE:
case IPv4RouterIdOfLocalNodeSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new IPv4TERouterIdOfLocalNodeTlv(iValue);
tlv = new IPv4RouterIdOfLocalNodeSubTlv(iValue);
break;
case IPv6TERouterIdofLocalNodeTlv.TYPE:
byte[] ipv6LValue = new byte[IPv6TERouterIdofLocalNodeTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6LValue, 0, IPv6TERouterIdofLocalNodeTlv.VALUE_LENGTH);
tlv = new IPv6TERouterIdofLocalNodeTlv(ipv6LValue);
case IPv6RouterIdofLocalNodeSubTlv.TYPE:
byte[] ipv6LValue = new byte[IPv6RouterIdofLocalNodeSubTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6LValue, 0, IPv6RouterIdofLocalNodeSubTlv.VALUE_LENGTH);
tlv = new IPv6RouterIdofLocalNodeSubTlv(ipv6LValue);
break;
case IPv4TERouterIdOfRemoteNodeTlv.TYPE:
case IPv4RouterIdOfRemoteNodeSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new IPv4TERouterIdOfRemoteNodeTlv(iValue);
tlv = new IPv4RouterIdOfRemoteNodeSubTlv(iValue);
break;
case IPv6TERouterIdofRemoteNodeTlv.TYPE:
byte[] ipv6RValue = new byte[IPv6TERouterIdofRemoteNodeTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6RValue, 0, IPv6TERouterIdofRemoteNodeTlv.VALUE_LENGTH);
tlv = new IPv6TERouterIdofRemoteNodeTlv(ipv6RValue);
case IPv6RouterIdofRemoteNodeSubTlv.TYPE:
byte[] ipv6RValue = new byte[IPv6RouterIdofRemoteNodeSubTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6RValue, 0, IPv6RouterIdofRemoteNodeSubTlv.VALUE_LENGTH);
tlv = new IPv6RouterIdofRemoteNodeSubTlv(ipv6RValue);
break;
case LinkLocalRemoteIdentifiersTlv.TYPE:
tlv = LinkLocalRemoteIdentifiersTlv.read(tempCb);
case LinkLocalRemoteIdentifiersSubTlv.TYPE:
tlv = LinkLocalRemoteIdentifiersSubTlv.read(tempCb);
break;
case AdministrativeGroupTlv.TYPE:
case AdministrativeGroupSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new AdministrativeGroupTlv(iValue);
tlv = new AdministrativeGroupSubTlv(iValue);
break;
case MaximumLinkBandwidthTlv.TYPE:
case MaximumLinkBandwidthSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new MaximumLinkBandwidthTlv(iValue);
tlv = new MaximumLinkBandwidthSubTlv(iValue);
break;
case MaximumReservableLinkBandwidthTlv.TYPE:
case MaximumReservableLinkBandwidthSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new MaximumReservableLinkBandwidthTlv(iValue);
tlv = new MaximumReservableLinkBandwidthSubTlv(iValue);
break;
case UnreservedBandwidthTlv.TYPE:
case UnreservedBandwidthSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new UnreservedBandwidthTlv(iValue);
tlv = new UnreservedBandwidthSubTlv(iValue);
break;
case TEDefaultMetricTlv.TYPE:
case TEDefaultMetricSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new TEDefaultMetricTlv(iValue);
tlv = new TEDefaultMetricSubTlv(iValue);
break;
case LinkProtectionTypeTlv.TYPE:
tlv = LinkProtectionTypeTlv.read(tempCb);
case LinkProtectionTypeSubTlv.TYPE:
tlv = LinkProtectionTypeSubTlv.read(tempCb);
break;
case MplsProtocolMaskTlv.TYPE:
case MplsProtocolMaskSubTlv.TYPE:
byte cValue = tempCb.readByte();
tlv = new MplsProtocolMaskTlv(cValue);
tlv = new MplsProtocolMaskSubTlv(cValue);
break;
case IgpMetricTlv.TYPE:
tlv = IgpMetricTlv.read(tempCb, length);
case IgpMetricSubTlv.TYPE:
tlv = IgpMetricSubTlv.read(tempCb, length);
break;
case SharedRiskLinkGroupTlv.TYPE:
tlv = SharedRiskLinkGroupTlv.read(tempCb, length);
case SharedRiskLinkGroupSubTlv.TYPE:
tlv = SharedRiskLinkGroupSubTlv.read(tempCb, length);
break;
case OpaqueLinkAttributeTlv.TYPE:
tlv = OpaqueLinkAttributeTlv.read(tempCb, length);
case OpaqueLinkAttributeSubTlv.TYPE:
tlv = OpaqueLinkAttributeSubTlv.read(tempCb, length);
break;
case LinkNameTlv.TYPE:
tlv = LinkNameTlv.read(tempCb, length);
case LinkNameAttributeSubTlv.TYPE:
tlv = LinkNameAttributeSubTlv.read(tempCb, length);
break;
default:
throw new PcepParseException("Unsupported Sub TLV type :" + hType);
......@@ -278,7 +279,7 @@ public class TELinkAttributesTlv implements PcepValueType {
throw new PcepParseException("Sub Tlv parsing error. Extra bytes received.");
}
return new TELinkAttributesTlv(llLinkAttributesSubTLVs);
return new LinkAttributesTlv(llLinkAttributesSubTLVs);
}
@Override
......
......@@ -17,6 +17,7 @@ package org.onosproject.pcepio.types;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
......@@ -31,10 +32,10 @@ import com.google.common.base.MoreObjects;
/**
* Provides TE Link Descriptors TLV.
*/
public class TELinkDescriptorsTlv implements PcepValueType {
public class LinkDescriptorsTlv implements PcepValueType {
/*
* Reference: PCEP Extension for Transporting TE Data draft-dhodylee-pce-pcep-te-data-extn-02
* Reference: draft-dhodylee-pce-pcep-ls-01, section 9.2.6.
* 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
......@@ -47,33 +48,33 @@ public class TELinkDescriptorsTlv implements PcepValueType {
*/
protected static final Logger log = LoggerFactory.getLogger(TELinkDescriptorsTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LinkDescriptorsTlv.class);
public static final short TYPE = 1070; //TODD:change this TBD14
public static final short TYPE = (short) 65284;
public short hLength;
public static final int TLV_HEADER_LENGTH = 4;
// LinkDescriptors Sub-TLVs (variable)
private LinkedList<PcepValueType> llLinkDescriptorsSubTLVs;
private List<PcepValueType> llLinkDescriptorsSubTLVs;
/**
* Constructor to initialize llLinkDescriptorsSubTLVs.
*
* @param llLinkDescriptorsSubTLVs of PcepValueType
*/
public TELinkDescriptorsTlv(LinkedList<PcepValueType> llLinkDescriptorsSubTLVs) {
public LinkDescriptorsTlv(List<PcepValueType> llLinkDescriptorsSubTLVs) {
this.llLinkDescriptorsSubTLVs = llLinkDescriptorsSubTLVs;
}
/**
* Returns object of TELinkDescriptorsTLV.
* Returns object of LinkDescriptorsTlv.
*
* @param llLinkDescriptorsSubTLVs of PcepValueType
* @return object of TELinkDescriptorsTLV
* @return object of LinkDescriptorsTlv
*/
public static TELinkDescriptorsTlv of(final LinkedList<PcepValueType> llLinkDescriptorsSubTLVs) {
return new TELinkDescriptorsTlv(llLinkDescriptorsSubTLVs);
public static LinkDescriptorsTlv of(final List<PcepValueType> llLinkDescriptorsSubTLVs) {
return new LinkDescriptorsTlv(llLinkDescriptorsSubTLVs);
}
/**
......@@ -81,7 +82,7 @@ public class TELinkDescriptorsTlv implements PcepValueType {
*
* @return llLinkDescriptorsSubTLVs linked list of Link Attribute of Sub TLV
*/
public LinkedList<PcepValueType> getllLinkDescriptorsSubTLVs() {
public List<PcepValueType> getllLinkDescriptorsSubTLVs() {
return llLinkDescriptorsSubTLVs;
}
......@@ -118,13 +119,13 @@ public class TELinkDescriptorsTlv implements PcepValueType {
* the size, if both are same then we should check for the subtlv objects otherwise
* we should return false.
*/
if (obj instanceof TELinkDescriptorsTlv) {
if (obj instanceof LinkDescriptorsTlv) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
TELinkDescriptorsTlv other = (TELinkDescriptorsTlv) obj;
Iterator<PcepValueType> objListIterator = ((TELinkDescriptorsTlv) obj).llLinkDescriptorsSubTLVs.iterator();
countObjSubTlv = ((TELinkDescriptorsTlv) obj).llLinkDescriptorsSubTLVs.size();
LinkDescriptorsTlv other = (LinkDescriptorsTlv) obj;
Iterator<PcepValueType> objListIterator = ((LinkDescriptorsTlv) obj).llLinkDescriptorsSubTLVs.iterator();
countObjSubTlv = ((LinkDescriptorsTlv) obj).llLinkDescriptorsSubTLVs.size();
countOtherSubTlv = other.llLinkDescriptorsSubTLVs.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
......@@ -173,17 +174,17 @@ public class TELinkDescriptorsTlv implements PcepValueType {
}
/**
* Reads channel buffer and returns object of TELinkDescriptorsTLV.
* Reads channel buffer and returns object of LinkDescriptorsTlv.
*
* @param c input channel buffer
* @param length length
* @return object of TELinkDescriptorsTLV
* @return object of LinkDescriptorsTlv
* @throws PcepParseException if mandatory fields are missing
*/
public static PcepValueType read(ChannelBuffer c, short length) throws PcepParseException {
// Node Descriptor Sub-TLVs (variable)
LinkedList<PcepValueType> llLinkDescriptorsSubTLVs = new LinkedList<>();
List<PcepValueType> llLinkDescriptorsSubTLVs = new LinkedList<>();
ChannelBuffer tempCb = c.readBytes(length);
......@@ -196,26 +197,26 @@ public class TELinkDescriptorsTlv implements PcepValueType {
log.debug("sub Tlv Length" + hLength);
switch (hType) {
case LinkLocalRemoteIdentifiersTlv.TYPE:
tlv = LinkLocalRemoteIdentifiersTlv.read(tempCb);
case LinkLocalRemoteIdentifiersSubTlv.TYPE:
tlv = LinkLocalRemoteIdentifiersSubTlv.read(tempCb);
break;
case IPv4InterfaceAddressTlv.TYPE:
case IPv4InterfaceAddressSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new IPv4InterfaceAddressTlv(iValue);
tlv = new IPv4InterfaceAddressSubTlv(iValue);
break;
case IPv4NeighborAddressTlv.TYPE:
case IPv4NeighborAddressSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new IPv4NeighborAddressTlv(iValue);
tlv = new IPv4NeighborAddressSubTlv(iValue);
break;
case IPv6InterfaceAddressTlv.TYPE:
byte[] ipv6Value = new byte[IPv6InterfaceAddressTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6Value, 0, IPv6InterfaceAddressTlv.VALUE_LENGTH);
tlv = new IPv6InterfaceAddressTlv(ipv6Value);
case IPv6InterfaceAddressSubTlv.TYPE:
byte[] ipv6Value = new byte[IPv6InterfaceAddressSubTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6Value, 0, IPv6InterfaceAddressSubTlv.VALUE_LENGTH);
tlv = new IPv6InterfaceAddressSubTlv(ipv6Value);
break;
case IPv6NeighborAddressTlv.TYPE:
byte[] ipv6NeighborAdd = new byte[IPv6NeighborAddressTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6NeighborAdd, 0, IPv6NeighborAddressTlv.VALUE_LENGTH);
tlv = new IPv6NeighborAddressTlv(ipv6NeighborAdd);
case IPv6NeighborAddressSubTlv.TYPE:
byte[] ipv6NeighborAdd = new byte[IPv6NeighborAddressSubTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6NeighborAdd, 0, IPv6NeighborAddressSubTlv.VALUE_LENGTH);
tlv = new IPv6NeighborAddressSubTlv(ipv6NeighborAdd);
break;
default:
throw new PcepParseException("Unsupported Sub TLV type:" + hType);
......@@ -237,7 +238,7 @@ public class TELinkDescriptorsTlv implements PcepValueType {
throw new PcepParseException("Sub Tlv parsing error. Extra bytes received.");
}
return new TELinkDescriptorsTlv(llLinkDescriptorsSubTLVs);
return new LinkDescriptorsTlv(llLinkDescriptorsSubTLVs);
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Local and remote Link Identifiers.
*/
public class LinkLocalRemoteIdentifiersTlv implements PcepValueType {
public class LinkLocalRemoteIdentifiersSubTlv implements PcepValueType {
/* Reference :RFC5307
* 0 1 2 3
......@@ -41,9 +41,9 @@ public class LinkLocalRemoteIdentifiersTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkLocalRemoteIdentifiersTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LinkLocalRemoteIdentifiersSubTlv.class);
public static final short TYPE = 4;
public static final short TYPE = 6;
public static final short LENGTH = 8;
private final int iLinkLocalIdentifier;
private final int iLinkRemoteIdentifier;
......@@ -54,7 +54,7 @@ public class LinkLocalRemoteIdentifiersTlv implements PcepValueType {
* @param iLinkLocalIdentifier Link Local identifier
* @param iLinkRemoteIdentifier Link Remote identifier
*/
public LinkLocalRemoteIdentifiersTlv(int iLinkLocalIdentifier, int iLinkRemoteIdentifier) {
public LinkLocalRemoteIdentifiersSubTlv(int iLinkLocalIdentifier, int iLinkRemoteIdentifier) {
this.iLinkLocalIdentifier = iLinkLocalIdentifier;
this.iLinkRemoteIdentifier = iLinkRemoteIdentifier;
}
......@@ -66,8 +66,8 @@ public class LinkLocalRemoteIdentifiersTlv implements PcepValueType {
* @param iLinkRemoteIdentifier Link Remote identifier
* @return object of LinkLocalRemoteIdentifiersTlv
*/
public static LinkLocalRemoteIdentifiersTlv of(int iLinkLocalIdentifier, int iLinkRemoteIdentifier) {
return new LinkLocalRemoteIdentifiersTlv(iLinkLocalIdentifier, iLinkRemoteIdentifier);
public static LinkLocalRemoteIdentifiersSubTlv of(int iLinkLocalIdentifier, int iLinkRemoteIdentifier) {
return new LinkLocalRemoteIdentifiersSubTlv(iLinkLocalIdentifier, iLinkRemoteIdentifier);
}
/**
......@@ -113,8 +113,8 @@ public class LinkLocalRemoteIdentifiersTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof LinkLocalRemoteIdentifiersTlv) {
LinkLocalRemoteIdentifiersTlv other = (LinkLocalRemoteIdentifiersTlv) obj;
if (obj instanceof LinkLocalRemoteIdentifiersSubTlv) {
LinkLocalRemoteIdentifiersSubTlv other = (LinkLocalRemoteIdentifiersSubTlv) obj;
return Objects.equals(iLinkLocalIdentifier, other.iLinkLocalIdentifier)
&& Objects.equals(iLinkRemoteIdentifier, other.iLinkRemoteIdentifier);
}
......@@ -140,7 +140,7 @@ public class LinkLocalRemoteIdentifiersTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c) {
int iLinkLocalIdentifier = c.readInt();
int iLinkRemoteIdentifier = c.readInt();
return new LinkLocalRemoteIdentifiersTlv(iLinkLocalIdentifier, iLinkRemoteIdentifier);
return new LinkLocalRemoteIdentifiersSubTlv(iLinkLocalIdentifier, iLinkRemoteIdentifier);
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides the Link Name.
*/
public class LinkNameTlv implements PcepValueType {
public class LinkNameAttributeSubTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution] /3.3.2.7
* Link name tlv format.
......@@ -40,9 +40,9 @@ public class LinkNameTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkNameTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LinkNameAttributeSubTlv.class);
public static final short TYPE = 1098; //TODO:NEED TO HANDLE TDB43
public static final short TYPE = 32;
private short hLength;
private final byte[] rawValue;
......@@ -53,7 +53,7 @@ public class LinkNameTlv implements PcepValueType {
* @param rawValue Link-Name
* @param hLength length
*/
public LinkNameTlv(byte[] rawValue, short hLength) {
public LinkNameAttributeSubTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
if (0 == hLength) {
this.hLength = (short) rawValue.length;
......@@ -69,8 +69,8 @@ public class LinkNameTlv implements PcepValueType {
* @param hLength length
* @return object of LinkNameTlv
*/
public static LinkNameTlv of(final byte[] raw, short hLength) {
return new LinkNameTlv(raw, hLength);
public static LinkNameAttributeSubTlv of(final byte[] raw, short hLength) {
return new LinkNameAttributeSubTlv(raw, hLength);
}
/**
......@@ -107,8 +107,8 @@ public class LinkNameTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof LinkNameTlv) {
LinkNameTlv other = (LinkNameTlv) obj;
if (obj instanceof LinkNameAttributeSubTlv) {
LinkNameAttributeSubTlv other = (LinkNameAttributeSubTlv) obj;
return Arrays.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -133,7 +133,7 @@ public class LinkNameTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] linkName = new byte[hLength];
c.readBytes(linkName, 0, hLength);
return new LinkNameTlv(linkName, hLength);
return new LinkNameAttributeSubTlv(linkName, hLength);
}
@Override
......
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects;
* Provide Link Protection Type.
*/
public class LinkProtectionTypeTlv implements PcepValueType {
public class LinkProtectionTypeSubTlv implements PcepValueType {
/* Reference :[RFC5307]/1.2
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class LinkProtectionTypeTlv implements PcepValueType {
|Protection Cap | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkProtectionTypeTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LinkProtectionTypeSubTlv.class);
public static final short TYPE = 20; //TDB38
public static final short TYPE = 27;
public static final short LENGTH = 2;
private final byte protectionCap;
private final byte reserved;
......@@ -51,7 +51,7 @@ public class LinkProtectionTypeTlv implements PcepValueType {
*
* @param protectionCap Protection Cap
*/
public LinkProtectionTypeTlv(byte protectionCap) {
public LinkProtectionTypeSubTlv(byte protectionCap) {
this.protectionCap = protectionCap;
this.reserved = 0;
}
......@@ -62,7 +62,7 @@ public class LinkProtectionTypeTlv implements PcepValueType {
* @param protectionCap Protection Cap
* @param reserved Reserved value
*/
public LinkProtectionTypeTlv(byte protectionCap, byte reserved) {
public LinkProtectionTypeSubTlv(byte protectionCap, byte reserved) {
this.protectionCap = protectionCap;
this.reserved = reserved;
}
......@@ -101,8 +101,8 @@ public class LinkProtectionTypeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof LinkProtectionTypeTlv) {
LinkProtectionTypeTlv other = (LinkProtectionTypeTlv) obj;
if (obj instanceof LinkProtectionTypeSubTlv) {
LinkProtectionTypeSubTlv other = (LinkProtectionTypeSubTlv) obj;
return Objects.equals(protectionCap, other.protectionCap) && Objects.equals(reserved, other.reserved);
}
......@@ -128,7 +128,7 @@ public class LinkProtectionTypeTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c) {
byte protectionCap = c.readByte();
byte reserved = c.readByte();
return new LinkProtectionTypeTlv(protectionCap, reserved);
return new LinkProtectionTypeSubTlv(protectionCap, reserved);
}
@Override
......
......@@ -17,6 +17,7 @@ package org.onosproject.pcepio.types;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
......@@ -31,9 +32,9 @@ import com.google.common.base.MoreObjects;
/**
* Provides Local TE Node Descriptors TLV which contains Node Descriptor Sub-TLVs.
*/
public class LocalTENodeDescriptorsTlv implements PcepValueType {
public class LocalNodeDescriptorsTlv implements PcepValueType {
/* REFERENCE :draft-ietf-idr-ls-distribution-10
/* REFERENCE :draft-dhodylee-pce-pcep-ls-01, section 9.2.2
* 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
......@@ -46,32 +47,32 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
Note: Length is including header here. Refer Routing Universe TLV.
*/
protected static final Logger log = LoggerFactory.getLogger(LocalTENodeDescriptorsTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LocalNodeDescriptorsTlv.class);
public static final short TYPE = 1637; //TODD:change this TBD8
public static final short TYPE = (short) 65282;
public short hLength;
public static final int TLV_HEADER_LENGTH = 4;
// Node Descriptor Sub-TLVs (variable)
private LinkedList<PcepValueType> llNodeDescriptorSubTLVs;
private List<PcepValueType> llNodeDescriptorSubTLVs;
/**
* Constructor to initialize llNodeDescriptorSubTLVs.
*
* @param llNodeDescriptorSubTLVs LinkedList of PcepValueType
* @param llNodeDescriptorSubTLVs List of PcepValueType
*/
public LocalTENodeDescriptorsTlv(LinkedList<PcepValueType> llNodeDescriptorSubTLVs) {
public LocalNodeDescriptorsTlv(List<PcepValueType> llNodeDescriptorSubTLVs) {
this.llNodeDescriptorSubTLVs = llNodeDescriptorSubTLVs;
}
/**
* Returns a new object of LocalTENodeDescriptorsTLV.
* Returns a new object of LocalNodeDescriptorsTLV.
*
* @param llNodeDescriptorSubTLVs linked list of Node Descriptor Sub TLVs
* @return object of LocalTENodeDescriptorsTLV
* @return object of LocalNodeDescriptorsTLV
*/
public static LocalTENodeDescriptorsTlv of(final LinkedList<PcepValueType> llNodeDescriptorSubTLVs) {
return new LocalTENodeDescriptorsTlv(llNodeDescriptorSubTLVs);
public static LocalNodeDescriptorsTlv of(final List<PcepValueType> llNodeDescriptorSubTLVs) {
return new LocalNodeDescriptorsTlv(llNodeDescriptorSubTLVs);
}
/**
......@@ -79,7 +80,7 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
*
* @return llNodeDescriptorSubTLVs linked list of Node Descriptor Sub TLV
*/
public LinkedList<PcepValueType> getllNodeDescriptorSubTLVs() {
public List<PcepValueType> getllNodeDescriptorSubTLVs() {
return llNodeDescriptorSubTLVs;
}
......@@ -117,14 +118,14 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
* the size, if both are same then we should check for the subtlv objects otherwise
* we should return false.
*/
if (obj instanceof LocalTENodeDescriptorsTlv) {
if (obj instanceof LocalNodeDescriptorsTlv) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
LocalTENodeDescriptorsTlv other = (LocalTENodeDescriptorsTlv) obj;
Iterator<PcepValueType> objListIterator = ((LocalTENodeDescriptorsTlv) obj).llNodeDescriptorSubTLVs
LocalNodeDescriptorsTlv other = (LocalNodeDescriptorsTlv) obj;
Iterator<PcepValueType> objListIterator = ((LocalNodeDescriptorsTlv) obj).llNodeDescriptorSubTLVs
.iterator();
countObjSubTlv = ((LocalTENodeDescriptorsTlv) obj).llNodeDescriptorSubTLVs.size();
countObjSubTlv = ((LocalNodeDescriptorsTlv) obj).llNodeDescriptorSubTLVs.size();
countOtherSubTlv = other.llNodeDescriptorSubTLVs.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
......@@ -184,7 +185,7 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) throws PcepParseException {
// Node Descriptor Sub-TLVs (variable)
LinkedList<PcepValueType> llNodeDescriptorSubTLVs = new LinkedList<>();
List<PcepValueType> llNodeDescriptorSubTLVs = new LinkedList<>();
ChannelBuffer tempCb = c.readBytes(hLength);
......@@ -197,20 +198,20 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
switch (hType) {
case AutonomousSystemTlv.TYPE:
case AutonomousSystemSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new AutonomousSystemTlv(iValue);
tlv = new AutonomousSystemSubTlv(iValue);
break;
case BgpLsIdentifierTlv.TYPE:
case BgpLsIdentifierSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new BgpLsIdentifierTlv(iValue);
tlv = new BgpLsIdentifierSubTlv(iValue);
break;
case OspfAreaIdSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new OspfAreaIdSubTlv(iValue);
break;
case RouterIDSubTlv.TYPE:
tlv = RouterIDSubTlv.read(tempCb, length);
case IgpRouterIdSubTlv.TYPE:
tlv = IgpRouterIdSubTlv.read(tempCb, length);
break;
default:
......@@ -232,7 +233,7 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
if (0 < tempCb.readableBytes()) {
throw new PcepParseException("Sub Tlv parsing error. Extra bytes received.");
}
return new LocalTENodeDescriptorsTlv(llNodeDescriptorSubTLVs);
return new LocalNodeDescriptorsTlv(llNodeDescriptorSubTLVs);
}
@Override
......
......@@ -27,10 +27,10 @@ import com.google.common.base.MoreObjects;
/**
* Provides TED Capability Tlv.
*/
public class TedCapabilityTlv implements PcepValueType {
public class LsCapabilityTlv implements PcepValueType {
/*
* Reference :PCEP Extension for Transporting TE Data draft-dhodylee-pce-pcep-te-data-extn-02
* Reference :draft-dhodylee-pce-pcep-ls-01, section 9.1.1.
* 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
......@@ -40,14 +40,14 @@ public class TedCapabilityTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(TedCapabilityTlv.class);
protected static final Logger log = LoggerFactory.getLogger(LsCapabilityTlv.class);
public static final short TYPE = 132; //TODO: need to change this TBD5
public static final short TYPE = (short) 65280;
public static final short LENGTH = 4;
public static final int SET = 1;
public static final byte RFLAG_CHECK = 0x01;
private final boolean bRFlag;
private final boolean rFlag;
private final int rawValue;
private final boolean isRawValueSet;
......@@ -56,26 +56,26 @@ public class TedCapabilityTlv implements PcepValueType {
*
* @param rawValue Flags
*/
public TedCapabilityTlv(final int rawValue) {
public LsCapabilityTlv(final int rawValue) {
this.rawValue = rawValue;
this.isRawValueSet = true;
int temp = rawValue;
temp = temp & RFLAG_CHECK;
if (temp == SET) {
this.bRFlag = true;
this.rFlag = true;
} else {
this.bRFlag = false;
this.rFlag = false;
}
}
/**
* Constructor to initialize bRFlag.
* Constructor to initialize rFlag.
*
* @param bRFlag R-flag
* @param rFlag R-flag
*/
public TedCapabilityTlv(boolean bRFlag) {
this.bRFlag = bRFlag;
public LsCapabilityTlv(boolean rFlag) {
this.rFlag = rFlag;
this.rawValue = 0;
this.isRawValueSet = false;
}
......@@ -83,20 +83,20 @@ public class TedCapabilityTlv implements PcepValueType {
/**
* Returns R-flag.
*
* @return bRFlag
* @return rFlag
*/
public boolean getbRFlag() {
return bRFlag;
public boolean getrFlag() {
return rFlag;
}
/**
* Returns an object of TedCapabilityTlv.
* Returns an object of LsCapabilityTlv.
*
* @param raw value Flags
* @return object of TedCapabilityTlv
* @return object of LsCapabilityTlv
*/
public static TedCapabilityTlv of(final int raw) {
return new TedCapabilityTlv(raw);
public static LsCapabilityTlv of(final int raw) {
return new LsCapabilityTlv(raw);
}
@Override
......@@ -123,7 +123,7 @@ public class TedCapabilityTlv implements PcepValueType {
if (isRawValueSet) {
return Objects.hash(rawValue);
} else {
return Objects.hash(bRFlag);
return Objects.hash(rFlag);
}
}
......@@ -132,12 +132,12 @@ public class TedCapabilityTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof TedCapabilityTlv) {
TedCapabilityTlv other = (TedCapabilityTlv) obj;
if (obj instanceof LsCapabilityTlv) {
LsCapabilityTlv other = (LsCapabilityTlv) obj;
if (isRawValueSet) {
return Objects.equals(this.rawValue, other.rawValue);
} else {
return Objects.equals(this.bRFlag, other.bRFlag);
return Objects.equals(this.rFlag, other.rFlag);
}
}
return false;
......@@ -152,7 +152,7 @@ public class TedCapabilityTlv implements PcepValueType {
if (isRawValueSet) {
c.writeInt(rawValue);
} else {
if (bRFlag) {
if (rFlag) {
temp = temp | RFLAG_CHECK;
}
c.writeInt(temp);
......@@ -161,13 +161,13 @@ public class TedCapabilityTlv implements PcepValueType {
}
/**
* Reads channel buffer and returns object of TedCapabilityTlv.
* Reads channel buffer and returns object of LsCapabilityTlv.
*
* @param c input channel buffer
* @return object of TedCapabilityTlv
* @return object of LsCapabilityTlv
*/
public static TedCapabilityTlv read(ChannelBuffer c) {
return TedCapabilityTlv.of(c.readInt());
public static LsCapabilityTlv read(ChannelBuffer c) {
return LsCapabilityTlv.of(c.readInt());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provide the Maximum Link Bandwidth.
*/
public class MaximumLinkBandwidthTlv implements PcepValueType {
public class MaximumLinkBandwidthSubTlv implements PcepValueType {
/* Reference :[RFC5305]/3.3.
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class MaximumLinkBandwidthTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(MaximumLinkBandwidthTlv.class);
protected static final Logger log = LoggerFactory.getLogger(MaximumLinkBandwidthSubTlv.class);
public static final short TYPE = 9; //TDB34
public static final short TYPE = 23;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -52,7 +52,7 @@ public class MaximumLinkBandwidthTlv implements PcepValueType {
* @param rawValue Maximum-Link-Bandwidth
*/
public MaximumLinkBandwidthTlv(int rawValue) {
public MaximumLinkBandwidthSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -62,8 +62,8 @@ public class MaximumLinkBandwidthTlv implements PcepValueType {
* @param raw value of Maximum-Link-Bandwidth
* @return object of MaximumLinkBandwidthTlv
*/
public static MaximumLinkBandwidthTlv of(final int raw) {
return new MaximumLinkBandwidthTlv(raw);
public static MaximumLinkBandwidthSubTlv of(final int raw) {
return new MaximumLinkBandwidthSubTlv(raw);
}
/**
......@@ -100,8 +100,8 @@ public class MaximumLinkBandwidthTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof MaximumLinkBandwidthTlv) {
MaximumLinkBandwidthTlv other = (MaximumLinkBandwidthTlv) obj;
if (obj instanceof MaximumLinkBandwidthSubTlv) {
MaximumLinkBandwidthSubTlv other = (MaximumLinkBandwidthSubTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -122,8 +122,8 @@ public class MaximumLinkBandwidthTlv implements PcepValueType {
* @param c input channel buffer
* @return object of MaximumLinkBandwidthTlv
*/
public static MaximumLinkBandwidthTlv read(ChannelBuffer c) {
return MaximumLinkBandwidthTlv.of(c.readInt());
public static MaximumLinkBandwidthSubTlv read(ChannelBuffer c) {
return MaximumLinkBandwidthSubTlv.of(c.readInt());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provide the Maximum Reservable Link Bandwidth.
*/
public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
public class MaximumReservableLinkBandwidthSubTlv implements PcepValueType {
/* Reference :[RFC5305]/3.5.
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(MaximumReservableLinkBandwidthTlv.class);
protected static final Logger log = LoggerFactory.getLogger(MaximumReservableLinkBandwidthSubTlv.class);
public static final short TYPE = 10; // TDB35
public static final short TYPE = 24;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -51,7 +51,7 @@ public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
*
* @param rawValue MaximumReservableLinkBandwidth
*/
public MaximumReservableLinkBandwidthTlv(int rawValue) {
public MaximumReservableLinkBandwidthSubTlv(int rawValue) {
log.debug("MaximumReservableLinkBandwidthTlv");
this.rawValue = rawValue;
}
......@@ -62,8 +62,8 @@ public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
* @param raw MaximumReservableLinkBandwidth
* @return object of MaximumReservableLinkBandwidthTlv
*/
public static MaximumReservableLinkBandwidthTlv of(final int raw) {
return new MaximumReservableLinkBandwidthTlv(raw);
public static MaximumReservableLinkBandwidthSubTlv of(final int raw) {
return new MaximumReservableLinkBandwidthSubTlv(raw);
}
/**
......@@ -99,8 +99,8 @@ public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof MaximumReservableLinkBandwidthTlv) {
MaximumReservableLinkBandwidthTlv other = (MaximumReservableLinkBandwidthTlv) obj;
if (obj instanceof MaximumReservableLinkBandwidthSubTlv) {
MaximumReservableLinkBandwidthSubTlv other = (MaximumReservableLinkBandwidthSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -121,8 +121,8 @@ public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
* @param c input channel buffer
* @return object of MaximumReservableLinkBandwidthTlv
*/
public static MaximumReservableLinkBandwidthTlv read(ChannelBuffer c) {
return MaximumReservableLinkBandwidthTlv.of(c.readInt());
public static MaximumReservableLinkBandwidthSubTlv read(ChannelBuffer c) {
return MaximumReservableLinkBandwidthSubTlv.of(c.readInt());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides MPLS Protocol Mask.
*/
public class MplsProtocolMaskTlv implements PcepValueType {
public class MplsProtocolMaskSubTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr-ls-distribution]/3.3.2.2
* 0 1 2 3
......@@ -38,9 +38,9 @@ public class MplsProtocolMaskTlv implements PcepValueType {
|L|R| Reserved |
+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(MplsProtocolMaskTlv.class);
protected static final Logger log = LoggerFactory.getLogger(MplsProtocolMaskSubTlv.class);
public static final short TYPE = 1094; //TDB39
public static final short TYPE = 28;
public static final short LENGTH = 1;
public static final byte LFLAG_SET = (byte) 0x80;
public static final byte RFLAG_SET = 0x40;
......@@ -55,7 +55,7 @@ public class MplsProtocolMaskTlv implements PcepValueType {
*
* @param rawValue MPLS Protocol Mask Flag Bits
*/
public MplsProtocolMaskTlv(byte rawValue) {
public MplsProtocolMaskSubTlv(byte rawValue) {
this.rawValue = rawValue;
this.isRawValueSet = true;
this.bLFlag = (rawValue & LFLAG_SET) == LFLAG_SET;
......@@ -68,7 +68,7 @@ public class MplsProtocolMaskTlv implements PcepValueType {
* @param bLFlag L-flag
* @param bRFlag R-flag
*/
public MplsProtocolMaskTlv(boolean bLFlag, boolean bRFlag) {
public MplsProtocolMaskSubTlv(boolean bLFlag, boolean bRFlag) {
this.bLFlag = bLFlag;
this.bRFlag = bRFlag;
this.rawValue = 0;
......@@ -81,8 +81,8 @@ public class MplsProtocolMaskTlv implements PcepValueType {
* @param raw MPLS Protocol Mask Tlv
* @return new object of MPLS Protocol Mask Tlv
*/
public static MplsProtocolMaskTlv of(final byte raw) {
return new MplsProtocolMaskTlv(raw);
public static MplsProtocolMaskSubTlv of(final byte raw) {
return new MplsProtocolMaskSubTlv(raw);
}
/**
......@@ -141,8 +141,8 @@ public class MplsProtocolMaskTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof MplsProtocolMaskTlv) {
MplsProtocolMaskTlv other = (MplsProtocolMaskTlv) obj;
if (obj instanceof MplsProtocolMaskSubTlv) {
MplsProtocolMaskSubTlv other = (MplsProtocolMaskSubTlv) obj;
if (isRawValueSet) {
return Objects.equals(this.rawValue, other.rawValue);
} else {
......@@ -186,7 +186,7 @@ public class MplsProtocolMaskTlv implements PcepValueType {
bLFlag = (temp & LFLAG_SET) == LFLAG_SET;
bRFlag = (temp & RFLAG_SET) == RFLAG_SET;
return new MplsProtocolMaskTlv(bLFlag, bRFlag);
return new MplsProtocolMaskSubTlv(bLFlag, bRFlag);
}
@Override
......
......@@ -17,6 +17,7 @@ package org.onosproject.pcepio.types;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
......@@ -31,7 +32,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides TE Node Attributes Tlv.
*/
public class TENodeAttributesTlv implements PcepValueType {
public class NodeAttributesTlv implements PcepValueType {
/*
* Reference :PCEP Extension for Transporting TE Data draft-dhodylee-pce-pcep-te-data-extn-02
*
......@@ -48,32 +49,32 @@ public class TENodeAttributesTlv implements PcepValueType {
*/
protected static final Logger log = LoggerFactory.getLogger(TENodeAttributesTlv.class);
protected static final Logger log = LoggerFactory.getLogger(NodeAttributesTlv.class);
public static final short TYPE = 1267; //TODD:change this TBD20
public static final short TYPE = (short) 65285;
public short hLength;
public static final int TLV_HEADER_LENGTH = 4;
// LinkDescriptors Sub-TLVs (variable)
private LinkedList<PcepValueType> llNodeAttributesSubTLVs;
private List<PcepValueType> llNodeAttributesSubTLVs;
/**
* Constructor to initialize llNodeAttributesSubTLVs.
*
* @param llNodeAttributesSubTLVs linked list of Node Attributes Sub-TLVs
*/
public TENodeAttributesTlv(LinkedList<PcepValueType> llNodeAttributesSubTLVs) {
public NodeAttributesTlv(List<PcepValueType> llNodeAttributesSubTLVs) {
this.llNodeAttributesSubTLVs = llNodeAttributesSubTLVs;
}
/**
* Returns object of TENodeAttributesTlv.
* Returns object of NodeAttributesTlv.
*
* @param llNodeAttributesSubTLVs LinkedList of PcepValueType
* @return object of TENodeAttributesTlv
* @param llNodeAttributesSubTLVs List of PcepValueType
* @return object of NodeAttributesTlv
*/
public static TENodeAttributesTlv of(LinkedList<PcepValueType> llNodeAttributesSubTLVs) {
return new TENodeAttributesTlv(llNodeAttributesSubTLVs);
public static NodeAttributesTlv of(List<PcepValueType> llNodeAttributesSubTLVs) {
return new NodeAttributesTlv(llNodeAttributesSubTLVs);
}
/**
......@@ -81,7 +82,7 @@ public class TENodeAttributesTlv implements PcepValueType {
*
* @return llNodeAttributesSubTLVs linked list of Node Attributes Sub-TLVs
*/
public LinkedList<PcepValueType> getllNodeAttributesSubTLVs() {
public List<PcepValueType> getllNodeAttributesSubTLVs() {
return llNodeAttributesSubTLVs;
}
......@@ -118,13 +119,13 @@ public class TENodeAttributesTlv implements PcepValueType {
* the size, if both are same then we should check for the subtlv objects otherwise
* we should return false.
*/
if (obj instanceof TENodeAttributesTlv) {
if (obj instanceof NodeAttributesTlv) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
TENodeAttributesTlv other = (TENodeAttributesTlv) obj;
Iterator<PcepValueType> objListIterator = ((TENodeAttributesTlv) obj).llNodeAttributesSubTLVs.iterator();
countObjSubTlv = ((TENodeAttributesTlv) obj).llNodeAttributesSubTLVs.size();
NodeAttributesTlv other = (NodeAttributesTlv) obj;
Iterator<PcepValueType> objListIterator = ((NodeAttributesTlv) obj).llNodeAttributesSubTLVs.iterator();
countObjSubTlv = ((NodeAttributesTlv) obj).llNodeAttributesSubTLVs.size();
countOtherSubTlv = other.llNodeAttributesSubTLVs.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
......@@ -173,17 +174,17 @@ public class TENodeAttributesTlv implements PcepValueType {
}
/**
* Reads the channel buffer and returns object of TENodeAttributesTlv.
* Reads the channel buffer and returns object of NodeAttributesTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of TENodeAttributesTlv
* @return object of NodeAttributesTlv
* @throws PcepParseException if mandatory fields are missing
*/
public static PcepValueType read(ChannelBuffer c, short hLength) throws PcepParseException {
// Node Descriptor Sub-TLVs (variable)
LinkedList<PcepValueType> llNodeAttributesSubTLVs = new LinkedList<>();
List<PcepValueType> llNodeAttributesSubTLVs = new LinkedList<>();
ChannelBuffer tempCb = c.readBytes(hLength);
......@@ -194,27 +195,27 @@ public class TENodeAttributesTlv implements PcepValueType {
short length = tempCb.readShort();
switch (hType) {
case NodeFlagBitsTlv.TYPE:
case NodeFlagBitsSubTlv.TYPE:
byte cValue = tempCb.readByte();
tlv = new NodeFlagBitsTlv(cValue);
tlv = new NodeFlagBitsSubTlv(cValue);
break;
case OpaqueNodeAttributeTlv.TYPE:
tlv = OpaqueNodeAttributeTlv.read(tempCb, length);
case OpaqueNodePropertiesSubTlv.TYPE:
tlv = OpaqueNodePropertiesSubTlv.read(tempCb, length);
break;
case NodeNameTlv.TYPE:
tlv = NodeNameTlv.read(tempCb, length);
case NodeNameSubTlv.TYPE:
tlv = NodeNameSubTlv.read(tempCb, length);
break;
case IsisAreaIdentifierTlv.TYPE:
tlv = IsisAreaIdentifierTlv.read(tempCb, length);
case IsisAreaIdentifierSubTlv.TYPE:
tlv = IsisAreaIdentifierSubTlv.read(tempCb, length);
break;
case IPv4TERouterIdOfLocalNodeTlv.TYPE:
case IPv4RouterIdOfLocalNodeSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new IPv4TERouterIdOfLocalNodeTlv(iValue);
tlv = new IPv4RouterIdOfLocalNodeSubTlv(iValue);
break;
case IPv6TERouterIdofLocalNodeTlv.TYPE:
byte[] ipv6Value = new byte[IPv6TERouterIdofLocalNodeTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6Value, 0, IPv6TERouterIdofLocalNodeTlv.VALUE_LENGTH);
tlv = new IPv6TERouterIdofLocalNodeTlv(ipv6Value);
case IPv6RouterIdofLocalNodeSubTlv.TYPE:
byte[] ipv6Value = new byte[IPv6RouterIdofLocalNodeSubTlv.VALUE_LENGTH];
tempCb.readBytes(ipv6Value, 0, IPv6RouterIdofLocalNodeSubTlv.VALUE_LENGTH);
tlv = new IPv6RouterIdofLocalNodeSubTlv(ipv6Value);
break;
default:
throw new PcepParseException("Unsupported Sub TLV type :" + hType);
......@@ -236,7 +237,7 @@ public class TENodeAttributesTlv implements PcepValueType {
throw new PcepParseException("Sub Tlv parsing error. Extra bytes received.");
}
return new TENodeAttributesTlv(llNodeAttributesSubTLVs);
return new NodeAttributesTlv(llNodeAttributesSubTLVs);
}
@Override
......
......@@ -26,7 +26,7 @@ import com.google.common.base.MoreObjects;
/**
* Provide node Flags bits.
*/
public class NodeFlagBitsTlv implements PcepValueType {
public class NodeFlagBitsSubTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution] /3.3.1.1
* 0 1 2 3
......@@ -38,9 +38,9 @@ public class NodeFlagBitsTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(NodeFlagBitsTlv.class);
protected static final Logger log = LoggerFactory.getLogger(NodeFlagBitsSubTlv.class);
public static final short TYPE = 14;
public static final short TYPE = 13;
public static final short LENGTH = 1;
public static final int SET = 1;
public static final byte OFLAG_SET = (byte) 0x80;
......@@ -60,7 +60,7 @@ public class NodeFlagBitsTlv implements PcepValueType {
*
* @param rawValue of Node Flag Bits TLV
*/
public NodeFlagBitsTlv(byte rawValue) {
public NodeFlagBitsSubTlv(byte rawValue) {
this.rawValue = rawValue;
isRawValueSet = true;
this.bOFlag = (rawValue & OFLAG_SET) == OFLAG_SET;
......@@ -77,7 +77,7 @@ public class NodeFlagBitsTlv implements PcepValueType {
* @param bEFlag E-flag
* @param bBFlag B-flag
*/
public NodeFlagBitsTlv(boolean bOFlag, boolean bTFlag, boolean bEFlag, boolean bBFlag) {
public NodeFlagBitsSubTlv(boolean bOFlag, boolean bTFlag, boolean bEFlag, boolean bBFlag) {
this.bOFlag = bOFlag;
this.bTFlag = bTFlag;
this.bEFlag = bEFlag;
......@@ -92,8 +92,8 @@ public class NodeFlagBitsTlv implements PcepValueType {
* @param raw of Node Flag Bits TLV
* @return new object of NodeFlagBitsTlv
*/
public static NodeFlagBitsTlv of(final byte raw) {
return new NodeFlagBitsTlv(raw);
public static NodeFlagBitsSubTlv of(final byte raw) {
return new NodeFlagBitsSubTlv(raw);
}
/**
......@@ -170,8 +170,8 @@ public class NodeFlagBitsTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof NodeFlagBitsTlv) {
NodeFlagBitsTlv other = (NodeFlagBitsTlv) obj;
if (obj instanceof NodeFlagBitsSubTlv) {
NodeFlagBitsSubTlv other = (NodeFlagBitsSubTlv) obj;
if (isRawValueSet) {
return Objects.equals(this.rawValue, other.rawValue);
} else {
......@@ -216,7 +216,7 @@ public class NodeFlagBitsTlv implements PcepValueType {
*/
public static PcepValueType read(ChannelBuffer c) {
return NodeFlagBitsTlv.of(c.readByte());
return NodeFlagBitsSubTlv.of(c.readByte());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provide the name for the node.
*/
public class NodeNameTlv implements PcepValueType {
public class NodeNameSubTlv implements PcepValueType {
/* reference :[I-D.ietf-idr-ls-distribution]/3.3.1.3
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class NodeNameTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(NodeNameTlv.class);
protected static final Logger log = LoggerFactory.getLogger(NodeNameSubTlv.class);
public static final short TYPE = 1007; //TODO:check and change TBD23
public static final short TYPE = 15;
public final short hLength;
private final byte[] rawValue;
......@@ -52,7 +52,7 @@ public class NodeNameTlv implements PcepValueType {
* @param rawValue of Node Name
* @param hLength length
*/
public NodeNameTlv(byte[] rawValue, short hLength) {
public NodeNameSubTlv(byte[] rawValue, short hLength) {
log.debug("NodeNameTlv");
this.rawValue = rawValue;
if (0 == hLength) {
......@@ -69,8 +69,8 @@ public class NodeNameTlv implements PcepValueType {
* @param hLength length
* @return new object of Node Name Tlv
*/
public static NodeNameTlv of(final byte[] raw, short hLength) {
return new NodeNameTlv(raw, hLength);
public static NodeNameSubTlv of(final byte[] raw, short hLength) {
return new NodeNameSubTlv(raw, hLength);
}
/**
......@@ -107,8 +107,8 @@ public class NodeNameTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof NodeNameTlv) {
NodeNameTlv other = (NodeNameTlv) obj;
if (obj instanceof NodeNameSubTlv) {
NodeNameSubTlv other = (NodeNameSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -133,7 +133,7 @@ public class NodeNameTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iNodeName = new byte[hLength];
c.readBytes(iNodeName, 0, hLength);
return new NodeNameTlv(iNodeName, hLength);
return new NodeNameSubTlv(iNodeName, hLength);
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides Opaque Link Attribute.
*/
public class OpaqueLinkAttributeTlv implements PcepValueType {
public class OpaqueLinkAttributeSubTlv implements PcepValueType {
/*
* TLV format.
......@@ -41,9 +41,9 @@ public class OpaqueLinkAttributeTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(OpaqueLinkAttributeTlv.class);
protected static final Logger log = LoggerFactory.getLogger(OpaqueLinkAttributeSubTlv.class);
public static final short TYPE = 1097; //TODO:NEED TO HANDLE TDB42
public static final short TYPE = 31;
private final short hLength;
private final byte[] rawValue;
......@@ -54,7 +54,7 @@ public class OpaqueLinkAttributeTlv implements PcepValueType {
* @param rawValue of Opaque Link Attribute
* @param hLength length
*/
public OpaqueLinkAttributeTlv(byte[] rawValue, short hLength) {
public OpaqueLinkAttributeSubTlv(byte[] rawValue, short hLength) {
log.debug("OpaqueLinkAttributeTlv");
this.rawValue = rawValue;
if (0 == hLength) {
......@@ -71,8 +71,8 @@ public class OpaqueLinkAttributeTlv implements PcepValueType {
* @param hLength length
* @return new object of OpaqueLinkAttributeTlv
*/
public static OpaqueLinkAttributeTlv of(final byte[] raw, short hLength) {
return new OpaqueLinkAttributeTlv(raw, hLength);
public static OpaqueLinkAttributeSubTlv of(final byte[] raw, short hLength) {
return new OpaqueLinkAttributeSubTlv(raw, hLength);
}
/**
......@@ -108,8 +108,8 @@ public class OpaqueLinkAttributeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof OpaqueLinkAttributeTlv) {
OpaqueLinkAttributeTlv other = (OpaqueLinkAttributeTlv) obj;
if (obj instanceof OpaqueLinkAttributeSubTlv) {
OpaqueLinkAttributeSubTlv other = (OpaqueLinkAttributeSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -134,7 +134,7 @@ public class OpaqueLinkAttributeTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iOpaqueValue = new byte[hLength];
c.readBytes(iOpaqueValue, 0, hLength);
return new OpaqueLinkAttributeTlv(iOpaqueValue, hLength);
return new OpaqueLinkAttributeSubTlv(iOpaqueValue, hLength);
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides Opaque node attributes.
*/
public class OpaqueNodeAttributeTlv implements PcepValueType {
public class OpaqueNodePropertiesSubTlv implements PcepValueType {
/*
* Reference [I-D.ietf-idr-Properties ls-distribution] /3.3.1.5
* 0 1 2 3
......@@ -39,9 +39,9 @@ public class OpaqueNodeAttributeTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(OpaqueNodeAttributeTlv.class);
protected static final Logger log = LoggerFactory.getLogger(OpaqueNodePropertiesSubTlv.class);
public static final short TYPE = 1001;
public static final short TYPE = 14;
private final short hLength;
private final byte[] rawValue;
......@@ -52,7 +52,7 @@ public class OpaqueNodeAttributeTlv implements PcepValueType {
* @param rawValue Opaque Node Attribute
* @param hLength length
*/
public OpaqueNodeAttributeTlv(byte[] rawValue, short hLength) {
public OpaqueNodePropertiesSubTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
if (0 == hLength) {
......@@ -69,8 +69,8 @@ public class OpaqueNodeAttributeTlv implements PcepValueType {
* @param hLength length
* @return new object of Opaque Node Attribute Tlv
*/
public static OpaqueNodeAttributeTlv of(final byte[] raw, short hLength) {
return new OpaqueNodeAttributeTlv(raw, hLength);
public static OpaqueNodePropertiesSubTlv of(final byte[] raw, short hLength) {
return new OpaqueNodePropertiesSubTlv(raw, hLength);
}
/**
......@@ -107,8 +107,8 @@ public class OpaqueNodeAttributeTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof OpaqueNodeAttributeTlv) {
OpaqueNodeAttributeTlv other = (OpaqueNodeAttributeTlv) obj;
if (obj instanceof OpaqueNodePropertiesSubTlv) {
OpaqueNodePropertiesSubTlv other = (OpaqueNodePropertiesSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -133,7 +133,7 @@ public class OpaqueNodeAttributeTlv implements PcepValueType {
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iOpaqueValue = new byte[hLength];
c.readBytes(iOpaqueValue, 0, hLength);
return new OpaqueNodeAttributeTlv(iOpaqueValue, hLength);
return new OpaqueNodePropertiesSubTlv(iOpaqueValue, hLength);
}
@Override
......
......@@ -40,7 +40,7 @@ public class OspfAreaIdSubTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(OspfAreaIdSubTlv.class);
public static final short TYPE = 600; //TODD:change this TBD12
public static final short TYPE = 3;
public static final short LENGTH = 4;
private final int rawValue;
......
......@@ -169,9 +169,9 @@ public class PcepRsvpUserErrorSpec implements PcepRsvpErrorSpec {
int iValue = 0;
//short hLength = cb.readShort();
switch (hType) {
case AutonomousSystemTlv.TYPE:
case AutonomousSystemSubTlv.TYPE:
iValue = cb.readInt();
tlv = new AutonomousSystemTlv(iValue);
tlv = new AutonomousSystemSubTlv(iValue);
break;
default:
throw new PcepParseException("Unsupported Sub TLV type :" + hType);
......
......@@ -17,6 +17,7 @@ package org.onosproject.pcepio.types;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
......@@ -31,10 +32,9 @@ import com.google.common.base.MoreObjects;
/**
* Provides Remote TE Node Descriptors TLV.
*/
public class RemoteTENodeDescriptorsTlv implements PcepValueType {
public class RemoteNodeDescriptorsTlv implements PcepValueType {
/* Reference :PCEP Extension for Transporting TE Data
draft-dhodylee-pce-pcep-te-data-extn-02
/* Reference : draft-dhodylee-pce-pcep-ls-01, section 9.2.3.
*
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
......@@ -47,32 +47,32 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(RemoteTENodeDescriptorsTlv.class);
protected static final Logger log = LoggerFactory.getLogger(RemoteNodeDescriptorsTlv.class);
public static final short TYPE = 1003; //TODD:change this TBD9
public static final short TYPE = (short) 65283;
public short hLength;
public static final int TLV_HEADER_LENGTH = 4;
// Node Descriptor Sub-TLVs (variable)
private LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs;
private List<PcepValueType> llRemoteTENodeDescriptorSubTLVs;
/**
* Constructor to initialize llRemoteTENodeDescriptorSubTLVs.
*
* @param llRemoteTENodeDescriptorSubTLVs LinkedList of PcepValueType
* @param llRemoteTENodeDescriptorSubTLVs List of PcepValueType
*/
public RemoteTENodeDescriptorsTlv(LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs) {
public RemoteNodeDescriptorsTlv(List<PcepValueType> llRemoteTENodeDescriptorSubTLVs) {
this.llRemoteTENodeDescriptorSubTLVs = llRemoteTENodeDescriptorSubTLVs;
}
/**
* Returns object of Remote TE Node Descriptors TLV.
*
* @param llRemoteTENodeDescriptorSubTLVs LinkedList of PcepValueType
* @return object of RemoteTENodeDescriptorsTLV
* @param llRemoteTENodeDescriptorSubTLVs List of PcepValueType
* @return object of RemoteNodeDescriptorsTlv
*/
public static RemoteTENodeDescriptorsTlv of(final LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs) {
return new RemoteTENodeDescriptorsTlv(llRemoteTENodeDescriptorSubTLVs);
public static RemoteNodeDescriptorsTlv of(final List<PcepValueType> llRemoteTENodeDescriptorSubTLVs) {
return new RemoteNodeDescriptorsTlv(llRemoteTENodeDescriptorSubTLVs);
}
/**
......@@ -80,7 +80,7 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
*
* @return llRemoteTENodeDescriptorSubTLVs
*/
public LinkedList<PcepValueType> getllRemoteTENodeDescriptorSubTLVs() {
public List<PcepValueType> getllRemoteTENodeDescriptorSubTLVs() {
return llRemoteTENodeDescriptorSubTLVs;
}
......@@ -117,14 +117,14 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
* the size, if both are same then we should check for the subtlv objects otherwise
* we should return false.
*/
if (obj instanceof RemoteTENodeDescriptorsTlv) {
if (obj instanceof RemoteNodeDescriptorsTlv) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
RemoteTENodeDescriptorsTlv other = (RemoteTENodeDescriptorsTlv) obj;
Iterator<PcepValueType> objListIterator = ((RemoteTENodeDescriptorsTlv) obj).llRemoteTENodeDescriptorSubTLVs
RemoteNodeDescriptorsTlv other = (RemoteNodeDescriptorsTlv) obj;
Iterator<PcepValueType> objListIterator = ((RemoteNodeDescriptorsTlv) obj).llRemoteTENodeDescriptorSubTLVs
.iterator();
countObjSubTlv = ((RemoteTENodeDescriptorsTlv) obj).llRemoteTENodeDescriptorSubTLVs.size();
countObjSubTlv = ((RemoteNodeDescriptorsTlv) obj).llRemoteTENodeDescriptorSubTLVs.size();
countOtherSubTlv = other.llRemoteTENodeDescriptorSubTLVs.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
......@@ -182,13 +182,13 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
*
* @param c input channel buffer
* @param length length of buffer
* @return object of RemoteTENodeDescriptorsTLV
* @return object of RemoteNodeDescriptorsTlv
* @throws PcepParseException if mandatory fields are missing
*/
public static PcepValueType read(ChannelBuffer c, short length) throws PcepParseException {
// Node Descriptor Sub-TLVs (variable)
LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs = new LinkedList<>();
List<PcepValueType> llRemoteTENodeDescriptorSubTLVs = new LinkedList<>();
ChannelBuffer tempCb = c.readBytes(length);
......@@ -200,20 +200,20 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
short hLength = tempCb.readShort();
switch (hType) {
case AutonomousSystemTlv.TYPE:
case AutonomousSystemSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new AutonomousSystemTlv(iValue);
tlv = new AutonomousSystemSubTlv(iValue);
break;
case BgpLsIdentifierTlv.TYPE:
case BgpLsIdentifierSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new BgpLsIdentifierTlv(iValue);
tlv = new BgpLsIdentifierSubTlv(iValue);
break;
case OspfAreaIdSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new OspfAreaIdSubTlv(iValue);
break;
case RouterIDSubTlv.TYPE:
tlv = RouterIDSubTlv.read(tempCb, hLength);
case IgpRouterIdSubTlv.TYPE:
tlv = IgpRouterIdSubTlv.read(tempCb, hLength);
break;
default:
......@@ -236,7 +236,7 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
throw new PcepParseException("Sub Tlv parsing error. Extra bytes received.");
}
return new RemoteTENodeDescriptorsTlv(llRemoteTENodeDescriptorSubTLVs);
return new RemoteNodeDescriptorsTlv(llRemoteTENodeDescriptorSubTLVs);
}
@Override
......
......@@ -52,7 +52,7 @@ public class RoutingUniverseTlv implements PcepValueType {
protected static final Logger log = LoggerFactory.getLogger(RoutingUniverseTlv.class);
public static final short TYPE = 14; // TODO:need to change TBD7
public static final short TYPE = (short) 65281;
public static final short LENGTH = 8;
private final long rawValue;
......
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides SharedRiskLinkGroupTlv.
*/
public class SharedRiskLinkGroupTlv implements PcepValueType {
public class SharedRiskLinkGroupSubTlv implements PcepValueType {
/*
* Reference :[I-D.ietf-idr- Group ls-distribution] /3.3.2.5
......@@ -46,9 +46,9 @@ public class SharedRiskLinkGroupTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(SharedRiskLinkGroupTlv.class);
protected static final Logger log = LoggerFactory.getLogger(SharedRiskLinkGroupSubTlv.class);
public static final short TYPE = 1096; //TODO:NEED TO HANDLE TDB41
public static final short TYPE = 30;
private final short hLength;
......@@ -60,7 +60,7 @@ public class SharedRiskLinkGroupTlv implements PcepValueType {
* @param srlgValue Shared Risk Link Group Value
* @param hLength length
*/
public SharedRiskLinkGroupTlv(int[] srlgValue, short hLength) {
public SharedRiskLinkGroupSubTlv(int[] srlgValue, short hLength) {
this.srlgValue = srlgValue;
if (0 == hLength) {
this.hLength = (short) ((srlgValue.length) * 4);
......@@ -76,8 +76,8 @@ public class SharedRiskLinkGroupTlv implements PcepValueType {
* @param hLength length
* @return object of SharedRiskLinkGroupTlv
*/
public static SharedRiskLinkGroupTlv of(final int[] raw, short hLength) {
return new SharedRiskLinkGroupTlv(raw, hLength);
public static SharedRiskLinkGroupSubTlv of(final int[] raw, short hLength) {
return new SharedRiskLinkGroupSubTlv(raw, hLength);
}
/**
......@@ -114,8 +114,8 @@ public class SharedRiskLinkGroupTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof SharedRiskLinkGroupTlv) {
SharedRiskLinkGroupTlv other = (SharedRiskLinkGroupTlv) obj;
if (obj instanceof SharedRiskLinkGroupSubTlv) {
SharedRiskLinkGroupSubTlv other = (SharedRiskLinkGroupSubTlv) obj;
return Arrays.equals(this.srlgValue, other.srlgValue);
}
return false;
......@@ -145,7 +145,7 @@ public class SharedRiskLinkGroupTlv implements PcepValueType {
for (int i = 0; i < iLength; i++) {
iSharedRiskLinkGroup[i] = c.readInt();
}
return new SharedRiskLinkGroupTlv(iSharedRiskLinkGroup, hLength);
return new SharedRiskLinkGroupSubTlv(iSharedRiskLinkGroup, hLength);
}
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides TEDefaultMetricTlv.
*/
public class TEDefaultMetricTlv implements PcepValueType {
public class TEDefaultMetricSubTlv implements PcepValueType {
/*
* Reference :| [I-D.ietf-idr- ls-distribution] /3.3.2.3
......@@ -40,9 +40,9 @@ public class TEDefaultMetricTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(TEDefaultMetricTlv.class);
protected static final Logger log = LoggerFactory.getLogger(TEDefaultMetricSubTlv.class);
public static final short TYPE = 13400; //TDB37
public static final short TYPE = 26;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -52,7 +52,7 @@ public class TEDefaultMetricTlv implements PcepValueType {
*
* @param rawValue TE Default Link Metric
*/
public TEDefaultMetricTlv(int rawValue) {
public TEDefaultMetricSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -62,8 +62,8 @@ public class TEDefaultMetricTlv implements PcepValueType {
* @param raw raw value
* @return object of TEDefaultMetricTlv.
*/
public static TEDefaultMetricTlv of(final int raw) {
return new TEDefaultMetricTlv(raw);
public static TEDefaultMetricSubTlv of(final int raw) {
return new TEDefaultMetricSubTlv(raw);
}
/**
......@@ -100,8 +100,8 @@ public class TEDefaultMetricTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof TEDefaultMetricTlv) {
TEDefaultMetricTlv other = (TEDefaultMetricTlv) obj;
if (obj instanceof TEDefaultMetricSubTlv) {
TEDefaultMetricSubTlv other = (TEDefaultMetricSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -122,8 +122,8 @@ public class TEDefaultMetricTlv implements PcepValueType {
* @param c input channel buffer
* @return object of TEDefaultMetricTlv
*/
public static TEDefaultMetricTlv read(ChannelBuffer c) {
return TEDefaultMetricTlv.of(c.readInt());
public static TEDefaultMetricSubTlv read(ChannelBuffer c) {
return TEDefaultMetricSubTlv.of(c.readInt());
}
@Override
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Unreserved Bandwidth Tlv.
*/
public class UnreservedBandwidthTlv implements PcepValueType {
public class UnreservedBandwidthSubTlv implements PcepValueType {
/* Reference :[RFC5305]/3.6
0 1 2 3
......@@ -39,9 +39,9 @@ public class UnreservedBandwidthTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(UnreservedBandwidthTlv.class);
protected static final Logger log = LoggerFactory.getLogger(UnreservedBandwidthSubTlv.class);
public static final short TYPE = 11; //TDB36
public static final short TYPE = 25;
public static final short LENGTH = 4;
private final int rawValue;
......@@ -51,7 +51,7 @@ public class UnreservedBandwidthTlv implements PcepValueType {
*
* @param rawValue Unreserved Bandwidth
*/
public UnreservedBandwidthTlv(int rawValue) {
public UnreservedBandwidthSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -61,8 +61,8 @@ public class UnreservedBandwidthTlv implements PcepValueType {
* @param raw as Unreserved Bandwidth
* @return object of UnreservedBandwidthTlv
*/
public static UnreservedBandwidthTlv of(final int raw) {
return new UnreservedBandwidthTlv(raw);
public static UnreservedBandwidthSubTlv of(final int raw) {
return new UnreservedBandwidthSubTlv(raw);
}
/**
......@@ -99,8 +99,8 @@ public class UnreservedBandwidthTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof UnreservedBandwidthTlv) {
UnreservedBandwidthTlv other = (UnreservedBandwidthTlv) obj;
if (obj instanceof UnreservedBandwidthSubTlv) {
UnreservedBandwidthSubTlv other = (UnreservedBandwidthSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -121,8 +121,8 @@ public class UnreservedBandwidthTlv implements PcepValueType {
* @param c input channel buffer
* @return object of UnreservedBandwidthTlv
*/
public static UnreservedBandwidthTlv read(ChannelBuffer c) {
return UnreservedBandwidthTlv.of(c.readInt());
public static UnreservedBandwidthSubTlv read(ChannelBuffer c) {
return UnreservedBandwidthSubTlv.of(c.readInt());
}
@Override
......