Merge "Increase timeout for waiting for broker service in sal-binding-it."
[controller.git] / opendaylight / md-sal / compatibility / sal-compatibility / src / main / java / org / opendaylight / controller / sal / compatibility / topology / TopologyAdapter.xtend
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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 package org.opendaylight.controller.sal.compatibility.topology
9
10 import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
11 import org.opendaylight.controller.sal.binding.api.data.DataProviderService
12 import org.opendaylight.controller.sal.topology.IPluginInTopologyService
13 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
14 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId
16 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
17 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
19
20 import static extension org.opendaylight.controller.sal.compatibility.topology.TopologyMapping.*
21
22 class TopologyAdapter implements IPluginInTopologyService {
23     
24     @Property
25     DataProviderService dataService;
26     
27     @Property
28     IPluginOutTopologyService topologyPublisher;
29     
30     override sollicitRefresh() {
31         val path = InstanceIdentifier.builder(NetworkTopology).child(Topology,new TopologyKey(new TopologyId("flow:1"))).toInstance;
32         val reader = TypeSafeDataReader.forReader(dataService)
33         val topology = reader.readOperationalData(path)
34         topologyPublisher.edgeUpdate(topology.toADEdgeUpdates(reader))
35     }
36     
37 }