Unit tests for ofoverlay
[groupbasedpolicy.git] / renderers / ofoverlay / src / test / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / endpoint / OfOverlayL3NatAugTest.java
1 /*\r
2  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.\r
3  *\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
7  */\r
8 \r
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.endpoint;\r
10 \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
14 \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
26 \r
27 public class OfOverlayL3NatAugTest {\r
28 \r
29     private OfOverlayL3NatAug ofOverlayL3NatAug;\r
30     private EpRendererAugmentationRegistry epRendererAugmentationRegistry;\r
31 \r
32     @Before\r
33     public void init() {\r
34         epRendererAugmentationRegistry = mock(EpRendererAugmentationRegistry.class);\r
35         ofOverlayL3NatAug = new OfOverlayL3NatAug(epRendererAugmentationRegistry);\r
36     }\r
37 \r
38     @Test\r
39     public void testConstructor() throws Exception {\r
40         OfOverlayL3NatAug other = new OfOverlayL3NatAug(epRendererAugmentationRegistry);\r
41         other.close();\r
42     }\r
43 \r
44     @Test\r
45     public void testBuildEndpointAugmentation() {\r
46         RegisterEndpointInput input = new RegisterEndpointInputBuilder().build();\r
47         // no op\r
48         assertNull(ofOverlayL3NatAug.buildEndpointAugmentation(input));\r
49     }\r
50 \r
51     @Test\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
59     }\r
60 \r
61     @Test\r
62     public void testBuildEndpointL3Augmentation_noAug() {\r
63         RegisterEndpointInput input = new RegisterEndpointInputBuilder().build();\r
64         assertNull(ofOverlayL3NatAug.buildEndpointL3Augmentation(input));\r
65     }\r
66 \r
67     @Test\r
68     public void testBuildL3PrefixEndpointAugmentation() {\r
69         RegisterL3PrefixEndpointInput input = new RegisterL3PrefixEndpointInputBuilder().build();\r
70         // no op\r
71 \r
72         assertNull(ofOverlayL3NatAug.buildL3PrefixEndpointAugmentation(input));\r
73     }\r
74 \r
75     @Test\r
76     public void testClose() {\r
77         //        fail("Not yet implemented");\r
78     }\r
79 \r
80 }\r