diff options
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceRoutingCustomizerTest.java')
-rw-r--r-- | v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceRoutingCustomizerTest.java | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceRoutingCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceRoutingCustomizerTest.java index 5732d587b..90c9d66c8 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceRoutingCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceRoutingCustomizerTest.java @@ -21,7 +21,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.Optional; import com.google.common.collect.ImmutableSet; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; @@ -30,6 +29,7 @@ import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.jvpp.core.dto.SwInterfaceSetTable; import io.fd.jvpp.core.dto.SwInterfaceSetTableReply; import java.util.Collections; +import java.util.Optional; import java.util.Set; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -38,11 +38,7 @@ import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.fib.table.managem import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.SubinterfaceAugmentation; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.interfaces._interface.SubInterfaces; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.interfaces._interface.sub.interfaces.SubInterface; -import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.interfaces._interface.sub.interfaces.SubInterfaceBuilder; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.interfaces._interface.sub.interfaces.SubInterfaceKey; -import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.sub._interface.ip4.attributes.Ipv4Builder; -import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.sub._interface.ip4.attributes.ipv4.AddressBuilder; -import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.sub._interface.ip6.attributes.Ipv6Builder; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.sub._interface.routing.attributes.Routing; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.sub._interface.routing.attributes.RoutingBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev180220.Interfaces; @@ -80,20 +76,6 @@ public class SubInterfaceRoutingCustomizerTest extends WriterCustomizerTest impl when(api.swInterfaceSetTable(any())).thenReturn(future(new SwInterfaceSetTableReply())); } - @Test(expected = IllegalStateException.class) - public void testWriteFailedV4AddressPresent() throws WriteFailedException { - when(writeContext.readBefore(any(InstanceIdentifier.class))).thenReturn(Optional.of(v4AddressPresent())); - final Routing v4Routing = new RoutingBuilder().setIpv4VrfId(new VniReference(4L)).build(); - customizer.writeCurrentAttributes(VALID_ID, v4Routing, writeContext); - } - - @Test(expected = IllegalStateException.class) - public void testWriteFailedV6AddressPresent() throws WriteFailedException { - when(writeContext.readBefore(any(InstanceIdentifier.class))).thenReturn(Optional.of(v6AddressPresent())); - final Routing v4Routing = new RoutingBuilder().setIpv4VrfId(new VniReference(4L)).build(); - customizer.writeCurrentAttributes(VALID_ID, v4Routing, writeContext); - } - @Test public void testWriteIpv4Vrf() throws WriteFailedException { when(writeContext.readBefore(any(InstanceIdentifier.class))).thenReturn(Optional.empty()); @@ -102,7 +84,6 @@ public class SubInterfaceRoutingCustomizerTest extends WriterCustomizerTest impl verifySetTableRequest(1, Collections.singleton(request(false, SUBIF_INDEX, 4))); } - @Test public void testWriteIpv6Vrf() throws WriteFailedException { when(writeContext.readBefore(any(InstanceIdentifier.class))).thenReturn(Optional.empty()); @@ -115,9 +96,9 @@ public class SubInterfaceRoutingCustomizerTest extends WriterCustomizerTest impl public void testUpdateIpv4Vrf() throws WriteFailedException { when(writeContext.readBefore(any(InstanceIdentifier.class))).thenReturn(Optional.empty()); final Routing routingBefore = new RoutingBuilder().setIpv6VrfId(new VniReference(3L)) - .setIpv4VrfId(new VniReference(4L)).build(); + .setIpv4VrfId(new VniReference(4L)).build(); final Routing routingAfter = new RoutingBuilder().setIpv6VrfId(new VniReference(3L)) - .setIpv4VrfId(new VniReference(5L)).build(); + .setIpv4VrfId(new VniReference(5L)).build(); customizer.updateCurrentAttributes(VALID_ID, routingBefore, routingAfter, writeContext); verifySetTableRequest(2, ImmutableSet.of(request(false, SUBIF_INDEX, 5), request(true, SUBIF_INDEX, 3))); @@ -127,9 +108,9 @@ public class SubInterfaceRoutingCustomizerTest extends WriterCustomizerTest impl public void testUpdateIpv6Vrf() throws WriteFailedException { when(writeContext.readBefore(any(InstanceIdentifier.class))).thenReturn(Optional.empty()); final Routing routingBefore = new RoutingBuilder().setIpv6VrfId(new VniReference(3L)) - .setIpv4VrfId(new VniReference(4L)).build(); + .setIpv4VrfId(new VniReference(4L)).build(); final Routing routingAfter = new RoutingBuilder().setIpv6VrfId(new VniReference(8L)) - .setIpv4VrfId(new VniReference(4L)).build(); + .setIpv4VrfId(new VniReference(4L)).build(); customizer.updateCurrentAttributes(VALID_ID, routingBefore, routingAfter, writeContext); verifySetTableRequest(2, ImmutableSet.of(request(false, SUBIF_INDEX, 4), request(true, SUBIF_INDEX, 8))); @@ -164,20 +145,4 @@ public class SubInterfaceRoutingCustomizerTest extends WriterCustomizerTest impl verify(api, times(times)).swInterfaceSetTable(requestCaptor.capture()); requestCaptor.getAllValues().containsAll(requests); } - - private static SubInterface v4AddressPresent() { - return new SubInterfaceBuilder() - .setIpv4(new Ipv4Builder() - .setAddress(Collections.singletonList(new AddressBuilder().build())) - .build()) - .build(); - } - - private static SubInterface v6AddressPresent(){ - return new SubInterfaceBuilder() - .setIpv6(new Ipv6Builder() - .setAddress(Collections.singletonList(new org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.vlan.rev180319.sub._interface.ip6.attributes.ipv6.AddressBuilder().build())) - .build()) - .build(); - } } |