예제 #1
0
  @Test
  public void testTwoOutboundRouteFilteringConfiguration() throws Exception {
    Capabilities caps = parser.parseConfig(config.configurationAt("Capabilities(7)"));
    Iterator<Capability> capIt = caps.getRequiredCapabilities().iterator();

    Assert.assertTrue(capIt.hasNext());
    OutboundRouteFilteringCapability cap = (OutboundRouteFilteringCapability) capIt.next();
    Map<ORFType, ORFSendReceive> filters = cap.getFilters();
    Assert.assertEquals(AddressFamily.IPv4, cap.getAddressFamily());
    Assert.assertEquals(
        SubsequentAddressFamily.NLRI_UNICAST_FORWARDING, cap.getSubsequentAddressFamily());
    Assert.assertEquals(1, filters.size());
    Assert.assertTrue(filters.containsKey(ORFType.ADDRESS_PREFIX_BASED));
    Assert.assertEquals(ORFSendReceive.BOTH, filters.get(ORFType.ADDRESS_PREFIX_BASED));

    cap = (OutboundRouteFilteringCapability) capIt.next();
    filters = cap.getFilters();
    Assert.assertEquals(AddressFamily.IPv6, cap.getAddressFamily());
    Assert.assertEquals(
        SubsequentAddressFamily.NLRI_UNICAST_FORWARDING, cap.getSubsequentAddressFamily());
    Assert.assertEquals(1, filters.size());
    Assert.assertTrue(filters.containsKey(ORFType.ADDRESS_PREFIX_BASED));
    Assert.assertEquals(ORFSendReceive.BOTH, filters.get(ORFType.ADDRESS_PREFIX_BASED));

    Assert.assertFalse(capIt.hasNext());
  }
예제 #2
0
  @Test
  public void testOneRouteRefreshConfiguration() throws Exception {
    Capabilities caps = parser.parseConfig(config.configurationAt("Capabilities(3)"));
    Iterator<Capability> capIt = caps.getRequiredCapabilities().iterator();

    Assert.assertTrue(capIt.hasNext());
    Assert.assertEquals(RouteRefreshCapability.class, capIt.next().getClass());

    Assert.assertFalse(capIt.hasNext());
  }
예제 #3
0
  @Test
  public void testOneAS4Configuration() throws Exception {
    Capabilities caps = parser.parseConfig(config.configurationAt("Capabilities(1)"));
    Iterator<Capability> capIt = caps.getRequiredCapabilities().iterator();

    Assert.assertTrue(capIt.hasNext());
    AutonomousSystem4Capability cap = (AutonomousSystem4Capability) capIt.next();
    Assert.assertEquals(256, cap.getAutonomousSystem());
    Assert.assertFalse(capIt.hasNext());
  }
예제 #4
0
  @Test
  public void testOneMultiProtoclConfiguration() throws Exception {
    Capabilities caps = parser.parseConfig(config.configurationAt("Capabilities(4)"));
    Iterator<Capability> capIt = caps.getRequiredCapabilities().iterator();

    Assert.assertTrue(capIt.hasNext());
    MultiProtocolCapability cap = (MultiProtocolCapability) capIt.next();
    Assert.assertEquals(AddressFamily.IPv4, cap.getAfi());
    Assert.assertEquals(SubsequentAddressFamily.NLRI_UNICAST_FORWARDING, cap.getSafi());

    Assert.assertFalse(capIt.hasNext());
  }
예제 #5
0
  @Test
  public void testRequiredOneAS4OptionalTwoMultiProtoclConfiguration() throws Exception {
    Capabilities caps = parser.parseConfig(config.configurationAt("Capabilities(9)"));
    Iterator<Capability> capIt = caps.getRequiredCapabilities().iterator();

    Assert.assertTrue(capIt.hasNext());
    AutonomousSystem4Capability as4cap = (AutonomousSystem4Capability) capIt.next();
    Assert.assertEquals(256, as4cap.getAutonomousSystem());
    Assert.assertFalse(capIt.hasNext());

    capIt = caps.getOptionalCapabilities().iterator();
    Assert.assertTrue(capIt.hasNext());
    MultiProtocolCapability cap = (MultiProtocolCapability) capIt.next();
    Assert.assertEquals(AddressFamily.IPv4, cap.getAfi());
    Assert.assertEquals(SubsequentAddressFamily.NLRI_UNICAST_FORWARDING, cap.getSafi());

    Assert.assertTrue(capIt.hasNext());
    cap = (MultiProtocolCapability) capIt.next();
    Assert.assertEquals(AddressFamily.IPv6, cap.getAfi());
    Assert.assertEquals(SubsequentAddressFamily.NLRI_UNICAST_FORWARDING, cap.getSafi());

    Assert.assertFalse(capIt.hasNext());
  }
예제 #6
0
  @Test
  public void testEmptyConfiguration() throws Exception {
    Capabilities caps = parser.parseConfig(config.configurationAt("Capabilities(0)"));

    Assert.assertEquals(0, caps.getRequiredCapabilities().size());
  }