diff options
Diffstat (limited to 'routing/routing-impl/src/test')
30 files changed, 176 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); diff --git a/routing/routing-impl/src/test/resources/ipv4/multiHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json index 99c987e03..99c987e03 100644 --- a/routing/routing-impl/src/test/resources/ipv4/multiHopRouteWithClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json new file mode 100644 index 000000000..71cefa6cb --- /dev/null +++ b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json @@ -0,0 +1,28 @@ +{ + "static-routes": { + "ipv4": { + "route": [ + { + "id": 1, + "destination-prefix": "192.168.2.1/24", + "next-hop-list": { + "next-hop": [ + { + "id": "1", + "address": "192.168.2.1", + "outgoing-interface": "iface", + "weight": "2" + }, + { + "id": "2", + "address": "192.168.2.2", + "outgoing-interface": "iface", + "weight": "3" + } + ] + } + } + ] + } + } +}
\ No newline at end of file diff --git a/routing/routing-impl/src/test/resources/ipv4/multiHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json index d4d4a0693..d4d4a0693 100644 --- a/routing/routing-impl/src/test/resources/ipv4/multiHopRouteWithoutClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json new file mode 100644 index 000000000..d987bb6b1 --- /dev/null +++ b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json @@ -0,0 +1,14 @@ +{ + "static-routes": { + "ipv4": { + "route": [ + { + "id": 1, + "destination-prefix": "192.168.2.1/24", + "next-hop": "192.168.2.2", + "outgoing-interface": "iface" + } + ] + } + } +} diff --git a/routing/routing-impl/src/test/resources/ipv4/simpleHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json index d00d9a06a..d00d9a06a 100644 --- a/routing/routing-impl/src/test/resources/ipv4/simpleHopRouteWithClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv4/simpleHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json index 0ef7cf765..0ef7cf765 100644 --- a/routing/routing-impl/src/test/resources/ipv4/simpleHopRouteWithoutClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteBlackhole.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json index b2ddc238b..b2ddc238b 100644 --- a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteBlackhole.json +++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json diff --git a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteProhibited.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json index fe9faf44c..fe9faf44c 100644 --- a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteProhibited.json +++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json diff --git a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteReceive.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json index c967aa542..c967aa542 100644 --- a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteReceive.json +++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json diff --git a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteUnreachable.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json index bae467fbd..bae467fbd 100644 --- a/routing/routing-impl/src/test/resources/ipv4/specialHopRouteUnreachable.json +++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json diff --git a/routing/routing-impl/src/test/resources/ipv6/multiHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json index c8b1e208e..c8b1e208e 100644 --- a/routing/routing-impl/src/test/resources/ipv6/multiHopRouteWithClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv6/multiHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json index 2e44ebcf5..2e44ebcf5 100644 --- a/routing/routing-impl/src/test/resources/ipv6/multiHopRouteWithoutClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json new file mode 100644 index 000000000..f85b1b716 --- /dev/null +++ b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json @@ -0,0 +1,28 @@ +{ + "static-routes": { + "ipv6": { + "route": [ + { + "id": 1, + "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64", + "next-hop-list": { + "next-hop": [ + { + "id": "1", + "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002", + "outgoing-interface": "iface", + "weight": "2" + }, + { + "id": "2", + "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002", + "outgoing-interface": "iface", + "weight": "2" + } + ] + } + } + ] + } + } +}
\ No newline at end of file diff --git a/routing/routing-impl/src/test/resources/ipv6/simpleHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json index c011a8d01..c011a8d01 100644 --- a/routing/routing-impl/src/test/resources/ipv6/simpleHopRouteWithClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv6/simpleHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json index 1cb663ca7..1cb663ca7 100644 --- a/routing/routing-impl/src/test/resources/ipv6/simpleHopRouteWithoutClassifier.json +++ b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json diff --git a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json new file mode 100644 index 000000000..a735c193c --- /dev/null +++ b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json @@ -0,0 +1,14 @@ +{ + "static-routes": { + "ipv6": { + "route": [ + { + "id": 1, + "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64", + "next-hop": "2001:0db8:0a0b:12f0:0000:0000:0000:0002", + "outgoing-interface": "iface" + } + ] + } + } +}
\ No newline at end of file diff --git a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteBlackhole.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json index 1cc319107..1cc319107 100644 --- a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteBlackhole.json +++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json diff --git a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteProhibited.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json index d69e817d7..d69e817d7 100644 --- a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteProhibited.json +++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json diff --git a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteReceive.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json index 50d447de0..50d447de0 100644 --- a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteReceive.json +++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json diff --git a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteUnreachable.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json index c874549d1..c874549d1 100644 --- a/routing/routing-impl/src/test/resources/ipv6/specialHopRouteUnreachable.json +++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json |