Search in sources :

Example 86 with Attributes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes in project bgpcep by opendaylight.

the class BgpConditionsRegistry method matchExportConditions.

@SuppressWarnings("unchecked")
public boolean matchExportConditions(final RouteEntryBaseAttributes entryInfo, final BGPRouteEntryExportParameters routeEntryExportParameters, final Attributes attributes, final Conditions conditions) {
    final Conditions1 bgpConditionsAug = conditions.getAugmentation(Conditions1.class);
    if (bgpConditionsAug != null) {
        final BgpConditions bgpConditions = bgpConditionsAug.getBgpConditions();
        if (!matchExportCondition(entryInfo, routeEntryExportParameters, attributes, bgpConditions)) {
            return false;
        }
        final Map<Class<? extends Augmentation<?>>, Augmentation<?>> bgpAug = BindingReflections.getAugmentations(bgpConditions);
        for (final Map.Entry<Class<? extends Augmentation<?>>, Augmentation<?>> entry : bgpAug.entrySet()) {
            final BgpConditionsAugmentationPolicy handler = this.bgpConditionsAugRegistry.get(entry.getKey());
            if (handler == null) {
                continue;
            }
            if (!handler.matchExportCondition(entryInfo, routeEntryExportParameters, handler.getConditionParameter(attributes), entry.getValue())) {
                return false;
            }
        }
    }
    return true;
}
Also used : Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) Conditions1(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.Conditions1) BgpConditions(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.conditions.BgpConditions) BgpConditionsAugmentationPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy) HashMap(java.util.HashMap) Map(java.util.Map)

Example 87 with Attributes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes 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());
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.LocalPrefBuilder) 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) Statement(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement) OriginBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder) MultiExitDiscBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.MultiExitDiscBuilder) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) RouteAttributeContainer(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer) 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) Test(org.junit.Test)

Example 88 with Attributes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes in project bgpcep by opendaylight.

the class ExportDefaultStatementTest method testFromInternalOrRRClientToRRClient.

@Test
public void testFromInternalOrRRClientToRRClient() {
    final Statement statement = getStatementAndSetToRole("from-internal-or-rr-client-to-route-reflector", PeerRole.RrClient);
    final Attributes expectedOutput = createInputWithOriginator();
    final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(createClusterInput());
    assertApplyExportStatement(statement, PeerRole.Ibgp, attributeContainer, expectedOutput);
    assertApplyExportStatement(statement, PeerRole.RrClient, attributeContainer, expectedOutput);
}
Also used : Statement(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) RouteAttributeContainer(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer) Test(org.junit.Test)

Example 89 with Attributes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes in project bgpcep by opendaylight.

the class ImportAttributeTestUtil method createOutput.

public static Attributes createOutput() {
    final AttributesBuilder attBuilder = new AttributesBuilder();
    attBuilder.setCNextHop(createNexHop());
    attBuilder.setOrigin(createOrigin());
    return attBuilder.build();
}
Also used : AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)

Example 90 with Attributes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes in project bgpcep by opendaylight.

the class ImportDefaultStatementTest method testFromNonExternal.

@Test
public void testFromNonExternal() {
    final Statement statement = getStatement("from-non-external");
    final Attributes expected = ImportAttributeTestUtil.createInput();
    final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(expected);
    assertApplyImportStatement(statement, PeerRole.Ibgp, attributeContainer, expected);
    assertApplyImportStatement(statement, PeerRole.RrClient, attributeContainer, expected);
    assertApplyImportStatement(statement, PeerRole.Internal, attributeContainer, expected);
}
Also used : Statement(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) RouteAttributeContainer(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer) Test(org.junit.Test)

Aggregations

Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)75 Test (org.junit.Test)62 ByteBuf (io.netty.buffer.ByteBuf)50 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)40 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update)34 Attributes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1)26 AbstractRIBSupportTest (org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest)24 Attributes2 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes2)24 ArrayList (java.util.ArrayList)19 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)13 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder)13 OriginBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginBuilder)11 Ipv4NextHopCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder)11 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)11 Collections (java.util.Collections)10 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPathBuilder)10 MultiExitDiscBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.MultiExitDiscBuilder)10 Attributes1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1Builder)9 PmsiTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.PmsiTunnelBuilder)9 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)8