Merge "ITM Tep Auto Config Unit test using Guice."
[genius.git] / itm / itm-impl / src / test / java / org / opendaylight / genius / itm / tests / xtend / ExpectedTransportZoneObjects.xtend
1 /*
2  * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.genius.itm.tests.xtend;
10
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
19 import org.opendaylight.genius.itm.tests.ItmTestConstants;
20 import org.opendaylight.genius.itm.globals.ITMConstants;
21
22 import static extension org.opendaylight.mdsal.binding.testutils.XtendBuilderExtensions.operator_doubleGreaterThan
23
24 class ExpectedTransportZoneObjects {
25
26     static def newTransportZone() {
27         new TransportZoneBuilder >> [
28             zoneName = "TZA"
29             tunnelType = TunnelTypeVxlan
30             subnets = #[
31                 new SubnetsBuilder >> [
32                 gatewayIp = new IpAddress( new Ipv4Address(ITMConstants.DUMMY_GATEWAY_IP) )
33                 prefix = new IpPrefix( new Ipv4Prefix(ITMConstants.DUMMY_PREFIX) )
34                 vlanId = ITMConstants.DUMMY_VLANID
35
36                 vteps = #[
37                         new VtepsBuilder >> [
38                             dpnId = ItmTestConstants.INT_DEF_BR_DPID
39                             ipAddress = new IpAddress( new Ipv4Address(ItmTestConstants.NB_TZ_TEP_IP) )
40                             portname = ITMConstants.DUMMY_PORT
41                         ]
42                     ]
43                 ]
44             ]
45         ]
46     }
47
48     static def updatedTransportZone() {
49             new TransportZoneBuilder >> [
50                 zoneName = "TZA"
51                 tunnelType = TunnelTypeVxlan
52                 subnets = #[
53                     new SubnetsBuilder >> [
54                     gatewayIp = new IpAddress( new Ipv4Address(ITMConstants.DUMMY_GATEWAY_IP) )
55                     prefix = new IpPrefix( new Ipv4Prefix(ITMConstants.DUMMY_PREFIX) )
56                     vlanId = ITMConstants.DUMMY_VLANID
57
58                     vteps = #[
59                             new VtepsBuilder >> [
60                                 dpnId = ItmTestConstants.INT_DEF_BR_DPID
61                                 ipAddress = new IpAddress( new Ipv4Address(ItmTestConstants.DEF_TZ_TEP_IP) )
62                                 portname = ITMConstants.DUMMY_PORT
63                             ]
64                     ]
65                 ]
66             ]
67         ]
68     }
69
70 }