HONEYCOMB-58 - Routing Api
[honeycomb.git] / v3po / v3po2vpp / src / main / java / io / fd / honeycomb / translate / v3po / interfacesstate / ip / Ipv4NeighbourCustomizer.java
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package io.fd.honeycomb.translate.v3po.interfacesstate.ip;
18
19 import io.fd.honeycomb.translate.read.ReadContext;
20 import io.fd.honeycomb.translate.read.ReadFailedException;
21 import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
22 import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
23 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
24 import java.util.Collections;
25 import java.util.List;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
28 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborBuilder;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborKey;
30 import org.opendaylight.yangtools.concepts.Builder;
31 import org.opendaylight.yangtools.yang.binding.DataObject;
32 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35
36 /**
37  * Operational data read operation customizer for {@link Neighbor}<br>
38  * Currently not supported in jvpp, so this is only dummy implementation<br>
39  */
40 public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
41         implements ListReaderCustomizer<Neighbor, NeighborKey, NeighborBuilder> {
42
43     private static final Logger LOG = LoggerFactory.getLogger(Ipv4NeighbourCustomizer.class);
44
45     public Ipv4NeighbourCustomizer(FutureJVppCore futureJVppCore) {
46         super(futureJVppCore);
47     }
48
49     @Override
50     public NeighborBuilder getBuilder(InstanceIdentifier<Neighbor> id) {
51         return new NeighborBuilder();
52     }
53
54     @Override
55     public void readCurrentAttributes(InstanceIdentifier<Neighbor> id, NeighborBuilder builder, ReadContext ctx)
56             throws ReadFailedException {
57         //TODO - not supported, implement https://jira.fd.io/browse/VPP-164 first + implement init
58         LOG.warn("Operation not supported");
59     }
60
61     @Override
62     public List<NeighborKey> getAllIds(InstanceIdentifier<Neighbor> id, ReadContext context)
63             throws ReadFailedException {
64         //TODO - not supported, implement https://jira.fd.io/browse/VPP-164 first
65         LOG.warn("Operation not supported,returning empty List");
66         return Collections.emptyList();
67     }
68
69     @Override
70     public void merge(Builder<? extends DataObject> builder, List<Neighbor> readData) {
71         ((Ipv4Builder) builder).setNeighbor(readData);
72     }
73 }