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;
}
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());
}
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);
}
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();
}
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);
}
Aggregations