Migrate to simplified addAugmentation() method
[genius.git] / interfacemanager / interfacemanager-impl / src / test / java / org / opendaylight / genius / interfacemanager / test / xtend / ExpectedTerminationPoint.xtend
1 /*
2  * Copyright (c) 2016, 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 package org.opendaylight.genius.interfacemanager.test.xtend
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeVxlan
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdBuilder
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIdsBuilder
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId
16 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder
17
18 import static extension org.opendaylight.mdsal.binding.testutils.XtendBuilderExtensions.operator_doubleGreaterThan
19
20 class ExpectedTerminationPoint {
21
22     static def newTerminationPoint() {
23         new TerminationPointBuilder >> [
24             tpId = new TpId("tun414a856a7a4")
25             addAugmentation(new OvsdbTerminationPointAugmentationBuilder >> [
26                 interfaceType = InterfaceTypeVxlan
27                 name = "tun414a856a7a4"
28                 options = #[
29                     new OptionsBuilder >> [
30                         option = "key"
31                         value = "flow"
32                     ],
33                     new OptionsBuilder >> [
34                         option = "local_ip"
35                         value = "2.2.2.2"
36                     ],
37                     new OptionsBuilder >> [
38                         option = "remote_ip"
39                         value = "1.1.1.1"
40                     ]
41                 ]
42             ])
43         ]
44
45     }
46
47     static def newBfdEnabledTerminationPoint() {
48     new TerminationPointBuilder >> [
49         tpId = new TpId("tun414a856a7a4")
50         addAugmentation(new OvsdbTerminationPointAugmentationBuilder >> [
51             interfaceBfd = #[
52                 new InterfaceBfdBuilder >> [
53                     bfdKey = "forwarding_if_rx"
54                     bfdValue = "true"
55                 ],
56                 new InterfaceBfdBuilder >> [
57                     bfdKey = "enable"
58                     bfdValue = "true"
59                 ],
60                 new InterfaceBfdBuilder >> [
61                     bfdKey = "min_tx"
62                     bfdValue = "10000"
63                 ]
64             ]
65             interfaceType = InterfaceTypeVxlan
66             name = "tun414a856a7a4"
67             options = #[
68                 new OptionsBuilder >> [
69                     option = "key"
70                     value = "flow"
71                 ],
72                 new OptionsBuilder >> [
73                     option = "local_ip"
74                     value = "2.2.2.2"
75                 ],
76                 new OptionsBuilder >> [
77                     option = "remote_ip"
78                     value = "1.1.1.1"
79                 ]
80             ]
81         ])
82     ]
83     }
84
85     static def newOvsdbTerminationPointAugmentation() {
86         new OvsdbTerminationPointAugmentationBuilder >> [
87             interfaceExternalIds = #[
88                 new InterfaceExternalIdsBuilder >> [
89                     externalIdKey = "iface-id"
90                     externalIdValue = "23701c04-7e58-4c65-9425-78a80d49a218"
91                 ]
92             ]
93             name = "tap23701c04-7e"
94         ]
95     }
96
97     static def newTerminationPointList() {
98         #[
99             new OvsdbTerminationPointAugmentationBuilder >> [
100                 interfaceType = InterfaceTypeVxlan
101                 name = "tun414a856a7a4"
102             ]
103         ]
104     }
105 }