mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-03 01:31:21 +01:00
[onos-2603] - Implement LinkState tag attributes
Change-Id: I674197405a57a8a45a2939e364c59c4565ad756f
This commit is contained in:
parent
68d434a0e6
commit
e79b0ef771
@ -15,7 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.onosproject.bgpio.types.attr;
|
package org.onosproject.bgpio.types.attr;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.jboss.netty.buffer.ChannelBuffer;
|
import org.jboss.netty.buffer.ChannelBuffer;
|
||||||
@ -36,18 +37,28 @@ public class BgpPrefixAttrRouteTag implements BGPValueType {
|
|||||||
protected static final Logger log = LoggerFactory
|
protected static final Logger log = LoggerFactory
|
||||||
.getLogger(BgpPrefixAttrRouteTag.class);
|
.getLogger(BgpPrefixAttrRouteTag.class);
|
||||||
|
|
||||||
public static final int ATTR_PREFIX_ROUTETAG = 1153;
|
public static final short ATTR_PREFIX_ROUTETAG = 1153;
|
||||||
|
|
||||||
/* Prefix Route Tag */
|
/* Prefix Route Tag */
|
||||||
private int[] pfxRouteTag;
|
private List<Integer> pfxRouteTag = new ArrayList<Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to initialize the values.
|
* Constructor to initialize the values.
|
||||||
*
|
*
|
||||||
* @param pfxRouteTag prefix route tag
|
* @param pfxRouteTag prefix route tag
|
||||||
*/
|
*/
|
||||||
BgpPrefixAttrRouteTag(int[] pfxRouteTag) {
|
public BgpPrefixAttrRouteTag(List<Integer> pfxRouteTag) {
|
||||||
this.pfxRouteTag = Arrays.copyOf(pfxRouteTag, pfxRouteTag.length);
|
this.pfxRouteTag = pfxRouteTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns object of this class with specified values.
|
||||||
|
*
|
||||||
|
* @param pfxRouteTag Prefix Metric
|
||||||
|
* @return object of BgpPrefixAttrRouteTag
|
||||||
|
*/
|
||||||
|
public static BgpPrefixAttrRouteTag of(ArrayList<Integer> pfxRouteTag) {
|
||||||
|
return new BgpPrefixAttrRouteTag(pfxRouteTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +70,8 @@ public class BgpPrefixAttrRouteTag implements BGPValueType {
|
|||||||
*/
|
*/
|
||||||
public static BgpPrefixAttrRouteTag read(ChannelBuffer cb)
|
public static BgpPrefixAttrRouteTag read(ChannelBuffer cb)
|
||||||
throws BGPParseException {
|
throws BGPParseException {
|
||||||
int[] pfxRouteTag;
|
int tmp;
|
||||||
|
ArrayList<Integer> pfxRouteTag = new ArrayList<Integer>();
|
||||||
|
|
||||||
short lsAttrLength = cb.readShort();
|
short lsAttrLength = cb.readShort();
|
||||||
int len = lsAttrLength / Integer.SIZE;
|
int len = lsAttrLength / Integer.SIZE;
|
||||||
@ -70,13 +82,12 @@ public class BgpPrefixAttrRouteTag implements BGPValueType {
|
|||||||
lsAttrLength);
|
lsAttrLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
pfxRouteTag = new int[lsAttrLength];
|
|
||||||
|
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
pfxRouteTag[i] = cb.readInt();
|
tmp = cb.readInt();
|
||||||
|
pfxRouteTag.add(new Integer(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BgpPrefixAttrRouteTag(pfxRouteTag);
|
return BgpPrefixAttrRouteTag.of(pfxRouteTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,7 +95,7 @@ public class BgpPrefixAttrRouteTag implements BGPValueType {
|
|||||||
*
|
*
|
||||||
* @return route tag
|
* @return route tag
|
||||||
*/
|
*/
|
||||||
int[] getPfxRouteTag() {
|
public List<Integer> getPfxRouteTag() {
|
||||||
return pfxRouteTag;
|
return pfxRouteTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user