summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-08-10 13:17:01 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-08-10 13:18:04 +0200
commit75f108e2b610fa981e1a03882249a23e09289289 (patch)
tree8e1570e63c9dd9484d7178d6c45ca54ac49b704e /v3po/v3po2vpp/src/main/java/io
parentdb84265112d45c173f4e4d25b6eb1a97c9ff06d7 (diff)
Adapt hc2vpp to changes to interface events api
Requires https://gerrit.fd.io/r/#/c/7925/ Change-Id: If627983bfcb0bf36ec1aa34ec863280e1f1bee36 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java8
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducer.java40
2 files changed, 22 insertions, 26 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java
index 336a66152..10c8478c4 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java
@@ -99,8 +99,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
private void setInterfaceFlags(final InstanceIdentifier<Interface> id, final String swIfName, final int swIfIndex,
final byte enabled) throws WriteFailedException {
final CompletionStage<SwInterfaceSetFlagsReply> swInterfaceSetFlagsReplyFuture =
- getFutureJVpp().swInterfaceSetFlags(
- getSwInterfaceSetFlagsInput(swIfIndex, enabled, (byte) 0 /* deleted */));
+ getFutureJVpp().swInterfaceSetFlags(getSwInterfaceSetFlagsInput(swIfIndex, enabled));
LOG.debug("Updating interface flags for: {}, index: {}, enabled: {}", swIfName, swIfIndex, enabled);
@@ -109,13 +108,10 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
swIfName, swIfIndex, enabled);
}
- private SwInterfaceSetFlags getSwInterfaceSetFlagsInput(final int swIfIndex, final byte enabled,
- final byte deleted) {
+ private SwInterfaceSetFlags getSwInterfaceSetFlagsInput(final int swIfIndex, final byte enabled) {
final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
swInterfaceSetFlags.swIfIndex = swIfIndex;
swInterfaceSetFlags.adminUpDown = enabled;
- swInterfaceSetFlags.linkUpDown = enabled;
- swInterfaceSetFlags.deleted = deleted;
return swInterfaceSetFlags;
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducer.java
index ffab221ee..8ad7debb5 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducer.java
@@ -20,11 +20,16 @@ import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.notification.ManagedNotificationProducer;
import io.fd.honeycomb.notification.NotificationCollector;
import io.fd.honeycomb.translate.MappingContext;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEventNotification;
+import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
+import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CompletionStage;
@@ -39,11 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.InterfaceStateChangeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.InterfaceStatus;
import org.opendaylight.yangtools.yang.binding.Notification;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -76,25 +76,25 @@ public final class InterfaceChangeNotificationProducer implements ManagedNotific
LOG.trace("Starting interface notifications");
enableDisableIfcNotifications(1);
LOG.debug("Interface notifications started successfully");
- notificationListenerReg = jvpp.getNotificationRegistry().registerSwInterfaceSetFlagsNotificationCallback(
- swInterfaceSetFlagsNotification -> {
- LOG.trace("Interface notification received: {}", swInterfaceSetFlagsNotification);
+ notificationListenerReg = jvpp.getNotificationRegistry().registerSwInterfaceEventNotificationCallback(
+ swInterfaceEventNotification -> {
+ LOG.trace("Interface notification received: {}", swInterfaceEventNotification);
// TODO HONEYCOMB-166 this should be lazy
- collector.onNotification(transformNotification(swInterfaceSetFlagsNotification));
+ collector.onNotification(transformNotification(swInterfaceEventNotification));
}
);
}
- private Notification transformNotification(final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification) {
- if (swInterfaceSetFlagsNotification.deleted == 1) {
- return new InterfaceDeletedBuilder().setName(getIfcName(swInterfaceSetFlagsNotification)).build();
+ private Notification transformNotification(final SwInterfaceEventNotification swInterfaceEventNotification) {
+ if (swInterfaceEventNotification.deleted == 1) {
+ return new InterfaceDeletedBuilder().setName(getIfcName(swInterfaceEventNotification)).build();
} else {
return new InterfaceStateChangeBuilder()
- .setName(getIfcName(swInterfaceSetFlagsNotification))
- .setAdminStatus(swInterfaceSetFlagsNotification.adminUpDown == 1
+ .setName(getIfcName(swInterfaceEventNotification))
+ .setAdminStatus(swInterfaceEventNotification.adminUpDown == 1
? InterfaceStatus.Up
: InterfaceStatus.Down)
- .setOperStatus(swInterfaceSetFlagsNotification.linkUpDown == 1
+ .setOperStatus(swInterfaceEventNotification.linkUpDown == 1
? InterfaceStatus.Up
: InterfaceStatus.Down)
.build();
@@ -108,12 +108,12 @@ public final class InterfaceChangeNotificationProducer implements ManagedNotific
* <p/>
* In case mapping is not available, index is used as name.
*/
- private InterfaceNameOrIndex getIfcName(final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification) {
+ private InterfaceNameOrIndex getIfcName(final SwInterfaceEventNotification swInterfaceEventNotification) {
final Optional<String> optionalName =
- interfaceContext.getNameIfPresent(swInterfaceSetFlagsNotification.swIfIndex, mappingContext);
+ interfaceContext.getNameIfPresent(swInterfaceEventNotification.swIfIndex, mappingContext);
return optionalName.isPresent()
? new InterfaceNameOrIndex(optionalName.get())
- : new InterfaceNameOrIndex((long) swInterfaceSetFlagsNotification.swIfIndex);
+ : new InterfaceNameOrIndex((long) swInterfaceEventNotification.swIfIndex);
}
@Override