コード例 #1
0
  @Test
  public void testParseCompleteWithTwoRoute() throws Exception {
    AddressFamilyRoutingConfiguration result =
        parser.parseConfiguration(config.configurationAt("AddressFamily(1)"));

    Assert.assertEquals(AddressFamily.IPv4, result.getKey().getAddressFamily());
    Assert.assertEquals(
        SubsequentAddressFamily.NLRI_UNICAST_FORWARDING,
        result.getKey().getSubsequentAddressFamily());

    Iterator<RouteConfiguration> it = result.getRoutes().iterator();

    Assert.assertTrue(it.hasNext());

    RouteConfiguration route = it.next();

    Assert.assertEquals(
        new NetworkLayerReachabilityInformation(
            24, new byte[] {(byte) 0xc0, (byte) 0xa8, (byte) 0x01}),
        route.getNlri());

    Assert.assertTrue(it.hasNext());
    route = it.next();

    Assert.assertEquals(
        new NetworkLayerReachabilityInformation(
            24, new byte[] {(byte) 0xc0, (byte) 0xa8, (byte) 0x02}),
        route.getNlri());

    Assert.assertFalse(it.hasNext());
  }
コード例 #2
0
 @Test(expected = ConfigurationException.class)
 public void testMissingSubsequentAddressFamily() throws Exception {
   parser.parseConfiguration(config.configurationAt("AddressFamily(3)"));
 }