From 75f108e2b610fa981e1a03882249a23e09289289 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Thu, 10 Aug 2017 13:17:01 +0200 Subject: Adapt hc2vpp to changes to interface events api Requires https://gerrit.fd.io/r/#/c/7925/ Change-Id: If627983bfcb0bf36ec1aa34ec863280e1f1bee36 Signed-off-by: Marek Gradzki --- .../v3po/interfaces/InterfaceCustomizerTest.java | 2 -- .../InterfaceChangeNotificationProducerTest.java | 32 +++++++++++----------- 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'v3po/v3po2vpp/src/test/java') diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java index 311889d1a..d33211842 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java @@ -107,9 +107,7 @@ public class InterfaceCustomizerTest extends WriterCustomizerTest implements Byt private SwInterfaceSetFlags expectedRequest(final boolean enabled) { final SwInterfaceSetFlags request = new SwInterfaceSetFlags(); - request.deleted = 0; request.adminUpDown = booleanToByte(enabled); - request.linkUpDown = booleanToByte(enabled); request.swIfIndex = IF_INDEX; return request; } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducerTest.java index 4751162f4..7605d42ac 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/notification/InterfaceChangeNotificationProducerTest.java @@ -22,11 +22,17 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import io.fd.honeycomb.notification.NotificationCollector; -import io.fd.honeycomb.translate.MappingContext; +import io.fd.hc2vpp.common.test.util.FutureProducer; import io.fd.hc2vpp.common.test.util.NamingContextHelper; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.hc2vpp.common.test.util.FutureProducer; +import io.fd.honeycomb.notification.NotificationCollector; +import io.fd.honeycomb.translate.MappingContext; +import io.fd.vpp.jvpp.core.callback.SwInterfaceEventNotificationCallback; +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 io.fd.vpp.jvpp.core.notification.CoreNotificationRegistry; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -34,12 +40,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.InterfaceStateChange; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.InterfaceStatus; -import io.fd.vpp.jvpp.core.callback.SwInterfaceSetFlagsNotificationCallback; -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 io.fd.vpp.jvpp.core.notification.CoreNotificationRegistry; public class InterfaceChangeNotificationProducerTest implements FutureProducer, NamingContextHelper { @@ -59,14 +59,14 @@ public class InterfaceChangeNotificationProducerTest implements FutureProducer, @Mock private AutoCloseable notificationListenerReg; - private ArgumentCaptor callbackArgumentCaptor; + private ArgumentCaptor callbackArgumentCaptor; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); doReturn(notificationRegistry).when(jVpp).getNotificationRegistry(); - callbackArgumentCaptor = ArgumentCaptor.forClass(SwInterfaceSetFlagsNotificationCallback.class); - doReturn(notificationListenerReg).when(notificationRegistry).registerSwInterfaceSetFlagsNotificationCallback( + callbackArgumentCaptor = ArgumentCaptor.forClass(SwInterfaceEventNotificationCallback.class); + doReturn(notificationListenerReg).when(notificationRegistry).registerSwInterfaceEventNotificationCallback( callbackArgumentCaptor.capture()); defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME); doReturn(future(new WantInterfaceEventsReply())).when(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class)); @@ -80,8 +80,8 @@ public class InterfaceChangeNotificationProducerTest implements FutureProducer, interfaceChangeNotificationProducer.start(collector); verify(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class)); verify(jVpp).getNotificationRegistry(); - verify(notificationRegistry).registerSwInterfaceSetFlagsNotificationCallback(any( - SwInterfaceSetFlagsNotificationCallback.class)); + verify(notificationRegistry).registerSwInterfaceEventNotificationCallback(any( + SwInterfaceEventNotificationCallback.class)); interfaceChangeNotificationProducer.stop(); verify(jVpp, times(2)).wantInterfaceEvents(any(WantInterfaceEvents.class)); @@ -95,12 +95,12 @@ public class InterfaceChangeNotificationProducerTest implements FutureProducer, interfaceChangeNotificationProducer.start(collector); - final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification = new SwInterfaceSetFlagsNotification(); + final SwInterfaceEventNotification swInterfaceSetFlagsNotification = new SwInterfaceEventNotification(); swInterfaceSetFlagsNotification.deleted = 0; swInterfaceSetFlagsNotification.swIfIndex = IFACE_ID; swInterfaceSetFlagsNotification.adminUpDown = 1; swInterfaceSetFlagsNotification.linkUpDown = 1; - callbackArgumentCaptor.getValue().onSwInterfaceSetFlagsNotification(swInterfaceSetFlagsNotification); + callbackArgumentCaptor.getValue().onSwInterfaceEventNotification(swInterfaceSetFlagsNotification); final ArgumentCaptor notificationCaptor = ArgumentCaptor.forClass(InterfaceStateChange.class); verify(collector).onNotification(notificationCaptor.capture()); -- cgit 1.2.3-korg