2 * Copyright (c) 2017 AT&T Intellectual Property. 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.bgpcep.config.loader.topology;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.opendaylight.protocol.util.CheckUtil.checkNotPresentConfiguration;
14 import static org.opendaylight.protocol.util.CheckUtil.checkPresentConfiguration;
16 import org.junit.Test;
17 import org.opendaylight.bgpcep.config.loader.impl.AbstractConfigLoader;
18 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
19 import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
21 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
22 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
23 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
24 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
25 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
26 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
27 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
29 public class NetworkTopologyConfigFileProcessorTest extends AbstractConfigLoader {
31 protected void registerModules(final ModuleInfoBackedContext moduleInfoBackedContext) throws Exception {
32 moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(NetworkTopology.class));
33 moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(Topology.class));
37 public void configFileTest() throws ReadFailedException, InterruptedException {
38 final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed =
39 InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
40 new TopologyKey(new TopologyId("topology-test")));
41 checkNotPresentConfiguration(getDataBroker(), topologyIIdKeyed);
43 assertNotNull(ClassLoader.getSystemClassLoader().getResource("initial/network-topology-config.xml"));
44 final NetworkTopologyConfigFileProcessor processor = new NetworkTopologyConfigFileProcessor(this.configLoader,
47 checkPresentConfiguration(getDataBroker(), topologyIIdKeyed);
49 assertEquals(SchemaPath.create(true, NetworkTopology.QNAME), processor.getSchemaPath());