Remove unused parameters
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / utils / L2GatewayConnectionUtils.java
1 /*
2  * Copyright (c) 2016 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.netvirt.elan.l2gw.utils;
10
11 import static org.opendaylight.netvirt.elan.utils.ElanUtils.isVxlanNetworkOrVxlanSegment;
12
13 import com.google.common.base.Optional;
14 import com.google.common.collect.Lists;
15 import com.google.common.util.concurrent.Futures;
16 import com.google.common.util.concurrent.MoreExecutors;
17 import com.google.common.util.concurrent.SettableFuture;
18 import java.util.ArrayList;
19 import java.util.Collections;
20 import java.util.List;
21 import java.util.Set;
22 import java.util.concurrent.CopyOnWriteArrayList;
23 import javax.annotation.Nonnull;
24 import javax.annotation.PreDestroy;
25 import javax.inject.Inject;
26 import javax.inject.Singleton;
27 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
28 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
29 import org.opendaylight.genius.mdsalutil.MDSALUtil;
30 import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
31 import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
32 import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
33 import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
34 import org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAOpClusteredListener;
35 import org.opendaylight.netvirt.elan.l2gw.jobs.AssociateHwvtepToElanJob;
36 import org.opendaylight.netvirt.elan.l2gw.jobs.DisAssociateHwvtepFromElanJob;
37 import org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepLogicalSwitchListener;
38 import org.opendaylight.netvirt.elan.l2gw.listeners.LocalUcastMacListener;
39 import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
40 import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
41 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayCache;
42 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
43 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.L2gatewayConnections;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnection;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.L2gateways;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gateway;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gatewayKey;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
55 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
56 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
57 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
58 import org.slf4j.Logger;
59 import org.slf4j.LoggerFactory;
60
61 @Singleton
62 public class L2GatewayConnectionUtils implements AutoCloseable {
63     private static final Logger LOG = LoggerFactory.getLogger(L2GatewayConnectionUtils.class);
64
65     private final DataBroker broker;
66     private final ElanL2GatewayUtils elanL2GatewayUtils;
67     private final ElanClusterUtils elanClusterUtils;
68     private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
69     private final JobCoordinator jobCoordinator;
70     private final L2GatewayCache l2GatewayCache;
71     private final ElanInstanceCache elanInstanceCache;
72     private final List<AutoCloseable> closeables = new CopyOnWriteArrayList<>();
73     private final HAOpClusteredListener haOpClusteredListener;
74
75     @Inject
76     public L2GatewayConnectionUtils(DataBroker dataBroker,
77             ElanClusterUtils elanClusterUtils, ElanL2GatewayUtils elanL2GatewayUtils,
78             JobCoordinator jobCoordinator, ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
79             L2GatewayCache l2GatewayCache, HAOpClusteredListener haOpClusteredListener,
80             ElanInstanceCache elanInstanceCache) {
81         this.broker = dataBroker;
82         this.elanL2GatewayUtils = elanL2GatewayUtils;
83         this.elanClusterUtils = elanClusterUtils;
84         this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
85         this.jobCoordinator = jobCoordinator;
86         this.l2GatewayCache = l2GatewayCache;
87         this.haOpClusteredListener = haOpClusteredListener;
88         this.elanInstanceCache = elanInstanceCache;
89     }
90
91     @Override
92     @PreDestroy
93     @SuppressWarnings("checkstyle:IllegalCatch")
94     public void close() {
95         closeables.forEach(c -> {
96             try {
97                 c.close();
98             } catch (Exception e) {
99                 LOG.warn("Error closing {}", c, e);
100             }
101         });
102     }
103
104     public static boolean isGatewayAssociatedToL2Device(L2GatewayDevice l2GwDevice) {
105         return l2GwDevice.getL2GatewayIds().size() > 0;
106     }
107
108     public static L2gateway getNeutronL2gateway(DataBroker broker, Uuid l2GatewayId) {
109         LOG.debug("getNeutronL2gateway for {}", l2GatewayId.getValue());
110         InstanceIdentifier<L2gateway> inst = InstanceIdentifier.create(Neutron.class).child(L2gateways.class)
111                 .child(L2gateway.class, new L2gatewayKey(l2GatewayId));
112         return MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, inst).orNull();
113     }
114
115     @Nonnull
116     public static List<L2gateway> getL2gatewayList(DataBroker broker) {
117         InstanceIdentifier<L2gateways> inst = InstanceIdentifier.create(Neutron.class).child(L2gateways.class);
118         return MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, inst).toJavaUtil().map(
119                 L2gateways::getL2gateway).orElse(Collections.emptyList());
120     }
121
122     @Nonnull
123     public static List<L2gatewayConnection> getAllL2gatewayConnections(DataBroker broker) {
124         InstanceIdentifier<L2gatewayConnections> inst = InstanceIdentifier.create(Neutron.class)
125                 .child(L2gatewayConnections.class);
126         return MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, inst).toJavaUtil().map(
127                 L2gatewayConnections::getL2gatewayConnection).orElse(Collections.emptyList());
128     }
129
130     /**
131      * Gets the associated l2 gw connections.
132      *
133      * @param broker
134      *            the broker
135      * @param l2GatewayIds
136      *            the l2 gateway ids
137      * @return the associated l2 gw connections
138      */
139     @Nonnull
140     public static List<L2gatewayConnection> getAssociatedL2GwConnections(DataBroker broker, Set<Uuid> l2GatewayIds) {
141         List<L2gatewayConnection> allL2GwConns = getAllL2gatewayConnections(broker);
142         List<L2gatewayConnection> l2GwConnections = new ArrayList<>();
143         for (Uuid l2GatewayId : l2GatewayIds) {
144             for (L2gatewayConnection l2GwConn : allL2GwConns) {
145                 if (l2GwConn.getL2gatewayId().equals(l2GatewayId)) {
146                     l2GwConnections.add(l2GwConn);
147                 }
148             }
149         }
150         return l2GwConnections;
151     }
152
153     /**
154      * Gets the associated l2 gw connections.
155      *
156      * @param broker
157      *            the broker
158      * @param elanName
159      *            the elan Name
160      * @return the associated l2 gw connection with elan
161      */
162     @Nonnull
163     public static List<L2gatewayConnection> getL2GwConnectionsByElanName(DataBroker broker, String elanName) {
164         List<L2gatewayConnection> allL2GwConns = getAllL2gatewayConnections(broker);
165         List<L2gatewayConnection> elanL2GateWayConnections = new ArrayList<>();
166         for (L2gatewayConnection l2GwConn : allL2GwConns) {
167             if (l2GwConn.getNetworkId().getValue().equalsIgnoreCase(elanName)) {
168                 elanL2GateWayConnections.add(l2GwConn);
169             }
170         }
171         return elanL2GateWayConnections;
172     }
173
174     public void addL2GatewayConnection(L2gatewayConnection input) {
175         addL2GatewayConnection(input, null/*deviceName*/, null);
176     }
177
178     public void addL2GatewayConnection(final L2gatewayConnection input,
179                                        final String l2GwDeviceName) {
180         addL2GatewayConnection(input, l2GwDeviceName, null);
181     }
182
183     public void addL2GatewayConnection(final L2gatewayConnection input,
184                                        final String l2GwDeviceName ,
185                                        L2gateway l2Gateway) {
186         LOG.info("Adding L2gateway Connection with ID: {}", input.getKey().getUuid());
187
188         Uuid networkUuid = input.getNetworkId();
189
190         // Taking cluster reboot scenario , if Elan instance is not available when l2GatewayConnection add events
191         // comes we need to wait for elaninstance to resolve. Hence updating the map with the runnable .
192         // When elanInstance add comes , it look in to the map and run the associated runnable associated with it.
193         ElanInstance elanInstance = elanInstanceCache.get(networkUuid.getValue(),
194             () -> addL2GatewayConnection(input, l2GwDeviceName)).orNull();
195         if (elanInstance == null) {
196             return;
197         }
198
199         if (!isVxlanNetworkOrVxlanSegment(elanInstance)) {
200             LOG.error("Neutron network with id {} is not VxlanNetwork", networkUuid.getValue());
201         } else {
202             Uuid l2GatewayId = input.getL2gatewayId();
203             if (l2Gateway == null) {
204                 l2Gateway = getNeutronL2gateway(broker, l2GatewayId);
205             }
206             if (l2Gateway == null) {
207                 LOG.error("L2Gateway with id {} is not present", l2GatewayId.getValue());
208             } else {
209                 associateHwvtepsToElan(elanInstance, l2Gateway, input, l2GwDeviceName);
210             }
211         }
212     }
213
214     public void deleteL2GatewayConnection(L2gatewayConnection input) {
215         LOG.info("Deleting L2gateway Connection with ID: {}", input.getKey().getUuid());
216
217         Uuid networkUuid = input.getNetworkId();
218         String elanName = networkUuid.getValue();
219         disAssociateHwvtepsFromElan(elanName, input);
220     }
221
222     private void disAssociateHwvtepsFromElan(String elanName, L2gatewayConnection input) {
223         Integer defaultVlan = input.getSegmentId();
224         List<L2GatewayDevice> l2Devices = ElanL2GwCacheUtils.getAllElanDevicesFromCache();
225         List<Devices> l2gwDevicesToBeDeleted = new ArrayList<>();
226         for (L2GatewayDevice elanL2gwDevice : l2Devices) {
227             if (elanL2gwDevice.getL2GatewayIds().contains(input.getKey().getUuid())) {
228                 l2gwDevicesToBeDeleted.addAll(elanL2gwDevice.getDevicesForL2gwConnectionId(input.getKey().getUuid()));
229             }
230         }
231         if (l2gwDevicesToBeDeleted.isEmpty()) {
232             //delete logical switch
233             Uuid l2GatewayId = input.getL2gatewayId();
234             L2gateway l2Gateway = L2GatewayConnectionUtils.getNeutronL2gateway(broker, l2GatewayId);
235             if (l2Gateway == null) {
236                 LOG.error("Failed to find the l2gateway for the connection {}", input.getUuid());
237                 return;
238             } else {
239                 l2gwDevicesToBeDeleted.addAll(l2Gateway.getDevices());
240             }
241         }
242         for (Devices l2Device : l2gwDevicesToBeDeleted) {
243             String l2DeviceName = l2Device.getDeviceName();
244             L2GatewayDevice l2GatewayDevice = l2GatewayCache.get(l2DeviceName);
245             String hwvtepNodeId = l2GatewayDevice.getHwvtepNodeId();
246             boolean isLastL2GwConnDeleted = false;
247             L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
248             if (elanL2GwDevice != null && isLastL2GwConnBeingDeleted(elanL2GwDevice)) {
249                 // Delete L2 Gateway device from 'ElanL2GwDevice' cache
250                 LOG.debug("Elan L2Gw Conn cache removed for id {}", hwvtepNodeId);
251                 ElanL2GwCacheUtils.removeL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
252                 isLastL2GwConnDeleted = true;
253             } else {
254                 Uuid l2GwConnId = input.getKey().getUuid();
255                 LOG.debug("Elan L2Gw Conn cache with id {} is being referred by other L2Gw Conns; so only "
256                         + "L2 Gw Conn {} reference is removed", hwvtepNodeId, l2GwConnId);
257                 if (elanL2GwDevice != null) {
258                     elanL2GwDevice.removeL2GatewayId(l2GwConnId);
259                 } else {
260                     isLastL2GwConnDeleted = true;
261                 }
262             }
263
264             DisAssociateHwvtepFromElanJob disAssociateHwvtepToElanJob =
265                     new DisAssociateHwvtepFromElanJob(elanL2GatewayUtils, elanL2GatewayMulticastUtils,
266                             elanL2GwDevice, elanName, () -> elanInstanceCache.get(elanName).orNull(),
267                             l2Device, defaultVlan, hwvtepNodeId, isLastL2GwConnDeleted);
268             elanClusterUtils.runOnlyInOwnerNode(disAssociateHwvtepToElanJob.getJobKey(), "remove l2gw connection job",
269                     disAssociateHwvtepToElanJob);
270         }
271     }
272
273     private void associateHwvtepsToElan(ElanInstance elanInstance,
274             L2gateway l2Gateway, L2gatewayConnection input, String l2GwDeviceName) {
275         String elanName = elanInstance.getElanInstanceName();
276         Integer defaultVlan = input.getSegmentId();
277         Uuid l2GwConnId = input.getKey().getUuid();
278         List<Devices> l2Devices = l2Gateway.getDevices();
279
280         LOG.trace("Associating ELAN {} with L2Gw Conn Id {} having below L2Gw devices {}", elanName, l2GwConnId,
281                 l2Devices);
282
283         for (Devices l2Device : l2Devices) {
284             String l2DeviceName = l2Device.getDeviceName();
285             // L2gateway can have more than one L2 Gw devices. Configure Logical Switch, VLAN mappings,...
286             // only on the switch which has come up just now and exclude all other devices from
287             // preprovisioning/re-provisioning
288             if (l2GwDeviceName != null && !l2GwDeviceName.equals(l2DeviceName)) {
289                 LOG.debug("Associating Hwvtep to ELAN is not been processed for {}; as only {} got connected now!",
290                         l2DeviceName, l2GwDeviceName);
291                 continue;
292             }
293             L2GatewayDevice l2GatewayDevice = l2GatewayCache.get(l2DeviceName);
294             if (isL2GwDeviceConnected(l2GatewayDevice)) {
295                 NodeId hwvtepNodeId = new NodeId(l2GatewayDevice.getHwvtepNodeId());
296
297                 // Delete pending delete logical switch task if scheduled
298                 elanL2GatewayUtils.cancelDeleteLogicalSwitch(hwvtepNodeId,
299                         ElanL2GatewayUtils.getLogicalSwitchFromElan(elanName));
300
301                 // Add L2 Gateway device to 'ElanL2GwDevice' cache
302                 boolean createLogicalSwitch;
303                 LogicalSwitches logicalSwitch = HwvtepUtils.getLogicalSwitch(broker, LogicalDatastoreType.CONFIGURATION,
304                         hwvtepNodeId, elanName);
305                 if (logicalSwitch == null) {
306                     HwvtepLogicalSwitchListener hwVTEPLogicalSwitchListener = new HwvtepLogicalSwitchListener(
307                             elanInstanceCache, elanL2GatewayUtils, elanClusterUtils, elanL2GatewayMulticastUtils,
308                             this, l2GatewayDevice, elanName, l2Device, defaultVlan, l2GwConnId);
309                     hwVTEPLogicalSwitchListener.registerListener(LogicalDatastoreType.OPERATIONAL, broker);
310                     closeables.add(hwVTEPLogicalSwitchListener);
311                     createLogicalSwitch = true;
312                 } else {
313                     addL2DeviceToElanL2GwCache(elanName, l2GatewayDevice, l2GwConnId, l2Device);
314                     createLogicalSwitch = false;
315                 }
316                 AssociateHwvtepToElanJob associateHwvtepToElanJob = new AssociateHwvtepToElanJob(broker,
317                         elanL2GatewayUtils, elanL2GatewayMulticastUtils, elanInstanceCache, l2GatewayDevice,
318                         elanInstance, l2Device, defaultVlan, createLogicalSwitch);
319
320                 elanClusterUtils.runOnlyInOwnerNode(associateHwvtepToElanJob.getJobKey(),
321                         "create logical switch in hwvtep topo", associateHwvtepToElanJob);
322
323             } else {
324                 LOG.info("L2GwConn create is not handled for device with id {} as it's not connected", l2DeviceName);
325             }
326         }
327     }
328
329     public L2GatewayDevice addL2DeviceToElanL2GwCache(String elanName, L2GatewayDevice l2GatewayDevice, Uuid l2GwConnId,
330             Devices l2Device) {
331         String l2gwDeviceNodeId = l2GatewayDevice.getHwvtepNodeId();
332         L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, l2gwDeviceNodeId);
333         if (elanL2GwDevice == null) {
334             elanL2GwDevice = new L2GatewayDevice(l2GatewayDevice.getDeviceName());
335             elanL2GwDevice.setHwvtepNodeId(l2gwDeviceNodeId);
336             elanL2GwDevice.setTunnelIps(l2GatewayDevice.getTunnelIps());
337             ElanL2GwCacheUtils.addL2GatewayDeviceToCache(elanName, elanL2GwDevice);
338             LOG.debug("Elan L2GwConn cache created for hwvtep id {}", l2gwDeviceNodeId);
339         } else {
340             LOG.debug("Elan L2GwConn cache already exists for hwvtep id {}; updating L2GwConn id {} to it",
341                     l2gwDeviceNodeId, l2GwConnId);
342         }
343         elanL2GwDevice.addL2GatewayId(l2GwConnId);
344         elanL2GwDevice.addL2gwConnectionIdToDevice(l2GwConnId, l2Device);
345
346         //incase of cluster reboot scenario southbound device would have added more macs
347         //while odl is down, pull them now
348         readAndCopyLocalUcastMacsToCache(elanName, l2GatewayDevice);
349
350         LOG.trace("Elan L2GwConn cache updated with below details: {}", elanL2GwDevice);
351         return elanL2GwDevice;
352     }
353
354     private static boolean isL2GwDeviceConnected(L2GatewayDevice l2GwDevice) {
355         return l2GwDevice != null && l2GwDevice.getHwvtepNodeId() != null;
356     }
357
358     protected static boolean isLastL2GwConnBeingDeleted(@Nonnull L2GatewayDevice l2GwDevice) {
359         return l2GwDevice.getL2GatewayIds().size() == 1;
360     }
361
362     private void readAndCopyLocalUcastMacsToCache(final String elanName, final L2GatewayDevice l2GatewayDevice) {
363         final InstanceIdentifier<Node> nodeIid = HwvtepSouthboundUtils.createInstanceIdentifier(
364                 new NodeId(l2GatewayDevice.getHwvtepNodeId()));
365         jobCoordinator.enqueueJob(elanName + ":" + l2GatewayDevice.getDeviceName(), () -> {
366             final SettableFuture settableFuture = SettableFuture.create();
367             Futures.addCallback(broker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL,
368                     nodeIid), new SettableFutureCallback<Optional<Node>>(settableFuture) {
369                         @Override
370                         public void onSuccess(@Nonnull Optional<Node> resultNode) {
371                             LocalUcastMacListener localUcastMacListener =
372                                     new LocalUcastMacListener(broker, haOpClusteredListener,
373                                             elanL2GatewayUtils, jobCoordinator, elanInstanceCache);
374                             settableFuture.set(resultNode);
375                             Optional<Node> nodeOptional = resultNode;
376                             if (nodeOptional.isPresent()) {
377                                 Node node = nodeOptional.get();
378                                 if (node.getAugmentation(HwvtepGlobalAugmentation.class) != null) {
379                                     List<LocalUcastMacs> localUcastMacs =
380                                             node.getAugmentation(HwvtepGlobalAugmentation.class).getLocalUcastMacs();
381                                     if (localUcastMacs == null) {
382                                         return;
383                                     }
384                                     localUcastMacs.stream()
385                                             .filter((mac) -> {
386                                                 return macBelongsToLogicalSwitch(mac, elanName);
387                                             })
388                                             .forEach((mac) -> {
389                                                 InstanceIdentifier<LocalUcastMacs> macIid = getMacIid(nodeIid, mac);
390                                                 localUcastMacListener.added(macIid, mac);
391                                             });
392                                 }
393                             }
394                         }
395                     }, MoreExecutors.directExecutor());
396             return Lists.newArrayList(settableFuture);
397         } , 5);
398     }
399
400     /**
401      * Gets the associated l2 gw connections.
402      *
403      * @param l2GatewayId the l2 gateway id
404      *
405      * @return the associated l2 gw connections
406      */
407     public List<L2gatewayConnection> getL2GwConnectionsByL2GatewayId(Uuid l2GatewayId) {
408         List<L2gatewayConnection> l2GwConnections = new ArrayList<>();
409         List<L2gatewayConnection> allL2GwConns = getAllL2gatewayConnections(broker);
410         for (L2gatewayConnection l2GwConn : allL2GwConns) {
411             if (l2GwConn.getL2gatewayId().equals(l2GatewayId)) {
412                 l2GwConnections.add(l2GwConn);
413             }
414         }
415         return l2GwConnections;
416     }
417
418     private static boolean macBelongsToLogicalSwitch(LocalUcastMacs mac, String logicalSwitchName) {
419         InstanceIdentifier<LogicalSwitches> iid = (InstanceIdentifier<LogicalSwitches>)
420                 mac.getLogicalSwitchRef().getValue();
421         return iid.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue().equals(logicalSwitchName);
422     }
423
424     static InstanceIdentifier<LocalUcastMacs> getMacIid(InstanceIdentifier<Node> nodeIid, LocalUcastMacs mac) {
425         return nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(LocalUcastMacs.class, mac.getKey());
426     }
427 }