summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-03-10 10:00:43 +0100
committerJan Srnicek <jsrnicek@cisco.com>2017-03-10 10:00:43 +0100
commitfb50d586985f12d1aa39eb6c5fdcd6b8a87b26da (patch)
treed9ddcc1095a51188a8af53daacab6873bb98bf5e /v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate
parent17ef7d8eb8bae7b34c0ccd2d4a7610f607a90f5e (diff)
HC2VPP-7 - L3 split to separate module
ipv4/ipv6/proxy arp/nd proxy Change-Id: I536298dd5584f79f357e94da08d402e67e79bb71 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/dump/params/IfaceDumpFilter.java62
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpAddressReader.java148
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpNeighbourReader.java103
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpReader.java60
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4AddressCustomizer.java145
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4Customizer.java59
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4NeighbourCustomizer.java103
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4AddressCustomizer.java127
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java93
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6AddressCustomizer.java125
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6Customizer.java58
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6NeighbourCustomizer.java98
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/nd/NdProxyCustomizer.java140
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6AddressCustomizer.java123
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java93
15 files changed, 0 insertions, 1537 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/dump/params/IfaceDumpFilter.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/dump/params/IfaceDumpFilter.java
deleted file mode 100644
index ce57e34be..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/dump/params/IfaceDumpFilter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params;
-
-public class IfaceDumpFilter {
-
- private final int interfaceIndex;
- private final boolean isIpv6;
-
- public IfaceDumpFilter(final int interfaceIndex, final boolean isIpv6) {
- this.interfaceIndex = interfaceIndex;
- this.isIpv6 = isIpv6;
- }
-
- public int getInterfaceIndex() {
- return interfaceIndex;
- }
-
- public boolean isIpv6() {
- return isIpv6;
- }
-
- @Override
- public String toString() {
- return "IfaceDumpFilter{" +
- "interfaceIndex=" + interfaceIndex +
- ", isIpv6=" + isIpv6 +
- '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- IfaceDumpFilter that = (IfaceDumpFilter) o;
-
- if (interfaceIndex != that.interfaceIndex) return false;
- return isIpv6 == that.isIpv6;
- }
-
- @Override
- public int hashCode() {
- int result = interfaceIndex;
- result = 31 * result + (isIpv6 ? 1 : 0);
- return result;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpAddressReader.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpAddressReader.java
deleted file mode 100644
index cb6228b33..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpAddressReader.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.fd.hc2vpp.v3po.interfacesstate.ip.readers;
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.IpAddressDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Provides logic for reading of ip addresses
- */
-public abstract class IpAddressReader extends IpReader {
-
- private final DumpCacheManager<IpAddressDetailsReplyDump, IfaceDumpFilter> dumpCacheManager;
-
- protected IpAddressReader(@Nonnull final NamingContext interfaceContext, final boolean isIpv6,
- @Nonnull final DumpCacheManager<IpAddressDetailsReplyDump, IfaceDumpFilter> dumpCacheManager) {
- super(interfaceContext, isIpv6);
- this.dumpCacheManager = dumpCacheManager;
- }
-
- @Nonnull
- protected Optional<IpAddressDetailsReplyDump> interfaceAddressDumpSupplier(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- return dumpCacheManager.getDump(id, context.getModificationCache(), new IfaceDumpFilter(getInterfaceContext()
- .getIndex(id.firstKeyOf(Interface.class).getName(), context.getMappingContext()), isIpv6()));
- }
-
- @Nonnull
- protected Optional<IpAddressDetailsReplyDump> subInterfaceAddressDumpSupplier(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- final String subInterfaceName = SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- id.firstKeyOf(SubInterface.class).getIdentifier().intValue());
- return dumpCacheManager.getDump(id, context.getModificationCache(), new IfaceDumpFilter(getInterfaceContext()
- .getIndex(subInterfaceName, context.getMappingContext()), isIpv6()));
- }
-
- @Nonnull
- protected <T extends Identifier> List<T> getAllIpv4AddressIds(
- final Optional<IpAddressDetailsReplyDump> dumpOptional,
- @Nonnull final Function<Ipv4AddressNoZone, T> keyConstructor) {
- if (dumpOptional.isPresent() && dumpOptional.get().ipAddressDetails != null) {
- return dumpOptional.get().ipAddressDetails.stream()
- .map(detail -> keyConstructor.apply(arrayToIpv4AddressNoZone(detail.ip)))
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-
- @Nonnull
- protected <T extends Identifier> List<T> getAllIpv6AddressIds(
- final Optional<IpAddressDetailsReplyDump> dumpOptional,
- @Nonnull final Function<Ipv6AddressNoZone, T> keyConstructor) {
- if (dumpOptional.isPresent() && dumpOptional.get().ipAddressDetails != null) {
- return dumpOptional.get().ipAddressDetails.stream()
- .map(detail -> keyConstructor.apply(arrayToIpv6AddressNoZone(detail.ip)))
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-
- @Nonnull
- protected Optional<IpAddressDetails> findIpv4AddressDetailsByIp(
- final Optional<IpAddressDetailsReplyDump> dump,
- @Nonnull final Ipv4AddressNoZone ip) {
- checkNotNull(ip, "ip address should not be null");
-
- if (dump.isPresent() && dump.get().ipAddressDetails != null) {
- final List<IpAddressDetails> details = dump.get().ipAddressDetails;
-
- return Optional.of(details.stream()
- .filter(singleDetail -> ip.equals(arrayToIpv4AddressNoZone(singleDetail.ip)))
- .collect(RWUtils.singleItemCollector()));
- }
- return Optional.absent();
- }
-
- @Nonnull
- protected Optional<IpAddressDetails> findIpv6AddressDetailsByIp(
- final Optional<IpAddressDetailsReplyDump> dump,
- @Nonnull final Ipv6AddressNoZone ip) {
- checkNotNull(ip, "ip address should not be null");
-
- if (dump.isPresent() && dump.get().ipAddressDetails != null) {
- final List<IpAddressDetails> details = dump.get().ipAddressDetails;
-
- return Optional.of(details.stream()
- .filter(singleDetail -> ip.equals(arrayToIpv6AddressNoZone(singleDetail.ip)))
- .collect(RWUtils.singleItemCollector()));
- }
- return Optional.absent();
- }
-
- @Nonnull
- protected static EntityDumpExecutor<IpAddressDetailsReplyDump, IfaceDumpFilter> createAddressDumpExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Address dump params cannot be null");
-
- final IpAddressDump dumpRequest = new IpAddressDump();
- dumpRequest.isIpv6 = ByteDataTranslator.INSTANCE.booleanToByte(params.isIpv6());
- dumpRequest.swIfIndex = params.getInterfaceIndex();
-
- return JvppReplyConsumer.INSTANCE.getReplyForRead(vppApi.ipAddressDump(dumpRequest).toCompletableFuture(), identifier);
- };
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpNeighbourReader.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpNeighbourReader.java
deleted file mode 100644
index 0acfb5b81..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpNeighbourReader.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.fd.hc2vpp.v3po.interfacesstate.ip.readers;
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Provides logic for reading ip neighbours
- */
-public abstract class IpNeighbourReader extends IpReader {
-
- private final DumpCacheManager<IpNeighborDetailsReplyDump, IfaceDumpFilter> dumpCacheManager;
-
- protected IpNeighbourReader(@Nonnull final NamingContext interfaceContext, boolean isIpv6,
- @Nonnull final DumpCacheManager<IpNeighborDetailsReplyDump, IfaceDumpFilter> dumpCacheManager) {
- super(interfaceContext, isIpv6);
- this.dumpCacheManager = dumpCacheManager;
- }
-
- @Nonnull
- protected Optional<IpNeighborDetailsReplyDump> interfaceNeighboursDump(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- return dumpCacheManager.getDump(id, context.getModificationCache(), new IfaceDumpFilter(getInterfaceContext()
- .getIndex(id.firstKeyOf(Interface.class).getName(), context.getMappingContext()), isIpv6()));
- }
-
- @Nonnull
- protected Optional<IpNeighborDetailsReplyDump> subInterfaceNeighboursDump(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- final String subInterfaceName = SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- id.firstKeyOf(SubInterface.class).getIdentifier().intValue());
- return dumpCacheManager.getDump(id, context.getModificationCache(), new IfaceDumpFilter(getInterfaceContext()
- .getIndex(subInterfaceName, context.getMappingContext()), isIpv6()));
- }
-
- @Nonnull
- protected static EntityDumpExecutor<IpNeighborDetailsReplyDump, IfaceDumpFilter> createNeighbourDumpExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Address dump params cannot be null");
-
- final IpNeighborDump dumpRequest = new IpNeighborDump();
- dumpRequest.isIpv6 = ByteDataTranslator.INSTANCE.booleanToByte(params.isIpv6());
- dumpRequest.swIfIndex = params.getInterfaceIndex();
-
- return JvppReplyConsumer.INSTANCE.getReplyForRead(vppApi.ipNeighborDump(dumpRequest).toCompletableFuture(), identifier);
- };
- }
-
- @Nonnull
- protected <T extends Identifier> List<T> getNeighborKeys(
- final Optional<IpNeighborDetailsReplyDump> neighbourDumpOpt,
- final Function<IpNeighborDetails, T> detailToKey)
- throws ReadFailedException {
- if (neighbourDumpOpt.isPresent()) {
- final IpNeighborDetailsReplyDump neighbourDump = neighbourDumpOpt.get();
-
- return neighbourDump.ipNeighborDetails.stream()
- .map(detailToKey)
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpReader.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpReader.java
deleted file mode 100644
index 9003dbab7..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/readers/IpReader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.readers;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.hc2vpp.common.translate.util.AddressTranslator;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.honeycomb.translate.util.read.cache.CacheKeyFactory;
-import io.fd.honeycomb.translate.util.read.cache.TypeAwareIdentifierCacheKeyFactory;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-
-import javax.annotation.Nonnull;
-
-/**
- * Utility class providing Ipv4/6 read support.
- */
-abstract class IpReader implements AddressTranslator, JvppReplyConsumer {
-
- private final NamingContext interfaceContext;
- private final boolean isIpv6;
-
- IpReader(@Nonnull final NamingContext interfaceContext, final boolean isIpv6) {
- this.interfaceContext = interfaceContext;
- this.isIpv6 = isIpv6;
- }
-
- @Nonnull
- protected static CacheKeyFactory interfaceScopedCacheKeyFactory(@Nonnull final Class<?> dumpReplyClass) {
- return new TypeAwareIdentifierCacheKeyFactory(dumpReplyClass, ImmutableSet.of(Interface.class));
- }
-
- @Nonnull
- protected static CacheKeyFactory subInterfaceScopedCacheKeyFactory(@Nonnull final Class<?> dumpReplyClass) {
- return new TypeAwareIdentifierCacheKeyFactory(dumpReplyClass, ImmutableSet.of(SubInterface.class));
- }
-
- protected NamingContext getInterfaceContext() {
- return interfaceContext;
- }
-
- protected boolean isIpv6() {
- return isIpv6;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4AddressCustomizer.java
deleted file mode 100644
index aeaae5bdf..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4AddressCustomizer.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v4;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.InterfaceCustomizer;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpAddressReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.Subnet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLengthBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-
-/**
- * Read customizer for interface Ipv4 addresses.
- */
-public class Ipv4AddressCustomizer extends IpAddressReader
- implements InitializingListReaderCustomizer<Address, AddressKey, AddressBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4AddressCustomizer.class);
-
- public Ipv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, false, new DumpCacheManagerBuilder<IpAddressDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createAddressDumpExecutor(futureJVppCore))
- // Key needs to contain interface ID to distinguish dumps between interfaces
- .withCacheKeyFactory(interfaceScopedCacheKeyFactory(IpAddressDetailsReplyDump.class))
- .build());
- }
-
- @Override
- @Nonnull
- public AddressBuilder getBuilder(@Nonnull InstanceIdentifier<Address> id) {
- return new AddressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Address> id, @Nonnull AddressBuilder builder,
- @Nonnull ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading attributes for interface address: {}", id);
- final Optional<IpAddressDetailsReplyDump> dumpOptional = interfaceAddressDumpSupplier(id, ctx);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().ipAddressDetails.isEmpty()) {
- return;
- }
- final Optional<IpAddressDetails> ipAddressDetails = findIpv4AddressDetailsByIp(dumpOptional, id.firstKeyOf(Address.class).getIp());
-
- if (ipAddressDetails.isPresent()) {
- final IpAddressDetails detail = ipAddressDetails.get();
- builder.setIp(arrayToIpv4AddressNoZone(detail.ip))
- .setSubnet(new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build());
-
- if (LOG.isDebugEnabled()) {
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int interfaceIndex = getInterfaceContext().getIndex(interfaceName, ctx.getMappingContext());
- LOG.debug("Attributes for {} interface (id={}) address {} successfully read: {}",
- interfaceName, interfaceIndex, id, builder.build());
- }
- }
- }
-
- @Override
- public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading list of keys for interface addresses: {}", id);
- return getAllIpv4AddressIds(interfaceAddressDumpSupplier(id, ctx), AddressKey::new);
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> builder, @Nonnull List<Address> readData) {
- ((Ipv4Builder) builder).setAddress(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> init(
- @Nonnull final InstanceIdentifier<Address> id, @Nonnull final Address readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder()
- .setIp(readValue.getIp())
- .setSubnet(getSubnet(readValue))
- .build());
- }
-
- private static Subnet getSubnet(final Address address) {
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.Subnet
- subnet = address.getSubnet();
-
- // Only prefix length supported
- Preconditions.checkArgument(
- subnet instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength);
-
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLengthBuilder()
- .setPrefixLength(
- ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength) subnet)
- .getPrefixLength()).build();
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> getCfgId(
- final InstanceIdentifier<Address> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(Interface1.class)
- .child(Ipv4.class)
- .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressKey(id.firstKeyOf(Address.class).getIp()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4Customizer.java
deleted file mode 100644
index ef8813ae5..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4Customizer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v4;
-
-import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Ipv4Customizer extends FutureJVppCustomizer implements ReaderCustomizer<Ipv4, Ipv4Builder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4Customizer.class);
-
- public Ipv4Customizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv4 readValue) {
- ((Interface2Builder) parentBuilder).setIpv4(readValue);
- }
-
- @Nonnull
- @Override
- public Ipv4Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv4> id) {
- return new Ipv4Builder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id, @Nonnull final Ipv4Builder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading Ipv4 leaves (mtu, forwarding) is not supported by VPP API");
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4NeighbourCustomizer.java
deleted file mode 100644
index c4eb7fd30..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/Ipv4NeighbourCustomizer.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v4;
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpNeighbourReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-import java.util.function.Function;
-
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.NeighborOrigin.Dynamic;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.NeighborOrigin.Static;
-
-/**
- * Operational data read operation customizer for {@link Neighbor}<br>
- * Currently not supported in jvpp, so this is only dummy implementation<br>
- */
-public class Ipv4NeighbourCustomizer extends IpNeighbourReader
- implements ListReaderCustomizer<Neighbor, NeighborKey, NeighborBuilder> {
-
- public Ipv4NeighbourCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, false, new DumpCacheManagerBuilder<IpNeighborDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createNeighbourDumpExecutor(futureJVppCore))
- // cached with parent interface scope
- .withCacheKeyFactory(interfaceScopedCacheKeyFactory(IpNeighborDetailsReplyDump.class))
- .build());
- }
-
- @Override
- public NeighborBuilder getBuilder(InstanceIdentifier<Neighbor> id) {
- return new NeighborBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Neighbor> id, NeighborBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- final Ipv4AddressNoZone ip = id.firstKeyOf(Neighbor.class).getIp();
-
- final Optional<IpNeighborDetailsReplyDump> dumpOpt = interfaceNeighboursDump(id, ctx);
-
- if (dumpOpt.isPresent()) {
- dumpOpt.get().ipNeighborDetails
- .stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress)))
- .findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress))
- .setKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress))
- .setOrigin(ipNeighborDetails.isStatic == 0
- ? Dynamic
- : Static));
- }
- }
-
- @Override
- public List<NeighborKey> getAllIds(InstanceIdentifier<Neighbor> id, ReadContext context)
- throws ReadFailedException {
- return getNeighborKeys(interfaceNeighboursDump(id, context), keyMapper());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Neighbor> readData) {
- ((Ipv4Builder) builder).setNeighbor(readData);
- }
-
- private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4AddressCustomizer.java
deleted file mode 100644
index 55fd6ca3a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4AddressCustomizer.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v4.subinterface;
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.SubInterfaceCustomizer;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpAddressReader;
-import io.fd.hc2vpp.v3po.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLengthBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-
-/**
- * Read customizer for sub-interface Ipv4 addresses.
- */
-public class SubInterfaceIpv4AddressCustomizer extends IpAddressReader
- implements InitializingListReaderCustomizer<Address, AddressKey, AddressBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceIpv4AddressCustomizer.class);
-
- public SubInterfaceIpv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, false, new DumpCacheManager.DumpCacheManagerBuilder<IpAddressDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createAddressDumpExecutor(futureJVppCore))
- //same as with ipv4 addresses for interfaces, these must have cache scope of their parent sub-interface
- .withCacheKeyFactory(subInterfaceScopedCacheKeyFactory(IpAddressDetailsReplyDump.class))
- .build());
- }
-
- private static String getSubInterfaceName(@Nonnull final InstanceIdentifier<Address> id) {
- return SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(id.firstKeyOf(SubInterface.class).getIdentifier()));
- }
-
- @Override
- @Nonnull
- public AddressBuilder getBuilder(@Nonnull InstanceIdentifier<Address> id) {
- return new AddressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Address> id, @Nonnull AddressBuilder builder,
- @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for sub-interface address: {}", id);
-
- final Optional<IpAddressDetails> ipAddressDetails =
- findIpv4AddressDetailsByIp(subInterfaceAddressDumpSupplier(id, ctx), id.firstKeyOf(Address.class).getIp());
-
- if (ipAddressDetails.isPresent()) {
- final IpAddressDetails detail = ipAddressDetails.get();
- builder.setIp(arrayToIpv4AddressNoZone(detail.ip));
- builder.setSubnet(new PrefixLengthBuilder().setPrefixLength((short) detail.prefixLength).build());
-
- if (LOG.isDebugEnabled()) {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = getInterfaceContext().getIndex(subInterfaceName, ctx.getMappingContext());
- LOG.debug("Attributes for {} sub-interface (id={}) address {} successfully read: {}",
- subInterfaceName, subInterfaceIndex, id, builder.build());
- }
- }
- }
-
- @Override
- @Nonnull
- public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading list of keys for sub-interface addresses: {}", id);
- return getAllIpv4AddressIds(subInterfaceAddressDumpSupplier(id, ctx), AddressKey::new);
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> builder, @Nonnull List<Address> readData) {
- ((Ipv4Builder) builder).setAddress(readData);
- }
-
- @Override
- public Initialized<Address> init(
- @Nonnull final InstanceIdentifier<Address> id, @Nonnull final Address readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id), readValue);
- }
-
- private InstanceIdentifier<Address> getCfgId(final InstanceIdentifier<Address> id) {
- return SubInterfaceCustomizer.getCfgId(RWUtils.cutId(id, SubInterface.class))
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(id.firstKeyOf(Address.class)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
deleted file mode 100644
index aaedabd9f..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v4.subinterface;
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpNeighbourReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.NeighborBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.NeighborKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-import java.util.function.Function;
-
-public class SubInterfaceIpv4NeighbourCustomizer extends IpNeighbourReader
- implements ListReaderCustomizer<Neighbor, NeighborKey, NeighborBuilder> {
-
- public SubInterfaceIpv4NeighbourCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, false, new DumpCacheManagerBuilder<IpNeighborDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createNeighbourDumpExecutor(futureJVppCore))
- // cached with parent interface scope
- .withCacheKeyFactory(subInterfaceScopedCacheKeyFactory(IpNeighborDetailsReplyDump.class))
- .build());
- }
-
- @Override
- public NeighborBuilder getBuilder(InstanceIdentifier<Neighbor> id) {
- return new NeighborBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Neighbor> id, NeighborBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- final Ipv4AddressNoZone ip = id.firstKeyOf(Neighbor.class).getIp();
-
- final Optional<IpNeighborDetailsReplyDump> dumpOpt = subInterfaceNeighboursDump(id, ctx);
-
- if (dumpOpt.isPresent()) {
- dumpOpt.get().ipNeighborDetails
- .stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress)))
- .findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress))
- .setKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress)));
- }
- }
-
- @Override
- public List<NeighborKey> getAllIds(InstanceIdentifier<Neighbor> id, ReadContext context)
- throws ReadFailedException {
- return getNeighborKeys(subInterfaceNeighboursDump(id, context), keyMapper());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Neighbor> readData) {
- ((Ipv4Builder) builder).setNeighbor(readData);
- }
-
- private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6AddressCustomizer.java
deleted file mode 100644
index 55ca35250..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6AddressCustomizer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v6;
-
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.InterfaceCustomizer;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpAddressReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv6.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv6.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv6.AddressKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-
-public class Ipv6AddressCustomizer extends IpAddressReader
- implements InitializingListReaderCustomizer<Address, AddressKey, AddressBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv6AddressCustomizer.class);
-
- public Ipv6AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, true, new DumpCacheManagerBuilder<IpAddressDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createAddressDumpExecutor(futureJVppCore))
- // Key needs to contain interface ID to distinguish dumps between interfaces
- .withCacheKeyFactory(interfaceScopedCacheKeyFactory(IpAddressDetailsReplyDump.class))
- .build());
- }
-
- @Override
- @Nonnull
- public AddressBuilder getBuilder(@Nonnull InstanceIdentifier<Address> id) {
- return new AddressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Address> id, @Nonnull AddressBuilder builder,
- @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for interface address: {}", id);
- final Optional<IpAddressDetails> ipAddressDetails =
- findIpv6AddressDetailsByIp(interfaceAddressDumpSupplier(id, ctx), id.firstKeyOf(Address.class).getIp());
-
- if (ipAddressDetails.isPresent()) {
- final IpAddressDetails detail = ipAddressDetails.get();
- builder.setIp(arrayToIpv6AddressNoZone(detail.ip))
- .setPrefixLength((short) Byte.toUnsignedInt(detail.prefixLength))
- .build();
-
- if (LOG.isDebugEnabled()) {
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int interfaceIndex = getInterfaceContext().getIndex(interfaceName, ctx.getMappingContext());
- LOG.debug("Attributes for {} interface (id={}) address {} successfully read: {}",
- interfaceName, interfaceIndex, id, builder.build());
- }
- }
- }
-
- @Override
- public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading list of keys for interface addresses: {}", id);
- return getAllIpv6AddressIds(interfaceAddressDumpSupplier(id, ctx), AddressKey::new);
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> builder, @Nonnull List<Address> readData) {
- ((Ipv6Builder) builder).setAddress(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.Address> init(
- @Nonnull final InstanceIdentifier<Address> id, @Nonnull final Address readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.AddressBuilder()
- .setIp(readValue.getIp())
- .setPrefixLength(readValue.getPrefixLength())
- .build());
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.Address> getCfgId(
- final InstanceIdentifier<Address> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(Interface1.class)
- .child(Ipv6.class)
- .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.Address.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.AddressKey(
- id.firstKeyOf(Address.class).getIp()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6Customizer.java
deleted file mode 100644
index 8f12619fd..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6Customizer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v6;
-
-import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Ipv6Customizer extends FutureJVppCustomizer implements ReaderCustomizer<Ipv6, Ipv6Builder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv6Customizer.class);
-
- public Ipv6Customizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv6 readValue) {
- ((Interface2Builder) parentBuilder).setIpv6(readValue);
- }
-
- @Nonnull
- @Override
- public Ipv6Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv6> id) {
- return new Ipv6Builder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, @Nonnull final Ipv6Builder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading Ipv6 leaves (mtu, forwarding) is not supported by VPP API");
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6NeighbourCustomizer.java
deleted file mode 100644
index de1b0ab5e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/Ipv6NeighbourCustomizer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v6;
-
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpNeighbourReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv6.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv6.NeighborBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv6.NeighborKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-import java.util.function.Function;
-
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.NeighborOrigin.Dynamic;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.NeighborOrigin.Static;
-
-public class Ipv6NeighbourCustomizer extends IpNeighbourReader
- implements ListReaderCustomizer<Neighbor, NeighborKey, NeighborBuilder> {
-
- public Ipv6NeighbourCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, true, new DumpCacheManager.DumpCacheManagerBuilder<IpNeighborDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createNeighbourDumpExecutor(futureJVppCore))
- // cached with parent interface scope
- .withCacheKeyFactory(interfaceScopedCacheKeyFactory(IpNeighborDetailsReplyDump.class))
- .build());
- }
-
- @Override
- public NeighborBuilder getBuilder(InstanceIdentifier<Neighbor> id) {
- return new NeighborBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Neighbor> id, NeighborBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- final Ipv6AddressNoZone ip = id.firstKeyOf(Neighbor.class).getIp();
- final Optional<IpNeighborDetailsReplyDump> dumpOpt = interfaceNeighboursDump(id, ctx);
-
- if (dumpOpt.isPresent()) {
- dumpOpt.get().ipNeighborDetails
- .stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress)))
- .findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress))
- .setKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress))
- .setOrigin(ipNeighborDetails.isStatic == 0
- ? Dynamic
- : Static));
- }
- }
-
- @Override
- public List<NeighborKey> getAllIds(InstanceIdentifier<Neighbor> id, ReadContext context)
- throws ReadFailedException {
- return getNeighborKeys(interfaceNeighboursDump(id, context), keyMapper());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Neighbor> readData) {
- ((Ipv6Builder) builder).setNeighbor(readData);
- }
-
- private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/nd/NdProxyCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/nd/NdProxyCustomizer.java
deleted file mode 100644
index 7ffde1dd4..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/nd/NdProxyCustomizer.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v6.nd;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
-import io.fd.hc2vpp.common.translate.util.Ipv6Translator;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.InterfaceCustomizer;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.Ip6NdProxyDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.Ip6NdProxyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.NdProxyIp6Augmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces.state._interface.ipv6.NdProxiesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces.state._interface.ipv6.nd.proxies.NdProxy;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces.state._interface.ipv6.nd.proxies.NdProxyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces.state._interface.ipv6.nd.proxies.NdProxyKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class NdProxyCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<NdProxy, NdProxyKey, NdProxyBuilder>, JvppReplyConsumer,
- Ipv6Translator {
-
- private static final Logger LOG = LoggerFactory.getLogger(NdProxyCustomizer.class);
- private final NamingContext interfaceContext;
- private final DumpCacheManager<Ip6NdProxyDetailsReplyDump, Void> dumpManager;
-
- public NdProxyCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<Ip6NdProxyDetailsReplyDump, Void>()
- .withExecutor((id, param) -> getReplyForRead(
- getFutureJVpp().ip6NdProxyDump(new Ip6NdProxyDump()).toCompletableFuture(), id))
- .acceptOnly(Ip6NdProxyDetailsReplyDump.class)
- .build();
- }
-
- @Nonnull
- @Override
- public List<NdProxyKey> getAllIds(@Nonnull final InstanceIdentifier<NdProxy> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int swIfIndex = interfaceContext.getIndex(interfaceName, context.getMappingContext());
- LOG.debug("Reading NDProxies for interface {}(id={})", interfaceName, swIfIndex);
- final Optional<Ip6NdProxyDetailsReplyDump> dump =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!dump.isPresent() || dump.get().ip6NdProxyDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return dump.get().ip6NdProxyDetails.stream()
- .filter(detail -> detail.swIfIndex == swIfIndex)
- .map(detail -> new NdProxyKey(arrayToIpv6AddressNoZone(detail.address)))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<NdProxy> list) {
- ((NdProxiesBuilder)builder).setNdProxy(list);
- }
-
- @Nonnull
- @Override
- public NdProxyBuilder getBuilder(@Nonnull final InstanceIdentifier<NdProxy> instanceIdentifier) {
- return new NdProxyBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<NdProxy> id,
- @Nonnull final NdProxyBuilder builder,
- @Nonnull final ReadContext context)
- throws ReadFailedException {
- // address is the only leaf and list key, so jvpp call is not needed:
- builder.setAddress(id.firstKeyOf(NdProxy.class).getAddress());
- }
-
- @Nonnull
- @Override
- public Initialized<? extends DataObject> init(@Nonnull final InstanceIdentifier<NdProxy> id,
- @Nonnull final NdProxy ndProxy,
- @Nonnull final ReadContext readContext) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces._interface.ipv6.nd.proxies.NdProxyBuilder()
- .setAddress(ndProxy.getAddress())
- .build());
- }
-
- @VisibleForTesting
- protected static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces._interface.ipv6.nd.proxies.NdProxy> getCfgId(
- final InstanceIdentifier<NdProxy> id) {
- final Ipv6AddressNoZone address = id.firstKeyOf(NdProxy.class).getAddress();
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(Interface1.class).child(Ipv6.class).augmentation(NdProxyIp6Augmentation.class)
- .child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces._interface.ipv6.NdProxies.class)
- .child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces._interface.ipv6.nd.proxies.NdProxy.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nd.proxy.rev170315.interfaces._interface.ipv6.nd.proxies.NdProxyKey(
- address));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6AddressCustomizer.java
deleted file mode 100644
index 1e4b62c87..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6AddressCustomizer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v6.subinterface;
-
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.SubInterfaceCustomizer;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpAddressReader;
-import io.fd.hc2vpp.v3po.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.AddressKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-
-public class SubInterfaceIpv6AddressCustomizer extends IpAddressReader
- implements InitializingListReaderCustomizer<Address, AddressKey, AddressBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceIpv6AddressCustomizer.class);
-
- public SubInterfaceIpv6AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, true, new DumpCacheManager.DumpCacheManagerBuilder<IpAddressDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createAddressDumpExecutor(futureJVppCore))
- .withCacheKeyFactory(subInterfaceScopedCacheKeyFactory(IpAddressDetailsReplyDump.class))
- .build());
- }
-
- private static String getSubInterfaceName(@Nonnull final InstanceIdentifier<Address> id) {
- return SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(id.firstKeyOf(SubInterface.class).getIdentifier()));
- }
-
- @Override
- @Nonnull
- public AddressBuilder getBuilder(@Nonnull InstanceIdentifier<Address> id) {
- return new AddressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Address> id, @Nonnull AddressBuilder builder,
- @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for sub-interface address: {}", id);
- final Optional<IpAddressDetails> ipAddressDetails =
- findIpv6AddressDetailsByIp(subInterfaceAddressDumpSupplier(id, ctx), id.firstKeyOf(Address.class).getIp());
-
- if (ipAddressDetails.isPresent()) {
- final IpAddressDetails detail = ipAddressDetails.get();
- builder.setIp(arrayToIpv6AddressNoZone(detail.ip));
- builder.setPrefixLength((short) Byte.toUnsignedInt(detail.prefixLength));
-
- if (LOG.isDebugEnabled()) {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = getInterfaceContext().getIndex(subInterfaceName, ctx.getMappingContext());
- LOG.debug("Attributes for {} sub-interface (id={}) address {} successfully read: {}",
- subInterfaceName, subInterfaceIndex, id, builder.build());
- }
- }
- }
-
- @Override
- @Nonnull
- public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading list of keys for sub-interface addresses: {}", id);
- return getAllIpv6AddressIds(subInterfaceAddressDumpSupplier(id, ctx), AddressKey::new);
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> builder, @Nonnull List<Address> readData) {
- ((Ipv6Builder) builder).setAddress(readData);
- }
-
- @Override
- @Nonnull
- public Initialized<Address> init(
- @Nonnull final InstanceIdentifier<Address> id, @Nonnull final Address readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id), readValue);
- }
-
- private InstanceIdentifier<Address> getCfgId(final InstanceIdentifier<Address> id) {
- return SubInterfaceCustomizer.getCfgId(RWUtils.cutId(id, SubInterface.class))
- .child(Ipv6.class)
- .child(Address.class, new AddressKey(id.firstKeyOf(Address.class)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
deleted file mode 100644
index a1b50680d..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.interfacesstate.ip.v6.subinterface;
-
-import com.google.common.base.Optional;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.dump.params.IfaceDumpFilter;
-import io.fd.hc2vpp.v3po.interfacesstate.ip.readers.IpNeighbourReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
-import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.NeighborBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.NeighborKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.List;
-import java.util.function.Function;
-
-public class SubInterfaceIpv6NeighbourCustomizer extends IpNeighbourReader
- implements ListReaderCustomizer<Neighbor, NeighborKey, NeighborBuilder> {
-
- public SubInterfaceIpv6NeighbourCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(interfaceContext, true, new DumpCacheManagerBuilder<IpNeighborDetailsReplyDump, IfaceDumpFilter>()
- .withExecutor(createNeighbourDumpExecutor(futureJVppCore))
- // cached with parent interface scope
- .withCacheKeyFactory(subInterfaceScopedCacheKeyFactory(IpNeighborDetailsReplyDump.class))
- .build());
- }
-
- @Override
- public NeighborBuilder getBuilder(InstanceIdentifier<Neighbor> id) {
- return new NeighborBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Neighbor> id, NeighborBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- final Ipv6AddressNoZone ip = id.firstKeyOf(Neighbor.class).getIp();
-
- final Optional<IpNeighborDetailsReplyDump> dumpOpt = subInterfaceNeighboursDump(id, ctx);
-
- if (dumpOpt.isPresent()) {
- dumpOpt.get().ipNeighborDetails
- .stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress)))
- .findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress))
- .setKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress)));
- }
- }
-
- @Override
- public List<NeighborKey> getAllIds(InstanceIdentifier<Neighbor> id, ReadContext context)
- throws ReadFailedException {
- return getNeighborKeys(subInterfaceNeighboursDump(id, context), keyMapper());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Neighbor> readData) {
- ((Ipv6Builder) builder).setNeighbor(readData);
- }
-
- private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress));
- }
-} \ No newline at end of file