37524dde6f75bf6fffe9480b559de1aa5c6f27f0
[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 package io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip;
17
18 import io.fd.honeycomb.v3po.translate.read.ReadContext;
19 import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
20 import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer;
21 import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer;
22 import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
23 import javax.annotation.Nonnull;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder;
27 import org.opendaylight.yangtools.concepts.Builder;
28 import org.opendaylight.yangtools.yang.binding.DataObject;
29 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
30 import org.openvpp.jvpp.future.FutureJVpp;
31
32 public class Ipv6Customizer extends FutureJVppCustomizer implements ChildReaderCustomizer<Ipv6, Ipv6Builder> {
33
34     private final NamingContext interfaceContext;
35
36     public Ipv6Customizer(@Nonnull final FutureJVpp futureJvpp, final NamingContext interfaceContext) {
37         super(futureJvpp);
38         this.interfaceContext = interfaceContext;
39     }
40
41     @Override
42     public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv6 readValue) {
43         ((Interface2Builder) parentBuilder).setIpv6(readValue);
44     }
45
46     @Nonnull
47     @Override
48     public Ipv6Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv6> id) {
49         return new Ipv6Builder();
50     }
51
52     @Override
53     public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, @Nonnull final Ipv6Builder builder,
54                                       @Nonnull final ReadContext ctx) throws ReadFailedException {
55         // TODO implement
56 //        final IpAddressDump dumpRequest = new IpAddressDump();
57 //        dumpRequest.isIpv6 = 1;
58 //        dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(), ctx.getMappingContext());
59 //        final CompletionStage<IpAddressDetailsReplyDump> addressDumpFuture = getFutureJVpp().ipAddressDump(dumpRequest);
60         // TODO consider extracting customizer for address
61 //        final IpAddressDetailsReplyDump reply = TranslateUtils.getReply(addressDumpFuture.toCompletableFuture());
62     }
63
64 }