2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.endpoint;
\r
11 import static org.junit.Assert.assertNotNull;
\r
12 import static org.junit.Assert.assertNull;
\r
13 import static org.mockito.Mockito.mock;
\r
15 import org.junit.Before;
\r
16 import org.junit.Test;
\r
17 import org.opendaylight.groupbasedpolicy.api.EpRendererAugmentationRegistry;
\r
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
\r
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
\r
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterEndpointInput;
\r
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterEndpointInputBuilder;
\r
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterL3PrefixEndpointInput;
\r
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterL3PrefixEndpointInputBuilder;
\r
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.l3endpoint.rev151217.NatAddressInput;
\r
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.l3endpoint.rev151217.NatAddressInputBuilder;
\r
27 public class OfOverlayL3NatAugTest {
\r
29 private OfOverlayL3NatAug ofOverlayL3NatAug;
\r
30 private EpRendererAugmentationRegistry epRendererAugmentationRegistry;
\r
33 public void init() {
\r
34 epRendererAugmentationRegistry = mock(EpRendererAugmentationRegistry.class);
\r
35 ofOverlayL3NatAug = new OfOverlayL3NatAug(epRendererAugmentationRegistry);
\r
39 public void testConstructor() throws Exception {
\r
40 OfOverlayL3NatAug other = new OfOverlayL3NatAug(epRendererAugmentationRegistry);
\r
45 public void testBuildEndpointAugmentation() {
\r
46 RegisterEndpointInput input = new RegisterEndpointInputBuilder().build();
\r
48 assertNull(ofOverlayL3NatAug.buildEndpointAugmentation(input));
\r
52 public void testBuildEndpointL3Augmentation() {
\r
53 NatAddressInput natAddressInput = new NatAddressInputBuilder().setNatAddress(
\r
54 new IpAddress(new Ipv4Address("10.0.0.2"))).build();
\r
55 RegisterEndpointInput input =
\r
56 new RegisterEndpointInputBuilder().addAugmentation(NatAddressInput.class,
\r
57 natAddressInput).build();
\r
58 assertNotNull(ofOverlayL3NatAug.buildEndpointL3Augmentation(input));
\r
62 public void testBuildEndpointL3Augmentation_noAug() {
\r
63 RegisterEndpointInput input = new RegisterEndpointInputBuilder().build();
\r
64 assertNull(ofOverlayL3NatAug.buildEndpointL3Augmentation(input));
\r
68 public void testBuildL3PrefixEndpointAugmentation() {
\r
69 RegisterL3PrefixEndpointInput input = new RegisterL3PrefixEndpointInputBuilder().build();
\r
72 assertNull(ofOverlayL3NatAug.buildL3PrefixEndpointAugmentation(input));
\r
76 public void testClose() {
\r
77 // fail("Not yet implemented");
\r