summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java8
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/SubInterfaceCustomizer.java3
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizerTest.java118
3 files changed, 80 insertions, 49 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java
index 7eb568530..57676c85b 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java
@@ -154,7 +154,7 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
*~
*.sw[op]

/build-root/.ccache
/build-root/build-*/
/build-root/install-*/
/build-root/tools
/build-root/dpdk-includes/
/build-root/packages-vpp/
/build-root/path_setup
/build-root/deb/debian/vpp-plugins/
/build-root/deb/.pybuild/
/build-root/*.deb
/build-root/*.rpm
/build-root/*.tar.xz
/build-root/*.changes
/build-root/rpmbuild/
/build-root/test-doc/
/build-root/test-cov/
/build-root/python/
/build-root/vapi_test/
/build-root/vom_test/
/build-config.mk
/dpdk/*.tar.gz
/dpdk/*.tar.xz
/dpdk/vpp-dpdk*.deb
/dpdk/vpp-dpdk*.changes
/path_setup
/tools/
# start autotools ignore
autom4te.cache/
config/
Makefile
Makefile.in
aclocal.m4
app.info
compile
config.h
config.log
config.guess
config.sub
config.status
configure
configure.scan
coverage_report
depcomp
install-sh
libtool
m4
missing
stamp-h1
ltmain.sh
ylwrap
test-driver

*.iml
.deps.ok
.settings
.autotools
# stop autotools ignore

# OSX and some IDE
.DS_Store
.idea/
.project
.cproject
.pydevproject
.vscode/
cmake-build*/

# cscope and ctags
/cscope.*
/tags
ID
TAGS
# ggtags
GPATH
GRTAGS
GTAGS
# Generated documentation
/build-root/docs
/build-root/.doxygen-bootstrap.ok
/build-root/.doxygen-siphon.dep
/docs/_build
/env
!/docs/Makefile

# indent backup files
*.BAK

# Python bytecode
*.pyc

# Python api generator
/src/vpp-api/python/build
/src/vpp-api/python/dist
/src/vpp-api/python/vpp_papi.egg-info

# Build files in the test directory
/test/*.ok

# vppctl command list
/src/scripts/vppctl-cmd-list

# No core files
**/core
erface.class, new SubInterfaceKey(index));
+ SubinterfaceAugmentation.class).child(SubInterfaces.class)
+ .child(SubInterface.class, new SubInterfaceKey(index));
}
private void whenCreateSubifThenSuccess() throws ExecutionException, InterruptedException, VppBaseCallException {
@@ -173,10 +192,12 @@ public class SubInterfaceCustomizerTest {
* Failure response send
*/
private void whenCreateSubifThenFailure() throws ExecutionException, InterruptedException, VppBaseCallException {
- doReturn(TestHelperUtils.<CreateSubifReply>createFutureException()).when(api).createSubif(any(CreateSubif.class));
+ doReturn(TestHelperUtils.<CreateSubifReply>createFutureException()).when(api)
+ .createSubif(any(CreateSubif.class));
}
- private void whenSwInterfaceSetFlagsThenSuccess() throws ExecutionException, InterruptedException, VppBaseCallException {
+ private void whenSwInterfaceSetFlagsThenSuccess()
+ throws ExecutionException, InterruptedException, VppBaseCallException {
final CompletableFuture<SwInterfaceSetFlagsReply> replyFuture = new CompletableFuture<>();
final SwInterfaceSetFlagsReply reply = new SwInterfaceSetFlagsReply();
replyFuture.complete(reply);
@@ -203,7 +224,8 @@ public class SubInterfaceCustomizerTest {
return actual;
}
- private SwInterfaceSetFlags verifySwInterfaceSetFlagsWasInvoked(final SwInterfaceSetFlags expected) throws VppBaseCallException{
+ private SwInterfaceSetFlags verifySwInterfaceSetFlagsWasInvoked(final SwInterfaceSetFlags expected)
+ throws VppBaseCallException {
ArgumentCaptor<SwInterfaceSetFlags> argumentCaptor = ArgumentCaptor.forClass(SwInterfaceSetFlags.class);
verify(api).swInterfaceSetFlags(argumentCaptor.capture());
final SwInterfaceSetFlags actual = argumentCaptor.getValue();
@@ -214,41 +236,50 @@ public class SubInterfaceCustomizerTest {
}
@Test
- public void testCreate() throws Exception {
- final SubInterface subInterface = generateSubInterface(SUPER_IF_NAME, false);
- final String superIfName = "local0";
- final String subIfaceName = "local0.11";
- final long subifIndex = 11;
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(superIfName, subifIndex);
+ public void testCreateTwoTags() throws Exception {
+ final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200));
+ final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
+
+ whenCreateSubifThenSuccess();
+ whenSwInterfaceSetFlagsThenSuccess();
+
+ customizer.writeCurrentAttributes(id, subInterface, writeContext);
+
+ verifyCreateSubifWasInvoked(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ID, false));
+ verify(mappingContext)
+ .put(eq(getMappingIid(SUB_IFACE_NAME, "test-instance")), eq(getMapping(SUB_IFACE_NAME, 0).get()));
+ }
+
+ @Test
+ public void testCreateDot1qAnyTag() throws Exception {
+ final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_ANY));
+ final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
whenCreateSubifThenSuccess();
whenSwInterfaceSetFlagsThenSuccess();
customizer.writeCurrentAttributes(id, subInterface, writeContext);
- verifyCreateSubifWasInvoked(generateSubInterfaceRequest(SUPER_IF_ID));
+ verifyCreateSubifWasInvoked(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ANY_ID, true));
verify(mappingContext)
- .put(eq(getMappingIid(subIfaceName, "test-instance")), eq(getMapping(subIfaceName, 0).get()));
+ .put(eq(getMappingIid(SUB_IFACE_NAME, "test-instance")), eq(getMapping(SUB_IFACE_NAME, 0).get()));
}
@Test
public void testCreateFailed() throws Exception {
- final SubInterface subInterface = generateSubInterface(SUPER_IF_NAME, false);
- final String superIfName = "local0";
- final String subIfaceName = "local0.11";
- final long subifIndex = 11;
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(superIfName, subifIndex);
+ final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200));
+ final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
whenCreateSubifThenFailure();
try {
customizer.writeCurrentAttributes(id, subInterface, writeContext);
} catch (WriteFailedException.CreateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException );
- verifyCreateSubifWasInvoked(generateSubInterfaceRequest(SUPER_IF_ID));
+ assertTrue(e.getCause() instanceof VppBaseCallException);
+ verifyCreateSubifWasInvoked(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ID, false));
verify(mappingContext, times(0)).put(
- eq(getMappingIid(subIfaceName, "test-instance")),
- eq(getMapping(subIfaceName, 0).get()));
+ eq(getMappingIid(SUPER_IF_NAME, "test-instance")),
+ eq(getMapping(SUPER_IF_NAME, 0).get()));
return;
}
fail("WriteFailedException.CreateFailedException was expected");
@@ -256,26 +287,25 @@ public class SubInterfaceCustomizerTest {
@Test
public void testUpdate() throws Exception {
- final SubInterface before = generateSubInterface("eth0", false);
- final SubInterface after = generateSubInterface("eth1", true);
- final String superIfName = "local0";
- final String subIfaceName = "local0.11";
- final int subifIndex = 11;
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(superIfName, subifIndex);
+ final List<Tag> tags = Arrays.asList(STAG_100, CTAG_200);
+ final SubInterface before = generateSubInterface(false, tags);
+ final SubInterface after = generateSubInterface(true, tags);
+ final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
whenSwInterfaceSetFlagsThenSuccess();
- final Optional<Mapping> ifcMapping = getMapping(subIfaceName, subifIndex);
+ final Optional<Mapping> ifcMapping = getMapping(SUPER_IF_NAME, SUBIF_INDEX);
doReturn(ifcMapping).when(mappingContext).read(any());
customizer.updateCurrentAttributes(id, before, after, writeContext);
- verifySwInterfaceSetFlagsWasInvoked(generateSwInterfaceEnableRequest(subifIndex));
+ verifySwInterfaceSetFlagsWasInvoked(generateSwInterfaceEnableRequest(SUBIF_INDEX));
}
@Test
public void testUpdateNoStateChange() throws Exception {
- final SubInterface before = generateSubInterface(SUPER_IF_NAME, false);
- final SubInterface after = generateSubInterface(SUPER_IF_NAME, false);
+ final List<Tag> tags = Arrays.asList(STAG_100, CTAG_200);
+ final SubInterface before = generateSubInterface(false, tags);
+ final SubInterface after = generateSubInterface(false, tags);
customizer.updateCurrentAttributes(null, before, after, writeContext);
verify(api, never()).swInterfaceSetFlags(any());
@@ -283,7 +313,7 @@ public class SubInterfaceCustomizerTest {
@Test(expected = UnsupportedOperationException.class)
public void testDelete() throws Exception {
- final SubInterface subInterface = generateSubInterface("eth0", false);
+ final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200));
customizer.deleteCurrentAttributes(null, subInterface, writeContext);
}
} \ No newline at end of file