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