From 6dcea1de979536dbe0478e31f17191bcfae92f3c Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Sun, 10 Apr 2016 22:06:36 +0200 Subject: HONEYCOMB-34: Configurable serializer dependency Change-Id: I05cb7836ec4a379f7617710a6c6f64c3541ff0c9 Signed-off-by: Marek Gradzki --- .../v3po/vppstate/BridgeDomainCustomizer.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'v3po/v3po2vpp') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java index 36e1da366..39f164e4b 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java @@ -39,10 +39,14 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.openvpp.vppjapi.vppBridgeDomainDetails; import org.openvpp.vppjapi.vppBridgeDomainInterfaceDetails; import org.openvpp.vppjapi.vppL2Fib; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public final class BridgeDomainCustomizer extends VppApiCustomizer implements ListReaderCustomizer { + private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainCustomizer.class); + public BridgeDomainCustomizer(@Nonnull final org.openvpp.vppjapi.vppApi vppApi) { super(vppApi); } @@ -50,11 +54,18 @@ public final class BridgeDomainCustomizer extends VppApiCustomizer @Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final BridgeDomainBuilder builder, @Nonnull final Context context) { + LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: id={}, builderbuilder={}, context={}", + id, builder, context); + final BridgeDomainKey key = id.firstKeyOf(id.getTargetType()); // TODO find out if bd exists based on name and if not return + LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: key={}", key); final int bdId = getVppApi().bridgeDomainIdFromName(key.getName()); + LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: bdId={}", bdId); + final vppBridgeDomainDetails bridgeDomainDetails = getVppApi().getBridgeDomainDetails(bdId); + logBridgeDomainDetails(bridgeDomainDetails); builder.setName(key.getName()); // builder.setName(bridgeDomainDetails.name); @@ -83,6 +94,21 @@ public final class BridgeDomainCustomizer extends VppApiCustomizer builder.setL2Fib(l2Fibs); } + private void logBridgeDomainDetails(final vppBridgeDomainDetails bridgeDomainDetails) { + LOG.debug("bridgeDomainDetails={}", bridgeDomainDetails); + if (bridgeDomainDetails != null) { + LOG.debug("bridgeDomainDetails.arpTerm={}", bridgeDomainDetails.arpTerm); + LOG.debug("bridgeDomainDetails.bdId={}", bridgeDomainDetails.bdId); + LOG.debug("bridgeDomainDetails.bviInterfaceName={}", bridgeDomainDetails.bviInterfaceName); + LOG.debug("bridgeDomainDetails.flood={}", bridgeDomainDetails.flood); + LOG.debug("bridgeDomainDetails.forward={}", bridgeDomainDetails.forward); + LOG.debug("bridgeDomainDetails.learn={}", bridgeDomainDetails.learn); + LOG.debug("bridgeDomainDetails.name={}", bridgeDomainDetails.name); + LOG.debug("bridgeDomainDetails.uuFlood={}", bridgeDomainDetails.uuFlood); + } + } + + private static String getMacAddress(byte[] mac) { StringBuilder sb = new StringBuilder(18); for (byte b : mac) { @@ -116,13 +142,18 @@ public final class BridgeDomainCustomizer extends VppApiCustomizer @Override public List getAllIds(@Nonnull final InstanceIdentifier id, @Nonnull final Context context) { final int[] bIds = getVppApi().bridgeDomainDump(-1); + LOG.debug("vppstate.BridgeDomainCustomizer.getAllIds: bIds.length={}", bIds.length); final List allIds = new ArrayList<>(bIds.length); for (int bId : bIds) { + LOG.debug("vppstate.BridgeDomainCustomizer.getAllIds: bId={}", bId); // FIXME this is highly inefficient having to dump all of the bridge domain details // Use context to store already read information // TODO Or just remove the getAllIds method and replace with a simple readAll final vppBridgeDomainDetails bridgeDomainDetails = getVppApi().getBridgeDomainDetails(bId); + logBridgeDomainDetails(bridgeDomainDetails); + final String bName = bridgeDomainDetails.name; + LOG.debug("vppstate.BridgeDomainCustomizer.getAllIds: bName={}", bName); allIds.add(new BridgeDomainKey(bName)); } -- cgit 1.2.3-korg