use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes in project bgpcep by opendaylight.
the class IPv6RIBSupportTest method testBuildMpReachNlriUpdate.
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = RIB_SUPPORT.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes().getDestinationType());
assertNull(update.getAttributes().getAugmentation(Attributes2.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes in project bgpcep by opendaylight.
the class Ipv4NlriParserTest method parseReachedNlriTest.
@Test
public void parseReachedNlriTest() throws BGPParsingException {
final MpReachNlriBuilder b = new MpReachNlriBuilder();
b.setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class);
this.parser.parseNlri(this.inputBytes, b);
assertNotNull("Advertized routes, destination type should not be null", b.getAdvertizedRoutes().getDestinationType());
assertEquals(this.ip4caseAD.hashCode(), b.getAdvertizedRoutes().getDestinationType().hashCode());
assertFalse(this.ip4caseADWrong.hashCode() == b.getAdvertizedRoutes().getDestinationType().hashCode());
assertTrue(this.ip4caseAD.toString().equals(b.getAdvertizedRoutes().getDestinationType().toString()));
assertFalse(this.ip4caseADWrong.toString().equals(b.getAdvertizedRoutes().getDestinationType().toString()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes in project bgpcep by opendaylight.
the class Ipv4NlriParserTest method parseUnreachedNlriTest.
@Test
public void parseUnreachedNlriTest() {
final MpUnreachNlriBuilder b = new MpUnreachNlriBuilder();
b.setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class);
this.parser.parseNlri(this.inputBytes, b);
assertNotNull("Withdrawn routes, destination type should not be null", b.getWithdrawnRoutes().getDestinationType());
assertEquals(this.ip4caseWD.hashCode(), b.getWithdrawnRoutes().getDestinationType().hashCode());
assertFalse(this.ip4caseWDWrong.hashCode() == b.getWithdrawnRoutes().getDestinationType().hashCode());
assertTrue(this.ip4caseWD.toString().equals(b.getWithdrawnRoutes().getDestinationType().toString()));
assertFalse(this.ip4caseWDWrong.toString().equals(b.getWithdrawnRoutes().getDestinationType().toString()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes in project bgpcep by opendaylight.
the class AbstractVpnNlriParser method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
List<VpnDestination> vpnDst = null;
boolean isWithdrawnRoute = false;
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = (pathAttributes1.getMpReachNlri()).getAdvertizedRoutes();
if (routes != null) {
vpnDst = getAdvertizedVpnDestination(routes.getDestinationType());
}
} else if (pathAttributes2 != null) {
final WithdrawnRoutes routes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
if (routes != null) {
vpnDst = getWithdrawnVpnDestination(routes.getDestinationType());
isWithdrawnRoute = true;
}
}
if (vpnDst != null) {
serializeNlri(vpnDst, isWithdrawnRoute, byteAggregator);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes in project bgpcep by opendaylight.
the class AbstractFlowspecL3vpnRIBSupport method buildDestination.
@Nonnull
@Override
protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
final RouteDistinguisher rd = extractRouteDistinguisher(routesCont, this.routeDistinguisherNID);
return this.nlriParser.createAdvertizedRoutesDestinationType(new Object[] { rd, this.nlriParser.extractFlowspec(routesCont) }, pathId);
}
Aggregations