summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java65
1 files changed, 31 insertions, 34 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java
index fd71a8015..4a80e98b6 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceCustomizerTest.java
@@ -25,9 +25,14 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.CreateSubif;
+import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
@@ -55,30 +60,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.TagBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.TagKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.CreateSubif;
-import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
public class SubInterfaceCustomizerTest extends WriterCustomizerTest {
- private NamingContext namingContext;
- private SubInterfaceCustomizer customizer;
-
private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
private static final String SUPER_IF_NAME = "local0";
private static final int SUPER_IF_ID = 1;
private static final String SUB_IFACE_NAME = "local0.11";
private static final int SUBIF_INDEX = 11;
-
private static final short STAG_ID = 100;
private static final short CTAG_ID = 200;
private static final short CTAG_ANY_ID = 0; // only the *IdAny flag is set
-
private final Tag STAG_100;
private final Tag CTAG_200;
private final Tag CTAG_ANY;
+ private NamingContext namingContext;
+ private SubInterfaceCustomizer customizer;
public SubInterfaceCustomizerTest() {
STAG_100 = generateTag((short) 0, SVlan.class, new Dot1qTag.VlanId(new Dot1qVlanId((int) STAG_ID)));
@@ -86,29 +83,6 @@ public class SubInterfaceCustomizerTest extends WriterCustomizerTest {
CTAG_ANY = generateTag((short) 1, CVlan.class, new Dot1qTag.VlanId(Dot1qTag.VlanId.Enumeration.Any));
}
- @Override
- public void setUp() throws Exception {
- namingContext = new NamingContext("generatedSubInterfaceName", IFC_TEST_INSTANCE);
- customizer = new SubInterfaceCustomizer(api, namingContext);
- defineMapping(mappingContext, SUB_IFACE_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
- defineMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_ID, IFC_TEST_INSTANCE);
- }
-
- private SubInterface generateSubInterface(final boolean enabled, final List<Tag> tagList) {
- SubInterfaceBuilder builder = new SubInterfaceBuilder();
- builder.setVlanType(_802dot1ad.class);
- builder.setIdentifier(11L);
- final TagsBuilder tags = new TagsBuilder();
-
- tags.setTag(tagList);
-
- builder.setTags(tags.build());
-
- builder.setMatch(generateMatch());
- builder.setEnabled(enabled);
- return builder.build();
- }
-
private static Tag generateTag(final short index, final Class<? extends Dot1qTagVlanType> tagType,
final Dot1qTag.VlanId vlanId) {
TagBuilder tag = new TagBuilder();
@@ -131,6 +105,29 @@ public class SubInterfaceCustomizerTest extends WriterCustomizerTest {
return match.build();
}
+ @Override
+ public void setUpTest() throws Exception {
+ namingContext = new NamingContext("generatedSubInterfaceName", IFC_TEST_INSTANCE);
+ customizer = new SubInterfaceCustomizer(api, namingContext);
+ defineMapping(mappingContext, SUB_IFACE_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
+ defineMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_ID, IFC_TEST_INSTANCE);
+ }
+
+ private SubInterface generateSubInterface(final boolean enabled, final List<Tag> tagList) {
+ SubInterfaceBuilder builder = new SubInterfaceBuilder();
+ builder.setVlanType(_802dot1ad.class);
+ builder.setIdentifier(11L);
+ final TagsBuilder tags = new TagsBuilder();
+
+ tags.setTag(tagList);
+
+ builder.setTags(tags.build());
+
+ builder.setMatch(generateMatch());
+ builder.setEnabled(enabled);
+ return builder.build();
+ }
+
private CreateSubif generateSubInterfaceRequest(final int superIfId, final short innerVlanId,
final boolean isInnerAny) {
CreateSubif request = new CreateSubif();