use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandler method parseAttribute.
@Override
public void parseAttribute(@Nonnull final ByteBuf buffer, @Nonnull final AttributesBuilder builder) {
if (!buffer.isReadable()) {
return;
}
final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
pmsiTunnelBuilder.setLeafInformationRequired(buffer.readBoolean());
final int tunnelType = buffer.readUnsignedByte();
parseMpls(pmsiTunnelBuilder, buffer);
final TunnelIdentifier tunnelIdentifier = this.tunnelIdentifierHandler.parse(tunnelType, buffer);
if (tunnelIdentifier != null) {
pmsiTunnelBuilder.setTunnelIdentifier(tunnelIdentifier);
}
builder.addAugmentation(PmsiTunnelAugmentation.class, new PmsiTunnelAugmentationBuilder().setPmsiTunnel(pmsiTunnelBuilder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class ClusterIdAttributeParser method parseAttribute.
@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) {
final List<ClusterIdentifier> list = Lists.newArrayList();
while (buffer.isReadable()) {
list.add(new ClusterIdentifier(Ipv4Util.addressForByteBuf(buffer)));
}
builder.setClusterId(new ClusterIdBuilder().setCluster(list).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class ExtendedCommunitiesAttributeParser method parseAttribute.
@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPDocumentedException, BGPParsingException {
final List<ExtendedCommunities> set = new ArrayList<>();
while (buffer.isReadable()) {
final ExtendedCommunities exComm = this.ecReg.parseExtendedCommunity(buffer);
if (exComm != null) {
set.add(exComm);
}
}
builder.setExtendedCommunities(set);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class BasePathSelectorTest method createStateFromPrefMedOrigin.
private static Attributes createStateFromPrefMedOrigin() {
AttributesBuilder dataContBuilder = new AttributesBuilder();
addLowerLocalRef(dataContBuilder);
addLowerMultiExitDisc(dataContBuilder);
addIgpOrigin(dataContBuilder);
return dataContBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class BasePathSelectorTest method testBestPathSelectionOptions.
@Test
public void testBestPathSelectionOptions() {
AttributesBuilder dataContBuilder = createStateFromPrefMedOriginASPath();
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
BaseBestPath processedPath = this.selector.result();
assertEquals(1, processedPath.getState().getOrigin().getIntValue());
// prefer the path with the lowest origin type
addIgpOrigin(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(0, processedPath.getState().getOrigin().getIntValue());
addEgpOrigin(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(0, processedPath.getState().getOrigin().getIntValue());
// prefer the path with the lowest multi-exit discriminator (MED)
assertEquals(4321L, (long) processedPath.getState().getMultiExitDisc());
addIgpOrigin(dataContBuilder);
addLowerMultiExitDisc(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(1234L, (long) processedPath.getState().getMultiExitDisc());
addHigherMultiExitDisc(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(1234L, (long) processedPath.getState().getMultiExitDisc());
addLowerMultiExitDisc(dataContBuilder);
addAsPath(dataContBuilder, SEQ_SEGMENT2);
assertEquals(1L, processedPath.getState().getPeerAs());
assertEquals(3, processedPath.getState().getAsPathLength());
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(1L, processedPath.getState().getPeerAs());
assertEquals(3, processedPath.getState().getAsPathLength());
}
Aggregations