<hosttracker.api.version>0.5.2-SNAPSHOT</hosttracker.api.version>
<hosttracker.implementation.version>0.5.2-SNAPSHOT</hosttracker.implementation.version>
<hosttracker.northbound.version>0.4.2-SNAPSHOT</hosttracker.northbound.version>
+ <hosttracker.shell.version>1.0.0-SNAPSHOT</hosttracker.shell.version>
<hosttracker_new.api.version>0.4.2-SNAPSHOT</hosttracker_new.api.version>
<hosttracker_new.implementation.version>0.4.2-SNAPSHOT</hosttracker_new.implementation.version>
<httpservice-bridge.northbound.version>0.0.2-SNAPSHOT</httpservice-bridge.northbound.version>
<northbound.jolokia.version>1.4.2-SNAPSHOT</northbound.jolokia.version>
<opendaylight-l2-types.version>2013.08.27.4-SNAPSHOT</opendaylight-l2-types.version>
<osgi-brandfragment.web.version>0.0.2-SNAPSHOT</osgi-brandfragment.web.version>
+ <pax.exam.version>4.0.0</pax.exam.version>
<parboiled.version>1.1.6</parboiled.version>
<parboiled.scala.version>1.1.6</parboiled.scala.version>
<propertymavenplugin.version>1.0-alpha-2</propertymavenplugin.version>
<topology.northbound.version>0.4.2-SNAPSHOT</topology.northbound.version>
<topology.web.version>0.4.2-SNAPSHOT</topology.web.version>
<topologymanager.version>0.4.2-SNAPSHOT</topologymanager.version>
+ <topologymanager.shell.version>1.0.0-SNAPSHOT</topologymanager.shell.version>
<troubleshoot.web.version>0.4.2-SNAPSHOT</troubleshoot.web.version>
<typesafe.config.version>1.2.0</typesafe.config.version>
<uncommons.maths.version>1.2.2</uncommons.maths.version>
<artifactId>sal-rest-connector-config</artifactId>
<version>${mdsal.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-netty-config</artifactId>
+ <version>${config.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>md-sal-config</artifactId>
+ <version>${mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>netconf-config</artifactId>
+ <version>${netconf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>netconf-connector-config</artifactId>
+ <version>${netconf.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-rest-docgen</artifactId>
<artifactId>sample-toaster-provider</artifactId>
<version>${mdsal.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller.samples</groupId>
+ <artifactId>toaster-config</artifactId>
+ <version>${mdsal.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller.thirdparty</groupId>
<artifactId>com.sun.jersey.jersey-servlet</artifactId>
<artifactId>util</artifactId>
<version>${yangtools.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-composite-node</artifactId>
+ <version>${yangtools.version}</version>
+ </dependency>
<!-- yangtools dependencies -->
<dependency>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${project.build.directory}/configuration</outputDirectory>
- <includeArtifactIds>sal-rest-connector-config</includeArtifactIds>
+ <includeArtifactIds>sal-rest-connector-config,config-netty-config,md-sal-config,netconf-config,toaster-config,netconf-connector-config</includeArtifactIds>
<includes>**\/*.xml</includes>
<excludeTransitive>true</excludeTransitive>
<ignorePermissions>false</ignorePermissions>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-rest-connector-config</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-netty-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>md-sal-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>netconf-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>netconf-connector-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller.samples</groupId>
+ <artifactId>toaster-config</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-rest-docgen</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-parser-impl</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-composite-node</artifactId>
+ </dependency>
<!-- yang model dependencies -->
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${project.build.directory}/configuration</outputDirectory>
- <includeArtifactIds>sal-rest-connector-config</includeArtifactIds>
+ <includeArtifactIds>sal-rest-connector-config,config-netty-config,md-sal-config,netconf-config,toaster-config,netconf-connector-config</includeArtifactIds>
<includes>**\/*.xml</includes>
<excludeTransitive>true</excludeTransitive>
<ignorePermissions>false</ignorePermissions>
import java.util.Collection;
import java.util.Collections;
-
+ import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+ import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
import org.opendaylight.controller.sal.core.api.Provider;
- import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
- import org.opendaylight.controller.sal.core.api.mount.MountService;
import org.opendaylight.controller.sal.rest.api.RestConnector;
import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.streams.websockets.WebSocketServer;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
public class RestconfProviderImpl implements Provider, AutoCloseable, RestConnector {
public final static String NOT_INITALIZED_MSG = "Restconf is not initialized yet. Please try again later";
- private ListenerRegistration<SchemaServiceListener> listenerRegistration;
+ private ListenerRegistration<SchemaContextListener> listenerRegistration;
private PortNumber port;
public void setWebsocketPort(PortNumber port) {
this.port = port;
@Override
public void onSessionInitiated(ProviderSession session) {
- DataBrokerService dataService = session.getService(DataBrokerService.class);
+ final DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class);
BrokerFacade.getInstance().setContext(session);
- BrokerFacade.getInstance().setDataService(dataService);
+ BrokerFacade.getInstance().setDomDataBroker( domDataBroker);
SchemaService schemaService = session.getService(SchemaService.class);
- listenerRegistration = schemaService.registerSchemaServiceListener(ControllerContext.getInstance());
+ listenerRegistration = schemaService.registerSchemaContextListener(ControllerContext.getInstance());
ControllerContext.getInstance().setSchemas(schemaService.getGlobalContext());
- ControllerContext.getInstance().setMountService(session.getService(MountService.class));
+ ControllerContext.getInstance().setMountService(session.getService(DOMMountPointService.class));
webSocketServerThread = new Thread(WebSocketServer.createInstance(port.getValue().intValue()));
webSocketServerThread.setName("Web socket server on port " + port);
import com.google.common.base.Function;
import com.google.common.base.Objects;
+ import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
-
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLDecoder;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
-
import javax.ws.rs.core.Response.Status;
-
- import org.opendaylight.controller.sal.core.api.mount.MountInstance;
- import org.opendaylight.controller.sal.core.api.mount.MountService;
+ import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+ import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.sal.rest.api.Draft02;
import org.opendaylight.controller.sal.rest.impl.RestUtil;
import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorTag;
new AtomicReference<>(Collections.<QName, RpcDefinition>emptyMap());
private volatile SchemaContext globalSchema;
- private volatile MountService mountService;
+ private volatile DOMMountPointService mountService;
public void setGlobalSchema(final SchemaContext globalSchema) {
this.globalSchema = globalSchema;
}
- public void setMountService(final MountService mountService) {
+ public void setMountService(final DOMMountPointService mountService) {
this.mountService = mountService;
}
return this.getLatestModule(globalSchema, moduleName);
}
- public Module findModuleByName(final MountInstance mountPoint, final String moduleName) {
+ public Module findModuleByName(final DOMMountPoint mountPoint, final String moduleName) {
Preconditions.checkArgument(moduleName != null && mountPoint != null);
final SchemaContext mountPointSchema = mountPoint.getSchemaContext();
return moduleSchemas == null ? null : this.filterLatestModule(moduleSchemas);
}
- public Module findModuleByNamespace(final MountInstance mountPoint, final URI namespace) {
+ public Module findModuleByNamespace(final DOMMountPoint mountPoint, final URI namespace) {
Preconditions.checkArgument(namespace != null && mountPoint != null);
final SchemaContext mountPointSchema = mountPoint.getSchemaContext();
return globalSchema.findModuleByName(module.getLocalName(), module.getRevision());
}
- public Module findModuleByNameAndRevision(final MountInstance mountPoint, final QName module) {
+ public Module findModuleByNameAndRevision(final DOMMountPoint mountPoint, final QName module) {
this.checkPreconditions();
Preconditions.checkArgument(module != null && module.getLocalName() != null && module.getRevision() != null
&& mountPoint != null);
return moduleName;
}
- public String findModuleNameByNamespace(final MountInstance mountPoint, final URI namespace) {
+ public String findModuleNameByNamespace(final DOMMountPoint mountPoint, final URI namespace) {
final Module module = this.findModuleByNamespace(mountPoint, namespace);
return module == null ? null : module.getName();
}
return namespace;
}
- public URI findNamespaceByModuleName(final MountInstance mountPoint, final String moduleName) {
+ public URI findNamespaceByModuleName(final DOMMountPoint mountPoint, final String moduleName) {
final Module module = this.findModuleByName(mountPoint, moduleName);
return module == null ? null : module.getNamespace();
}
- public Set<Module> getAllModules(final MountInstance mountPoint) {
+ public Set<Module> getAllModules(final DOMMountPoint mountPoint) {
this.checkPreconditions();
SchemaContext schemaContext = mountPoint == null ? null : mountPoint.getSchemaContext();
return builder.toString();
}
- public CharSequence toRestconfIdentifier(final MountInstance mountPoint, final QName qname) {
+ public CharSequence toRestconfIdentifier(final DOMMountPoint mountPoint, final QName qname) {
if (mountPoint == null) {
return null;
}
DataSchemaNode ret = container.getDataChildByName(name);
if (ret == null) {
for (final DataSchemaNode node : container.getChildNodes()) {
- if ((node instanceof ChoiceCaseNode)) {
- final ChoiceCaseNode caseNode = ((ChoiceCaseNode) node);
- DataSchemaNode childByQName = ControllerContext.childByQName(caseNode, name);
+ if ((node instanceof ChoiceNode)) {
+ final ChoiceNode choiceNode = ((ChoiceNode) node);
+ DataSchemaNode childByQName = ControllerContext.childByQName(choiceNode, name);
if (childByQName != null) {
return childByQName;
}
}
private InstanceIdWithSchemaNode collectPathArguments(final InstanceIdentifierBuilder builder,
- final List<String> strings, final DataNodeContainer parentNode, final MountInstance mountPoint,
+ final List<String> strings, final DataNodeContainer parentNode, final DOMMountPoint mountPoint,
final boolean returnJustMountPoint) {
Preconditions.<List<String>> checkNotNull(strings);
}
final YangInstanceIdentifier partialPath = builder.toInstance();
- final MountInstance mount = mountService.getMountPoint(partialPath);
- if (mount == null) {
+ final Optional<DOMMountPoint> mountOpt = mountService.getMountPoint(partialPath);
+ if (!mountOpt.isPresent()) {
LOG.debug("Instance identifier to missing mount point: {}", partialPath);
throw new RestconfDocumentedException("Mount point does not exist.", ErrorType.PROTOCOL,
ErrorTag.UNKNOWN_ELEMENT);
}
+ DOMMountPoint mount = mountOpt.get();
final SchemaContext mountPointSchema = mount.getSchemaContext();
if (mountPointSchema == null) {
}
private void addKeyValue(final HashMap<QName, Object> map, final DataSchemaNode node, final String uriValue,
- final MountInstance mountPoint) {
+ final DOMMountPoint mountPoint) {
Preconditions.<String> checkNotNull(uriValue);
Preconditions.checkArgument((node instanceof LeafSchemaNode));
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
- * {@link Notificator} is responsible to create, remove and find {@link ListenerAdapter} listener.
+ * {@link Notificator} is responsible to create, remove and find
+ * {@link ListenerAdapter} listener.
*/
public class Notificator {
private static Map<String, ListenerAdapter> listenersByStreamName = new ConcurrentHashMap<>();
- private static Map<YangInstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
private static final Lock lock = new ReentrantLock();
private Notificator() {
return listenersByStreamName.get(streamName);
}
- /**
- * Gets {@link ListenerAdapter} listener specified by {@link YangInstanceIdentifier} path.
- *
- * @param path
- * Path to data in data repository.
- * @return ListenerAdapter
- */
- public static ListenerAdapter getListenerFor(YangInstanceIdentifier path) {
- return listenersByInstanceIdentifier.get(path);
- }
-
/**
* Checks if the listener specified by {@link YangInstanceIdentifier} path exist.
*
- * @param path
- * Path to data in data repository.
+ * @param streamName
* @return True if the listener exist, false otherwise.
*/
- public static boolean existListenerFor(YangInstanceIdentifier path) {
- return listenersByInstanceIdentifier.containsKey(path);
+ public static boolean existListenerFor(String streamName) {
+ return listenersByStreamName.containsKey(streamName);
}
/**
ListenerAdapter listener = new ListenerAdapter(path, streamName);
try {
lock.lock();
- listenersByInstanceIdentifier.put(path, listener);
listenersByStreamName.put(streamName, listener);
} finally {
lock.unlock();
/**
* Looks for listener determined by {@link YangInstanceIdentifier} path and removes it.
- *
- * @param path
- * InstanceIdentifier
- */
- public static void removeListener(YangInstanceIdentifier path) {
- ListenerAdapter listener = listenersByInstanceIdentifier.get(path);
- deleteListener(listener);
- }
-
- /**
* Creates String representation of stream name from URI. Removes slash from URI in start and end position.
*
* @param uri
result = result.substring(1);
}
if (result.endsWith("/")) {
- result = result.substring(0, result.length());
+ result = result.substring(0, result.length()-1);
}
return result;
}
* Removes all listeners.
*/
public static void removeAllListeners() {
- for (ListenerAdapter listener : listenersByInstanceIdentifier.values()) {
+ for (ListenerAdapter listener : listenersByStreamName.values()) {
try {
listener.close();
} catch (Exception e) {
try {
lock.lock();
listenersByStreamName = new ConcurrentHashMap<>();
- listenersByInstanceIdentifier = new ConcurrentHashMap<>();
} finally {
lock.unlock();
}
}
try {
lock.lock();
- listenersByInstanceIdentifier.remove(listener.getPath());
listenersByStreamName.remove(listener.getStreamName());
} finally {
lock.unlock();