2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
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
8 package org.opendaylight.netvirt.elan.l2gw.nodehandlertest;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
13 import com.google.common.collect.Sets;
14 import java.util.ArrayList;
15 import java.util.HashSet;
16 import java.util.List;
18 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
19 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
20 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
21 import org.opendaylight.netvirt.elan.l2gw.ha.commands.LocalMcastCmd;
22 import org.opendaylight.netvirt.elan.l2gw.ha.commands.LocalUcastCmd;
23 import org.opendaylight.netvirt.elan.l2gw.ha.commands.LogicalSwitchesCmd;
24 import org.opendaylight.netvirt.elan.l2gw.ha.commands.RemoteMcastCmd;
25 import org.opendaylight.netvirt.elan.l2gw.ha.commands.RemoteUcastCmd;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalRef;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindings;
37 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
38 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
39 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
40 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
41 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
46 * Created by ekvsver on 8/6/2016.
48 public final class TestComparators {
49 static Logger LOG = LoggerFactory.getLogger(TestComparators.class);
51 private TestComparators() { }
53 public static void verifySwitches(Node globalOpNode, Node psOpNode) {
54 for (Switches switches : globalOpNode.getAugmentation(HwvtepGlobalAugmentation.class).getSwitches()) {
55 String switchValue = switches.getSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
56 assertEquals("Switch Name should be equal", switchValue, psOpNode.getNodeId().getValue());
60 public static void compareLogicalSwitches(Node src, Node dst, InstanceIdentifier<Node> nodePath) {
61 LogicalSwitchesCmd cmd = new LogicalSwitchesCmd();
62 HwvtepGlobalAugmentation d1Aug = src.getAugmentation(HwvtepGlobalAugmentation.class);
63 HwvtepGlobalAugmentation haAug = dst.getAugmentation(HwvtepGlobalAugmentation.class);
65 List<LogicalSwitches> d1Values =
66 d1Aug.getLogicalSwitches() != null ? d1Aug.getLogicalSwitches() : new ArrayList<>();
67 List<LogicalSwitches> result1 = cmd.transform(nodePath, d1Values);
68 List<LogicalSwitches> result2 = cmd.transform(nodePath, haAug.getLogicalSwitches());
70 Set<LogicalSwitches> set1 = Sets.newHashSet(result1);
71 Set<LogicalSwitches> set2 = Sets.newHashSet(result2);
72 assertEquals("should have equal logical switches", 0, Sets.symmetricDifference(set1, set2).size());
76 public static void compareLogicalSwitches(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
77 LogicalSwitchesCmd cmd = new LogicalSwitchesCmd();
78 HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
79 HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
80 HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
82 List<LogicalSwitches> d1Values =
83 d1Aug.getLogicalSwitches() != null ? d1Aug.getLogicalSwitches() : new ArrayList<>();
84 List<LogicalSwitches> result1 = cmd.transform(nodePath, d1Values);
85 List<LogicalSwitches> d2Values =
86 d2Aug.getLogicalSwitches() != null ? d2Aug.getLogicalSwitches() : new ArrayList<>();
87 List<LogicalSwitches> result2 = cmd.transform(nodePath, d2Values);
88 //Merge data of both d1 and d2 logical switch info should be same as ha
89 Set<LogicalSwitches> set1 = new HashSet<>();
92 List<LogicalSwitches> result = cmd.transform(nodePath, haAug.getLogicalSwitches());
93 Set<LogicalSwitches> set2 = Sets.newHashSet(result);
94 assertEquals("should have equal logical switches", 0, Sets.symmetricDifference(set1, set2).size());
98 public static void compareRemoteUcastMacs(Node src, Node dst, InstanceIdentifier<Node> nodePath) {
99 RemoteUcastCmd cmd = new RemoteUcastCmd();
100 HwvtepGlobalAugmentation d1Aug = src.getAugmentation(HwvtepGlobalAugmentation.class);
101 HwvtepGlobalAugmentation haAug = dst.getAugmentation(HwvtepGlobalAugmentation.class);
102 List<RemoteUcastMacs> d1Values =
103 d1Aug.getRemoteUcastMacs() != null ? d1Aug.getRemoteUcastMacs() : new ArrayList<>();
104 List<RemoteUcastMacs> result1 = cmd.transform(nodePath, d1Values);
105 List<RemoteUcastMacs> result2 = cmd.transform(nodePath, haAug.getRemoteUcastMacs());
107 RemoteUcastMacs mac1 = result1.get(0);
108 RemoteUcastMacs mac2 = result2.get(0);
109 LOG.info("Mac1{} ", mac1);
110 LOG.info("Mac2{}", mac2);
111 Set<RemoteUcastMacs> set1 = Sets.newHashSet(result1);
112 Set<RemoteUcastMacs> set2 = Sets.newHashSet(result2);
113 assertEquals("should have equal remote ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
116 public static void compareRemoteUcastMacs(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
117 RemoteUcastCmd cmd = new RemoteUcastCmd();
118 HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
119 HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
120 HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
122 List<RemoteUcastMacs> d1Values =
123 d1Aug.getRemoteUcastMacs() != null ? d1Aug.getRemoteUcastMacs() : new ArrayList<>();
124 List<RemoteUcastMacs> result1 = cmd.transform(nodePath, d1Values);
126 List<RemoteUcastMacs> d2Values =
127 d2Aug.getRemoteUcastMacs() != null ? d2Aug.getRemoteUcastMacs() : new ArrayList<>();
128 List<RemoteUcastMacs> result2 = cmd.transform(nodePath, d2Values);
129 List<RemoteUcastMacs> ruMacList = new ArrayList<>();
130 ruMacList.addAll(result1);
131 ruMacList.addAll(result2);
132 List<RemoteUcastMacs> result = cmd.transform(nodePath, haAug.getRemoteUcastMacs());
134 Set<RemoteUcastMacs> set1 = Sets.newHashSet(ruMacList);
135 Set<RemoteUcastMacs> set2 = Sets.newHashSet(result);
136 assertEquals("should have equal remote ucast macs ", 0, Sets.difference(set1, set2).size());
140 public static void compareRemoteMcastMacs(Node src, Node dst, InstanceIdentifier<Node> nodePath) {
141 RemoteMcastCmd cmd = new RemoteMcastCmd();
142 HwvtepGlobalAugmentation d1Aug = src.getAugmentation(HwvtepGlobalAugmentation.class);
143 HwvtepGlobalAugmentation haAug = dst.getAugmentation(HwvtepGlobalAugmentation.class);
144 List<RemoteMcastMacs> d1Values =
145 d1Aug.getRemoteMcastMacs() != null ? d1Aug.getRemoteMcastMacs() : new ArrayList<>();
146 List<RemoteMcastMacs> result1 = cmd.transform(nodePath, d1Values);
147 List<RemoteMcastMacs> result2 = cmd.transform(nodePath, haAug.getRemoteMcastMacs());
149 Set<RemoteMcastMacs> set1 = Sets.newHashSet(result1);
150 Set<RemoteMcastMacs> set2 = Sets.newHashSet(result2);
151 assertEquals("should have equal remote ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
155 public static void compareRemoteMcastMacs(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
156 RemoteMcastCmd cmd = new RemoteMcastCmd();
157 HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
158 HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
159 HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
161 List<RemoteMcastMacs> d1Values =
162 d1Aug.getRemoteMcastMacs() != null ? d1Aug.getRemoteMcastMacs() : new ArrayList<>();
163 List<RemoteMcastMacs> result1 = cmd.transform(nodePath, d1Values);
165 List<RemoteMcastMacs> d2Values =
166 d2Aug.getRemoteMcastMacs() != null ? d2Aug.getRemoteMcastMacs() : new ArrayList<>();
167 List<RemoteMcastMacs> result2 = cmd.transform(nodePath, d2Values);
168 List<RemoteMcastMacs> rmMacList = new ArrayList<>();
169 rmMacList.addAll(result1);
170 rmMacList.addAll(result2);
172 List<RemoteMcastMacs> result = cmd.transform(nodePath, haAug.getRemoteMcastMacs());
174 Set<RemoteMcastMacs> set1 = Sets.newHashSet(rmMacList);
175 Set<RemoteMcastMacs> set2 = Sets.newHashSet(result);
176 assertEquals("should have equal remote Mcast macs ", 0, Sets.symmetricDifference(set1, set2).size());
180 public static void compareLocalUcastMacs(Node src, Node dst, InstanceIdentifier<Node> nodePath) {
181 LocalUcastCmd cmd = new LocalUcastCmd();
182 HwvtepGlobalAugmentation d1Aug = src.getAugmentation(HwvtepGlobalAugmentation.class);
183 HwvtepGlobalAugmentation haAug = dst.getAugmentation(HwvtepGlobalAugmentation.class);
184 List<LocalUcastMacs> d1Values =
185 d1Aug.getLocalUcastMacs() != null ? d1Aug.getLocalUcastMacs() : new ArrayList<>();
186 List<LocalUcastMacs> result1 = cmd.transform(nodePath, d1Values);
187 List<LocalUcastMacs> result2 = cmd.transform(nodePath, haAug.getLocalUcastMacs());
189 Set<LocalUcastMacs> set1 = Sets.newHashSet(result1);
190 Set<LocalUcastMacs> set2 = Sets.newHashSet(result2);
191 assertEquals("should have equal remote ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
195 public static void compareLocalUcastMacs(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
196 LocalUcastCmd cmd = new LocalUcastCmd();
197 HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
198 HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
199 HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
201 List<LocalUcastMacs> d1Values =
202 d1Aug.getLocalUcastMacs() != null ? d1Aug.getLocalUcastMacs() : new ArrayList<>();
203 List<LocalUcastMacs> result1 = cmd.transform(nodePath, d1Values);
204 List<LocalUcastMacs> d2Values =
205 d2Aug.getLocalUcastMacs() != null ? d2Aug.getLocalUcastMacs() : new ArrayList<>();
206 List<LocalUcastMacs> result2 = cmd.transform(nodePath, d2Values);
208 List<LocalUcastMacs> result = cmd.transform(nodePath, haAug.getLocalUcastMacs());
210 List<LocalUcastMacs> luMacList = new ArrayList<>();
211 luMacList.addAll(result1);
212 luMacList.addAll(result2);
214 Set<LocalUcastMacs> set1 = Sets.newHashSet(luMacList);
215 Set<LocalUcastMacs> set2 = Sets.newHashSet(result);
216 assertEquals("should have equal Local ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
219 public static void compareLocalMcastMacs(Node src, Node dst, InstanceIdentifier<Node> nodePath) {
220 LocalMcastCmd cmd = new LocalMcastCmd();
221 HwvtepGlobalAugmentation d1Aug = src.getAugmentation(HwvtepGlobalAugmentation.class);
222 HwvtepGlobalAugmentation haAug = dst.getAugmentation(HwvtepGlobalAugmentation.class);
223 List<LocalMcastMacs> d1Values =
224 d1Aug.getLocalUcastMacs() != null ? d1Aug.getLocalMcastMacs() : new ArrayList<>();
225 List<LocalMcastMacs> result1 = cmd.transform(nodePath, d1Values);
226 List<LocalMcastMacs> result2 = cmd.transform(nodePath, haAug.getLocalMcastMacs());
228 Set<LocalMcastMacs> set1 = Sets.newHashSet(result1);
229 Set<LocalMcastMacs> set2 = Sets.newHashSet(result2);
230 assertEquals("should have equal remote ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
234 public static void compareLocalMcastMacs(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
235 LocalMcastCmd cmd = new LocalMcastCmd();
236 HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
237 HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
238 HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
239 List<LocalMcastMacs> d1Values =
240 d1Aug.getLocalUcastMacs() != null ? d1Aug.getLocalMcastMacs() : new ArrayList<>();
241 List<LocalMcastMacs> result1 = cmd.transform(nodePath, d1Values);
242 List<LocalMcastMacs> d2Values =
243 d2Aug.getLocalUcastMacs() != null ? d2Aug.getLocalMcastMacs() : new ArrayList<>();
244 List<LocalMcastMacs> result2 = cmd.transform(nodePath, d2Values);
246 List<LocalMcastMacs> result = cmd.transform(nodePath, haAug.getLocalMcastMacs());
248 List<LocalMcastMacs> lmMacList = new ArrayList<>();
249 lmMacList.addAll(result1);
250 lmMacList.addAll(result2);
252 Set<LocalMcastMacs> set1 = Sets.newHashSet(lmMacList);
253 Set<LocalMcastMacs> set2 = Sets.newHashSet(result);
254 assertEquals("should have equal Local Mcast macs ", 0, Sets.symmetricDifference(set1, set2).size());
258 public static void comparePhysicalSwitches(Node d1ps, Node d2ps, Node haps, InstanceIdentifier<Node> d1psnodePath,
259 InstanceIdentifier<Node> d2psnodePath,
260 InstanceIdentifier<Node> haPsnodePath,
261 ReadWriteTransaction readWriteTransaction, String switchName,
262 Node d1, Node d2, Node ha) throws ReadFailedException {
263 PhysicalSwitchAugmentation d1PsAug = d1ps.getAugmentation(PhysicalSwitchAugmentation.class);
264 PhysicalSwitchAugmentation d2PsAug = d2ps.getAugmentation(PhysicalSwitchAugmentation.class);
265 PhysicalSwitchAugmentation haPsAug = haps.getAugmentation(PhysicalSwitchAugmentation.class);
267 HwvtepGlobalRef managerd1Ps = d1PsAug.getManagedBy();
268 assertEquals("Hwvtep node name should be same", d1PsAug.getHwvtepNodeName().getValue(),
269 haPsAug.getHwvtepNodeName().getValue());
270 assertEquals("Managers should be equal for d1 ", d1ps.getNodeId().getValue(),
271 managerd1Ps.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
272 HwvtepGlobalRef managerd2Ps = d2PsAug.getManagedBy();
273 assertEquals("Hwvtep node name should be same", d2PsAug.getHwvtepNodeName().getValue(),
274 haPsAug.getHwvtepNodeName().getValue());
275 assertEquals("Managers should be equal for d2 ", d2ps.getNodeId().getValue(),
276 managerd2Ps.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
277 HwvtepGlobalRef managerhaPs = haPsAug.getManagedBy();
278 assertEquals("Managers should be equal for ha ", haps.getNodeId().getValue(),
279 managerhaPs.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
281 assertEquals("Should have equal number TunnelIps",
282 d1PsAug.getTunnelIps().size(), haPsAug.getTunnelIps().size());
283 assertEquals("Should have equal number TunnelIps",
284 d2PsAug.getTunnelIps().size(), haPsAug.getTunnelIps().size());
285 if (d1PsAug.getTunnelIps().size() == haPsAug.getTunnelIps().size()
286 && d2PsAug.getTunnelIps().size() == haPsAug.getTunnelIps().size()) {
287 assertTrue(d1PsAug.getTunnelIps().containsAll(haPsAug.getTunnelIps()));
288 assertTrue(d2PsAug.getTunnelIps().containsAll(haPsAug.getTunnelIps()));
291 //Compare Termination point
292 assertTerminationPoint(DataProvider.getPortNameListD1(),
293 d1psnodePath, haPsnodePath, readWriteTransaction, d1, ha);
294 assertTerminationPoint(DataProvider.getPortNameListD2(),
295 d2psnodePath, haPsnodePath, readWriteTransaction, d2, ha);
298 public static void comparePhysicalSwitches(Node d1ps, Node haps, InstanceIdentifier<Node> d1psnodePath,
299 InstanceIdentifier<Node> haPsnodePath,
300 ReadWriteTransaction readWriteTransaction,
301 String switchName, Node d1, Node ha) throws ReadFailedException {
302 //Compare Physical Augmentation data
303 PhysicalSwitchAugmentation d1PsAug = d1ps.getAugmentation(PhysicalSwitchAugmentation.class);
304 PhysicalSwitchAugmentation haPsAug = haps.getAugmentation(PhysicalSwitchAugmentation.class);
306 HwvtepGlobalRef managerd1Ps = d1PsAug.getManagedBy();
307 assertEquals("Hwvtep node name should be same", d1PsAug.getHwvtepNodeName().getValue(),
308 haPsAug.getHwvtepNodeName().getValue());
309 assertEquals("Managers should be equal for d1 ", d1ps.getNodeId().getValue(),
310 managerd1Ps.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
311 HwvtepGlobalRef managerhaPs = haPsAug.getManagedBy();
312 assertEquals("Managers should be equal for ha ", haps.getNodeId().getValue(),
313 managerhaPs.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
315 assertEquals("Should have equal number TunnelIps", d1PsAug.getTunnelIps().size(),
316 haPsAug.getTunnelIps().size());
317 if (d1PsAug.getTunnelIps().size() == haPsAug.getTunnelIps().size()) {
318 assertTrue(d1PsAug.getTunnelIps().containsAll(haPsAug.getTunnelIps()));
321 //Compare Termination point
322 assertTerminationPoint(DataProvider.getPortNameListD1(), d1psnodePath, haPsnodePath,
323 readWriteTransaction, d1, ha);
326 public static void assertTerminationPoint(List<String> terminationPointNames, InstanceIdentifier<Node> d1ps,
327 InstanceIdentifier<Node> haPsa, ReadWriteTransaction readWriteTransaction,
328 Node nodeD, Node nodeHa) throws ReadFailedException {
329 for (String portName : terminationPointNames) {
330 InstanceIdentifier<TerminationPoint> tpPathd = d1ps.child(TerminationPoint.class,
331 new TerminationPointKey(new TpId(portName)));
332 TerminationPoint tpNoded = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathd)
334 HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationD =
335 tpNoded.getAugmentation(HwvtepPhysicalPortAugmentation.class);
337 InstanceIdentifier<TerminationPoint> tpPathha = haPsa.child(TerminationPoint.class,
338 new TerminationPointKey(new TpId(portName)));
339 TerminationPoint tpNodeha = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathha)
341 HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationHa =
342 tpNodeha.getAugmentation(HwvtepPhysicalPortAugmentation.class);
343 assertEquals("Termination point hwvtep-node-name should be same",
344 hwvtepPhysicalPortAugmentationD.getHwvtepNodeName(),
345 hwvtepPhysicalPortAugmentationHa.getHwvtepNodeName());
347 List<VlanBindings> vlanBindingsesD = hwvtepPhysicalPortAugmentationD.getVlanBindings();
348 List<VlanBindings> vlanBindingsesHa = hwvtepPhysicalPortAugmentationHa.getVlanBindings();
349 assertEquals("Size of VlanBindings should be same", vlanBindingsesD.size(), vlanBindingsesHa.size());
351 List<Integer> vlanKeysD = new ArrayList<>();
352 List<Integer> vlanKeysHa = new ArrayList<>();
353 String logicalSwitchRefD = new String();
354 String logicalSwitchRefHa = new String();
355 List<String> logicalSwitchNameD = new ArrayList<>();
356 List<String> logicalSwitchNameHa = new ArrayList<>();
357 if (vlanBindingsesD.size() == vlanBindingsesHa.size()) {
358 for (int i = 0; i < vlanBindingsesD.size(); i++) {
359 vlanKeysD.add(vlanBindingsesD.get(i).getVlanIdKey().getValue());
360 logicalSwitchRefD = vlanBindingsesD.get(i).getLogicalSwitchRef().getValue()
361 .firstKeyOf(Node.class).getNodeId().getValue();
362 logicalSwitchNameD.add(vlanBindingsesD.get(i).getLogicalSwitchRef().getValue()
363 .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
365 vlanKeysHa.add(vlanBindingsesHa.get(i).getVlanIdKey().getValue());
366 logicalSwitchRefHa = vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue()
367 .firstKeyOf(Node.class).getNodeId().getValue();
368 logicalSwitchNameHa.add(vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue()
369 .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
371 assertTrue(vlanKeysD.containsAll(vlanKeysHa));
372 assertTrue(logicalSwitchRefD.equals(nodeD.getNodeId().getValue()));
373 assertTrue(logicalSwitchRefHa.equals(nodeHa.getNodeId().getValue()));
374 assertTrue(logicalSwitchNameD.containsAll(logicalSwitchNameHa));