3b04c5614a634504f930efe98880f658f8099769
[hc2vpp.git] /
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.spi.read.ListReaderCustomizer;
21 import io.fd.honeycomb.translate.v3po.util.FutureJVppCustomizer;
22 import io.fd.honeycomb.translate.read.ReadFailedException;
23 import java.util.Collections;
24 import java.util.List;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborBuilder;
28 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborKey;
29 import org.opendaylight.yangtools.concepts.Builder;
30 import org.opendaylight.yangtools.yang.binding.DataObject;
31 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
32 import org.openvpp.jvpp.future.FutureJVpp;
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(FutureJVpp futureJvpp) {
46         super(futureJvpp);
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
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 }