diff options
Diffstat (limited to 'vpp-classifier/impl/src/test/java/io/fd')
-rw-r--r-- | vpp-classifier/impl/src/test/java/io/fd/hc2vpp/vpp/classifier/write/ClassifySessionWriterTest.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vpp-classifier/impl/src/test/java/io/fd/hc2vpp/vpp/classifier/write/ClassifySessionWriterTest.java b/vpp-classifier/impl/src/test/java/io/fd/hc2vpp/vpp/classifier/write/ClassifySessionWriterTest.java index ccb02708e..68d20a728 100644 --- a/vpp-classifier/impl/src/test/java/io/fd/hc2vpp/vpp/classifier/write/ClassifySessionWriterTest.java +++ b/vpp-classifier/impl/src/test/java/io/fd/hc2vpp/vpp/classifier/write/ClassifySessionWriterTest.java @@ -99,6 +99,8 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { when(classfierContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX); final ClassifyTable table = mock(ClassifyTable.class); + when(table.getMask()).thenReturn(new HexString("00:00:00:00:00:00:ff:FF:ff:ff:ff:FF:00:00:00:00")); + when(table.getSkipNVectors()).thenReturn(0L); when(table.getClassifierNode()).thenReturn(new VppNodeName("ip4-classifier")); when(writeContext.readAfter(ArgumentMatchers.any())).thenReturn(Optional.of(table)); when(writeContext.readBefore(ArgumentMatchers.any())).thenReturn(Optional.of(table)); @@ -190,4 +192,32 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest { final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match); customizer.writeCurrentAttributes(id, classifySession, writeContext); } + + @Test(expected = IllegalArgumentException.class) + public void testCreateInvalidMatchLength() throws WriteFailedException { + final ClassifyTable table = mock(ClassifyTable.class); + when(table.getMask()).thenReturn(new HexString("00:00:00:00:00:00:ff:FF:ff:ff:ff:FF:00:00:00:00")); + when(table.getSkipNVectors()).thenReturn(1L); + when(writeContext.readAfter(ArgumentMatchers.any())).thenReturn(Optional.of(table)); + + final String match = "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00"; + final ClassifySession classifySession = generateClassifySession(SESSION_INDEX, match); + final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match); + customizer.writeCurrentAttributes(id, classifySession, writeContext); + } + + @Test + public void testCreateSkipOneVector() throws WriteFailedException { + final ClassifyTable table = mock(ClassifyTable.class); + when(table.getMask()).thenReturn(new HexString("00:00:00:00:00:00:ff:FF:ff:ff:ff:FF:00:00:00:00")); + when(table.getSkipNVectors()).thenReturn(1L); + when(writeContext.readAfter(ArgumentMatchers.any())).thenReturn(Optional.of(table)); + whenClassifyAddDelSessionThenSuccess(); + + final String match = + "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00"; + final ClassifySession classifySession = generateClassifySession(SESSION_INDEX, match); + final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match); + customizer.writeCurrentAttributes(id, classifySession, writeContext); + } }
\ No newline at end of file |