From: Giovanni Meo Date: Mon, 4 Aug 2014 16:22:11 +0000 (+0200) Subject: Remove old dependencies X-Git-Tag: release/helium~338^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=125644e6e71a7b47ebcfd85ee3d5671d69468742 Remove old dependencies - Remove stale dependencies that prevent releasing of artifacts - Remove unused flow-management-compatibility and inventory-topology-compatibility modules - Make sure that if a dependency is on module with a version defined by a variable, lets specify the version in the dependency management in common pom - Replace in netconf-cli the reference from yang-data-json to yang-data-composite-node because yang-data-json has been removed - Removed whitespaces in config-netty-config that would cause checkstyle issues downstream otherwise Change-Id: I866e4b36e71c004b925bd181412ff4df91b3091f Signed-off-by: Giovanni Meo --- diff --git a/features/config-netty/pom.xml b/features/config-netty/pom.xml index 98b97d1d95..16fd975130 100644 --- a/features/config-netty/pom.xml +++ b/features/config-netty/pom.xml @@ -19,7 +19,6 @@ org.opendaylight.controller config-persister-features - ${config.version} features xml runtime diff --git a/features/config-persister/pom.xml b/features/config-persister/pom.xml index 969d0c8841..ec1520ed98 100644 --- a/features/config-persister/pom.xml +++ b/features/config-persister/pom.xml @@ -27,7 +27,6 @@ org.opendaylight.controller netconf-features - ${netconf.version} features xml runtime @@ -35,7 +34,6 @@ org.opendaylight.controller config-features - ${config.version} features xml runtime diff --git a/features/netconf/pom.xml b/features/netconf/pom.xml index 90c088eaba..856557c1e8 100644 --- a/features/netconf/pom.xml +++ b/features/netconf/pom.xml @@ -19,7 +19,6 @@ org.opendaylight.controller config-features - ${config.version} features xml runtime @@ -27,7 +26,6 @@ org.opendaylight.controller features-odl-protocol-framework - ${protocol-framework.version} features xml runtime diff --git a/features/protocol-framework/pom.xml b/features/protocol-framework/pom.xml index 045ac2dffe..ba5dd18fc2 100644 --- a/features/protocol-framework/pom.xml +++ b/features/protocol-framework/pom.xml @@ -19,7 +19,6 @@ org.opendaylight.controller config-features - ${config.version} features xml runtime diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index ff8735a518..c3b55b8549 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -926,11 +926,6 @@ filter-valve ${filtervalve.version} - - org.opendaylight.controller - flow-management-compatibility - ${mdsal.version} - org.opendaylight.controller flowprogrammer.northbound @@ -1495,11 +1490,6 @@ model-flow-base ${mdsal.version} - - org.opendaylight.controller.model - model-flow-management - ${mdsal.version} - org.opendaylight.controller.model model-flow-service @@ -1807,6 +1797,62 @@ ${yangtools.version} test + + org.opendaylight.controller + config-features + ${config.version} + features + xml + runtime + + + org.opendaylight.controller + features-odl-protocol-framework + ${protocol-framework.version} + features + xml + runtime + + + org.opendaylight.controller + netconf-features + ${netconf.version} + features + xml + runtime + + + org.opendaylight.controller + config-persister-features + ${config.version} + features + xml + runtime + + + org.opendaylight.controller + config-netty-features + ${config.version} + features + xml + runtime + + + org.opendaylight.controller + features-adsal + ${sal.version} + features + xml + runtime + + + org.opendaylight.controller + mdsal-features + ${mdsal.version} + features + xml + runtime + diff --git a/opendaylight/config/config-netty-config/src/main/resources/initial/00-netty.xml b/opendaylight/config/config-netty-config/src/main/resources/initial/00-netty.xml index 686d363110..2bf5b36d7a 100644 --- a/opendaylight/config/config-netty-config/src/main/resources/initial/00-netty.xml +++ b/opendaylight/config/config-netty-config/src/main/resources/initial/00-netty.xml @@ -15,7 +15,7 @@ urn:opendaylight:params:xml:ns:yang:controller:netty:timer?module=netty-timer&revision=2013-11-19 - + @@ -35,7 +35,7 @@ singleton - + netty:netty-threadgroup diff --git a/opendaylight/distribution/opendaylight-karaf/pom.xml b/opendaylight/distribution/opendaylight-karaf/pom.xml index 977fab1334..5effbb09fc 100644 --- a/opendaylight/distribution/opendaylight-karaf/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf/pom.xml @@ -64,7 +64,6 @@ org.opendaylight.controller config-netty-features - ${config.version} features xml runtime @@ -74,7 +73,6 @@ org.opendaylight.controller features-adsal - ${sal.version} features xml runtime @@ -92,7 +90,6 @@ org.opendaylight.controller mdsal-features - ${mdsal.version} features xml runtime diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml b/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml deleted file mode 100644 index 7770c15349..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - compatibility-parent - 1.1-SNAPSHOT - - flow-management-compatibility - bundle - - - - com.google.guava - guava - - - org.opendaylight.controller - forwardingrulesmanager - - - org.opendaylight.controller - sal-binding-api - - - org.opendaylight.controller - sal-common-util - - - org.opendaylight.controller - sal-compatibility - - - org.opendaylight.controller.model - model-flow-management - - - org.slf4j - slf4j-api - - - junit - junit - test - - - org.mockito - mockito-all - test - - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - Forwarding Rules Manager Adapter for MD-SAL - - - - - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - - diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/ConfigurationReader.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/ConfigurationReader.java deleted file mode 100644 index 411af282bd..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/ConfigurationReader.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.frm.compatibility; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -import org.opendaylight.controller.forwardingrulesmanager.FlowConfig; -import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager; -import org.opendaylight.controller.sal.compatibility.NodeMapping; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.FlowsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ConfigurationReader implements FlowManagementReader { - - private final static Logger LOG = LoggerFactory.getLogger(ConfigurationReader.class); - - private IForwardingRulesManager manager; - - @Override - public Flows readAllFlows() { - List staticFlows = this.manager.getStaticFlows(); - List flowMap = new ArrayList(staticFlows.size()); - - for (FlowConfig conf : staticFlows) { - flowMap.add(FlowConfigMapping.toConfigurationFlow(conf)); - } - final FlowsBuilder flowsBuilder = new FlowsBuilder(); - return (flowsBuilder.setFlow(flowMap)).build(); - } - - @Override - public Flow readFlow(final FlowKey key) { - try { - final FlowConfig flowConf = - this.manager.getStaticFlow(String.valueOf(key.getId()), NodeMapping.toADNode(key.getNode())); - return FlowConfigMapping.toConfigurationFlow(flowConf); - } catch (Exception e) { - String errMsg = MessageFormat.format("readFlow by key {} fail", key); - LOG.error(errMsg, e); - throw new RuntimeException(errMsg, e); - } - } - - public IForwardingRulesManager getManager() { - return this.manager; - } - - public void setManager(final IForwardingRulesManager manager) { - this.manager = manager; - } -} diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java deleted file mode 100644 index 0653eeb2a6..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.frm.compatibility; - -import org.opendaylight.controller.forwardingrulesmanager.FlowConfig; -import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager; -import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener; -import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler; -import org.opendaylight.controller.md.sal.common.api.data.DataModification; -import org.opendaylight.controller.sal.binding.api.data.DataProviderService; -import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider; -import org.opendaylight.controller.sal.common.util.Arguments; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey; -import org.opendaylight.yangtools.concepts.Registration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.Identifier; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; -import org.opendaylight.yangtools.yang.common.RpcResult; -import org.opendaylight.yangtools.yang.common.RpcResultBuilder; - -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; - -public class FRMRuntimeDataProvider implements RuntimeDataProvider, DataCommitHandler,DataObject> { - - private final static InstanceIdentifier FLOWS_PATH = InstanceIdentifier. builder(Flows.class).toInstance(); - - private final FlowManagementReader configuration = new ConfigurationReader(); - private DataChangeListener, DataObject> changeListener; - private DataProviderService dataService; - private IForwardingRulesManager manager; - - public Registration init() { - return this.dataService.registerCommitHandler(FRMRuntimeDataProvider.FLOWS_PATH, this); - } - - @Override - public DataObject readConfigurationData(final InstanceIdentifier path) { - return this.readFrom(this.configuration, path); - } - - @Override - public DataObject readOperationalData(final InstanceIdentifier path) { - return this.readFrom(this.configuration, path); - } - - public DataObject readFrom(final FlowManagementReader store, final InstanceIdentifier path) { - if (Objects.equal(FRMRuntimeDataProvider.FLOWS_PATH, path)) { - return store.readAllFlows(); - } - if (FRMRuntimeDataProvider.FLOWS_PATH.contains(path)) { - return store.readFlow(this.toFlowKey(path)); - } - return null; - } - - @Override - public FlowCommitTransaction requestCommit(final DataModification, DataObject> modification) { - return new FlowCommitTransaction(this, modification); - } - - public FlowKey toFlowKey(final InstanceIdentifier identifier) { - Preconditions.> checkNotNull(identifier); - - Iterable path = identifier.getPathArguments(); - PathArgument get = path.iterator().next(); - final Identifier itemKey = Arguments. checkInstanceOf(get, IdentifiableItem.class).getKey(); - return Arguments. checkInstanceOf(itemKey, FlowKey.class); - } - - public RpcResult finish(final FlowCommitTransaction transaction) { - Iterable toRemove = transaction.getToRemove(); - for (final FlowConfig flow : toRemove) { - this.manager.removeStaticFlow(flow.getName(), flow.getNode()); - } - Iterable toUpdate = transaction.getToUpdate(); - for (final FlowConfig flow : toUpdate) { - this.manager.removeStaticFlow(flow.getName(), flow.getNode()); - this.manager.addStaticFlow(flow); - } - return RpcResultBuilder. success().build(); - } - - public RpcResult rollback(final FlowCommitTransaction transaction) { - return null; - } - - public DataProviderService getDataService() { - return this.dataService; - } - - public void setDataService(final DataProviderService dataService) { - this.dataService = dataService; - } - - public DataChangeListener, DataObject> getChangeListener() { - return this.changeListener; - } - - public void setChangeListener(final DataChangeListener, DataObject> changeListener) { - this.changeListener = changeListener; - } - - public IForwardingRulesManager getManager() { - return this.manager; - } - - public void setManager(final IForwardingRulesManager manager) { - this.manager = manager; - } -} diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowCommitTransaction.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowCommitTransaction.java deleted file mode 100644 index bf0050d6c0..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowCommitTransaction.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.frm.compatibility; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import org.opendaylight.controller.forwardingrulesmanager.FlowConfig; -import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction; -import org.opendaylight.controller.md.sal.common.api.data.DataModification; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.common.RpcResult; - -public class FlowCommitTransaction implements DataCommitTransaction, DataObject> { - - private final DataModification, DataObject> modification; - private final HashSet toAdd = new HashSet(); - private final FRMRuntimeDataProvider flowManager; - private Iterable toUpdate; - private Iterable toRemove; - - public FlowCommitTransaction( - final FRMRuntimeDataProvider flowManager, - final DataModification, DataObject> modification) { - this.flowManager = flowManager; - this.modification = modification; - this.processModification(); - } - - @Override - public RpcResult finish() throws IllegalStateException { - return this.flowManager.finish(this); - } - - @Override - public RpcResult rollback() throws IllegalStateException { - return this.flowManager.rollback(this); - } - - public void processModification() { - final Set, DataObject>> updated = - this.modification.getUpdatedConfigurationData().entrySet(); - final List forUpdate = new ArrayList(updated.size()); - - if (updated != null && !(updated.isEmpty())) { - for (Entry, DataObject> entry : updated) { - if (FlowConfigMapping.isFlowPath(entry.getKey())) { - forUpdate.add(FlowConfigMapping.toFlowConfig((Flow) entry.getValue())); - } - } - } - this.toUpdate = Collections.unmodifiableCollection(forUpdate); - - final Set> removedConfigurationData = - this.modification.getRemovedConfigurationData(); - final List forRemove = new ArrayList(removedConfigurationData.size()); - - if (removedConfigurationData != null && !(removedConfigurationData.isEmpty())) { - for (InstanceIdentifier data : removedConfigurationData) { - if (FlowConfigMapping.isFlowPath(data)) { - forRemove.add(FlowConfigMapping.toFlowConfig(data)); - } - } - } - this.toRemove = Collections.unmodifiableCollection(forRemove); - } - - @Override - public DataModification, DataObject> getModification() { - return this.modification; - } - - public FRMRuntimeDataProvider getFlowManager() { - return this.flowManager; - } - - public HashSet getToAdd() { - return this.toAdd; - } - - public Iterable getToUpdate() { - return this.toUpdate; - } - - public Iterable getToRemove() { - return this.toRemove; - } -} diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.java deleted file mode 100644 index 58c60ec1c5..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.frm.compatibility; - -import java.text.MessageFormat; -import java.util.Iterator; - -import org.opendaylight.controller.forwardingrulesmanager.FlowConfig; -import org.opendaylight.controller.sal.compatibility.MDFlowMapping; -import org.opendaylight.controller.sal.compatibility.NodeMapping; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded; -import org.opendaylight.yangtools.yang.binding.Identifiable; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class FlowConfigMapping { - - private final static Logger LOG = LoggerFactory.getLogger(FlowConfigMapping.class); - - /* nodes/node/flow -> 0 / 1 / 2 */ - private static final int FLOW_KEY_IDENTIFIER_DEEP = 2; - - public static Flow toConfigurationFlow(final FlowConfig sourceCfg) { - final FlowAdded source = MDFlowMapping.flowAdded(sourceCfg.getFlow()); - final FlowBuilder flowBuilder = new FlowBuilder(); - flowBuilder.setInstructions(source.getInstructions()); - flowBuilder.setCookie(source.getCookie()); - flowBuilder.setHardTimeout(source.getHardTimeout()); - flowBuilder.setIdleTimeout(source.getIdleTimeout()); - flowBuilder.setMatch(source.getMatch()); - flowBuilder.setNode(source.getNode()); - - FlowKey flowKey = - new FlowKey(Long.valueOf(sourceCfg.getName()), flowBuilder.getNode()); - flowBuilder.setKey(flowKey); - return flowBuilder.build(); - } - - public static FlowConfig toFlowConfig(final Flow sourceCfg) { - try { - final FlowConfig flowConfig = new FlowConfig(); - flowConfig.setName(String.valueOf(sourceCfg.getId())); - flowConfig.setNode(NodeMapping.toADNode(sourceCfg.getNode())); - return flowConfig; - } catch (Exception e) { - String errMsg = MessageFormat.format("Convert from Flow {} to FlowConfig fail", sourceCfg); - LOG.error(errMsg, e); - throw new RuntimeException(errMsg, e); - } - } - - public static FlowConfig toFlowConfig(final InstanceIdentifier identifier) { - try { - PathArgument pathArg = FlowConfigMapping.getSecondPathArgumentFromPath(identifier); - if (pathArg != null) { - final FlowConfig flowConfig = new FlowConfig(); - FlowKey key = ((IdentifiableItem) pathArg).getKey(); - flowConfig.setName(String.valueOf(key.getId())); - flowConfig.setNode(NodeMapping.toADNode(key.getNode())); - return flowConfig; - } - return null; - } catch (Exception e) { - String errMsg = MessageFormat.format("Convert from InstanceIdentifier {} to FlowConfig fail", identifier); - LOG.error(errMsg, e); - throw new RuntimeException(errMsg, e); - } - } - - public static boolean isFlowPath(final InstanceIdentifier path) { - PathArgument pathArg = FlowConfigMapping.getSecondPathArgumentFromPath(path); - if (pathArg == null) { - return false; - } - if (pathArg instanceof IdentifiableItem) { - final Identifiable key = ((IdentifiableItem>) pathArg).getKey(); - if ((key instanceof FlowKey)) { - return true; - } - } - return false; - } - - private static PathArgument getSecondPathArgumentFromPath(final InstanceIdentifier path) { - if (path != null && path.getPathArguments() != null) { - Iterator iterator = path.getPathArguments().iterator(); - int deep = 0; - while (iterator.hasNext()) { - PathArgument pathArg = iterator.next(); - if (deep == FlowConfigMapping.FLOW_KEY_IDENTIFIER_DEEP) { - return pathArg; - } - deep++; - } - } - return null; - } -} diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java deleted file mode 100644 index cb61c8a095..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.frm.compatibility; - -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey; - -public interface FlowManagementReader { - - Flows readAllFlows(); - - Flow readFlow(FlowKey key); - -} diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java deleted file mode 100644 index a91cef6136..0000000000 --- a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.frm.compatibility; - -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext; -import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; -import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public class SampleConsumer { - - ConsumerContext context; - - void addFlowExample() { - - DataBrokerService dataService = context.getSALService(DataBrokerService.class); - - DataModificationTransaction transaction = dataService.beginTransaction(); - Flow flow = createSampleFlow("foo", null); - InstanceIdentifier path = InstanceIdentifier.builder(Flows.class).child(Flow.class, flow.getKey()) - .toInstance(); - transaction.putConfigurationData(path, flow); - - transaction.commit(); - - dataService.readConfigurationData(path); - } - - Flow createSampleFlow(String name, NodeRef node) { - FlowBuilder ret = new FlowBuilder(); - FlowKey key = new FlowKey(Long.parseLong(name), node); - ret.setKey(key); - return ret.build(); - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml deleted file mode 100644 index 62dc2ffa1a..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - compatibility-parent - 1.1-SNAPSHOT - - inventory-topology-compatibility - bundle - - - - com.google.guava - guava - - - org.opendaylight.controller - forwardingrulesmanager - - - org.opendaylight.controller - sal-binding-api - - - org.opendaylight.controller - sal-binding-util - - - org.opendaylight.controller - sal-common-util - - - org.opendaylight.controller - sal-compatibility - - - org.opendaylight.controller - switchmanager - - - org.opendaylight.controller - topologymanager - - - org.opendaylight.controller.model - model-flow-management - - - org.opendaylight.controller.model - model-topology - - - org.slf4j - slf4j-api - - - junit - junit - test - - - org.mockito - mockito-all - test - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - Forwarding Rules Manager Adapter - for MD-SAL - - - - - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - - diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java deleted file mode 100644 index b37b50159f..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.inventory; - -import java.util.ArrayList; -import java.util.Set; - -import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider; -import org.opendaylight.controller.sal.compatibility.InventoryMapping; -import org.opendaylight.controller.switchmanager.ISwitchManager; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class InventoryReader implements RuntimeDataProvider { - private static final Logger LOG = LoggerFactory.getLogger(InventoryReader.class); - private ISwitchManager switchManager; - - public ISwitchManager getSwitchManager() { - return switchManager; - } - - public void setSwitchManager(final ISwitchManager switchManager) { - this.switchManager = switchManager; - } - - @Override - public DataObject readConfigurationData(final InstanceIdentifier path) { - // Topology and Inventory are operational only - return null; - } - - @SuppressWarnings("unchecked") - @Override - public DataObject readOperationalData(final InstanceIdentifier path) { - final Class type = path.getTargetType(); - if (Nodes.class.equals(type)) { - return readNodes(((InstanceIdentifier) path)); - } - if (Node.class.equals(type)) { - return readNode(((InstanceIdentifier) path)); - } - if (NodeConnector.class.equals(type)) { - return readNodeConnector(((InstanceIdentifier) path)); - } - - LOG.debug("Unsupported type {}", type); - return null; - } - - private NodeConnector readNodeConnector(final InstanceIdentifier identifier) { - return constructNodeConnector(InventoryMapping.toAdNodeConnector(identifier)); - } - - private Node readNode(final InstanceIdentifier identifier) { - return constructNode(InventoryMapping.toAdNode(identifier)); - } - - private Node constructNode(final org.opendaylight.controller.sal.core.Node node) { - final Set connectors = getSwitchManager().getNodeConnectors(node); - final ArrayList tpList = new ArrayList(connectors.size()); - for (final org.opendaylight.controller.sal.core.NodeConnector connector : connectors) { - tpList.add(constructNodeConnector(connector)); - } - - return new NodeBuilder() - .setKey(InventoryMapping.toNodeKey(node)) - .setNodeConnector(tpList) - .build(); - } - - private Nodes readNodes(final InstanceIdentifier identifier) { - final Set nodes = getSwitchManager().getNodes(); - final ArrayList nodeList = new ArrayList(nodes.size()); - for (final org.opendaylight.controller.sal.core.Node node : nodes) { - nodeList.add(constructNode(node)); - } - - return new NodesBuilder().setNode(nodeList).build(); - } - - private static NodeConnector constructNodeConnector(final org.opendaylight.controller.sal.core.NodeConnector connector) { - return new NodeConnectorBuilder().setKey(InventoryMapping.toNodeConnectorKey(connector)).build(); - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java deleted file mode 100644 index 82c5b7bf61..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java +++ /dev/null @@ -1,347 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.switchmanager; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; -import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; -import org.opendaylight.controller.sal.compatibility.NodeMapping; -import org.opendaylight.controller.sal.core.Bandwidth; -import org.opendaylight.controller.sal.core.ConstructionException; -import org.opendaylight.controller.sal.core.Description; -import org.opendaylight.controller.sal.core.ForwardingMode; -import org.opendaylight.controller.sal.core.MacAddress; -import org.opendaylight.controller.sal.core.NodeConnector; -import org.opendaylight.controller.sal.core.Property; -import org.opendaylight.controller.sal.core.Tier; -import org.opendaylight.controller.sal.utils.Status; -import org.opendaylight.controller.switchmanager.ISwitchManager; -import org.opendaylight.controller.switchmanager.Subnet; -import org.opendaylight.controller.switchmanager.Switch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CompatibleSwitchManager extends ConfigurableSwitchManager implements ISwitchManager { - private static final Logger LOG = LoggerFactory.getLogger(CompatibleSwitchManager.class); - - private DataBrokerService _dataService; - - public DataBrokerService getDataService() { - return this._dataService; - } - - public void setDataService(final DataBrokerService dataService) { - this._dataService = dataService; - } - - @Override - public Status addNodeConnectorProp(final NodeConnector nodeConnector, final Property prop) { - final DataModificationTransaction it = getDataService().beginTransaction(); - final NodeConnectorRef path = NodeMapping.toNodeConnectorRef(nodeConnector); - return null; - } - - @Override - public Property createProperty(final String propName, final String propValue) { - try { - if (propName.equalsIgnoreCase(Description.propertyName)) { - return new Description(propValue); - } else if (propName.equalsIgnoreCase(Tier.TierPropName)) { - return new Tier(Integer.parseInt(propValue)); - } else if (propName.equalsIgnoreCase(Bandwidth.BandwidthPropName)) { - return new Bandwidth(Long.parseLong(propValue)); - } else if (propName.equalsIgnoreCase(ForwardingMode.name)) { - return new ForwardingMode(Integer.parseInt(propValue)); - } else if (propName.equalsIgnoreCase(MacAddress.name)) { - return new MacAddress(propValue); - } else { - LOG.debug("Not able to create {} property", propName); - } - } catch (Exception e) { - LOG.debug("createProperty caught exception {}", e.getMessage()); - } - - return null; - } - - @Override - public boolean doesNodeConnectorExist(final NodeConnector nc) { - return (getDataService().readOperationalData(NodeMapping.toNodeConnectorRef(nc).getValue()) != null); - } - - @Override - public byte[] getControllerMAC() { - final Enumeration nis; - try { - nis = NetworkInterface.getNetworkInterfaces(); - } catch (SocketException e) { - LOG.error("Failed to acquire list of interfaces, cannot determine controller MAC", e); - return null; - } - - while (nis.hasMoreElements()) { - final NetworkInterface ni = nis.nextElement(); - try { - return ni.getHardwareAddress(); - } catch (SocketException e) { - LOG.error("Failed to acquire controller MAC from interface {}", ni, e); - } - } - - // This happens when running controller on windows VM, for example - // Try parsing the OS command output - LOG.warn("Failed to acquire controller MAC: No physical interface found"); - return null; - } - - @Override - public Map getControllerProperties() { - return Collections.emptyMap(); - } - - @Override - public Property getControllerProperty(final String propertyName) { - return null; - } - - @Override - public List getNetworkDevices() { - final InstanceIdentifier path = InstanceIdentifier.builder(Nodes.class).toInstance(); - final Nodes data = ((Nodes) getDataService().readOperationalData(path)); - final ArrayList ret = new ArrayList<>(); - for (final Node node : data.getNode()) { - try { - ret.add(toSwitch(node)); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create switch {}", node), e); - } - } - return ret; - } - - @Override - public NodeConnector getNodeConnector(final org.opendaylight.controller.sal.core.Node node, final String nodeConnectorName) { - final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(nodeConnectorName)); - try { - return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, node); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create node connector for {} {}", node, nodeConnectorName), e); - } - } - - @Override - public Property getNodeConnectorProp(final NodeConnector nodeConnector, final String propName) { - return getNodeConnectorProps(nodeConnector).get(propName); - } - - @Override - public Map getNodeConnectorProps(final NodeConnector nodeConnector) { - final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(nodeConnector); - return toAdProperties(readNodeConnector(ref.getValue())); - } - - @Override - public Set getNodeConnectors(final org.opendaylight.controller.sal.core.Node node) { - final Node data = this.readNode(NodeMapping.toNodeRef(node).getValue()); - final HashSet ret = new HashSet<>(); - for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) { - try { - ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node)); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create node {} connector", node, nc.getKey()), e); - } - } - return ret; - } - - @Override - public String getNodeDescription(final org.opendaylight.controller.sal.core.Node node) { - return ((Description) getNodeProps(node).get(Description.propertyName)).getValue(); - } - - @Override - public byte[] getNodeMAC(final org.opendaylight.controller.sal.core.Node node) { - return ((MacAddress) getNodeProps(node).get(MacAddress.name)).getMacAddress(); - } - - @Override - public Property getNodeProp(final org.opendaylight.controller.sal.core.Node node, final String propName) { - return getNodeProps(node).get(propName); - } - - @Override - public Map getNodeProps(final org.opendaylight.controller.sal.core.Node node) { - final NodeRef ref = NodeMapping.toNodeRef(node); - return toAdProperties(((Node) getDataService().readOperationalData(ref.getValue()))); - } - - @Override - public Set getNodes() { - final InstanceIdentifier path = InstanceIdentifier.builder(Nodes.class).toInstance(); - final Nodes data = ((Nodes) getDataService().readOperationalData(path)); - final HashSet ret = new HashSet<>(); - for (final Node node : data.getNode()) { - try { - ret.add(new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, node.getKey())); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create node for {}", node), e); - } - } - return ret; - } - - private static Switch toSwitch(final Node node) throws ConstructionException { - return new Switch(new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, node.getKey())); - } - - @Override - public Set getPhysicalNodeConnectors(final org.opendaylight.controller.sal.core.Node node) { - final NodeRef ref = NodeMapping.toNodeRef(node); - final Node data = readNode(ref.getValue()); - final HashSet ret = new HashSet<>(); - for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) { - final FlowCapableNodeConnector flowConnector = nc.getAugmentation(FlowCapableNodeConnector.class); - try { - ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node)); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create connector for {} on node {}", nc.getKey(), node), e); - } - } - return ret; - } - - private static Map toAdProperties(final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector connector) { - return Collections.emptyMap(); - } - - private static Map toAdProperties(final Node connector) { - return Collections.emptyMap(); - } - - private Node readNode(final InstanceIdentifier ref) { - return (Node) getDataService().readOperationalData((ref)); - } - - private org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector readNodeConnector(final InstanceIdentifier ref) { - return ((org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) getDataService().readOperationalData(ref)); - } - - @Override - public List getSpanPorts(final org.opendaylight.controller.sal.core.Node node) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Subnet getSubnetByNetworkAddress(final InetAddress networkAddress) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Set getUpNodeConnectors(final org.opendaylight.controller.sal.core.Node node) { - final Node data = readNode(NodeMapping.toNodeRef(node).getValue()); - final HashSet ret = new HashSet<>(); - for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) { - final FlowCapableNodeConnector flowConn = nc.getAugmentation(FlowCapableNodeConnector.class); - if (flowConn != null && flowConn.getState() != null && !flowConn.getState().isLinkDown()) { - try { - ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node)); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create node connector for node {} connector {}", node, nc), e); - } - } - } - return ret; - } - - @Override - public Boolean isNodeConnectorEnabled(final NodeConnector nodeConnector) { - final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(nodeConnector); - final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector data = readNodeConnector(ref.getValue()); - return true; - } - - @Override - public boolean isSpecial(final NodeConnector p) { - final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(p); - final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector data = readNodeConnector(ref.getValue()); - return true; - } - - @Override - public Status removeControllerProperty(final String propertyName) { - return null; - } - - @Override - public Status removeNodeAllProps(final org.opendaylight.controller.sal.core.Node node) { - return null; - } - - @Override - public Status removeNodeConnectorAllProps(final NodeConnector nodeConnector) { - return null; - } - - @Override - public Status removeNodeConnectorProp(final NodeConnector nc, final String propName) { - return null; - } - - @Override - public Status removeNodeProp(final org.opendaylight.controller.sal.core.Node node, final String propName) { - return null; - } - - @Override - public Status removePortsFromSubnet(final String name, final List nodeConnectors) { - return null; - } - - @Override - public Status removeSubnet(final String name) { - return null; - } - - @Override - public Status setControllerProperty(final Property property) { - return null; - } - - @Override - public void setNodeProp(final org.opendaylight.controller.sal.core.Node node, final Property prop) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Status addPortsToSubnet(final String name, final List nodeConnectors) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Set getConfiguredNotConnectedSwitches() { - return null; - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java deleted file mode 100644 index 63f682a361..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.switchmanager; - -import java.util.List; - -import org.opendaylight.controller.sal.utils.Status; -import org.opendaylight.controller.switchmanager.ISwitchManager; -import org.opendaylight.controller.switchmanager.SpanConfig; -import org.opendaylight.controller.switchmanager.SubnetConfig; -import org.opendaylight.controller.switchmanager.SwitchConfig; - -/** - * These methods should be backed by config subsystem. - */ -public abstract class ConfigurableSwitchManager implements ISwitchManager { - @Override - public Status saveSwitchConfig() { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Status removeSpanConfig(final SpanConfig cfgObject) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Status addSubnet(final SubnetConfig configObject) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final Status addSpanConfig(final SpanConfig configObject) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final List getSpanConfigList() { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final void updateSwitchConfig(final SwitchConfig cfgObject) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final Status updateNodeConfig(final SwitchConfig switchConfig) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final SubnetConfig getSubnetConfig(final String subnet) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final Status removeNodeConfig(final String nodeId) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final Status removeSubnet(final SubnetConfig configObject) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final List getSubnetsConfigList() { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final SwitchConfig getSwitchConfig(final String nodeId) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public Status modifySubnet(final SubnetConfig configObject) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java deleted file mode 100644 index 8e50bd881e..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.topology; - -import java.util.Iterator; - -import org.opendaylight.controller.sal.compatibility.InventoryMapping; -import org.opendaylight.controller.sal.core.ConstructionException; -import org.opendaylight.controller.sal.core.Edge; -import org.opendaylight.controller.sal.core.NodeConnector; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; -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.Link; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; - -import com.google.common.base.Splitter; - -public class TopologyMapping { - private static final String HEAD_TAIL_STRING = "::::"; - private static final Splitter HEAD_TAIL_SPLITTER = Splitter.on(HEAD_TAIL_STRING); - - public TopologyMapping(final TopologyKey path, final InstanceIdentifier key) { - // No-op for now. Multi-instance will require fixing InventoryMapping first. - } - - public Edge toAdTopologyEdge(final InstanceIdentifier identifier) throws ConstructionException { - @SuppressWarnings("unchecked") - final LinkKey linkKey = ((KeyedInstanceIdentifier)identifier).getKey(); - - final Iterator it = HEAD_TAIL_SPLITTER.split(linkKey.getLinkId().getValue()).iterator(); - final NodeConnector tail = InventoryMapping.nodeConnectorFromId(it.next()); - final NodeConnector head = InventoryMapping.nodeConnectorFromId(it.next()); - return new Edge(tail, head); - } - - public NodeConnector toAdTopologyNodeConnector(final InstanceIdentifier identifier) { - @SuppressWarnings("unchecked") - final TerminationPointKey tpKey = ((KeyedInstanceIdentifier)identifier).getKey(); - - return InventoryMapping.nodeConnectorFromId(tpKey.getTpId().getValue()); - } - - public org.opendaylight.controller.sal.core.Node toAdTopologyNode(final InstanceIdentifier identifier) { - @SuppressWarnings("unchecked") - final NodeKey nodeKey = ((KeyedInstanceIdentifier)identifier).getKey(); - - return InventoryMapping.nodeFromNodeId(nodeKey.getNodeId().getValue()); - } - - public NodeKey toTopologyNodeKey(final org.opendaylight.controller.sal.core.Node node) { - return new NodeKey(new NodeId(InventoryMapping.toNodeId(node))); - } - - public TerminationPointKey toTopologyTerminationPointKey(final NodeConnector nc) { - return new TerminationPointKey(new TpId(InventoryMapping.toNodeConnectorId(nc))); - } - - public LinkKey toTopologyLinkKey(final Edge edge) { - final TerminationPointKey sourceTp = toTopologyTerminationPointKey(edge.getTailNodeConnector()); - final TerminationPointKey destTp = toTopologyTerminationPointKey(edge.getHeadNodeConnector()); - - final StringBuilder sb = new StringBuilder(); - sb.append(sourceTp.getTpId().toString()); - sb.append(HEAD_TAIL_STRING); - sb.append(destTp.getTpId().toString()); - return new LinkKey(new LinkId(sb.toString())); - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java deleted file mode 100644 index a4ac6f94ee..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.topology; - -import java.util.ArrayList; -import java.util.Map; -import java.util.Set; - -import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider; -import org.opendaylight.controller.sal.core.ConstructionException; -import org.opendaylight.controller.sal.core.Edge; -import org.opendaylight.controller.sal.core.NodeConnector; -import org.opendaylight.controller.sal.core.Property; -import org.opendaylight.controller.switchmanager.ISwitchManager; -import org.opendaylight.controller.topologymanager.ITopologyManager; -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.TopologyId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.DestinationBuilder; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.SourceBuilder; -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.TopologyBuilder; -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.Link; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TopologyReader implements RuntimeDataProvider { - private static final Logger LOG = LoggerFactory.getLogger(TopologyReader.class); - private final InstanceIdentifier topologyPath; - private final TopologyKey topologyKey; - private final TopologyMapping mapping; - private ITopologyManager topologyManager; - private ISwitchManager switchManager; - - public ISwitchManager getSwitchManager() { - return this.switchManager; - } - - public void setSwitchManager(final ISwitchManager switchManager) { - this.switchManager = switchManager; - } - - public ITopologyManager getTopologyManager() { - return this.topologyManager; - } - - public void setTopologyManager(final ITopologyManager topologyManager) { - this.topologyManager = topologyManager; - } - - public TopologyKey getTopologyKey() { - return this.topologyKey; - } - - public TopologyMapping getMapping() { - return this.mapping; - } - - public TopologyReader() { - this.topologyKey = new TopologyKey(new TopologyId("compatibility:ad-sal")); - this.topologyPath = InstanceIdentifier.builder(NetworkTopology.class) - .child(Topology.class, topologyKey) - .toInstance(); - this.mapping = new TopologyMapping(topologyKey, topologyPath); - } - - @Override - public DataObject readConfigurationData(final InstanceIdentifier path) { - // Topology and Inventory are operational only - return null; - } - - @SuppressWarnings("unchecked") - @Override - public DataObject readOperationalData(final InstanceIdentifier path) { - if (!topologyPath.contains(path)) { - return null; - } - - final Class type = path.getTargetType(); - if (Link.class.equals(type)) { - return readLink((InstanceIdentifier) path); - } - if (Node.class.equals(type)) { - return readNode((InstanceIdentifier) path); - } - if (TerminationPoint.class.equals(type)) { - return readTerminationPoint((InstanceIdentifier) path); - - } - if (Topology.class.equals(type)) { - return readTopology((InstanceIdentifier) path); - } - - LOG.debug("Unsupported type {}", type); - return null; - } - - private Link readLink(final InstanceIdentifier identifier) { - final Edge edge; - try { - edge = this.mapping.toAdTopologyEdge(identifier); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to construct edge for link %s", identifier), e); - } - - final Map> edges; - if (topologyManager != null) { - edges = topologyManager.getEdges(); - } else { - edges = null; - } - - final Set properties; - if (edges != null) { - properties = edges.get(edge); - } else { - properties = null; - } - - return constructLink(edge); - } - - private TerminationPoint readTerminationPoint(final InstanceIdentifier identifier) { - return constructTerminationPoint(mapping.toAdTopologyNodeConnector(identifier)); - } - - private Node readNode(final InstanceIdentifier identifier) { - return constructNode(mapping.toAdTopologyNode(identifier)); - } - - private Topology readTopology(final InstanceIdentifier identifier) { - final Set nodes = getSwitchManager().getNodes(); - final ArrayList nodeList = new ArrayList(nodes.size()); - for (final org.opendaylight.controller.sal.core.Node node : nodes) { - nodeList.add(constructNode(node)); - } - - final Map> edges = getTopologyManager().getEdges(); - final ArrayList linkList = new ArrayList(edges.size()); - for (final Edge edge : edges.keySet()) { - linkList.add(constructLink(edge)); - } - - return new TopologyBuilder() - .setKey(topologyKey) - .setNode(nodeList) - .setLink(linkList) - .build(); - } - - private Link constructLink(final Edge edge) { - final NodeConnector sourceNc = edge.getTailNodeConnector(); - final NodeConnector destNc = edge.getHeadNodeConnector(); - - final LinkBuilder it = new LinkBuilder().setKey(mapping.toTopologyLinkKey(edge)); - - it.setSource(new SourceBuilder() - .setSourceNode(mapping.toTopologyNodeKey(sourceNc.getNode()).getNodeId()) - .setSourceTp(mapping.toTopologyTerminationPointKey(sourceNc).getTpId()) - .build()); - - it.setDestination(new DestinationBuilder() - .setDestNode(mapping.toTopologyNodeKey(destNc.getNode()).getNodeId()) - .setDestTp(mapping.toTopologyTerminationPointKey(destNc).getTpId()) - .build()); - - return it.build(); - } - - private Node constructNode(final org.opendaylight.controller.sal.core.Node node) { - final Set connectors = getSwitchManager().getNodeConnectors(node); - final ArrayList tpList = new ArrayList(connectors.size()); - for (final NodeConnector connector : connectors) { - tpList.add(constructTerminationPoint(connector)); - } - - return new NodeBuilder() - .setKey(mapping.toTopologyNodeKey(node)) - .setTerminationPoint(tpList) - .build(); - } - - private TerminationPoint constructTerminationPoint(final NodeConnector connector) { - return new TerminationPointBuilder().setKey(mapping.toTopologyTerminationPointKey(connector)).build(); - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java deleted file mode 100644 index a7a7a9ac3a..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.topologymanager; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.opendaylight.controller.sal.compatibility.NodeMapping; -import org.opendaylight.controller.sal.core.ConstructionException; -import org.opendaylight.controller.sal.core.Edge; -import org.opendaylight.controller.sal.core.NodeConnector; -import org.opendaylight.controller.sal.core.Property; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; -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.NodeId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Destination; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Source; -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.Link; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public class AdSalTopologyMapping { - private final InstanceIdentifier topologyPath; - - public AdSalTopologyMapping(final TopologyKey topology) { - this.topologyPath = InstanceIdentifier.builder(NetworkTopology.class) - .child(Topology.class, topology).toInstance(); - } - - public InstanceIdentifier getTopologyPath() { - return topologyPath; - } - - public InstanceIdentifier toTerminationPoint(final NodeConnector connector) { - return getTopologyPath().builder() - .child(Node.class) - .child(TerminationPoint.class, toTerminationPointKey(connector)) - .toInstance(); - } - - public Map> toEdgePropertiesMap(final Iterable links) { - final HashMap> ret = new HashMap<>(); - for (final Link link : links) { - try { - ret.put(toEdge(link), toProperties(link)); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to create edge properties for {}", link), e); - } - } - return ret; - } - - public static Set toEdges(final Iterable links) throws ConstructionException { - final HashSet ret = new HashSet(); - for (final Link link : links) { - ret.add(toEdge(link)); - } - return ret; - } - - public static Edge toEdge(final Link link) throws ConstructionException { - final NodeConnector tail = toNodeConnector(link.getSource()); - final NodeConnector head = toNodeConnector(link.getDestination()); - return new Edge(tail, head); - } - - public static org.opendaylight.controller.sal.core.Node toAdNode(final Node node) throws ConstructionException { - return toAdNode(node.getNodeId()); - } - - public static org.opendaylight.controller.sal.core.Node toAdNode(final NodeId node) throws ConstructionException { - final NodeKey key = new NodeKey( - new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId(node)); - return new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, key); - } - - public static NodeConnector toNodeConnector(final Source ref) throws ConstructionException { - final org.opendaylight.controller.sal.core.Node adNode = toAdNode(ref.getSourceNode()); - final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(ref.getSourceTp())); - return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode); - } - - public static NodeConnector toNodeConnector(final Destination ref) throws ConstructionException { - final org.opendaylight.controller.sal.core.Node adNode = toAdNode(ref.getDestNode()); - final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(ref.getDestTp())); - return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode); - } - - public TerminationPointKey toTerminationPointKey(final NodeConnector connector) { - return null; - } - - public Set toProperties(final Link link) { - return null; - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java deleted file mode 100644 index 11320a12cd..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.topologymanager; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader; -import org.opendaylight.controller.sal.core.ConstructionException; -import org.opendaylight.controller.sal.core.Edge; -import org.opendaylight.controller.sal.core.Host; -import org.opendaylight.controller.sal.core.NodeConnector; -import org.opendaylight.controller.sal.core.Property; -import org.opendaylight.controller.sal.core.UpdateType; -import org.opendaylight.controller.sal.utils.Status; -import org.opendaylight.controller.topologymanager.ITopologyManager; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; -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.topology.Link; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -import com.google.common.base.Predicate; -import com.google.common.collect.FluentIterable; - -@SuppressWarnings("all") -public class CompatibleTopologyManager extends ConfigurableLinkManager implements ITopologyManager { - private AdSalTopologyMapping topologyMapping; - private TypeSafeDataReader dataReader; - - public TypeSafeDataReader getDataReader() { - return dataReader; - } - - public void setDataReader(final TypeSafeDataReader dataReader) { - this.dataReader = dataReader; - } - - public AdSalTopologyMapping getTopologyMapping() { - return topologyMapping; - } - - public void setTopologyMapping(final AdSalTopologyMapping topologyMapping) { - this.topologyMapping = topologyMapping; - } - - @Override - public Map> getEdges() { - final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath()); - return this.topologyMapping.toEdgePropertiesMap(topology.getLink()); - } - - @Override - public Map> getNodeEdges() { - final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath()); - final HashMap> ret = new HashMap<>(); - for (final Node node : topology.getNode()) { - try { - ret.put(topologyMapping.toAdNode(node), topologyMapping.toEdges( - FluentIterable.from(topology.getLink()).filter(new Predicate() { - @Override - public boolean apply(final Link input) { - final NodeId nodeId = node.getNodeId(); - if (nodeId.equals(input.getSource().getSourceNode())) { - return true; - } - if (nodeId.equals(input.getDestination().getDestNode())) { - return true; - } - - return false; - } - }))); - } catch (ConstructionException e) { - throw new IllegalStateException(String.format("Failed to construct node for {}", node), e); - } - } - return ret; - } - - /** - * Returns true if point is connected to link - */ - private boolean isInternal(final TerminationPoint point) { - final Topology topology = getDataReader().readConfigurationData(topologyMapping.getTopologyPath()); - final TpId tpId = point.getKey().getTpId(); - return FluentIterable.from(topology.getLink()).anyMatch(new Predicate() { - @Override - public boolean apply(final Link input) { - if (tpId.equals(input.getSource().getSourceTp())) { - return true; - } - if (tpId.equals(input.getDestination().getDestTp())) { - return true; - } - return false; - } - }); - } - - @Override - public Set getNodeConnectorWithHost() { - return null; - } - - @Override - public Host getHostAttachedToNodeConnector(final NodeConnector p) { - final InstanceIdentifier tpPath = topologyMapping.toTerminationPoint(p); - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public List getHostsAttachedToNodeConnector(final NodeConnector p) { - final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath()); - throw new UnsupportedOperationException("Hosts not mapped yet"); - } - - @Override - public Map> getNodesWithNodeConnectorHost() { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public boolean isInternal(final NodeConnector p) { - final TerminationPoint connector = getDataReader() - .readConfigurationData(topologyMapping.toTerminationPoint(p)); - return this.isInternal(connector); - } - - @Override - public void updateHostLink(final NodeConnector p, final Host h, final UpdateType t, final Set props) { - // Update app defined topology - } - - @Override - public Status saveConfig() { - // FIXME: commit configuration - return null; - } -} diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java deleted file mode 100644 index 2d85f76278..0000000000 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.compatibility.topologymanager; - -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.sal.utils.Status; -import org.opendaylight.controller.topologymanager.ITopologyManager; -import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig; - -public abstract class ConfigurableLinkManager implements ITopologyManager { - @Override - public final Status addUserLink(final TopologyUserLinkConfig link) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final Status deleteUserLink(final String linkName) { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } - - @Override - public final ConcurrentMap getUserLinks() { - throw new UnsupportedOperationException("TODO: auto-generated method stub"); - } -} diff --git a/opendaylight/md-sal/compatibility/pom.xml b/opendaylight/md-sal/compatibility/pom.xml index 688e6ac09b..b9e9d19b48 100644 --- a/opendaylight/md-sal/compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/pom.xml @@ -12,8 +12,6 @@ sal-compatibility - inventory-topology-compatibility - flow-management-compatibility diff --git a/opendaylight/md-sal/forwardingrules-manager/pom.xml b/opendaylight/md-sal/forwardingrules-manager/pom.xml index ed5e192193..5a9b190219 100644 --- a/opendaylight/md-sal/forwardingrules-manager/pom.xml +++ b/opendaylight/md-sal/forwardingrules-manager/pom.xml @@ -19,10 +19,6 @@ org.opendaylight.controller sal-binding-api - - org.opendaylight.controller.model - model-flow-management - org.opendaylight.controller.model model-flow-service diff --git a/opendaylight/md-sal/sal-binding-dom-it/pom.xml b/opendaylight/md-sal/sal-binding-dom-it/pom.xml index 42d5cfff65..7a66c41196 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-dom-it/pom.xml @@ -29,11 +29,6 @@ test-jar test - - org.opendaylight.controller.model - model-flow-management - test - org.opendaylight.controller.model model-flow-service diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java deleted file mode 100644 index 34a71ac0c4..0000000000 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.sal.binding.test.bugfix; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import org.junit.Ignore; -import org.junit.Test; -import org.opendaylight.controller.md.sal.common.api.TransactionStatus; -import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; -import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.common.RpcResult; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; - -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; - -@SuppressWarnings("deprecation") -public class DOMCodecBug01Test extends AbstractDataServiceTest { - - private static final long FLOW_ID = 1234; - private static final String NODE_ID = "node:1"; - - private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID)); - - private static final InstanceIdentifier NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) // - .child(Node.class, NODE_KEY).toInstance(); - - private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA); - - private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID, NODE_REF); - - private static final InstanceIdentifier FLOW_INSTANCE_ID_BA = // - InstanceIdentifier.builder(Flows.class) // - .child(Flow.class, FLOW_KEY) // - .toInstance(); - - - - /** - * - * Testcase for https://bugs.opendaylight.org/show_bug.cgi?id= - * - * Cannot compile CoDec for - * org.opendaylight.yang.gen.v1.urn.opendaylight.flow - * .config.rev130819.flows.Flow - * - * When invoking following code in the consumer, user got an - * IllegalStateException during creation of mapping between Java DTOs and - * data-dom. - * - * Exception was compilation error which was caused by incorect generation - * of code. - * - * Reported by Depthi V V - * - * @deprecated This test tests indirect generation, which should be tested - * different way. the test creates conflicting transactions - * and assumes correct commit - to test codec generation - * - */ - @Test - @Ignore - @Deprecated - public void testIndirectGeneration() throws Exception { - - ExecutorService basePool = Executors.newFixedThreadPool(2); - ListeningExecutorService listenablePool = MoreExecutors.listeningDecorator(basePool); - - createFlow(); - - Object lock = new Object(); - CreateFlowTask task1 = new CreateFlowTask(lock); - CreateFlowTask task2 = new CreateFlowTask(lock); - CreateFlowTask task3 = new CreateFlowTask(lock); - - ListenableFuture task1Future = listenablePool.submit(task1); - ListenableFuture task2Future = listenablePool.submit(task2); - ListenableFuture task3Future = listenablePool.submit(task3); - - - @SuppressWarnings("unchecked") - ListenableFuture> compositeFuture = Futures.allAsList(task1Future,task2Future,task3Future); - - Thread.sleep(500); - //lock.notifyAll(); - compositeFuture.get(); - - verifyDataAreStoredProperly(); - - DataModificationTransaction modification2 = baDataService.beginTransaction(); - modification2.removeConfigurationData(FLOW_INSTANCE_ID_BA); - - DataObject originalData = modification2.getOriginalConfigurationData().get(FLOW_INSTANCE_ID_BA); - assertNotNull(originalData); - RpcResult ret2 = modification2.commit().get(); - - assertNotNull(ret2); - assertEquals(TransactionStatus.COMMITED, ret2.getResult()); - - // Data are not in the store. - assertNull(baDataService.readConfigurationData(FLOW_INSTANCE_ID_BA)); - - } - - private void createFlow() throws Exception { - - DataModificationTransaction modification = baDataService.beginTransaction(); - - FlowBuilder flow = new FlowBuilder(); - MatchBuilder match = new MatchBuilder(); - VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); - VlanIdBuilder vlanIdBuilder = new VlanIdBuilder(); - VlanId vlanId = new VlanId(10); - vlanBuilder.setVlanId(vlanIdBuilder.setVlanId(vlanId).build()); - match.setVlanMatch(vlanBuilder.build()); - - flow.setKey(FLOW_KEY); - flow.setMatch(match.build()); - flow.setNode(NODE_REF); - InstructionsBuilder instructions = new InstructionsBuilder(); - InstructionBuilder instruction = new InstructionBuilder(); - - instruction.setOrder(10); - ApplyActionsBuilder applyActions = new ApplyActionsBuilder(); - List actionList = new ArrayList<>(); - PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder(); - popMplsAction.setEthernetType(34); - actionList.add(new ActionBuilder().setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build()).setOrder(10).build()); - - applyActions.setAction(actionList ); - - instruction.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActions.build()).build()); - - - List instructionList = Collections.singletonList(instruction.build()); - instructions.setInstruction(instructionList ); - - flow.setInstructions(instructions.build()); - modification.putConfigurationData(FLOW_INSTANCE_ID_BA, flow.build()); - RpcResult ret = modification.commit().get(); - assertNotNull(ret); - assertEquals(TransactionStatus.COMMITED, ret.getResult()); - } - - private void createFlow2() throws Exception { - DataModificationTransaction modification = baDataService.beginTransaction(); - long id = 123; - FlowKey key = new FlowKey(id, new NodeRef(NODE_INSTANCE_ID_BA)); - InstanceIdentifier path1; - FlowBuilder flow = new FlowBuilder(); - flow.setKey(key); - MatchBuilder match = new MatchBuilder(); - match.setLayer4Match(new TcpMatchBuilder().build()); - flow.setMatch(match.build()); - - path1 = InstanceIdentifier.builder(Flows.class).child(Flow.class, key).toInstance(); - // DataObject cls = (DataObject) modification.readConfigurationData(path1); - modification.putConfigurationData(path1, flow.build()); - modification.commit(); - - } - - private class CreateFlowTask implements Callable { - - public CreateFlowTask(final Object startSync) { - } - - @Override - public Void call() { - try { - //startSyncObj ect.wait(); - //Thread.sleep(500); - createFlow(); - createFlow2(); - } catch (Exception e) { - throw new RuntimeException(e); - } - return null; - } - } - - private void verifyDataAreStoredProperly() { - CompositeNode biFlows = biDataService.readConfigurationData(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.of(Flows.QNAME)); - assertNotNull(biFlows); - CompositeNode biFlow = biFlows.getFirstCompositeByName(Flow.QNAME); - assertNotNull(biFlow); - } - - -} diff --git a/opendaylight/md-sal/sal-binding-it/pom.xml b/opendaylight/md-sal/sal-binding-it/pom.xml index 98515966d9..25a48761dc 100644 --- a/opendaylight/md-sal/sal-binding-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-it/pom.xml @@ -128,11 +128,6 @@ org.slf4j log4j-over-slf4j - - org.opendaylight.controller.model - model-flow-management - provided - org.opendaylight.controller.model model-flow-service diff --git a/opendaylight/md-sal/topology-lldp-discovery/pom.xml b/opendaylight/md-sal/topology-lldp-discovery/pom.xml index 2c8571ca64..e01a0d5dcb 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/pom.xml +++ b/opendaylight/md-sal/topology-lldp-discovery/pom.xml @@ -45,10 +45,6 @@ org.opendaylight.controller.model model-flow-base - - org.opendaylight.controller.model - model-flow-management - org.opendaylight.controller.model model-flow-service diff --git a/opendaylight/netconf/netconf-cli/pom.xml b/opendaylight/netconf/netconf-cli/pom.xml index cd7a1aacf2..55a8715000 100644 --- a/opendaylight/netconf/netconf-cli/pom.xml +++ b/opendaylight/netconf/netconf-cli/pom.xml @@ -52,12 +52,10 @@ org.opendaylight.yangtools yang-data-impl - org.opendaylight.yangtools - yang-data-json - 0.6.2-SNAPSHOT + yang-data-composite-node org.opendaylight.yangtools diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java index c101db9ef8..ef29a76fff 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java @@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher; import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils; -import org.opendaylight.yangtools.yang.data.json.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory; +import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; import org.opendaylight.yangtools.yang.model.api.ChoiceNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;