2 * Copyright (c) 2017 Hewlett Packard Enterprise, Co. 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
9 package org.opendaylight.netvirt.federation.plugin.creators;
11 import java.util.ArrayList;
12 import java.util.Collection;
13 import java.util.Collections;
15 import javax.inject.Inject;
16 import javax.inject.Singleton;
18 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
19 import org.opendaylight.netvirt.federation.plugin.FederationPluginConstants;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 public class FederationElanInterfaceModificationCreator
27 implements FederationPluginModificationCreator<ElanInterface, ElanInterfaces> {
28 private static final Logger LOG = LoggerFactory.getLogger(FederationElanInterfaceModificationCreator.class);
31 public FederationElanInterfaceModificationCreator() {
32 FederationPluginCreatorRegistry.registerCreator(FederationPluginConstants.ELAN_INTERFACE_KEY, this);
36 public Collection<DataTreeModification<ElanInterface>> createDataTreeModifications(ElanInterfaces elanInterfaces) {
37 if (elanInterfaces == null || elanInterfaces.getElanInterface() == null) {
38 LOG.debug("No ELAN interfaces found");
39 return Collections.emptyList();
42 Collection<DataTreeModification<ElanInterface>> modifications = new ArrayList<>();
43 for (ElanInterface elanInterface : elanInterfaces.getElanInterface()) {
44 modifications.add(new FullSyncDataTreeModification<ElanInterface>(elanInterface));