diff options
author | Jozef Gloncak <jgloncak@cisco.com> | 2016-02-02 08:35:12 +0100 |
---|---|---|
committer | Jozef Gloncak <jgloncak@cisco.com> | 2016-02-02 13:16:31 +0100 |
commit | a03a2cb26606a9099f2ea8cfd589f7ef503f0374 (patch) | |
tree | 071291fffee8e08fd6ae5481d99798666c64c480 /vbd/impl/src/main/java/io/fd | |
parent | 136b9074bc3a49fbbb86699eec6458d7f4d7ba7f (diff) |
Adding named augmentation + prepare naked application.
Named augmentation of node topology-types was added for
better readibility of generated code.
Running application was created. It is possible to start via
installing feature odl-vbd-rest.
Change-Id: I2d919cd20d962ff9b28143794f6984137331c51a
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
Diffstat (limited to 'vbd/impl/src/main/java/io/fd')
3 files changed, 22 insertions, 15 deletions
diff --git a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/BridgeDomain.java b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/BridgeDomain.java index aff03b2a6..9cea6589f 100644 --- a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/BridgeDomain.java +++ b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/BridgeDomain.java @@ -18,9 +18,10 @@ import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.Mod import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; +import org.opendaylight.controller.md.sal.binding.api.MountPointService; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vbridge.topology.rev160129.Topology1; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vbridge.topology.rev160129.TopologyVbridgeAugment; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; @@ -41,19 +42,21 @@ final class BridgeDomain implements DataTreeChangeListener<Topology> { @GuardedBy("this") private final BindingTransactionChain chain; private final ListenerRegistration<?> reg; - private Topology1 config; + private final MountPointService mountService; + private TopologyVbridgeAugment config; - private BridgeDomain(final DataBroker dataBroker, final KeyedInstanceIdentifier<Topology, TopologyKey> topology, + private BridgeDomain(final DataBroker dataBroker, final MountPointService mountService, final KeyedInstanceIdentifier<Topology, TopologyKey> topology, final BindingTransactionChain chain) { this.topology = Preconditions.checkNotNull(topology); this.chain = Preconditions.checkNotNull(chain); + this.mountService = mountService; reg = dataBroker.registerDataTreeChangeListener( new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, topology), this); } static BridgeDomain create(final DataBroker dataBroker, - final KeyedInstanceIdentifier<Topology, TopologyKey> topology, final BindingTransactionChain chain) { + MountPointService mountService, final KeyedInstanceIdentifier<Topology, TopologyKey> topology, final BindingTransactionChain chain) { LOG.debug("Wiping operational state of {}", topology); @@ -61,7 +64,7 @@ final class BridgeDomain implements DataTreeChangeListener<Topology> { tx.delete(LogicalDatastoreType.OPERATIONAL, topology); tx.submit(); - return new BridgeDomain(dataBroker, topology, chain); + return new BridgeDomain(dataBroker, mountService, topology, chain); } synchronized void forceStop() { @@ -92,7 +95,7 @@ final class BridgeDomain implements DataTreeChangeListener<Topology> { break; case SUBTREE_MODIFIED: // First check if the configuration has changed - final DataObjectModification<Topology1> newConfig = mod.getModifiedAugmentation(Topology1.class); + final DataObjectModification<TopologyVbridgeAugment> newConfig = mod.getModifiedAugmentation(TopologyVbridgeAugment.class); if (newConfig != null) { if (newConfig.getModificationType() != ModificationType.DELETE) { LOG.debug("Topology {} modified configuration {}", topology, newConfig); @@ -116,7 +119,7 @@ final class BridgeDomain implements DataTreeChangeListener<Topology> { final Topology data = mod.getDataAfter(); // Read configuration - final Topology1 config = data.getAugmentation(Topology1.class); + final TopologyVbridgeAugment config = data.getAugmentation(TopologyVbridgeAugment.class); if (config != null) { setConfiguration(config); } else { @@ -153,14 +156,14 @@ final class BridgeDomain implements DataTreeChangeListener<Topology> { } } - private void setConfiguration(final Topology1 config) { + private void setConfiguration(final TopologyVbridgeAugment config) { LOG.debug("Topology {} configuration set to {}", topology, config); this.config = config; } @GuardedBy("this") - private void updateConfiguration(final DataObjectModification<Topology1> mod) { + private void updateConfiguration(final DataObjectModification<TopologyVbridgeAugment> mod) { LOG.debug("Topology {} configuration changed", topology); // FIXME: do something smarter diff --git a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/TopologyMonitor.java b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/TopologyMonitor.java index b2e52c37e..213ff6685 100644 --- a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/TopologyMonitor.java +++ b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/TopologyMonitor.java @@ -19,6 +19,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; +import org.opendaylight.controller.md.sal.binding.api.MountPointService; import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; import org.opendaylight.controller.md.sal.common.api.data.TransactionChain; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; @@ -39,9 +40,11 @@ final class TopologyMonitor implements DataTreeChangeListener<VbridgeTopology>, @GuardedBy("this") private final Map<TopologyKey, BridgeDomain> domains = new HashMap<>(); private final DataBroker dataBroker; + private final MountPointService mountService; - TopologyMonitor(final DataBroker dataBroker) { + public TopologyMonitor(DataBroker dataBroker, MountPointService mountService) { this.dataBroker = Preconditions.checkNotNull(dataBroker); + this.mountService = Preconditions.checkNotNull(mountService); } @Override @@ -115,7 +118,7 @@ final class TopologyMonitor implements DataTreeChangeListener<VbridgeTopology>, } }); - final BridgeDomain domain = BridgeDomain.create(dataBroker, topology, chain); + final BridgeDomain domain = BridgeDomain.create(dataBroker, mountService, topology, chain); domains.put(topology.getKey(), domain); LOG.debug("Bridge domain {} for {} started", domain, topology); diff --git a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VirtualBridgeDomainManager.java b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VirtualBridgeDomainManager.java index 37da73159..0c1d08faa 100644 --- a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VirtualBridgeDomainManager.java +++ b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VirtualBridgeDomainManager.java @@ -12,8 +12,9 @@ import com.google.common.base.Preconditions; import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; +import org.opendaylight.controller.md.sal.binding.api.MountPointService; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vbridge.topology.rev160129.TopologyTypes1; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vbridge.topology.rev160129.TopologyTypesVbridgeAugment; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vbridge.topology.rev160129.network.topology.topology.topology.types.VbridgeTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; @@ -32,7 +33,7 @@ public final class VirtualBridgeDomainManager implements AutoCloseable { private static final DataTreeIdentifier<VbridgeTopology> LISTEN_TREE = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class).child(TopologyTypes.class) - .augmentation(TopologyTypes1.class).child(VbridgeTopology.class).build()); + .augmentation(TopologyTypesVbridgeAugment.class).child(VbridgeTopology.class).build()); private final ListenerRegistration<TopologyMonitor> reg; private boolean closed; @@ -41,9 +42,9 @@ public final class VirtualBridgeDomainManager implements AutoCloseable { this.reg = Preconditions.checkNotNull(reg); } - public static VirtualBridgeDomainManager create(@Nonnull final DataBroker dataBroker) { + public static VirtualBridgeDomainManager create(@Nonnull final DataBroker dataBroker,@Nonnull MountPointService mountService) { final ListenerRegistration<TopologyMonitor> reg = - dataBroker.registerDataTreeChangeListener(LISTEN_TREE, new TopologyMonitor(dataBroker)); + dataBroker.registerDataTreeChangeListener(LISTEN_TREE, new TopologyMonitor(dataBroker, mountService)); return new VirtualBridgeDomainManager(reg); } |