a10ad3ba5905edd38647eae3cdac7f466014455e
[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.v3po.translate.v3po.interfacesstate.ip;
18
19 import io.fd.honeycomb.v3po.translate.read.ReadContext;
20 import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
21 import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer;
22 import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer;
23 import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
24 import javax.annotation.Nonnull;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
28 import org.opendaylight.yangtools.concepts.Builder;
29 import org.opendaylight.yangtools.yang.binding.DataObject;
30 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
31 import org.openvpp.jvpp.future.FutureJVpp;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35 public class Ipv4Customizer extends FutureJVppCustomizer implements ChildReaderCustomizer<Ipv4, Ipv4Builder> {
36
37     private static final Logger LOG = LoggerFactory.getLogger(Ipv4Customizer.class);
38
39     //do not remove,it will be needed in future implementation
40     private final NamingContext interfaceContext;
41
42     public Ipv4Customizer(@Nonnull final FutureJVpp futureJvpp, final NamingContext interfaceContext) {
43         super(futureJvpp);
44         this.interfaceContext = interfaceContext;
45     }
46
47     @Override
48     public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv4 readValue) {
49         ((Interface2Builder) parentBuilder).setIpv4(readValue);
50     }
51
52     @Nonnull
53     @Override
54     public Ipv4Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv4> id) {
55         return new Ipv4Builder();
56     }
57
58     @Override
59     public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id, @Nonnull final Ipv4Builder builder,
60                                       @Nonnull final ReadContext ctx) throws ReadFailedException {
61         //TODO add reading of isForwarding flag when there is dump for it
62         LOG.warn("Operation not supported");
63     }
64
65 }