2 * Copyright (c) 2016 Cisco and/or its affiliates.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package io.fd.honeycomb.translate.v3po.interfacesstate.ip;
19 import io.fd.honeycomb.translate.read.ReadContext;
20 import io.fd.honeycomb.translate.read.ReadFailedException;
21 import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
22 import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
23 import io.fd.honeycomb.translate.vpp.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.Ipv6;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder;
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 io.fd.vpp.jvpp.core.future.FutureJVppCore;
33 public class Ipv6Customizer extends FutureJVppCustomizer implements ReaderCustomizer<Ipv6, Ipv6Builder> {
35 private final NamingContext interfaceContext;
37 public Ipv6Customizer(@Nonnull final FutureJVppCore futureJVppCore, final NamingContext interfaceContext) {
38 super(futureJVppCore);
39 this.interfaceContext = interfaceContext;
43 public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv6 readValue) {
44 ((Interface2Builder) parentBuilder).setIpv6(readValue);
49 public Ipv6Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv6> id) {
50 return new Ipv6Builder();
54 public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, @Nonnull final Ipv6Builder builder,
55 @Nonnull final ReadContext ctx) throws ReadFailedException {
56 // TODO HONEYCOMB-102 implement + init
57 // final IpAddressDump dumpRequest = new IpAddressDump();
58 // dumpRequest.isIpv6 = 1;
59 // dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(),
60 // ctx.getMappingContext());
61 // final CompletionStage<IpAddressDetailsReplyDump> addressDumpFuture = getFutureJVpp().
62 // ipAddressDump(dumpRequest);
63 // final IpAddressDetailsReplyDump reply = TranslateUtils.getReply(addressDumpFuture.toCompletableFuture());