@Test public void testBuildRendererNetworkDomainAugmentation() { Gateways gateways = new GatewaysBuilder().setGateway(IP_ADDRESS) .setPrefixes(Collections.singletonList(new PrefixesBuilder().setPrefix(IP_PREFIX_2).build())) .build(); SubnetAugmentForwarding subnetAugmentForwarding = new SubnetAugmentForwardingBuilder().setSubnet(new SubnetBuilder().setIpPrefix(IP_PREFIX) .setGateways(Collections.singletonList(gateways)) .setVirtualRouterIp(IP_ADDRESS_2) .build()).build(); NetworkDomain networkDomain = new NetworkDomainBuilder() .setNetworkDomainType( org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.rev160427.NetworkDomain.class) .setNetworkDomainId(NET_DOMAIN) .addAugmentation(SubnetAugmentForwarding.class, subnetAugmentForwarding) .build(); Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> rendererNetworkDomainAugmentation = l2l3Augmentor.buildRendererNetworkDomainAugmentation(networkDomain); Assert.assertNotNull(rendererNetworkDomainAugmentation); Assert.assertEquals(SubnetAugmentRenderer.class, rendererNetworkDomainAugmentation.getKey()); Augmentation<RendererNetworkDomain> rendererNetDomainAug = rendererNetworkDomainAugmentation.getValue(); Assert.assertTrue(rendererNetDomainAug instanceof SubnetAugmentRenderer); SubnetAugmentRenderer subnetAugmentRenderer = (SubnetAugmentRenderer) rendererNetDomainAug; Assert.assertEquals(subnetAugmentForwarding.getSubnet(), subnetAugmentRenderer.getSubnet()); }
@Override public Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input) { SubnetAugmentForwarding subnetForwarding = input.getAugmentation(SubnetAugmentForwarding.class); if (subnetForwarding == null) { return null; } return new SimpleImmutableEntry<>(SubnetAugmentRenderer.class, new SubnetAugmentRendererBuilder(subnetForwarding).build()); }
L2L3NetworkDomainAugmentor implements NetworkDomainAugmentor, AutoCloseable { @Override public Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input) { SubnetAugmentForwarding subnetForwarding = input.getAugmentation(SubnetAugmentForwarding.class); if (subnetForwarding == null) { return null; } return new SimpleImmutableEntry<>(SubnetAugmentRenderer.class, new SubnetAugmentRendererBuilder(subnetForwarding).build()); } }
L2L3NetworkDomainAugmentor implements NetworkDomainAugmentor, AutoCloseable { @Override public Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input) { SubnetAugmentForwarding subnetForwarding = input.getAugmentation(SubnetAugmentForwarding.class); if (subnetForwarding == null) { return null; } return new SimpleImmutableEntry<>(SubnetAugmentRenderer.class, new SubnetAugmentRendererBuilder(subnetForwarding).build()); } L2L3NetworkDomainAugmentor(NetworkDomainAugmentorRegistry networkDomainAugmentorRegistry); }
L2L3NetworkDomainAugmentor implements NetworkDomainAugmentor, AutoCloseable { @Override public Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input) { SubnetAugmentForwarding subnetForwarding = input.getAugmentation(SubnetAugmentForwarding.class); if (subnetForwarding == null) { return null; } return new SimpleImmutableEntry<>(SubnetAugmentRenderer.class, new SubnetAugmentRendererBuilder(subnetForwarding).build()); } L2L3NetworkDomainAugmentor(NetworkDomainAugmentorRegistry networkDomainAugmentorRegistry); @Override Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input); @Override void close(); }
L2L3NetworkDomainAugmentor implements NetworkDomainAugmentor, AutoCloseable { @Override public Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input) { SubnetAugmentForwarding subnetForwarding = input.getAugmentation(SubnetAugmentForwarding.class); if (subnetForwarding == null) { return null; } return new SimpleImmutableEntry<>(SubnetAugmentRenderer.class, new SubnetAugmentRendererBuilder(subnetForwarding).build()); } L2L3NetworkDomainAugmentor(NetworkDomainAugmentorRegistry networkDomainAugmentorRegistry); @Override Entry<Class<? extends Augmentation<RendererNetworkDomain>>, Augmentation<RendererNetworkDomain>> buildRendererNetworkDomainAugmentation(@Nonnull NetworkDomain input); @Override void close();  }