use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class AbstractAddPathTest method createSimpleUpdateEbgp.
private static Update createSimpleUpdateEbgp(final Ipv4Prefix prefix) {
final AttributesBuilder attBuilder = new AttributesBuilder();
attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AS_NUMBER)).build())).build());
addAttributeAugmentation(attBuilder, prefix, null);
return new UpdateBuilder().setAttributes(attBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class AbstractAddPathTest method addAttributeAugmentation.
private static void addAttributeAugmentation(final AttributesBuilder attBuilder, final Ipv4Prefix prefix, final PathId pathId) {
attBuilder.setUnrecognizedAttributes(Collections.emptyList());
attBuilder.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(new MpReachNlriBuilder().setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(NH1).build()).build()).setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(Collections.singletonList(new Ipv4PrefixesBuilder().setPathId(pathId).setPrefix(new Ipv4Prefix(prefix)).build())).build()).build()).build()).build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class LocRibWriter method init.
@SuppressWarnings("unchecked")
private synchronized void init() {
final WriteTransaction tx = this.chain.newWriteOnlyTransaction();
tx.merge(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.builder().child(Attributes.class).build(), new AttributesBuilder().setUptodate(true).build());
tx.submit();
final InstanceIdentifier<Tables> tableId = this.ribIId.builder().child(Peer.class).child(EffectiveRibIn.class).child(Tables.class, this.tk).build();
this.reg = this.dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, tableId), this);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class AppPeerBenchmark method addRoute.
private long addRoute(final Ipv4Prefix ipv4Prefix, final Ipv4Address nextHop, final long count, final long batch) {
final AttributesBuilder attributesBuilder = new AttributesBuilder();
attributesBuilder.setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address(nextHop)).build()).build());
attributesBuilder.setMultiExitDisc(MED);
attributesBuilder.setLocalPref(LOC_PREF);
attributesBuilder.setOrigin(ORIGIN);
attributesBuilder.setAsPath(AS_PATH);
final Attributes attributes = attributesBuilder.build();
return processRoutes(ipv4Prefix, count, batch, attributes);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class BasePathSelectorTest method testBestPathWithHigherLocalPref.
@Test
public void testBestPathWithHigherLocalPref() {
// local-pref 123
this.selector.processPath(ROUTER_ID2, createStateFromPrefMedOrigin());
BaseBestPath processedPath = this.selector.result();
assertEquals(123L, processedPath.getState().getLocalPref().longValue());
// local-pref 321
this.selector.processPath(ROUTER_ID2, createStateFromPrefMedOriginASPath().build());
processedPath = this.selector.result();
assertEquals(321L, processedPath.getState().getLocalPref().longValue());
AttributesBuilder dataContBuilder = new AttributesBuilder();
// prefer path with higher LOCAL_PREF
addLowerLocalRef(dataContBuilder);
this.selector.processPath(ROUTER_ID2, dataContBuilder.build());
processedPath = this.selector.result();
assertEquals(321L, processedPath.getState().getLocalPref().longValue());
}
Aggregations