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 AppendActionTest method testAppend.
@Test
public void testAppend() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("multiple-append-test")).findFirst().get();
final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
final Attributes expected = new AttributesBuilder().setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build()).setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("4.5.6.7")).build()).build()).setLocalPref(new LocalPrefBuilder().setPref(100L).build()).setMultiExitDisc(new MultiExitDiscBuilder().setMed(15L).build()).build();
assertEquals(expected, result.getAttributes());
}
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 MultiPathAbstractRIBSupportTest method buildUpdate.
@Test
public void buildUpdate() {
final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
final Attributes attr = new AttributesBuilder().setCNextHop(nextHop).build();
final Collection<MapEntryNode> routes = new HashSet<>();
assertEquals(new UpdateBuilder().setAttributes(new AttributesBuilder().build()).build(), MULTI_PATH_ABSTRACT_TEST.buildUpdate(routes, routes, attr));
routes.add(this.mapEntryNode);
final MpReachNlri mpReach = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setCNextHop(nextHop).setAdvertizedRoutes(new AdvertizedRoutesBuilder().build()).build();
final Attributes attMpR = new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mpReach).build()).build();
assertEquals(new UpdateBuilder().setAttributes(attMpR).build(), MULTI_PATH_ABSTRACT_TEST.buildUpdate(routes, Collections.emptySet(), attr));
final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().build()).build();
final Attributes attMpU = new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mpUnreach).build()).build();
assertEquals(new UpdateBuilder().setAttributes(attMpU).build(), MULTI_PATH_ABSTRACT_TEST.buildUpdate(Collections.emptySet(), routes, attr));
}
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 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.rev200120.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());
}
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 createStateFromPrefMedOriginASPath.
protected static AttributesBuilder createStateFromPrefMedOriginASPath() {
AttributesBuilder dataContBuilder = new AttributesBuilder();
addHigherLocalRef(dataContBuilder);
addHigherMultiExitDisc(dataContBuilder);
addEgpOrigin(dataContBuilder);
addAsPath(dataContBuilder, SEQ_SEGMENT);
return dataContBuilder;
}
Aggregations