Search in sources :

Example 91 with AttributesBuilder

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();
}
Also used : AsPathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPathBuilder) SegmentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.as.path.SegmentsBuilder) OriginBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder) UpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)

Example 92 with AttributesBuilder

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());
}
Also used : Attributes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1Builder) MpReachNlriBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlriBuilder) AdvertizedRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder) Ipv4NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder) Ipv4NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder) DestinationIpv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder) Ipv4PrefixesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.prefixes.destination.ipv4.Ipv4PrefixesBuilder) DestinationIpv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.prefixes.DestinationIpv4Builder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) UnicastSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily)

Example 93 with AttributesBuilder

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);
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) Peer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.AttributesBuilder)

Example 94 with AttributesBuilder

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);
}
Also used : Ipv4NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder) Ipv4NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 95 with AttributesBuilder

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());
}
Also used : AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder) Test(org.junit.Test)

Aggregations

AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)118 Test (org.junit.Test)95 ByteBuf (io.netty.buffer.ByteBuf)58 RouteAttributeContainer (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer)29 Statement (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement)29 Attributes1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1Builder)28 ArrayList (java.util.ArrayList)26 MpReachNlriBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlriBuilder)25 AdvertizedRoutesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder)24 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)23 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPathBuilder)23 Attributes2Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes2Builder)22 OriginBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder)20 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)19 MpUnreachNlriBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpUnreachNlriBuilder)19 WithdrawnRoutesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder)18 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder)17 Flowspec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.Flowspec)16 FlowspecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.FlowspecBuilder)16 Ipv4NextHopCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder)16