Do not use BindingReflections in AbstractRIBSupport
[bgpcep.git] / bgp / rib-spi / src / test / java / org / opendaylight / protocol / bgp / rib / spi / RIBSupportTestImp.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.rib.spi;
9
10 import java.util.Collection;
11 import java.util.Collections;
12 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.Ipv4Prefixes;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.ipv4.routes.Ipv4Routes;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.ipv4.routes.ipv4.routes.Ipv4Route;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.UnicastSubsequentAddressFamily;
21 import org.opendaylight.yangtools.yang.common.QName;
22 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
23 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
24 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
25 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
26
27 public final class RIBSupportTestImp extends AbstractRIBSupport<Ipv4RoutesCase, Ipv4Routes, Ipv4Route> {
28     private static final String ROUTE_KEY = "prefix";
29     private static final String PREFIX = "1.2.3.4/32";
30
31     private static final NodeIdentifierWithPredicates PREFIX_NII = NodeIdentifierWithPredicates.of(Ipv4Route.QNAME,
32             QName.create(Ipv4Route.QNAME, ROUTE_KEY).intern(), PREFIX);
33
34     public RIBSupportTestImp(final BindingNormalizedNodeSerializer mappingService) {
35         super(mappingService, Ipv4RoutesCase.class, Ipv4RoutesCase.QNAME, Ipv4Routes.class, Ipv4Routes.QNAME,
36             Ipv4Route.class, Ipv4Route.QNAME, Ipv4AddressFamily.VALUE, Ipv4AddressFamily.QNAME,
37             UnicastSubsequentAddressFamily.VALUE, UnicastSubsequentAddressFamily.QNAME, Ipv4Prefixes.QNAME);
38     }
39
40     @Override
41     protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
42         return null;
43     }
44
45     @Override
46     protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
47         return null;
48     }
49
50     @Override
51     protected Collection<NodeIdentifierWithPredicates> processDestination(final DOMDataTreeWriteTransaction tx,
52                                                                           final YangInstanceIdentifier routesPath,
53                                                                           final ContainerNode destination,
54                                                                           final ContainerNode attributes,
55                                                                           final ApplyRoute applyFunction) {
56         applyFunction.apply(tx, routesPath.node(Ipv4Route.QNAME), PREFIX_NII, destination, attributes);
57         return Collections.emptySet();
58     }
59 }