summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-05-11 11:01:08 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-05-13 06:59:33 +0000
commit11395c60f5c204a6c050c5d90c902c4fc5940537 (patch)
treea5d7261a1f187fd9d5b4c87ca06aeaf2bf734795 /v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java
parent65e93b3426fcc61ee821c3674b51f8365721abeb (diff)
HONEYCOMG-37 Enable ipv6 addresses for vxlan-tunnels
+ Add logging to other interface type customizers Change-Id: I177c0af26991c5f421b513f5fd9964ca1c23027e Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java
index 4b9c7c8bc..70a6da1cc 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java
@@ -16,6 +16,8 @@
package io.fd.honeycomb.v3po.translate.v3po.interfacesstate;
+import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType;
+
import io.fd.honeycomb.v3po.translate.Context;
import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer;
@@ -53,22 +55,19 @@ public class VhostUserCustomizer extends FutureJVppCustomizer
public static final String DUMPED_VHOST_USERS_CONTEXT_KEY = VhostUserCustomizer.class.getName() + "dumpedVhostUsersDuringGetAllIds";
private NamingContext interfaceContext;
- public VhostUserCustomizer(@Nonnull final FutureJVpp jvpp,
- final NamingContext interfaceContext) {
+ public VhostUserCustomizer(@Nonnull final FutureJVpp jvpp, @Nonnull final NamingContext interfaceContext) {
super(jvpp);
this.interfaceContext = interfaceContext;
}
@Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder,
- @Nonnull VhostUser readValue) {
+ public void merge(@Nonnull Builder<? extends DataObject> parentBuilder, @Nonnull VhostUser readValue) {
((VppInterfaceStateAugmentationBuilder) parentBuilder).setVhostUser(readValue);
}
@Nonnull
@Override
- public VhostUserBuilder getBuilder(
- @Nonnull InstanceIdentifier<VhostUser> id) {
+ public VhostUserBuilder getBuilder(@Nonnull InstanceIdentifier<VhostUser> id) {
return new VhostUserBuilder();
}
@@ -77,6 +76,14 @@ public class VhostUserCustomizer extends FutureJVppCustomizer
@Nonnull final VhostUserBuilder builder,
@Nonnull final Context ctx) throws ReadFailedException {
final InterfaceKey key = id.firstKeyOf(Interface.class);
+ // Relying here that parent InterfaceCustomizer was invoked first (PREORDER)
+ // to fill in the context with initial ifc mapping
+ final int index = interfaceContext.getIndex(key.getName());
+ if (!isInterfaceOfType(ctx, index, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class)) {
+ return;
+ }
+
+ LOG.debug("Reading attributes for vhpost user interface: {}", key.getName());
@SuppressWarnings("unchecked")
Map<Integer, SwInterfaceVhostUserDetails> mappedVhostUsers =
@@ -103,12 +110,8 @@ public class VhostUserCustomizer extends FutureJVppCustomizer
}
// Relying here that parent InterfaceCustomizer was invoked first to fill in the context with initial ifc mapping
- final int index = interfaceContext.getIndex(key.getName());
final SwInterfaceVhostUserDetails swInterfaceVhostUserDetails = mappedVhostUsers.get(index);
- if(swInterfaceVhostUserDetails == null) {
- // Not a VhostUser interface type
- return;
- }
+ LOG.trace("Vhost user interface: {} attributes returned from VPP: {}", key.getName(), swInterfaceVhostUserDetails);
builder.setRole(swInterfaceVhostUserDetails.isServer == 1 ? VhostUserRole.Server : VhostUserRole.Client);
builder.setFeatures(BigInteger.valueOf(swInterfaceVhostUserDetails.features));
@@ -116,6 +119,7 @@ public class VhostUserCustomizer extends FutureJVppCustomizer
builder.setSocket(V3poUtils.toString(swInterfaceVhostUserDetails.sockFilename));
builder.setVirtioNetHdrSize((long) swInterfaceVhostUserDetails.virtioNetHdrSz);
builder.setConnectError(Integer.toString(swInterfaceVhostUserDetails.sockErrno));
- // TODO add logging
+
+ LOG.debug("Vhost user interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
}
}