final ByteBuf buffer = Unpooled.buffer();
final EvpnDestination dest = EvpnNlriParser.extractRouteKeyDestination(evpn);
EvpnNlriParser.serializeNlri(Collections.singletonList(dest), buffer);
- return new NodeIdentifierWithPredicates(routeQName(), ROUTE_KEY, ByteArray.readAllBytes(buffer));
+ return new NodeIdentifierWithPredicates(routeQName(), ROUTE_KEY, ByteArray.encodeBase64(buffer));
}
}
container evpn-routes {
list evpn-route {
leaf route-key {
- type binary;
+ type string;
}
key "route-key";
uses evpn;
import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.EvpnSubsequentAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.L2vpnAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.bgp.rib.rib.loc.rib.tables.routes.EvpnRoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.bgp.rib.rib.loc.rib.tables.routes.EvpnRoutesCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.evpn.destination.EvpnDestination;
act.start(context);
final ByteBuf buffer = Unpooled.buffer();
EvpnNlriParser.serializeNlri(Collections.singletonList(new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE_KEY).build()), buffer);
- final byte[] arrayKey = ByteArray.readAllBytes(buffer);
- ROUTE_KEY = new EvpnRouteKey(arrayKey);
- ROUTE = new EvpnRouteBuilder().setRouteKey(arrayKey).setAttributes(ATTRIBUTES).setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
+ ROUTE_KEY = new EvpnRouteKey(ByteArray.encodeBase64(buffer));
+ ROUTE = new EvpnRouteBuilder().setRouteKey(ROUTE_KEY.getRouteKey()).setAttributes(ATTRIBUTES).setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
EVPN_ROUTES = new EvpnRoutesBuilder().setEvpnRoute(Collections.singletonList(ROUTE)).build();
}
* @param containerClass Binding class of the container in routes choice, must not be null.
* @param listClass Binding class of the route list, nust not be null;
*/
- protected AbstractVpnRIBSupport(Class<? extends Routes> cazeClass, Class<? extends DataObject> containerClass, Class<? extends Route> listClass,
- Class<? extends AddressFamily> afiClass, final QName vpnDstContainerClassQname) {
+ protected AbstractVpnRIBSupport(final Class<? extends Routes> cazeClass, final Class<? extends DataObject> containerClass, final Class<? extends Route> listClass,
+ final Class<? extends AddressFamily> afiClass, final QName vpnDstContainerClassQname) {
super(cazeClass, containerClass, listClass, afiClass, MplsLabeledVpnSubsequentAddressFamily.class, vpnDstContainerClassQname);
final QName classQname = BindingReflections.findQName(containerClass).intern();
- routeKey = QName.create(routeQName(), "route-key").intern();
+ this.routeKey = QName.create(routeQName(), "route-key").intern();
final QName vpnDstClassQname = QName.create(classQname, VpnDestination.QNAME.getLocalName());
- nlriRoutesListNid = NodeIdentifier.create(vpnDstClassQname);
- prefixTypeNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "prefix").intern());
- labelStackNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "label-stack").intern());
- lvNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "label-value").intern());
- rdNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "route-distinguisher").intern());
+ this.nlriRoutesListNid = NodeIdentifier.create(vpnDstClassQname);
+ this.prefixTypeNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "prefix").intern());
+ this.labelStackNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "label-stack").intern());
+ this.lvNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "label-value").intern());
+ this.rdNid = NodeIdentifier.create(QName.create(vpnDstClassQname, "route-distinguisher").intern());
}
- private VpnDestination extractVpnDestination(DataContainerNode<? extends PathArgument> route) {
+ private VpnDestination extractVpnDestination(final DataContainerNode<? extends PathArgument> route) {
final VpnDestination dst = new VpnDestinationBuilder()
- .setPrefix(extractPrefix(route, prefixTypeNid))
- .setLabelStack(LabeledUnicastIpv4RIBSupport.extractLabel(route, labelStackNid, lvNid))
+ .setPrefix(extractPrefix(route, this.prefixTypeNid))
+ .setLabelStack(LabeledUnicastIpv4RIBSupport.extractLabel(route, this.labelStackNid, this.lvNid))
.setRouteDistinguisher(extractRouteDistinguisher(route))
.build();
return dst;
protected abstract IpPrefix extractPrefix(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier prefixTypeNid);
private RouteDistinguisher extractRouteDistinguisher(final DataContainerNode<? extends YangInstanceIdentifier.PathArgument> route) {
- if (route.getChild(rdNid).isPresent()) {
- return RouteDistinguisherBuilder.getDefaultInstance((String) route.getChild(rdNid).get().getValue());
+ if (route.getChild(this.rdNid).isPresent()) {
+ return RouteDistinguisherBuilder.getDefaultInstance((String) route.getChild(this.rdNid).get().getValue());
}
return null;
}
if (maybeRoutes.isPresent()) {
final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
if (routes instanceof UnkeyedListNode) {
- UnkeyedListNode routeListNode = (UnkeyedListNode) routes;
+ final UnkeyedListNode routeListNode = (UnkeyedListNode) routes;
LOG.debug("{} routes are found", routeListNode.getSize());
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeNid());
for (final UnkeyedListEntryNode e : routeListNode.getValue()) {
final VpnDestination dest = extractVpnDestination(l3vpn);
AbstractVpnNlriParser.serializeNlri(Collections.singletonList(dest), buffer);
- return new NodeIdentifierWithPredicates(routeQName(), this.routeKey, ByteArray.readAllBytes(buffer));
+ return new NodeIdentifierWithPredicates(routeQName(), this.routeKey, ByteArray.encodeBase64(buffer));
}
}
list vpn-route {
key "route-key";
leaf route-key {
- type binary;
+ type string;
}
uses l3vpn;
uses bgp-rib:route;
act.start(context);
final ByteBuf buffer = Unpooled.buffer();
AbstractVpnNlriParser.serializeNlri(Collections.singletonList(IPV4_VPN), buffer);
- final byte[] arrayKey = ByteArray.readAllBytes(buffer);
- ROUTE_KEY = new VpnRouteKey(arrayKey);
+ ROUTE_KEY = new VpnRouteKey(ByteArray.encodeBase64(buffer));
ROUTE = new VpnRouteBuilder().setPathId(new PathId(NON_PATH_ID)).setAttributes(ATTRIBUTES).setPrefix(IPv4_PREFIX)
.setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).setKey(ROUTE_KEY).build();
ROUTES = new VpnIpv4RoutesBuilder().setVpnRoute(Collections.singletonList(ROUTE)).build();
act.start(context);
final ByteBuf buffer = Unpooled.buffer();
AbstractVpnNlriParser.serializeNlri(Collections.singletonList(IPV6_VPN), buffer);
- final byte[] arrayKey = ByteArray.readAllBytes(buffer);
- ROUTE_KEY = new VpnRouteKey(arrayKey);
+ ROUTE_KEY = new VpnRouteKey(ByteArray.encodeBase64(buffer));
ROUTE = new VpnRouteBuilder().setPathId(new PathId(NON_PATH_ID)).setAttributes(ATTRIBUTES).setPrefix(IPv6_PREFIX)
.setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).setKey(ROUTE_KEY).build();
ROUTES = new VpnIpv6RoutesBuilder().setVpnRoute(Collections.singletonList(ROUTE)).build();
final CLabeledUnicastDestination dest = extractCLabeledUnicastDestination(labeledUnicast);
LUNlriParser.serializeNlri(Collections.singletonList(dest), buffer);
- final byte[] routeKeyValue = ByteArray.readAllBytes(buffer);
+ final String routeKeyValue = ByteArray.encodeBase64(buffer);
final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf = labeledUnicast.getChild(routePathIdNid());
final NodeIdentifierWithPredicates routeKey = PathIdUtil.createNidKey(routeQName(), routeKeyQName(), pathIdQName(), routeKeyValue, maybePathIdLeaf);
return routeKey;
grouping labeled-unicast-routes-list {
list labeled-unicast-route {
leaf route-key {
- type binary;
+ type string;
}
key "route-key path-id";
uses labeled-unicast;
private static final LabeledUnicastRoute ROUTE;
private static final LabeledUnicastRoutes ROUTES;
private static final LabeledUnicastRouteKey ROUTE_KEY;
- private static final byte[] LABEL_KEY;
+ private static final String LABEL_KEY;
private static final PathId PATH_ID = new PathId(1L);
private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(new LabelStackBuilder().setLabelValue(new MplsLabel(355L)).build());
private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST = Collections.singletonList(new CLabeledUnicastDestinationBuilder()
act.start(context);
final ByteBuf buffer = Unpooled.buffer();
LUNlriParser.serializeNlri(LABELED_DESTINATION_LIST, buffer);
- LABEL_KEY = ByteArray.readAllBytes(buffer);
+ LABEL_KEY = ByteArray.encodeBase64(buffer);
ROUTE_KEY = new LabeledUnicastRouteKey(PATH_ID, LABEL_KEY);
ROUTE = new LabeledUnicastRouteBuilder().setKey(ROUTE_KEY).setPrefix(IPv4_PREFIX).setPathId(PATH_ID).setLabelStack(LABEL_STACK)
.setAttributes(new AttributesBuilder().build()).build();
private static final LabeledUnicastRoute ROUTE;
private static final LabeledUnicastIpv6Routes ROUTES;
private static final LabeledUnicastRouteKey ROUTE_KEY;
- private static final byte[] LABEL_KEY;
+ private static final String LABEL_KEY;
private static final PathId PATH_ID = new PathId(1L);
private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(new LabelStackBuilder().setLabelValue(new MplsLabel(355L)).build());
private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST = Collections.singletonList(new CLabeledUnicastDestinationBuilder()
act.start(context);
final ByteBuf buffer = Unpooled.buffer();
LUNlriParser.serializeNlri(LABELED_DESTINATION_LIST, buffer);
- LABEL_KEY = ByteArray.readAllBytes(buffer);
+ LABEL_KEY = ByteArray.encodeBase64(buffer);
ROUTE_KEY = new LabeledUnicastRouteKey(PATH_ID, LABEL_KEY);
ROUTE = new LabeledUnicastRouteBuilder().setKey(ROUTE_KEY).setPrefix(IPv6_PREFIX).setPathId(PATH_ID).setLabelStack(LABEL_STACK)
.setAttributes(new AttributesBuilder().build()).build();