2 * Copyright (c) 2017 Cisco Systems, Inc. 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.neutron.hostconfig.vpp;
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.ImmutableList;
13 import com.google.common.collect.ImmutableSet;
14 import com.google.common.collect.ImmutableSet.Builder;
16 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
17 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
21 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
23 public class HostconfigsDataBrokerTest extends AbstractConcurrentDataBrokerTest {
26 protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
27 Builder<YangModuleInfo> moduleInfoSet = ImmutableSet.<YangModuleInfo>builder();
28 for (Class<?> moduleClass : ImmutableList.<Class<?>>of(
29 NetworkTopology.class, Neutron.class, NetconfNode.class)) {
30 YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(moduleClass);
31 Preconditions.checkNotNull(moduleInfo, "Module Info for %s is not available.", moduleClass);
32 collectYangModuleInfo(moduleInfo, moduleInfoSet);
34 return moduleInfoSet.build();
37 private static void collectYangModuleInfo(final YangModuleInfo moduleInfo,
38 final Builder<YangModuleInfo> moduleInfoSet) {
39 moduleInfoSet.add(moduleInfo);
40 for (YangModuleInfo dependency : moduleInfo.getImportedModules()) {
41 collectYangModuleInfo(dependency, moduleInfoSet);