diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-01-12 10:46:28 +0100 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2017-01-12 14:07:40 +0000 |
commit | 765cb29e4c12c48fca6326c434b985e655bafc1a (patch) | |
tree | a30c03a4530826ae82e7fdfd73f1d45c117026b8 /routing/routing-impl/src/test/java | |
parent | 7cf98fe610c2912873bdf5fe5fea353adb9d2cbf (diff) |
HONEYCOMB-325 - Null pointer while routing attr not defined
Fixes multiple null pointers
Change-Id: Iaa1df9a8b0a886d1835fe7cb87bcf7cf5130c6f5
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'routing/routing-impl/src/test/java')
10 files changed, 92 insertions, 44 deletions
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java index 1fc8152eb..79650e81c 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java @@ -72,7 +72,7 @@ public class Ipv4RouteNamesFactoryTest @Test public void testUniqueRouteName( - @InjectTestData(resourcePath = "/ipv4/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes data) { assertEquals("tst-protocol_19216821_24", factory.uniqueRouteName(ROUTE_PROTOCOL_NAME, getIpv4RouteWithId(data, 1L))); diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java index 4f95ae328..a993b9b65 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java @@ -72,7 +72,7 @@ public class Ipv6RouteNamesFactoryTest implements RoutingRequestTestHelper, Sche @Test public void testUniqueRouteName( - @InjectTestData(resourcePath = "/ipv6/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes data) { assertEquals("tst-protocol_2001db8a0b12f01_64", factory.uniqueRouteName(ROUTE_PROTOCOL_NAME, getIpv6RouteWithId(data, 1L))); diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java index 13b434716..9cefb345a 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java @@ -96,7 +96,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testWriteSingleHop( - @InjectTestData(resourcePath = "/ipv4/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { final Route route1 = getIpv4RouteWithId(route, 1L); noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context"); @@ -111,7 +111,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testWriteHopList( - @InjectTestData(resourcePath = "/ipv4/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { final Route route1 = getIpv4RouteWithId(route, 1L); noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context"); @@ -141,7 +141,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testWriteSpecialHop( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { final Route route1 = getIpv4RouteWithId(route, 1L); noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context"); @@ -154,7 +154,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testUpdate( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) { + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) { try { customizer.updateCurrentAttributes(validId, new RouteBuilder().build(), getIpv4RouteWithId(route, 1L), writeContext); @@ -169,7 +169,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testDeleteSingleHop( - @InjectTestData(resourcePath = "/ipv4/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { customizer.deleteCurrentAttributes(validId, getIpv4RouteWithId(route, 1L), writeContext); verifyInvocation(1, ImmutableList @@ -180,7 +180,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testDeleteHopList( - @InjectTestData(resourcePath = "/ipv4/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { final Route route1 = getIpv4RouteWithId(route, 1L); noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context"); @@ -209,7 +209,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest @Test public void testDeleteSpecialHop( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { customizer.deleteCurrentAttributes(validId, getIpv4RouteWithId(route, 1L), writeContext); diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java index c776ca7f7..6ba973340 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java @@ -91,7 +91,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest @Test public void testWriteSingleHop( - @InjectTestData(resourcePath = "/ipv6/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { whenAddRouteThenSuccess(api); customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext); @@ -103,7 +103,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest @Test public void testWriteHopList( - @InjectTestData(resourcePath = "/ipv6/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv6/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { whenAddRouteThenSuccess(api); customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext); @@ -133,7 +133,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest @Test public void testDeleteSpecialHop( - @InjectTestData(resourcePath = "/ipv6/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { whenAddRouteThenSuccess(api); customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), @@ -145,7 +145,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest @Test public void testDeleteSingleHop( - @InjectTestData(resourcePath = "/ipv6/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { whenAddRouteThenSuccess(api); customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext); @@ -157,7 +157,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest @Test public void testDeleteHopList( - @InjectTestData(resourcePath = "/ipv6/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv6/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { whenAddRouteThenSuccess(api); customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext); @@ -174,7 +174,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest @Test public void testWriteSpecialHop( - @InjectTestData(resourcePath = "/ipv6/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) + @InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) throws WriteFailedException { whenAddRouteThenSuccess(api); customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java index 43d01abbf..1eb91aa37 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java @@ -51,18 +51,24 @@ public class MultipathHopRequestFactoryIpv4Test @Mock private MappingContext mappingContext; - @InjectTestData(resourcePath = "/ipv4/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) private StaticRoutes ipv4StaticRoutesWithClassifier; - @InjectTestData(resourcePath = "/ipv4/multiHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) private StaticRoutes ipv4StaticRoutesWithoutClassifier; + @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json", id = STATIC_ROUTE_PATH) + private StaticRoutes ipv4StaticRoutesWithoutRouteAttrs; + private Route ipv4MutlipathRouteWithClassifier; private NextHop ipv4nextHopWithClassifier; private Route ipv4MutlipathRouteWithoutClassifier; private NextHop ipv4nextHopWithoutClassifier; + private Route ipv4MutlipathRouteWithoutRouteAtts; + private NextHop ipv4nextHopWithoutRouteAtts; + private NamingContext interfaceContext; private NamingContext routingProtocolContext; private MultipathHopRequestFactory factory; @@ -88,10 +94,17 @@ public class MultipathHopRequestFactoryIpv4Test ipv4MutlipathRouteWithoutClassifier = getIpv4RouteWithId(ipv4StaticRoutesWithoutClassifier, 1L); final List<NextHop> ipv4HopsNonClassified = - NextHopList.class.cast(ipv4MutlipathRouteWithClassifier.getNextHopOptions()).getNextHopList() + NextHopList.class.cast(ipv4MutlipathRouteWithoutClassifier.getNextHopOptions()).getNextHopList() .getNextHop(); ipv4nextHopWithoutClassifier = ipv4HopsNonClassified.stream().filter(nextHop -> nextHop.getId() == 1L).findFirst().get(); + + ipv4MutlipathRouteWithoutRouteAtts = getIpv4RouteWithId(ipv4StaticRoutesWithoutRouteAttrs, 1L); + final List<NextHop> ipv4HopsNonRouteAttrs = + NextHopList.class.cast(ipv4MutlipathRouteWithoutRouteAtts.getNextHopOptions()).getNextHopList() + .getNextHop(); + ipv4nextHopWithoutRouteAtts = + ipv4HopsNonClassified.stream().filter(nextHop -> nextHop.getId() == 1L).findFirst().get(); } @Test @@ -116,4 +129,16 @@ public class MultipathHopRequestFactoryIpv4Test desiredFlaglessResult(0, 0, 1, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 2, 1, 1, 0, 0, 0), request); } + + @Test + public void testIpv4WithoutRouteAttrs() { + final IpAddDelRoute request = + factory.createIpv4MultipathHopRequest(false, ROUTE_PROTOCOL_NAME, ipv4MutlipathRouteWithoutRouteAtts, + ipv4nextHopWithoutRouteAtts, + mappingContext); + + assertEquals( + desiredFlaglessResult(0, 0, 1, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, + Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 2, 1, 1, 0, 0, 0), request); + } } diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java index 9fc5fae65..dfbd093de 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java @@ -50,10 +50,10 @@ public class MultipathHopRequestFactoryIpv6Test @Mock private MappingContext mappingContext; - @InjectTestData(resourcePath = "/ipv6/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) private StaticRoutes ipv6StaticRoutesWithClassifier; - @InjectTestData(resourcePath = "/ipv6/multiHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/multihop/multiHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) private StaticRoutes ipv6StaticRoutesWithoutClassifier; private Route ipv6MultipathRouteWithClassifier; diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java index cfb352daa..d344e016e 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java @@ -46,12 +46,6 @@ public class SimpleHopRequestFactoryIpv4Test @Mock private MappingContext mappingContext; - @InjectTestData(resourcePath = "/ipv4/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) - private StaticRoutes ipv4StaticRouteWithClassifier; - - @InjectTestData(resourcePath = "/ipv4/simpleHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) - private StaticRoutes ipv4StaticRouteWithoutClassifier; - private NamingContext interfaceContext; private NamingContext routingProtocolContext; private SimpleHopRequestFactory factory; @@ -70,7 +64,9 @@ public class SimpleHopRequestFactoryIpv4Test } @Test - public void testIpv4WithClassifier() { + public void testIpv4WithClassifier( + @InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) + StaticRoutes ipv4StaticRouteWithClassifier) { final IpAddDelRoute request = factory.createIpv4SimpleHopRequest(false, ROUTE_PROTOCOL_NAME, getIpv4RouteWithId(ipv4StaticRouteWithClassifier, 1L), @@ -82,7 +78,9 @@ public class SimpleHopRequestFactoryIpv4Test } @Test - public void testIpv4WithoutClassifier() { + public void testIpv4WithoutClassifier( + @InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) + StaticRoutes ipv4StaticRouteWithoutClassifier) { final IpAddDelRoute request = factory.createIpv4SimpleHopRequest(false, ROUTE_PROTOCOL_NAME, ipv4StaticRouteWithoutClassifier.getAugmentation(StaticRoutes1.class).getIpv4().getRoute() @@ -92,4 +90,18 @@ public class SimpleHopRequestFactoryIpv4Test desiredFlaglessResult(0, 0, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 1, 0, 0, 0), request); } + + @Test + public void testIpv4WithoutVppAttrs( + @InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json", id = STATIC_ROUTE_PATH) + StaticRoutes ipv4StaticRouteWithoutRouteAttrs) { + final IpAddDelRoute request = + factory.createIpv4SimpleHopRequest(false, ROUTE_PROTOCOL_NAME, + ipv4StaticRouteWithoutRouteAttrs.getAugmentation(StaticRoutes1.class).getIpv4().getRoute() + .get(0), mappingContext); + + assertEquals( + desiredFlaglessResult(0, 0, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, + Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 1, 0, 0, 0), request); + } } diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java index e95a66775..721fac315 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java @@ -47,12 +47,6 @@ public class SimpleHopRequestFactoryIpv6Test @Mock private MappingContext mappingContext; - @InjectTestData(resourcePath = "/ipv6/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) - private StaticRoutes ipv6StaticRouteWithClassifier; - - @InjectTestData(resourcePath = "/ipv6/simpleHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) - private StaticRoutes ipv6StaticRouteWithoutClassifier; - private NamingContext interfaceContext; private NamingContext routingProtocolContext; private SimpleHopRequestFactory factory; @@ -71,7 +65,9 @@ public class SimpleHopRequestFactoryIpv6Test } @Test - public void testIpv6WithClassifier() { + public void testIpv6WithClassifier( + @InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) + StaticRoutes ipv6StaticRouteWithClassifier) { final IpAddDelRoute request = factory.createIpv6SimpleHopRequest(false, ROUTE_PROTOCOL_NAME, ipv6StaticRouteWithClassifier.getAugmentation(StaticRoutes1.class).getIpv6().getRoute().get(0), @@ -83,7 +79,9 @@ public class SimpleHopRequestFactoryIpv6Test } @Test - public void testIpv6WithoutClassifier() { + public void testIpv6WithoutClassifier( + @InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithoutClassifier.json", id = STATIC_ROUTE_PATH) + StaticRoutes ipv6StaticRouteWithoutClassifier) { final IpAddDelRoute request = factory.createIpv6SimpleHopRequest(false, ROUTE_PROTOCOL_NAME, ipv6StaticRouteWithoutClassifier.getAugmentation(StaticRoutes1.class).getIpv6().getRoute() @@ -93,4 +91,17 @@ public class SimpleHopRequestFactoryIpv6Test assertEquals(desiredFlaglessResult(0, 1, 0, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64, Ipv6RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 1, 0, 0, 0), request); } + + @Test + public void testIpv6WithoutRouteAttrs(@InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json", id = STATIC_ROUTE_PATH) + StaticRoutes ipv6StaticRouteWithoutRouteAttrs) { + final IpAddDelRoute request = + factory.createIpv6SimpleHopRequest(false, ROUTE_PROTOCOL_NAME, + ipv6StaticRouteWithoutRouteAttrs.getAugmentation(StaticRoutes1.class).getIpv6().getRoute() + .get(0), + mappingContext); + + assertEquals(desiredFlaglessResult(0, 1, 0, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64, + Ipv6RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 1, 0, 0, 0), request); + } } diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java index dd93de59a..253a1b1a9 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java @@ -65,7 +65,7 @@ public class SpecialNextHopRequestFactoryIpv4Test @Test public void testIpv4WithClassifierBlackhole( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv4SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, @@ -76,7 +76,7 @@ public class SpecialNextHopRequestFactoryIpv4Test @Test public void testIpv4WithClassifierReceive( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteReceive.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteReceive.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv4SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Receive); @@ -86,7 +86,7 @@ public class SpecialNextHopRequestFactoryIpv4Test @Test public void testIpv4WithClassifierUnreach( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteUnreachable.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteUnreachable.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv4SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Unreachable); @@ -96,7 +96,7 @@ public class SpecialNextHopRequestFactoryIpv4Test @Test public void testIpv4WithClassifierProhibited( - @InjectTestData(resourcePath = "/ipv4/specialHopRouteProhibited.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteProhibited.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv4SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Prohibit); diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java index b129eef59..d5f504094 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java @@ -63,7 +63,7 @@ public class SpecialNextHopRequestFactoryIpv6Test @Test public void testIpv6Blackhole( - @InjectTestData(resourcePath = "/ipv6/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv6SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Blackhole); @@ -74,7 +74,7 @@ public class SpecialNextHopRequestFactoryIpv6Test @Test public void testIpv6Receive( - @InjectTestData(resourcePath = "/ipv6/specialHopRouteReceive.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteReceive.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv6SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Receive); @@ -84,7 +84,7 @@ public class SpecialNextHopRequestFactoryIpv6Test @Test public void testIpv6Unreach( - @InjectTestData(resourcePath = "/ipv6/specialHopRouteUnreachable.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteUnreachable.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv6SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Unreachable); @@ -94,7 +94,7 @@ public class SpecialNextHopRequestFactoryIpv6Test @Test public void testIpv6Prohibited( - @InjectTestData(resourcePath = "/ipv6/specialHopRouteProhibited.json", id = STATIC_ROUTE_PATH) + @InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteProhibited.json", id = STATIC_ROUTE_PATH) StaticRoutes routes) { final IpAddDelRoute request = factory.createIpv6SpecialHopRequest(true, extractSingleRoute(routes, 1L), mappingContext, Prohibit); |