Sho SHIMIZU
Committed by Ray Milkey

Use LF as line separator

Change-Id: Iaaed8d5bf5157ceba403f53cf86dd535a70f41f8
Showing 89 changed files with 2572 additions and 2572 deletions
package org.onosproject.pcepio.protocol.ver1;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepAttribute;
import org.onosproject.pcepio.protocol.PcepEroObject;
import org.onosproject.pcepio.protocol.PcepMsgPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides PCEP Message PAth for update message.
* Reference :PCE extensions for stateful draft-ietf-pce-stateful-pce-10.
*/
public class PcepMsgPathVer1 implements PcepMsgPath {
/*
* <path> ::= <ERO><attribute-list>
*/
protected static final Logger log = LoggerFactory.getLogger(PcepMsgPathVer1.class);
//PcepEroObject
private PcepEroObject eroObj;
private boolean isEroObjectSet;
// PcepAttribute
private PcepAttribute attrList;
private boolean isAttributeListSet;
/**
* constructor to initialize objects.
*/
public PcepMsgPathVer1() {
eroObj = null;
attrList = null;
isEroObjectSet = false;
isAttributeListSet = false;
}
@Override
public PcepEroObject getEroObject() {
return eroObj;
}
@Override
public PcepAttribute getPcepAttribute() {
return attrList;
}
@Override
public void setEroObject(PcepEroObject eroObj) {
this.eroObj = eroObj;
}
@Override
public void setPcepAttribute(PcepAttribute attrList) {
this.attrList = attrList;
}
/**
* constructor to initialize member variables.
*
* @param eroObj pcep ero object
* @param attrList pcep attribute
*/
public PcepMsgPathVer1(PcepEroObject eroObj, PcepAttribute attrList) {
this.eroObj = eroObj;
isEroObjectSet = true;
this.attrList = attrList;
if (attrList == null) {
isAttributeListSet = false;
} else {
isAttributeListSet = true;
}
}
@Override
public PcepMsgPath read(ChannelBuffer cb) throws PcepParseException {
PcepEroObject eroObj;
PcepAttribute attrList;
eroObj = PcepEroObjectVer1.read(cb);
attrList = PcepAttributeVer1.read(cb);
return new PcepMsgPathVer1(eroObj, attrList);
}
@Override
public int write(ChannelBuffer cb) throws PcepParseException {
int iLenStartIndex = cb.writerIndex();
//write Object header
if (this.isEroObjectSet) {
this.eroObj.write(cb);
}
if (this.isAttributeListSet) {
attrList.write(cb);
}
return cb.writerIndex() - iLenStartIndex;
}
/**
* Builder class for PCEP Message path.
*/
public static class Builder implements PcepMsgPath.Builder {
private boolean bIsEROObjectSet = false;
private boolean bIsPcepAttributeSet = false;
//PCEP ERO Object
private PcepEroObject eroObject;
//PCEP Attribute list
private PcepAttribute pcepAttribute;
@Override
public PcepMsgPath build() throws PcepParseException {
//PCEP ERO Object
PcepEroObject eroObject = null;
//PCEP Attribute list
PcepAttribute pcepAttribute = null;
if (!this.bIsEROObjectSet) {
throw new PcepParseException("ERO Object NOT Set while building PcepMsgPath.");
} else {
eroObject = this.eroObject;
}
if (!this.bIsPcepAttributeSet) {
throw new PcepParseException("Pcep Attributes NOT Set while building PcepMsgPath.");
} else {
pcepAttribute = this.pcepAttribute;
}
return new PcepMsgPathVer1(eroObject, pcepAttribute);
}
@Override
public PcepEroObject getEroObject() {
return this.eroObject;
}
@Override
public PcepAttribute getPcepAttribute() {
return this.pcepAttribute;
}
@Override
public Builder setEroObject(PcepEroObject eroObject) {
this.eroObject = eroObject;
this.bIsEROObjectSet = true;
return this;
}
@Override
public Builder setPcepAttribute(PcepAttribute pcepAttribute) {
this.pcepAttribute = pcepAttribute;
this.bIsPcepAttributeSet = true;
return this;
}
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("EroObject", eroObj).add("AttributeList", attrList)
.toString();
}
package org.onosproject.pcepio.protocol.ver1;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepAttribute;
import org.onosproject.pcepio.protocol.PcepEroObject;
import org.onosproject.pcepio.protocol.PcepMsgPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides PCEP Message PAth for update message.
* Reference :PCE extensions for stateful draft-ietf-pce-stateful-pce-10.
*/
public class PcepMsgPathVer1 implements PcepMsgPath {
/*
* <path> ::= <ERO><attribute-list>
*/
protected static final Logger log = LoggerFactory.getLogger(PcepMsgPathVer1.class);
//PcepEroObject
private PcepEroObject eroObj;
private boolean isEroObjectSet;
// PcepAttribute
private PcepAttribute attrList;
private boolean isAttributeListSet;
/**
* constructor to initialize objects.
*/
public PcepMsgPathVer1() {
eroObj = null;
attrList = null;
isEroObjectSet = false;
isAttributeListSet = false;
}
@Override
public PcepEroObject getEroObject() {
return eroObj;
}
@Override
public PcepAttribute getPcepAttribute() {
return attrList;
}
@Override
public void setEroObject(PcepEroObject eroObj) {
this.eroObj = eroObj;
}
@Override
public void setPcepAttribute(PcepAttribute attrList) {
this.attrList = attrList;
}
/**
* constructor to initialize member variables.
*
* @param eroObj pcep ero object
* @param attrList pcep attribute
*/
public PcepMsgPathVer1(PcepEroObject eroObj, PcepAttribute attrList) {
this.eroObj = eroObj;
isEroObjectSet = true;
this.attrList = attrList;
if (attrList == null) {
isAttributeListSet = false;
} else {
isAttributeListSet = true;
}
}
@Override
public PcepMsgPath read(ChannelBuffer cb) throws PcepParseException {
PcepEroObject eroObj;
PcepAttribute attrList;
eroObj = PcepEroObjectVer1.read(cb);
attrList = PcepAttributeVer1.read(cb);
return new PcepMsgPathVer1(eroObj, attrList);
}
@Override
public int write(ChannelBuffer cb) throws PcepParseException {
int iLenStartIndex = cb.writerIndex();
//write Object header
if (this.isEroObjectSet) {
this.eroObj.write(cb);
}
if (this.isAttributeListSet) {
attrList.write(cb);
}
return cb.writerIndex() - iLenStartIndex;
}
/**
* Builder class for PCEP Message path.
*/
public static class Builder implements PcepMsgPath.Builder {
private boolean bIsEROObjectSet = false;
private boolean bIsPcepAttributeSet = false;
//PCEP ERO Object
private PcepEroObject eroObject;
//PCEP Attribute list
private PcepAttribute pcepAttribute;
@Override
public PcepMsgPath build() throws PcepParseException {
//PCEP ERO Object
PcepEroObject eroObject = null;
//PCEP Attribute list
PcepAttribute pcepAttribute = null;
if (!this.bIsEROObjectSet) {
throw new PcepParseException("ERO Object NOT Set while building PcepMsgPath.");
} else {
eroObject = this.eroObject;
}
if (!this.bIsPcepAttributeSet) {
throw new PcepParseException("Pcep Attributes NOT Set while building PcepMsgPath.");
} else {
pcepAttribute = this.pcepAttribute;
}
return new PcepMsgPathVer1(eroObject, pcepAttribute);
}
@Override
public PcepEroObject getEroObject() {
return this.eroObject;
}
@Override
public PcepAttribute getPcepAttribute() {
return this.pcepAttribute;
}
@Override
public Builder setEroObject(PcepEroObject eroObject) {
this.eroObject = eroObject;
this.bIsEROObjectSet = true;
return this;
}
@Override
public Builder setPcepAttribute(PcepAttribute pcepAttribute) {
this.pcepAttribute = pcepAttribute;
this.bIsPcepAttributeSet = true;
return this;
}
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("EroObject", eroObj).add("AttributeList", attrList)
.toString();
}
}
\ No newline at end of file
......
/*
* 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.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 Administrative Group Tlv which contains value (32 Bit ).
*/
public class AdministrativeGroupTlv implements PcepValueType {
/* REFERENCE :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB33] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| value (32 Bit ) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AdministrativeGroupTlv.class);
public static final short TYPE = 3; //TDB33
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue of Administrative-Group-Tlv.
*/
public AdministrativeGroupTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created AdministrativeGroupTlv object.
*
* @param raw value.
* @return object of Administrative-Group-Tlv
*/
public static AdministrativeGroupTlv of(final int raw) {
return new AdministrativeGroupTlv(raw);
}
/**
* Returns raw value.
*
* @return rawValue raw value
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AdministrativeGroupTlv) {
AdministrativeGroupTlv other = (AdministrativeGroupTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of Administrative-Group-Tlv.
*
* @param c input channel buffer
* @return object of Administrative-Group-Tlv
*/
public static AdministrativeGroupTlv read(ChannelBuffer c) {
return AdministrativeGroupTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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 Administrative Group Tlv which contains value (32 Bit ).
*/
public class AdministrativeGroupTlv implements PcepValueType {
/* REFERENCE :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB33] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| value (32 Bit ) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AdministrativeGroupTlv.class);
public static final short TYPE = 3; //TDB33
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue of Administrative-Group-Tlv.
*/
public AdministrativeGroupTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created AdministrativeGroupTlv object.
*
* @param raw value.
* @return object of Administrative-Group-Tlv
*/
public static AdministrativeGroupTlv of(final int raw) {
return new AdministrativeGroupTlv(raw);
}
/**
* Returns raw value.
*
* @return rawValue raw value
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AdministrativeGroupTlv) {
AdministrativeGroupTlv other = (AdministrativeGroupTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of Administrative-Group-Tlv.
*
* @param c input channel buffer
* @return object of Administrative-Group-Tlv
*/
public static AdministrativeGroupTlv read(ChannelBuffer c) {
return AdministrativeGroupTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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-Tlv which contains opaque value (32 Bit AS Number).
*/
public class AutonomousSystemTlv implements PcepValueType {
/* Reference :RFC3209
* 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TBD10] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| opaque value (32 Bit AS Number) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemTlv.class);
public static final short TYPE = 100; //TODD:change this TBD10
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue Autonomous-System-Tlv
*/
public AutonomousSystemTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created AutonomousSystemTlv object.
*
* @param raw value of opaque.
* @return object of Autonomous-System-Tlv
*/
public static AutonomousSystemTlv of(final int raw) {
return new AutonomousSystemTlv(raw);
}
/**
* Returns opaque value.
*
* @return rawValue opaque value.
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AutonomousSystemTlv) {
AutonomousSystemTlv other = (AutonomousSystemTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of AutonomousSystemTlv.
*
* @param c input channel buffer
* @return object of Autonomous-System-Tlv
*/
public static AutonomousSystemTlv read(ChannelBuffer c) {
return AutonomousSystemTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("TYPE", TYPE)
.add("Length", LENGTH)
.add("value", rawValue)
.toString();
}
}
/*
* 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.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-Tlv which contains opaque value (32 Bit AS Number).
*/
public class AutonomousSystemTlv implements PcepValueType {
/* Reference :RFC3209
* 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TBD10] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| opaque value (32 Bit AS Number) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemTlv.class);
public static final short TYPE = 100; //TODD:change this TBD10
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue Autonomous-System-Tlv
*/
public AutonomousSystemTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created AutonomousSystemTlv object.
*
* @param raw value of opaque.
* @return object of Autonomous-System-Tlv
*/
public static AutonomousSystemTlv of(final int raw) {
return new AutonomousSystemTlv(raw);
}
/**
* Returns opaque value.
*
* @return rawValue opaque value.
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AutonomousSystemTlv) {
AutonomousSystemTlv other = (AutonomousSystemTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of AutonomousSystemTlv.
*
* @param c input channel buffer
* @return object of Autonomous-System-Tlv
*/
public static AutonomousSystemTlv read(ChannelBuffer c) {
return AutonomousSystemTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("TYPE", TYPE)
.add("Length", LENGTH)
.add("value", rawValue)
.toString();
}
}
......
/*
* 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.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 BGP LS identifier which contains opaque value (32 Bit ID).
*/
public class BGPLSidentifierTlv implements PcepValueType {
/* Reference :draft-ietf-idr-ls-distribution-10
* 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TBD11] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| opaque value (32 Bit ID). |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(BGPLSidentifierTlv.class);
public static final short TYPE = 17; //TODD:change this TBD11
public static final short LENGTH = 4;
private final int rawValue;
/**
* constructor to initialize rawValue.
*
* @param rawValue BGP LS identifier Tlv
*/
public BGPLSidentifierTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created BGPLSidentifierTlv object.
*
* @param raw value
* @return object of BGPLSidentifierTlv
*/
public static BGPLSidentifierTlv of(final int raw) {
return new BGPLSidentifierTlv(raw);
}
/**
* Returns opaque value.
*
* @return rawValue opaque value
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof BGPLSidentifierTlv) {
BGPLSidentifierTlv other = (BGPLSidentifierTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of BGPLSidentifierTlv.
*
* @param c input channel buffer
* @return object of BGP LS identifier Tlv
*/
public static BGPLSidentifierTlv read(ChannelBuffer c) {
return BGPLSidentifierTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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 BGP LS identifier which contains opaque value (32 Bit ID).
*/
public class BGPLSidentifierTlv implements PcepValueType {
/* Reference :draft-ietf-idr-ls-distribution-10
* 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TBD11] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| opaque value (32 Bit ID). |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(BGPLSidentifierTlv.class);
public static final short TYPE = 17; //TODD:change this TBD11
public static final short LENGTH = 4;
private final int rawValue;
/**
* constructor to initialize rawValue.
*
* @param rawValue BGP LS identifier Tlv
*/
public BGPLSidentifierTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created BGPLSidentifierTlv object.
*
* @param raw value
* @return object of BGPLSidentifierTlv
*/
public static BGPLSidentifierTlv of(final int raw) {
return new BGPLSidentifierTlv(raw);
}
/**
* Returns opaque value.
*
* @return rawValue opaque value
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof BGPLSidentifierTlv) {
BGPLSidentifierTlv other = (BGPLSidentifierTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of BGPLSidentifierTlv.
*
* @param c input channel buffer
* @return object of BGP LS identifier Tlv
*/
public static BGPLSidentifierTlv read(ChannelBuffer c) {
return BGPLSidentifierTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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 GMPLS Capability Tlv.
*/
public class GmplsCapabilityTlv implements PcepValueType {
/*
* GMPLS-CAPABILITY TLV format
* reference :draft-ietf-pce-gmpls-pcep-extensions -2.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=14 | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(GmplsCapabilityTlv.class);
public static final short TYPE = 14;
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize raw value.
*
* @param rawValue of Gmpls-Capability-Tlv
*/
public GmplsCapabilityTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created GmplsCapabilityTlv object.
*
* @param raw Flags value
* @return object of Gmpls-Capability-Tlv
*/
public static GmplsCapabilityTlv of(final int raw) {
return new GmplsCapabilityTlv(raw);
}
/**
* Returns value of Flags.
*
* @return rawValue Flags
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof GmplsCapabilityTlv) {
GmplsCapabilityTlv other = (GmplsCapabilityTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of Gmpls-Capability-Tlv.
*
* @param c input channel buffer
* @return object of Gmpls-Capability-Tlv
*/
public static GmplsCapabilityTlv read(ChannelBuffer c) {
return GmplsCapabilityTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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 GMPLS Capability Tlv.
*/
public class GmplsCapabilityTlv implements PcepValueType {
/*
* GMPLS-CAPABILITY TLV format
* reference :draft-ietf-pce-gmpls-pcep-extensions -2.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=14 | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(GmplsCapabilityTlv.class);
public static final short TYPE = 14;
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize raw value.
*
* @param rawValue of Gmpls-Capability-Tlv
*/
public GmplsCapabilityTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created GmplsCapabilityTlv object.
*
* @param raw Flags value
* @return object of Gmpls-Capability-Tlv
*/
public static GmplsCapabilityTlv of(final int raw) {
return new GmplsCapabilityTlv(raw);
}
/**
* Returns value of Flags.
*
* @return rawValue Flags
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof GmplsCapabilityTlv) {
GmplsCapabilityTlv other = (GmplsCapabilityTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of Gmpls-Capability-Tlv.
*
* @param c input channel buffer
* @return object of Gmpls-Capability-Tlv
*/
public static GmplsCapabilityTlv read(ChannelBuffer c) {
return GmplsCapabilityTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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;
import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides IGP Link Metric .
*/
public class IGPMetricTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr-ls-distribution] /3.3.2.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TDB40 | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// IGP Link Metric (variable length) //
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IGPMetricTlv.class);
public static final short TYPE = 1095; //TODO:NEED TO HANDLE TDB40
private short hLength;
private final byte[] rawValue;
/**
* Constructor to initialize raw value.
*
* @param rawValue IGP Link Metric
* @param hLength length
*/
public IGPMetricTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
this.hLength = hLength;
}
/**
* Returns newly created IGPMetricTlv object.
*
* @param raw value of IGP Link Metric
* @param hLength length
* @return object of IGPMetricTlv
*/
public static IGPMetricTlv of(final byte[] raw, short hLength) {
return new IGPMetricTlv(raw, hLength);
}
/**
* Returns value of IGP Link Metric.
*
* @return rawValue of IGP Link Metric
*/
public byte[] getValue() {
return rawValue;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return hLength;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IGPMetricTlv) {
IGPMetricTlv other = (IGPMetricTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(hLength);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IGPMetricTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of IGPMetricTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iIGPMetric = new byte[hLength];
c.readBytes(iIGPMetric, 0, hLength);
return new IGPMetricTlv(iIGPMetric, hLength);
}
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
toStrHelper.add("Type", TYPE);
toStrHelper.add("Length", hLength);
StringBuffer result = new StringBuffer();
for (byte b : rawValue) {
result.append(String.format("%02X ", b));
}
toStrHelper.add("Value", result);
return toStrHelper.toString();
}
}
/*
* 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.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;
import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides IGP Link Metric .
*/
public class IGPMetricTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr-ls-distribution] /3.3.2.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TDB40 | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// IGP Link Metric (variable length) //
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IGPMetricTlv.class);
public static final short TYPE = 1095; //TODO:NEED TO HANDLE TDB40
private short hLength;
private final byte[] rawValue;
/**
* Constructor to initialize raw value.
*
* @param rawValue IGP Link Metric
* @param hLength length
*/
public IGPMetricTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
this.hLength = hLength;
}
/**
* Returns newly created IGPMetricTlv object.
*
* @param raw value of IGP Link Metric
* @param hLength length
* @return object of IGPMetricTlv
*/
public static IGPMetricTlv of(final byte[] raw, short hLength) {
return new IGPMetricTlv(raw, hLength);
}
/**
* Returns value of IGP Link Metric.
*
* @return rawValue of IGP Link Metric
*/
public byte[] getValue() {
return rawValue;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return hLength;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IGPMetricTlv) {
IGPMetricTlv other = (IGPMetricTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(hLength);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IGPMetricTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of IGPMetricTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iIGPMetric = new byte[hLength];
c.readBytes(iIGPMetric, 0, hLength);
return new IGPMetricTlv(iIGPMetric, hLength);
}
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
toStrHelper.add("Type", TYPE);
toStrHelper.add("Length", hLength);
StringBuffer result = new StringBuffer();
for (byte b : rawValue) {
result.append(String.format("%02X ", b));
}
toStrHelper.add("Value", result);
return toStrHelper.toString();
}
}
......
/*
* 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.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 IPv4 Interface Address .
*/
public class IPv4InterfaceAddressTlv implements PcepValueType {
/*
* reference :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=6 | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 Interface Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4InterfaceAddressTlv.class);
public static final short TYPE = 6;
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue of IPv4-Interface-Address.
*/
public IPv4InterfaceAddressTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4InterfaceAddressTlv object.
*
* @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);
}
/**
* Returns value of IPv4 Interface Address.
*
* @return rawValue IPv4 Interface Address
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4InterfaceAddressTlv) {
IPv4InterfaceAddressTlv other = (IPv4InterfaceAddressTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4InterfaceAddressTlv.
*
* @param c input channel buffer
* @return object of IPv4-Interface-Address-Tlv
*/
public static IPv4InterfaceAddressTlv read(ChannelBuffer c) {
return IPv4InterfaceAddressTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
/*
* 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.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 IPv4 Interface Address .
*/
public class IPv4InterfaceAddressTlv implements PcepValueType {
/*
* reference :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=6 | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 Interface Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4InterfaceAddressTlv.class);
public static final short TYPE = 6;
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue of IPv4-Interface-Address.
*/
public IPv4InterfaceAddressTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4InterfaceAddressTlv object.
*
* @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);
}
/**
* Returns value of IPv4 Interface Address.
*
* @return rawValue IPv4 Interface Address
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4InterfaceAddressTlv) {
IPv4InterfaceAddressTlv other = (IPv4InterfaceAddressTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4InterfaceAddressTlv.
*
* @param c input channel buffer
* @return object of IPv4-Interface-Address-Tlv
*/
public static IPv4InterfaceAddressTlv read(ChannelBuffer c) {
return IPv4InterfaceAddressTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
\ No newline at end of file
......
/*
* 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.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 IPv4 Neighbor Address .
*/
public class IPv4NeighborAddressTlv implements PcepValueType {
/* Reference :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=8 | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 Neighbor Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4NeighborAddressTlv.class);
public static final short TYPE = 8;
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4-Neighbor-Address-Tlv
*/
public IPv4NeighborAddressTlv(int rawValue) {
log.debug("IPv4NeighborAddressTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4NeighborAddressTlv object.
*
* @param raw value of IPv4-Neighbor-Address
* @return object of IPv4NeighborAddressTlv
*/
public static IPv4NeighborAddressTlv of(final int raw) {
return new IPv4NeighborAddressTlv(raw);
}
/**
* Returns value of IPv4 Neighbor Address.
*
* @return rawValue IPv4 Neighbor Address
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4NeighborAddressTlv) {
IPv4NeighborAddressTlv other = (IPv4NeighborAddressTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4-Neighbor-Address-Tlv.
*
* @param c input channel buffer
* @return object of IPv4-Neighbor-Address-Tlv
*/
public static IPv4NeighborAddressTlv read(ChannelBuffer c) {
return IPv4NeighborAddressTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
/*
* 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.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 IPv4 Neighbor Address .
*/
public class IPv4NeighborAddressTlv implements PcepValueType {
/* Reference :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=8 | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 Neighbor Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4NeighborAddressTlv.class);
public static final short TYPE = 8;
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4-Neighbor-Address-Tlv
*/
public IPv4NeighborAddressTlv(int rawValue) {
log.debug("IPv4NeighborAddressTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4NeighborAddressTlv object.
*
* @param raw value of IPv4-Neighbor-Address
* @return object of IPv4NeighborAddressTlv
*/
public static IPv4NeighborAddressTlv of(final int raw) {
return new IPv4NeighborAddressTlv(raw);
}
/**
* Returns value of IPv4 Neighbor Address.
*
* @return rawValue IPv4 Neighbor Address
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4NeighborAddressTlv) {
IPv4NeighborAddressTlv other = (IPv4NeighborAddressTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4-Neighbor-Address-Tlv.
*
* @param c input channel buffer
* @return object of IPv4-Neighbor-Address-Tlv
*/
public static IPv4NeighborAddressTlv read(ChannelBuffer c) {
return IPv4NeighborAddressTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
\ No newline at end of file
......
/*
* 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.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 IPv4 TE Router Id Of Local Node.
*/
public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
/* Reference:[RFC5305]/4.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB25] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 TE Router Id Of Local Node |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfLocalNodeTlv.class);
public static final short TYPE = 134; //TDB25
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4-TE-RouterId-Of-Local-Node-Tlv
*/
public IPv4TERouterIdOfLocalNodeTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4TERouterIdOfLocalNodeTlv object.
*
* @param raw value of IPv4-TE-RouterId-Of-Local-Node
* @return object of IPv4TERouterIdOfLocalNodeTlv
*/
public static IPv4TERouterIdOfLocalNodeTlv of(final int raw) {
return new IPv4TERouterIdOfLocalNodeTlv(raw);
}
/**
* Returns value of IPv4 TE Router Id Of Local Node.
*
* @return rawValue IPv4 TE Router Id Of Local Node
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4TERouterIdOfLocalNodeTlv) {
IPv4TERouterIdOfLocalNodeTlv other = (IPv4TERouterIdOfLocalNodeTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4TERouterIdOfLocalNodeTlv.
*
* @param c input channel buffer
* @return object of IPv4TERouterIdOfLocalNodeTlv
*/
public static IPv4TERouterIdOfLocalNodeTlv read(ChannelBuffer c) {
return IPv4TERouterIdOfLocalNodeTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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 IPv4 TE Router Id Of Local Node.
*/
public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType {
/* Reference:[RFC5305]/4.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB25] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 TE Router Id Of Local Node |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfLocalNodeTlv.class);
public static final short TYPE = 134; //TDB25
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4-TE-RouterId-Of-Local-Node-Tlv
*/
public IPv4TERouterIdOfLocalNodeTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4TERouterIdOfLocalNodeTlv object.
*
* @param raw value of IPv4-TE-RouterId-Of-Local-Node
* @return object of IPv4TERouterIdOfLocalNodeTlv
*/
public static IPv4TERouterIdOfLocalNodeTlv of(final int raw) {
return new IPv4TERouterIdOfLocalNodeTlv(raw);
}
/**
* Returns value of IPv4 TE Router Id Of Local Node.
*
* @return rawValue IPv4 TE Router Id Of Local Node
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4TERouterIdOfLocalNodeTlv) {
IPv4TERouterIdOfLocalNodeTlv other = (IPv4TERouterIdOfLocalNodeTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4TERouterIdOfLocalNodeTlv.
*
* @param c input channel buffer
* @return object of IPv4TERouterIdOfLocalNodeTlv
*/
public static IPv4TERouterIdOfLocalNodeTlv read(ChannelBuffer c) {
return IPv4TERouterIdOfLocalNodeTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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 IPv4 TE Router Id Of Remote Node.
*/
public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
/* Reference :[RFC5305]/4.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB28] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 TE Router Id Of Remote Node |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfRemoteNodeTlv.class);
public static final short TYPE = 1340; //TDB28
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4 TE RouterId Of Remote Node Tlv
*/
public IPv4TERouterIdOfRemoteNodeTlv(int rawValue) {
log.debug("IPv4TERouterIdOfRemoteNodeTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4TERouterIdOfRemoteNodeTlv object.
*
* @param raw IPv4 TE RouterId Of Remote Node
* @return object of IPv4TERouterIdOfRemoteNodeTlv
*/
public static IPv4TERouterIdOfRemoteNodeTlv of(final int raw) {
return new IPv4TERouterIdOfRemoteNodeTlv(raw);
}
/**
* Returns value of IPv4 TE Router Id Of Remote Node.
*
* @return rawValue IPv4 TE Router Id Of Remote Node
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4TERouterIdOfRemoteNodeTlv) {
IPv4TERouterIdOfRemoteNodeTlv other = (IPv4TERouterIdOfRemoteNodeTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4TERouterIdOfRemoteNodeTlv.
*
* @param c input channel buffer
* @return object of IPv4TERouterIdOfRemoteNodeTlv
*/
public static IPv4TERouterIdOfRemoteNodeTlv read(ChannelBuffer c) {
return IPv4TERouterIdOfRemoteNodeTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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 IPv4 TE Router Id Of Remote Node.
*/
public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType {
/* Reference :[RFC5305]/4.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB28] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IPv4 TE Router Id Of Remote Node |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfRemoteNodeTlv.class);
public static final short TYPE = 1340; //TDB28
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue IPv4 TE RouterId Of Remote Node Tlv
*/
public IPv4TERouterIdOfRemoteNodeTlv(int rawValue) {
log.debug("IPv4TERouterIdOfRemoteNodeTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created IPv4TERouterIdOfRemoteNodeTlv object.
*
* @param raw IPv4 TE RouterId Of Remote Node
* @return object of IPv4TERouterIdOfRemoteNodeTlv
*/
public static IPv4TERouterIdOfRemoteNodeTlv of(final int raw) {
return new IPv4TERouterIdOfRemoteNodeTlv(raw);
}
/**
* Returns value of IPv4 TE Router Id Of Remote Node.
*
* @return rawValue IPv4 TE Router Id Of Remote Node
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IPv4TERouterIdOfRemoteNodeTlv) {
IPv4TERouterIdOfRemoteNodeTlv other = (IPv4TERouterIdOfRemoteNodeTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of IPv4TERouterIdOfRemoteNodeTlv.
*
* @param c input channel buffer
* @return object of IPv4TERouterIdOfRemoteNodeTlv
*/
public static IPv4TERouterIdOfRemoteNodeTlv read(ChannelBuffer c) {
return IPv4TERouterIdOfRemoteNodeTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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;
import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides ISIS Area Identifier.
*/
public class ISISAreaIdentifierTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution]/3.3.1.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TBD24] | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Area Identifier (variable) //
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(ISISAreaIdentifierTlv.class);
public static final short TYPE = 107; //TODO:NEED TO HANDLE TBD24
private short hLength;
private final byte[] rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue ISIS-Area-Identifier
* @param hLength length
*/
public ISISAreaIdentifierTlv(byte[] rawValue, short hLength) {
log.debug("ISISAreaIdentifierTlv");
this.rawValue = rawValue;
if (0 == hLength) {
this.hLength = (short) rawValue.length;
} else {
this.hLength = hLength;
}
}
/**
* Returns newly created ISISAreaIdentifierTlv object.
*
* @param raw ISIS-Area-Identifier
* @param hLength length
* @return object of ISISAreaIdentifierTlv
*/
public static ISISAreaIdentifierTlv of(final byte[] raw, short hLength) {
return new ISISAreaIdentifierTlv(raw, hLength);
}
/**
* Returns value of ISIS-Area-Identifier.
*
* @return byte array of rawValue
*/
public byte[] getValue() {
return rawValue;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return hLength;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ISISAreaIdentifierTlv) {
ISISAreaIdentifierTlv other = (ISISAreaIdentifierTlv) obj;
return Objects.equals(hLength, other.hLength) && Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(hLength);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of ISISAreaIdentifierTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of ISISAreaIdentifierTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iISISAreaIdentifier = new byte[hLength];
c.readBytes(iISISAreaIdentifier, 0, hLength);
return new ISISAreaIdentifierTlv(iISISAreaIdentifier, hLength);
}
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
toStrHelper.add("Type", TYPE);
toStrHelper.add("Length", hLength);
StringBuffer result = new StringBuffer();
for (byte b : rawValue) {
result.append(String.format("%02X ", b));
}
toStrHelper.add("Value", result);
return toStrHelper.toString();
}
}
/*
* 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.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;
import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides ISIS Area Identifier.
*/
public class ISISAreaIdentifierTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution]/3.3.1.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TBD24] | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Area Identifier (variable) //
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(ISISAreaIdentifierTlv.class);
public static final short TYPE = 107; //TODO:NEED TO HANDLE TBD24
private short hLength;
private final byte[] rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue ISIS-Area-Identifier
* @param hLength length
*/
public ISISAreaIdentifierTlv(byte[] rawValue, short hLength) {
log.debug("ISISAreaIdentifierTlv");
this.rawValue = rawValue;
if (0 == hLength) {
this.hLength = (short) rawValue.length;
} else {
this.hLength = hLength;
}
}
/**
* Returns newly created ISISAreaIdentifierTlv object.
*
* @param raw ISIS-Area-Identifier
* @param hLength length
* @return object of ISISAreaIdentifierTlv
*/
public static ISISAreaIdentifierTlv of(final byte[] raw, short hLength) {
return new ISISAreaIdentifierTlv(raw, hLength);
}
/**
* Returns value of ISIS-Area-Identifier.
*
* @return byte array of rawValue
*/
public byte[] getValue() {
return rawValue;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return hLength;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ISISAreaIdentifierTlv) {
ISISAreaIdentifierTlv other = (ISISAreaIdentifierTlv) obj;
return Objects.equals(hLength, other.hLength) && Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(hLength);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of ISISAreaIdentifierTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of ISISAreaIdentifierTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iISISAreaIdentifier = new byte[hLength];
c.readBytes(iISISAreaIdentifier, 0, hLength);
return new ISISAreaIdentifierTlv(iISISAreaIdentifier, hLength);
}
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
toStrHelper.add("Type", TYPE);
toStrHelper.add("Length", hLength);
StringBuffer result = new StringBuffer();
for (byte b : rawValue) {
result.append(String.format("%02X ", b));
}
toStrHelper.add("Value", result);
return toStrHelper.toString();
}
}
......
/*
* 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.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;
/**
* LabelSubObject: Provides a LabelSubObject.
*/
public class LabelSubObject implements PcepValueType {
/* Reference : RFC 3209
* LABEL Sub Object
*
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length | Flags | C-Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Contents of Label Object |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LabelSubObject.class);
public static final short TYPE = 0x03;
public static final short LENGTH = 8;
private final byte flags;
private final byte cType;
private final int contents;
/**
* constructor to initialize parameters for LabelSubObject.
*
* @param flags flags
* @param cType C-Type
* @param contents Contents of label object
*/
public LabelSubObject(byte flags, byte cType, int contents) {
this.flags = flags;
this.cType = cType;
this.contents = contents;
}
/**
* Return an object of LabelSubObject.
*
* @param flags flags
* @param cType C-type
* @param contents contents of label objects
* @return object of LabelSubObject
*/
public static LabelSubObject of(byte flags, byte cType, int contents) {
return new LabelSubObject(flags, cType, contents);
}
/**
* Returns Flags.
*
* @return flags
*/
public byte getFlags() {
return flags;
}
/**
* Returns cType.
*
* @return cType
*/
public byte getCtype() {
return cType;
}
/**
* Returns contents.
*
* @return contents
*/
public int getContents() {
return contents;
}
@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(flags, cType, contents);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LabelSubObject) {
LabelSubObject other = (LabelSubObject) obj;
return Objects.equals(this.flags, other.flags) && Objects.equals(this.cType, other.cType)
&& Objects.equals(this.contents, other.contents);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeByte(flags);
c.writeByte(cType);
c.writeByte(contents);
return c.writerIndex() - iStartIndex;
}
/**
* Reads the channel buffer and returns object of LabelSubObject.
*
* @param c type of channel buffer
* @return object of LabelSubObject
*/
public static PcepValueType read(ChannelBuffer c) {
byte flags = c.readByte();
byte cType = c.readByte();
int contents = c.readInt();
return new LabelSubObject(flags, cType, contents);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("type", TYPE).add("Length", LENGTH).add("flags", flags)
.add("C-type", cType).add("contents", contents).toString();
}
}
/*
* 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.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;
/**
* LabelSubObject: Provides a LabelSubObject.
*/
public class LabelSubObject implements PcepValueType {
/* Reference : RFC 3209
* LABEL Sub Object
*
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length | Flags | C-Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Contents of Label Object |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LabelSubObject.class);
public static final short TYPE = 0x03;
public static final short LENGTH = 8;
private final byte flags;
private final byte cType;
private final int contents;
/**
* constructor to initialize parameters for LabelSubObject.
*
* @param flags flags
* @param cType C-Type
* @param contents Contents of label object
*/
public LabelSubObject(byte flags, byte cType, int contents) {
this.flags = flags;
this.cType = cType;
this.contents = contents;
}
/**
* Return an object of LabelSubObject.
*
* @param flags flags
* @param cType C-type
* @param contents contents of label objects
* @return object of LabelSubObject
*/
public static LabelSubObject of(byte flags, byte cType, int contents) {
return new LabelSubObject(flags, cType, contents);
}
/**
* Returns Flags.
*
* @return flags
*/
public byte getFlags() {
return flags;
}
/**
* Returns cType.
*
* @return cType
*/
public byte getCtype() {
return cType;
}
/**
* Returns contents.
*
* @return contents
*/
public int getContents() {
return contents;
}
@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(flags, cType, contents);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LabelSubObject) {
LabelSubObject other = (LabelSubObject) obj;
return Objects.equals(this.flags, other.flags) && Objects.equals(this.cType, other.cType)
&& Objects.equals(this.contents, other.contents);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeByte(flags);
c.writeByte(cType);
c.writeByte(contents);
return c.writerIndex() - iStartIndex;
}
/**
* Reads the channel buffer and returns object of LabelSubObject.
*
* @param c type of channel buffer
* @return object of LabelSubObject
*/
public static PcepValueType read(ChannelBuffer c) {
byte flags = c.readByte();
byte cType = c.readByte();
int contents = c.readInt();
return new LabelSubObject(flags, cType, contents);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("type", TYPE).add("Length", LENGTH).add("flags", flags)
.add("C-type", cType).add("contents", contents).toString();
}
}
......
/*
* 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.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;
import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides the Link Name.
*/
public class LinkNameTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution] /3.3.2.7
* Link name tlv format.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TDB43 | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Link Name (variable) //
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkNameTlv.class);
public static final short TYPE = 1098; //TODO:NEED TO HANDLE TDB43
private short hLength;
private final byte[] rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue Link-Name
* @param hLength length
*/
public LinkNameTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
if (0 == hLength) {
this.hLength = (short) rawValue.length;
} else {
this.hLength = hLength;
}
}
/**
* Returns newly created LinkNameTlv object.
*
* @param raw Link-Name
* @param hLength length
* @return object of LinkNameTlv
*/
public static LinkNameTlv of(final byte[] raw, short hLength) {
return new LinkNameTlv(raw, hLength);
}
/**
* Returns value of Link-Name.
*
* @return raw value
*/
public byte[] getValue() {
return rawValue;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return hLength;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LinkNameTlv) {
LinkNameTlv other = (LinkNameTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(hLength);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of LinkNameTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of LinkNameTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] linkName = new byte[hLength];
c.readBytes(linkName, 0, hLength);
return new LinkNameTlv(linkName, hLength);
}
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
toStrHelper.add("Type", TYPE);
toStrHelper.add("Length", hLength);
StringBuffer result = new StringBuffer();
for (byte b : rawValue) {
result.append(String.format("%02X ", b));
}
toStrHelper.add("Value", result);
return toStrHelper.toString();
}
}
/*
* 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.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;
import com.google.common.base.MoreObjects.ToStringHelper;
/**
* Provides the Link Name.
*/
public class LinkNameTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution] /3.3.2.7
* Link name tlv format.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TDB43 | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Link Name (variable) //
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkNameTlv.class);
public static final short TYPE = 1098; //TODO:NEED TO HANDLE TDB43
private short hLength;
private final byte[] rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue Link-Name
* @param hLength length
*/
public LinkNameTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
if (0 == hLength) {
this.hLength = (short) rawValue.length;
} else {
this.hLength = hLength;
}
}
/**
* Returns newly created LinkNameTlv object.
*
* @param raw Link-Name
* @param hLength length
* @return object of LinkNameTlv
*/
public static LinkNameTlv of(final byte[] raw, short hLength) {
return new LinkNameTlv(raw, hLength);
}
/**
* Returns value of Link-Name.
*
* @return raw value
*/
public byte[] getValue() {
return rawValue;
}
@Override
public PcepVersion getVersion() {
return PcepVersion.PCEP_1;
}
@Override
public short getType() {
return TYPE;
}
@Override
public short getLength() {
return hLength;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LinkNameTlv) {
LinkNameTlv other = (LinkNameTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(hLength);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of LinkNameTlv.
*
* @param c input channel buffer
* @param hLength length
* @return object of LinkNameTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] linkName = new byte[hLength];
c.readBytes(linkName, 0, hLength);
return new LinkNameTlv(linkName, hLength);
}
@Override
public String toString() {
ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass());
toStrHelper.add("Type", TYPE);
toStrHelper.add("Length", hLength);
StringBuffer result = new StringBuffer();
for (byte b : rawValue) {
result.append(String.format("%02X ", b));
}
toStrHelper.add("Value", result);
return toStrHelper.toString();
}
}
......
/*
* 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.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;
/**
* Provide Link Protection Type.
*/
public class LinkProtectionTypeTlv implements PcepValueType {
/* Reference :[RFC5307]/1.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB38] | Length=2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Protection Cap | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkProtectionTypeTlv.class);
public static final short TYPE = 20; //TDB38
public static final short LENGTH = 2;
private final byte protectionCap;
private final byte reserved;
/**
* Constructor to initialize protectionCap.
*
* @param protectionCap Protection Cap
*/
public LinkProtectionTypeTlv(byte protectionCap) {
this.protectionCap = protectionCap;
this.reserved = 0;
}
/**
* Constructor to initialize protectionCap, reserved.
*
* @param protectionCap Protection Cap
* @param reserved Reserved value
*/
public LinkProtectionTypeTlv(byte protectionCap, byte reserved) {
this.protectionCap = protectionCap;
this.reserved = reserved;
}
/**
* Returns Protection Cap.
*
* @return protectionCap Protection Cap
*/
public byte getProtectionCap() {
return protectionCap;
}
@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(protectionCap, reserved);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LinkProtectionTypeTlv) {
LinkProtectionTypeTlv other = (LinkProtectionTypeTlv) obj;
return Objects.equals(protectionCap, other.protectionCap) && Objects.equals(reserved, other.reserved);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeByte(protectionCap);
c.writeByte(reserved);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of LinkProtectionTypeTlv.
*
* @param c input channel buffer
* @return object of LinkProtectionTypeTlv
*/
public static PcepValueType read(ChannelBuffer c) {
byte protectionCap = c.readByte();
byte reserved = c.readByte();
return new LinkProtectionTypeTlv(protectionCap, reserved);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH)
.add("ProtectionCap", protectionCap).toString();
}
/*
* 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.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;
/**
* Provide Link Protection Type.
*/
public class LinkProtectionTypeTlv implements PcepValueType {
/* Reference :[RFC5307]/1.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB38] | Length=2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Protection Cap | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(LinkProtectionTypeTlv.class);
public static final short TYPE = 20; //TDB38
public static final short LENGTH = 2;
private final byte protectionCap;
private final byte reserved;
/**
* Constructor to initialize protectionCap.
*
* @param protectionCap Protection Cap
*/
public LinkProtectionTypeTlv(byte protectionCap) {
this.protectionCap = protectionCap;
this.reserved = 0;
}
/**
* Constructor to initialize protectionCap, reserved.
*
* @param protectionCap Protection Cap
* @param reserved Reserved value
*/
public LinkProtectionTypeTlv(byte protectionCap, byte reserved) {
this.protectionCap = protectionCap;
this.reserved = reserved;
}
/**
* Returns Protection Cap.
*
* @return protectionCap Protection Cap
*/
public byte getProtectionCap() {
return protectionCap;
}
@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(protectionCap, reserved);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LinkProtectionTypeTlv) {
LinkProtectionTypeTlv other = (LinkProtectionTypeTlv) obj;
return Objects.equals(protectionCap, other.protectionCap) && Objects.equals(reserved, other.reserved);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeByte(protectionCap);
c.writeByte(reserved);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of LinkProtectionTypeTlv.
*
* @param c input channel buffer
* @return object of LinkProtectionTypeTlv
*/
public static PcepValueType read(ChannelBuffer c) {
byte protectionCap = c.readByte();
byte reserved = c.readByte();
return new LinkProtectionTypeTlv(protectionCap, reserved);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH)
.add("ProtectionCap", protectionCap).toString();
}
}
\ No newline at end of file
......
/*
* 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.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;
/**
* Provide the Maximum Link Bandwidth.
*/
public class MaximumLinkBandwidthTlv implements PcepValueType {
/* Reference :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB34] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Maximum Link Bandwidth |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(MaximumLinkBandwidthTlv.class);
public static final short TYPE = 9; //TDB34
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue Maximum-Link-Bandwidth
*/
public MaximumLinkBandwidthTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created MaximumLinkBandwidthTlv object.
*
* @param raw value of Maximum-Link-Bandwidth
* @return object of MaximumLinkBandwidthTlv
*/
public static MaximumLinkBandwidthTlv of(final int raw) {
return new MaximumLinkBandwidthTlv(raw);
}
/**
* Returns value of Maximum Link Bandwidth.
*
* @return rawValue Maximum Link Bandwidth
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MaximumLinkBandwidthTlv) {
MaximumLinkBandwidthTlv other = (MaximumLinkBandwidthTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of MaximumLinkBandwidthTlv.
*
* @param c input channel buffer
* @return object of MaximumLinkBandwidthTlv
*/
public static MaximumLinkBandwidthTlv read(ChannelBuffer c) {
return MaximumLinkBandwidthTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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;
/**
* Provide the Maximum Link Bandwidth.
*/
public class MaximumLinkBandwidthTlv implements PcepValueType {
/* Reference :[RFC5305]/3.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB34] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Maximum Link Bandwidth |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(MaximumLinkBandwidthTlv.class);
public static final short TYPE = 9; //TDB34
public static final short LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize rawValue.
*
* @param rawValue Maximum-Link-Bandwidth
*/
public MaximumLinkBandwidthTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Returns newly created MaximumLinkBandwidthTlv object.
*
* @param raw value of Maximum-Link-Bandwidth
* @return object of MaximumLinkBandwidthTlv
*/
public static MaximumLinkBandwidthTlv of(final int raw) {
return new MaximumLinkBandwidthTlv(raw);
}
/**
* Returns value of Maximum Link Bandwidth.
*
* @return rawValue Maximum Link Bandwidth
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MaximumLinkBandwidthTlv) {
MaximumLinkBandwidthTlv other = (MaximumLinkBandwidthTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of MaximumLinkBandwidthTlv.
*
* @param c input channel buffer
* @return object of MaximumLinkBandwidthTlv
*/
public static MaximumLinkBandwidthTlv read(ChannelBuffer c) {
return MaximumLinkBandwidthTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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;
/**
* Provide the Maximum Reservable Link Bandwidth.
*/
public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
/* Reference :[RFC5305]/3.5.
* 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB35] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Maximum Reservable Link Bandwidth |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(MaximumReservableLinkBandwidthTlv.class);
public static final short TYPE = 10; // TDB35
public static final short LENGTH = 4;
private final int rawValue;
/**
* constructor to initialize rawValue.
*
* @param rawValue MaximumReservableLinkBandwidth
*/
public MaximumReservableLinkBandwidthTlv(int rawValue) {
log.debug("MaximumReservableLinkBandwidthTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created MaximumReservableLinkBandwidth object.
*
* @param raw MaximumReservableLinkBandwidth
* @return object of MaximumReservableLinkBandwidthTlv
*/
public static MaximumReservableLinkBandwidthTlv of(final int raw) {
return new MaximumReservableLinkBandwidthTlv(raw);
}
/**
* Returns value of Maximum Reservable Link Bandwidth.
* @return rawValue Maximum Reservable Link Bandwidth
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MaximumReservableLinkBandwidthTlv) {
MaximumReservableLinkBandwidthTlv other = (MaximumReservableLinkBandwidthTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of MaximumReservableLinkBandwidthTlv.
*
* @param c input channel buffer
* @return object of MaximumReservableLinkBandwidthTlv
*/
public static MaximumReservableLinkBandwidthTlv read(ChannelBuffer c) {
return MaximumReservableLinkBandwidthTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
/*
* 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.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;
/**
* Provide the Maximum Reservable Link Bandwidth.
*/
public class MaximumReservableLinkBandwidthTlv implements PcepValueType {
/* Reference :[RFC5305]/3.5.
* 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=[TDB35] | Length=4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Maximum Reservable Link Bandwidth |
+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-
*/
protected static final Logger log = LoggerFactory.getLogger(MaximumReservableLinkBandwidthTlv.class);
public static final short TYPE = 10; // TDB35
public static final short LENGTH = 4;
private final int rawValue;
/**
* constructor to initialize rawValue.
*
* @param rawValue MaximumReservableLinkBandwidth
*/
public MaximumReservableLinkBandwidthTlv(int rawValue) {
log.debug("MaximumReservableLinkBandwidthTlv");
this.rawValue = rawValue;
}
/**
* Returns newly created MaximumReservableLinkBandwidth object.
*
* @param raw MaximumReservableLinkBandwidth
* @return object of MaximumReservableLinkBandwidthTlv
*/
public static MaximumReservableLinkBandwidthTlv of(final int raw) {
return new MaximumReservableLinkBandwidthTlv(raw);
}
/**
* Returns value of Maximum Reservable Link Bandwidth.
* @return rawValue Maximum Reservable Link Bandwidth
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MaximumReservableLinkBandwidthTlv) {
MaximumReservableLinkBandwidthTlv other = (MaximumReservableLinkBandwidthTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of MaximumReservableLinkBandwidthTlv.
*
* @param c input channel buffer
* @return object of MaximumReservableLinkBandwidthTlv
*/
public static MaximumReservableLinkBandwidthTlv read(ChannelBuffer c) {
return MaximumReservableLinkBandwidthTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue)
.toString();
}
}
......
/*
* 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.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;
/**
* NexthopIPv6addressTlv provides Ipv4 address of next hop.
*/
public class NexthopIPv4addressTlv implements PcepValueType {
/*
Reference :draft-zhao-pce-pcep-extension-for-pce-controller-01
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TBD | Length = 8 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| nexthop IPv4 address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NEXTHOP-IPV4-ADDRESS TLV
*/
protected static final Logger log = LoggerFactory.getLogger(NexthopIPv4addressTlv.class);
public static final short TYPE = 2; //to be defined
//Length is header + value
public static final short LENGTH = 8;
public static final short VALUE_LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize next hop IPv4 address.
*
* @param rawValue next hop IPv4 address
*/
public NexthopIPv4addressTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Return next hop IPv4 address tlv.
*
* @param raw of next hop IPv4 address
* @return object of NexthopIPv4addressTlv
*/
public static NexthopIPv4addressTlv of(final int raw) {
return new NexthopIPv4addressTlv(raw);
}
/**
* Returns next hop IPv4 address.
*
* @return next hop IPv4 address
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof NexthopIPv4addressTlv) {
NexthopIPv4addressTlv other = (NexthopIPv4addressTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iStartIndex;
}
/**
* Reads the channel buffer and returns object of NexthopIPv4addressTlv.
*
* @param c type of channel buffer
* @return object of NexthopIPv4addressTlv
*/
public static NexthopIPv4addressTlv read(ChannelBuffer c) {
return NexthopIPv4addressTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("Ipv4Address ", rawValue)
.toString();
}
}
/*
* 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.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;
/**
* NexthopIPv6addressTlv provides Ipv4 address of next hop.
*/
public class NexthopIPv4addressTlv implements PcepValueType {
/*
Reference :draft-zhao-pce-pcep-extension-for-pce-controller-01
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TBD | Length = 8 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| nexthop IPv4 address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NEXTHOP-IPV4-ADDRESS TLV
*/
protected static final Logger log = LoggerFactory.getLogger(NexthopIPv4addressTlv.class);
public static final short TYPE = 2; //to be defined
//Length is header + value
public static final short LENGTH = 8;
public static final short VALUE_LENGTH = 4;
private final int rawValue;
/**
* Constructor to initialize next hop IPv4 address.
*
* @param rawValue next hop IPv4 address
*/
public NexthopIPv4addressTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* Return next hop IPv4 address tlv.
*
* @param raw of next hop IPv4 address
* @return object of NexthopIPv4addressTlv
*/
public static NexthopIPv4addressTlv of(final int raw) {
return new NexthopIPv4addressTlv(raw);
}
/**
* Returns next hop IPv4 address.
*
* @return next hop IPv4 address
*/
public int getInt() {
return rawValue;
}
@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(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof NexthopIPv4addressTlv) {
NexthopIPv4addressTlv other = (NexthopIPv4addressTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(rawValue);
return c.writerIndex() - iStartIndex;
}
/**
* Reads the channel buffer and returns object of NexthopIPv4addressTlv.
*
* @param c type of channel buffer
* @return object of NexthopIPv4addressTlv
*/
public static NexthopIPv4addressTlv read(ChannelBuffer c) {
return NexthopIPv4addressTlv.of(c.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("Ipv4Address ", rawValue)
.toString();
}
}
......
/*
* 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.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;
/**
* NexthopUnnumberedIPv4IDTlv provides the next node's ID and Interface ID.
*/
public class NexthopUnnumberedIPv4IDTlv implements PcepValueType {
/*
Reference : draft-zhao-pce-pcep-extension-for-pce-controller-01.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TBD | Length = 12 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Node-ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Interface ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NEXTHOP-UNNUMBERED-IPV4-ID TLV
*/
protected static final Logger log = LoggerFactory.getLogger(NexthopUnnumberedIPv4IDTlv.class);
public static final short TYPE = 1; //to be defined
//Length is header + value
public static final short LENGTH = 12;
private final int nodeID;
private final int interfaceID;
/**
* constructor to initialize nodeID and interfaceID.
*
* @param nodeID node ID
* @param interfaceID interface ID
*/
public NexthopUnnumberedIPv4IDTlv(int nodeID, int interfaceID) {
this.nodeID = nodeID;
this.interfaceID = interfaceID;
}
/**
* Returns new object of NexthopUnnumberedIPv4IDTlv.
*
* @param nodeID node ID
* @param interfaceID interface ID
* @return NexthopUnnumberedIPv4IDTlv
*/
public static NexthopUnnumberedIPv4IDTlv of(int nodeID, int interfaceID) {
return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID);
}
/**
* Returns Node Id.
*
* @return node ID
*/
public int getNodeID() {
return nodeID;
}
/**
* Returns Interface Id.
*
* @return interface ID
*/
public int getInterfaceID() {
return interfaceID;
}
@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(nodeID, interfaceID);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof NexthopUnnumberedIPv4IDTlv) {
NexthopUnnumberedIPv4IDTlv other = (NexthopUnnumberedIPv4IDTlv) obj;
return Objects.equals(this.nodeID, other.nodeID) && Objects.equals(this.interfaceID, other.interfaceID);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(nodeID);
c.writeInt(interfaceID);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of NexthopUnnumberedIPv4IDTlv.
*
* @param cb type of channel buffer
* @return object of NexthopUnnumberedIPv4IDTlv
*/
public static NexthopUnnumberedIPv4IDTlv read(ChannelBuffer cb) {
int nodeID = cb.readInt();
int interfaceID = cb.readInt();
return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("NodeId", nodeID)
.add("InterfaceId", interfaceID).toString();
}
}
/*
* 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.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;
/**
* NexthopUnnumberedIPv4IDTlv provides the next node's ID and Interface ID.
*/
public class NexthopUnnumberedIPv4IDTlv implements PcepValueType {
/*
Reference : draft-zhao-pce-pcep-extension-for-pce-controller-01.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type=TBD | Length = 12 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Node-ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Interface ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NEXTHOP-UNNUMBERED-IPV4-ID TLV
*/
protected static final Logger log = LoggerFactory.getLogger(NexthopUnnumberedIPv4IDTlv.class);
public static final short TYPE = 1; //to be defined
//Length is header + value
public static final short LENGTH = 12;
private final int nodeID;
private final int interfaceID;
/**
* constructor to initialize nodeID and interfaceID.
*
* @param nodeID node ID
* @param interfaceID interface ID
*/
public NexthopUnnumberedIPv4IDTlv(int nodeID, int interfaceID) {
this.nodeID = nodeID;
this.interfaceID = interfaceID;
}
/**
* Returns new object of NexthopUnnumberedIPv4IDTlv.
*
* @param nodeID node ID
* @param interfaceID interface ID
* @return NexthopUnnumberedIPv4IDTlv
*/
public static NexthopUnnumberedIPv4IDTlv of(int nodeID, int interfaceID) {
return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID);
}
/**
* Returns Node Id.
*
* @return node ID
*/
public int getNodeID() {
return nodeID;
}
/**
* Returns Interface Id.
*
* @return interface ID
*/
public int getInterfaceID() {
return interfaceID;
}
@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(nodeID, interfaceID);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof NexthopUnnumberedIPv4IDTlv) {
NexthopUnnumberedIPv4IDTlv other = (NexthopUnnumberedIPv4IDTlv) obj;
return Objects.equals(this.nodeID, other.nodeID) && Objects.equals(this.interfaceID, other.interfaceID);
}
return false;
}
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeInt(nodeID);
c.writeInt(interfaceID);
return c.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of NexthopUnnumberedIPv4IDTlv.
*
* @param cb type of channel buffer
* @return object of NexthopUnnumberedIPv4IDTlv
*/
public static NexthopUnnumberedIPv4IDTlv read(ChannelBuffer cb) {
int nodeID = cb.readInt();
int interfaceID = cb.readInt();
return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("NodeId", nodeID)
.add("InterfaceId", interfaceID).toString();
}
}
......