import org.opendaylight.controller.sal.restconf.impl.RestCodec;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
writeStringRepresentation(writer, node, baseType, QName.class);
}
} else if (baseType instanceof InstanceIdentifierTypeDefinition) {
- if (node.getValue() instanceof InstanceIdentifier) {
+ if (node.getValue() instanceof YangInstanceIdentifier) {
IdentityValuesDTO valueDTO = (IdentityValuesDTO) RestCodec.from(baseType, mountPoint).serialize(
node.getValue());
writeIdentityValuesDTOToJson(writer, valueDTO);
} else {
- writeStringRepresentation(writer, node, baseType, InstanceIdentifier.class);
+ writeStringRepresentation(writer, node, baseType, YangInstanceIdentifier.class);
}
} else if (baseType instanceof DecimalTypeDefinition || baseType instanceof IntegerTypeDefinition
|| baseType instanceof UnsignedIntegerTypeDefinition) {
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
+public class BrokerFacade implements DataReader<YangInstanceIdentifier, CompositeNode> {
private final static Logger LOG = LoggerFactory.getLogger(BrokerFacade.class);
private final static BrokerFacade INSTANCE = new BrokerFacade();
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
this.checkPreconditions();
LOG.trace("Read Configuration via Restconf: {}", path);
}
public CompositeNode readConfigurationDataBehindMountPoint(final MountInstance mountPoint,
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
this.checkPreconditions();
LOG.trace("Read Configuration via Restconf: {}", path);
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
this.checkPreconditions();
BrokerFacade.LOG.trace("Read Operational via Restconf: {}", path);
}
public CompositeNode readOperationalDataBehindMountPoint(final MountInstance mountPoint,
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
this.checkPreconditions();
BrokerFacade.LOG.trace("Read Operational via Restconf: {}", path);
return context.rpc(type, payload);
}
- public Future<RpcResult<TransactionStatus>> commitConfigurationDataPut(final InstanceIdentifier path,
+ public Future<RpcResult<TransactionStatus>> commitConfigurationDataPut(final YangInstanceIdentifier path,
final CompositeNode payload) {
this.checkPreconditions();
}
public Future<RpcResult<TransactionStatus>> commitConfigurationDataPutBehindMountPoint(
- final MountInstance mountPoint, final InstanceIdentifier path, final CompositeNode payload) {
+ final MountInstance mountPoint, final YangInstanceIdentifier path, final CompositeNode payload) {
this.checkPreconditions();
final DataModificationTransaction transaction = mountPoint.beginTransaction();
return transaction.commit();
}
- public Future<RpcResult<TransactionStatus>> commitConfigurationDataPost(final InstanceIdentifier path,
+ public Future<RpcResult<TransactionStatus>> commitConfigurationDataPost(final YangInstanceIdentifier path,
final CompositeNode payload) {
this.checkPreconditions();
}
public Future<RpcResult<TransactionStatus>> commitConfigurationDataPostBehindMountPoint(
- final MountInstance mountPoint, final InstanceIdentifier path, final CompositeNode payload) {
+ final MountInstance mountPoint, final YangInstanceIdentifier path, final CompositeNode payload) {
this.checkPreconditions();
final DataModificationTransaction transaction = mountPoint.beginTransaction();
return transaction.commit();
}
- public Future<RpcResult<TransactionStatus>> commitConfigurationDataDelete(final InstanceIdentifier path) {
+ public Future<RpcResult<TransactionStatus>> commitConfigurationDataDelete(final YangInstanceIdentifier path) {
this.checkPreconditions();
return deleteDataAtTarget(path, dataService.beginTransaction());
}
public Future<RpcResult<TransactionStatus>> commitConfigurationDataDeleteBehindMountPoint(
- final MountInstance mountPoint, final InstanceIdentifier path) {
+ final MountInstance mountPoint, final YangInstanceIdentifier path) {
this.checkPreconditions();
return deleteDataAtTarget(path, mountPoint.beginTransaction());
}
- private Future<RpcResult<TransactionStatus>> deleteDataAtTarget(final InstanceIdentifier path,
+ private Future<RpcResult<TransactionStatus>> deleteDataAtTarget(final YangInstanceIdentifier path,
final DataModificationTransaction transaction) {
LOG.info("Delete Configuration via Restconf: {}", path);
CompositeNode redDataAtPath = transaction.readConfigurationData(path);
return;
}
- InstanceIdentifier path = listener.getPath();
+ YangInstanceIdentifier path = listener.getPath();
final ListenerRegistration<DataChangeListener> registration = dataService.registerDataChangeListener(path,
listener);
import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType;
import org.opendaylight.yangtools.concepts.Codec;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
}
- InstanceIdentifierBuilder builder = InstanceIdentifier.builder();
+ InstanceIdentifierBuilder builder = YangInstanceIdentifier.builder();
Module latestModule = this.getLatestModule(globalSchema, startModule);
InstanceIdWithSchemaNode iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null,
toMountPointIdentifier);
module.getRevision());
}
- public DataNodeContainer getDataNodeContainerFor(final InstanceIdentifier path) {
+ public DataNodeContainer getDataNodeContainerFor(final YangInstanceIdentifier path) {
this.checkPreconditions();
final Iterable<PathArgument> elements = path.getPathArguments();
return node;
}
- public String toFullRestconfIdentifier(final InstanceIdentifier path) {
+ public String toFullRestconfIdentifier(final YangInstanceIdentifier path) {
this.checkPreconditions();
final Iterable<PathArgument> elements = path.getPathArguments();
ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED);
}
- final InstanceIdentifier partialPath = builder.toInstance();
+ final YangInstanceIdentifier partialPath = builder.toInstance();
final MountInstance mount = mountService.getMountPoint(partialPath);
if (mount == null) {
LOG.debug("Instance identifier to missing mount point: {}", partialPath);
}
if (returnJustMountPoint) {
- InstanceIdentifier instance = InstanceIdentifier.builder().toInstance();
+ YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
}
if (strings.size() == 1) {
- InstanceIdentifier instance = InstanceIdentifier.builder().toInstance();
+ YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
}
}
List<String> subList = strings.subList(1, strings.size());
- return this.collectPathArguments(InstanceIdentifier.builder(), subList, moduleBehindMountPoint, mount,
+ return this.collectPathArguments(YangInstanceIdentifier.builder(), subList, moduleBehindMountPoint, mount,
returnJustMountPoint);
}
package org.opendaylight.controller.sal.restconf.impl;
import org.opendaylight.controller.sal.core.api.mount.MountInstance;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
public class InstanceIdWithSchemaNode {
- private final InstanceIdentifier instanceIdentifier;
+ private final YangInstanceIdentifier instanceIdentifier;
private final DataSchemaNode schemaNode;
private final MountInstance mountPoint;
- public InstanceIdWithSchemaNode(InstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
+ public InstanceIdWithSchemaNode(YangInstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
MountInstance mountPoint) {
this.instanceIdentifier = instanceIdentifier;
this.schemaNode = schemaNode;
this.mountPoint = mountPoint;
}
- public InstanceIdentifier getInstanceIdentifier() {
+ public YangInstanceIdentifier getInstanceIdentifier() {
return instanceIdentifier;
}
import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.Predicate;
import org.opendaylight.yangtools.concepts.Codec;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.codec.IdentityrefCodec;
import org.opendaylight.yangtools.yang.data.api.codec.InstanceIdentifierCodec;
import org.opendaylight.yangtools.yang.data.api.codec.LeafrefCodec;
}
@Override
- public IdentityValuesDTO serialize(final InstanceIdentifier data) {
+ public IdentityValuesDTO serialize(final YangInstanceIdentifier data) {
IdentityValuesDTO identityValuesDTO = new IdentityValuesDTO();
for (PathArgument pathArgument : data.getPathArguments()) {
IdentityValue identityValue = qNameToIdentityValue(pathArgument.getNodeType());
}
@Override
- public InstanceIdentifier deserialize(final IdentityValuesDTO data) {
+ public YangInstanceIdentifier deserialize(final IdentityValuesDTO data) {
List<PathArgument> result = new ArrayList<PathArgument>();
IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
}
}
- return result.isEmpty() ? null : InstanceIdentifier.create(result);
+ return result.isEmpty() ? null : YangInstanceIdentifier.create(result);
}
private List<Predicate> keyValuesToPredicateList(final Map<QName, Object> keyValues) {
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
rpc.getQName(), "path"));
final Object pathValue = pathNode == null ? null : pathNode.getValue();
- if (!(pathValue instanceof InstanceIdentifier)) {
+ if (!(pathValue instanceof YangInstanceIdentifier)) {
throw new RestconfDocumentedException("Instance identifier was not normalized correctly.",
ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED);
}
- final InstanceIdentifier pathIdentifier = ((InstanceIdentifier) pathValue);
+ final YangInstanceIdentifier pathIdentifier = ((YangInstanceIdentifier) pathValue);
String streamName = null;
if (!Iterables.isEmpty(pathIdentifier.getPathArguments())) {
String fullRestconfIdentifier = this.controllerContext.toFullRestconfIdentifier(pathIdentifier);
private InstanceIdWithSchemaNode addLastIdentifierFromData(final InstanceIdWithSchemaNode identifierWithSchemaNode,
final CompositeNode data, final DataSchemaNode schemaOfData) {
- InstanceIdentifier instanceIdentifier = null;
+ YangInstanceIdentifier instanceIdentifier = null;
if (identifierWithSchemaNode != null) {
instanceIdentifier = identifierWithSchemaNode.getInstanceIdentifier();
}
- final InstanceIdentifier iiOriginal = instanceIdentifier;
+ final YangInstanceIdentifier iiOriginal = instanceIdentifier;
InstanceIdentifierBuilder iiBuilder = null;
if (iiOriginal == null) {
- iiBuilder = InstanceIdentifier.builder();
+ iiBuilder = YangInstanceIdentifier.builder();
} else {
- iiBuilder = InstanceIdentifier.builder(iiOriginal);
+ iiBuilder = YangInstanceIdentifier.builder(iiOriginal);
}
if ((schemaOfData instanceof ListSchemaNode)) {
iiBuilder.node(schemaOfData.getQName());
}
- InstanceIdentifier instance = iiBuilder.toInstance();
+ YangInstanceIdentifier instance = iiBuilder.toInstance();
MountInstance mountPoint = null;
if (identifierWithSchemaNode != null) {
mountPoint = identifierWithSchemaNode.getMountPoint();
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final XmlMapper xmlMapper = new XmlMapper();
private final SimpleDateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ");
- private final InstanceIdentifier path;
+ private final YangInstanceIdentifier path;
private ListenerRegistration<DataChangeListener> registration;
private final String streamName;
private Set<Channel> subscribers = new ConcurrentSet<>();
* @param streamName
* The name of the stream.
*/
- ListenerAdapter(final InstanceIdentifier path, final String streamName) {
+ ListenerAdapter(final YangInstanceIdentifier path, final String streamName) {
Preconditions.checkNotNull(path);
Preconditions.checkArgument(streamName != null && !streamName.isEmpty());
this.path = path;
}
@Override
- public void onDataChanged(final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+ public void onDataChanged(final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
if (!change.getCreatedConfigurationData().isEmpty() || !change.getCreatedOperationalData().isEmpty()
|| !change.getUpdatedConfigurationData().isEmpty() || !change.getUpdatedOperationalData().isEmpty()
|| !change.getRemovedConfigurationData().isEmpty() || !change.getRemovedOperationalData().isEmpty()) {
* DataChangeEvent
* @return Data in printable form.
*/
- private String prepareXmlFrom(final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+ private String prepareXmlFrom(final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
Document doc = createDocument();
Element notificationElement = doc.createElementNS("urn:ietf:params:xml:ns:netconf:notification:1.0",
"notification");
*/
private void addValuesToDataChangedNotificationEventElement(final Document doc,
final Element dataChangedNotificationEventElement,
- final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+ final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
addValuesFromDataToElement(doc, change.getCreatedConfigurationData(), dataChangedNotificationEventElement,
Store.CONFIG, Operation.CREATED);
addValuesFromDataToElement(doc, change.getCreatedOperationalData(), dataChangedNotificationEventElement,
* @param doc
* {@link Document}
* @param data
- * Set of {@link InstanceIdentifier}.
+ * Set of {@link YangInstanceIdentifier}.
* @param element
* {@link Element}
* @param store
* @param operation
* {@link Operation}
*/
- private void addValuesFromDataToElement(final Document doc, final Set<InstanceIdentifier> data,
+ private void addValuesFromDataToElement(final Document doc, final Set<YangInstanceIdentifier> data,
final Element element, final Store store, final Operation operation) {
if (data == null || data.isEmpty()) {
return;
}
- for (InstanceIdentifier path : data) {
+ for (YangInstanceIdentifier path : data) {
Node node = createDataChangeEventElement(doc, path, null, store, operation);
element.appendChild(node);
}
* @param doc
* {@link Document}
* @param data
- * Map of {@link InstanceIdentifier} and {@link CompositeNode}.
+ * Map of {@link YangInstanceIdentifier} and {@link CompositeNode}.
* @param element
* {@link Element}
* @param store
* @param operation
* {@link Operation}
*/
- private void addValuesFromDataToElement(final Document doc, final Map<InstanceIdentifier, CompositeNode> data,
+ private void addValuesFromDataToElement(final Document doc, final Map<YangInstanceIdentifier, CompositeNode> data,
final Element element, final Store store, final Operation operation) {
if (data == null || data.isEmpty()) {
return;
}
- for (Entry<InstanceIdentifier, CompositeNode> entry : data.entrySet()) {
+ for (Entry<YangInstanceIdentifier, CompositeNode> entry : data.entrySet()) {
Node node = createDataChangeEventElement(doc, entry.getKey(), entry.getValue(), store, operation);
element.appendChild(node);
}
* {@link Operation}
* @return {@link Node} node represented by changed event element.
*/
- private Node createDataChangeEventElement(final Document doc, final InstanceIdentifier path,
+ private Node createDataChangeEventElement(final Document doc, final YangInstanceIdentifier path,
final CompositeNode data, final Store store, final Operation operation) {
Element dataChangeEventElement = doc.createElement("data-change-event");
* {@link CompositeNode}
* @return Data in XML format.
*/
- private Node translateToXml(final InstanceIdentifier path, final CompositeNode data) {
+ private Node translateToXml(final YangInstanceIdentifier path, final CompositeNode data) {
DataNodeContainer schemaNode = ControllerContext.getInstance().getDataNodeContainerFor(path);
if (schemaNode == null) {
LOG.info(
* @param element
* {@link Element}
*/
- private void addPathAsValueToElement(final InstanceIdentifier path, final Element element) {
+ private void addPathAsValueToElement(final YangInstanceIdentifier path, final Element element) {
// Map< key = namespace, value = prefix>
Map<String, String> prefixes = new HashMap<>();
- InstanceIdentifier instanceIdentifier = path;
+ YangInstanceIdentifier instanceIdentifier = path;
StringBuilder textContent = new StringBuilder();
// FIXME: BUG-1281: this is duplicated code from yangtools (BUG-1275)
*
* @return Path pointed to data in data store.
*/
- public InstanceIdentifier getPath() {
+ public YangInstanceIdentifier getPath() {
return path;
}
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* {@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<InstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
+ private static Map<YangInstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
private static final Lock lock = new ReentrantLock();
private Notificator() {
}
/**
- * Gets {@link ListenerAdapter} listener specified by {@link InstanceIdentifier} path.
+ * Gets {@link ListenerAdapter} listener specified by {@link YangInstanceIdentifier} path.
*
* @param path
* Path to data in data repository.
* @return ListenerAdapter
*/
- public static ListenerAdapter getListenerFor(InstanceIdentifier path) {
+ public static ListenerAdapter getListenerFor(YangInstanceIdentifier path) {
return listenersByInstanceIdentifier.get(path);
}
/**
- * Checks if the listener specified by {@link InstanceIdentifier} path exist.
+ * Checks if the listener specified by {@link YangInstanceIdentifier} path exist.
*
* @param path
* Path to data in data repository.
* @return True if the listener exist, false otherwise.
*/
- public static boolean existListenerFor(InstanceIdentifier path) {
+ public static boolean existListenerFor(YangInstanceIdentifier path) {
return listenersByInstanceIdentifier.containsKey(path);
}
/**
- * Creates new {@link ListenerAdapter} listener from {@link InstanceIdentifier} path and stream name.
+ * Creates new {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name.
*
* @param path
* Path to data in data repository.
* @param streamName
* The name of the stream.
- * @return New {@link ListenerAdapter} listener from {@link InstanceIdentifier} path and stream name.
+ * @return New {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name.
*/
- public static ListenerAdapter createListener(InstanceIdentifier path, String streamName) {
+ public static ListenerAdapter createListener(YangInstanceIdentifier path, String streamName) {
ListenerAdapter listener = new ListenerAdapter(path, streamName);
try {
lock.lock();
}
/**
- * Looks for listener determined by {@link InstanceIdentifier} path and removes it.
+ * Looks for listener determined by {@link YangInstanceIdentifier} path and removes it.
*
* @param path
* InstanceIdentifier
*/
- public static void removeListener(InstanceIdentifier path) {
+ public static void removeListener(YangInstanceIdentifier path) {
ListenerAdapter listener = listenersByInstanceIdentifier.get(path);
deleteListener(listener);
}
import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
Builder<TransactionStatus> futureBuilder = new DummyFuture.Builder<TransactionStatus>();
futureBuilder.rpcResult(new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
.build());
- when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(futureBuilder.build());
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
/**
QName qname = QName.create("node");
- InstanceIdentifier instanceID = InstanceIdentifier.builder().node(qname).toInstance();
+ YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(qname).toInstance();
@Before
public void setUp() throws Exception {
public void testCommitConfigurationDataPost() {
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
- Map<InstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<InstanceIdentifier, CompositeNode>()
+ Map<YangInstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<YangInstanceIdentifier, CompositeNode>()
.put(instanceID, dataNode).build();
when(dataBroker.beginTransaction()).thenReturn(mockTransaction);
public void testCommitConfigurationDataPostBehindMountPoint() {
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
- Map<InstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<InstanceIdentifier, CompositeNode>()
+ Map<YangInstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<YangInstanceIdentifier, CompositeNode>()
.put(instanceID, dataNode).build();
when(mockMountInstance.beginTransaction()).thenReturn(mockTransaction);
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
when(dataBroker.beginTransaction()).thenReturn(mockTransaction);
- when(mockTransaction.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
+ when(mockTransaction.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(
ImmutableCompositeNode.builder().toInstance());
mockTransaction.removeConfigurationData(instanceID);
when(mockTransaction.commit()).thenReturn(expFuture);
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
when(mockMountInstance.beginTransaction()).thenReturn(mockTransaction);
- when(mockTransaction.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
+ when(mockTransaction.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(
ImmutableCompositeNode.builder().toInstance());
mockTransaction.removeConfigurationData(instanceID);
when(mockTransaction.commit()).thenReturn(expFuture);
import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
}
- private CompositeNode prepareCnSn(final InstanceIdentifier instanceIdentifier) throws URISyntaxException {
+ private CompositeNode prepareCnSn(final YangInstanceIdentifier instanceIdentifier) throws URISyntaxException {
CompositeNodeBuilder<ImmutableCompositeNode> cont = ImmutableCompositeNode.builder();
cont.setQName(QName.create("instance:identifier:module", "2014-01-17", "cont"));
return cont.toInstance();
}
- private InstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
+ private YangInstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
List<PathArgument> pathArguments = new ArrayList<>();
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
pathArguments.add(new NodeIdentifier(new QName(new URI("augment:augment:module"), "lf112")));
- return InstanceIdentifier.create(pathArguments);
+ return YangInstanceIdentifier.create(pathArguments);
}
- private InstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
+ private YangInstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
List<PathArgument> pathArguments = new ArrayList<>();
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
pathArguments.add(new NodeWithValue(new QName(new URI("augment:module:leaf:list"), "lflst11"), "lflst11_1"));
- return InstanceIdentifier.create(pathArguments);
+ return YangInstanceIdentifier.create(pathArguments);
}
}
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public void deleteConfigStatusCodes() throws UnsupportedEncodingException {
String uri = "/config/test-interface:interfaces";
Future<RpcResult<TransactionStatus>> dummyFuture = createFuture(TransactionStatus.COMMITED);
- when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
+ when(brokerFacade.commitConfigurationDataDelete(any(YangInstanceIdentifier.class))).thenReturn(dummyFuture);
Response response = target(uri).request(MediaType.APPLICATION_XML).delete();
assertEquals(200, response.getStatus());
dummyFuture = createFuture(TransactionStatus.FAILED);
- when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
+ when(brokerFacade.commitConfigurationDataDelete(any(YangInstanceIdentifier.class))).thenReturn(dummyFuture);
response = target(uri).request(MediaType.APPLICATION_XML).delete();
assertEquals(500, response.getStatus());
}
import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
public void getDataWithUrlMountPoint() throws UnsupportedEncodingException, URISyntaxException {
when(
brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+ any(YangInstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
* Slashes in URI behind mount point. lst1 element with key GigabitEthernet0%2F0%2F0%2F0 (GigabitEthernet0/0/0/0) is
* requested via GET HTTP operation. It is tested whether %2F character is replaced with simple / in
* InstanceIdentifier parameter in method
- * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, InstanceIdentifier)} which is called in
+ * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, YangInstanceIdentifier)} which is called in
* method {@link RestconfImpl#readConfigurationData}
*
*
@Test
public void getDataWithSlashesBehindMountPoint() throws UnsupportedEncodingException, URISyntaxException,
ParseException {
- InstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
+ YangInstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
when(
brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
eq(awaitedInstanceIdentifier))).thenReturn(prepareCnDataForMountPointTest());
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
assertEquals(200, get(uri, MediaType.APPLICATION_XML));
}
- private InstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
+ private YangInstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
List<PathArgument> parameters = new ArrayList<>();
Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-09");
QName qNameList = QName.create(uri, revision, "lst1");
QName qNameKeyList = QName.create(uri, revision, "lf11");
- parameters.add(new InstanceIdentifier.NodeIdentifier(qNameCont));
- parameters.add(new InstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
+ parameters.add(new YangInstanceIdentifier.NodeIdentifier(qNameCont));
+ parameters.add(new YangInstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
"GigabitEthernet0/0/0/0"));
- return InstanceIdentifier.create(parameters);
+ return YangInstanceIdentifier.create(parameters);
}
@Test
public void getDataMountPointIntoHighestElement() throws UnsupportedEncodingException, URISyntaxException {
when(
brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+ any(YangInstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
controllerContext.setMountService(mockMountService);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
controllerContext.setMountService(mockMountService);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
controllerContext.setMountService(mockMountService);
}
private void mockReadOperationalDataMethod() {
- when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+ when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
}
private void mockReadConfigurationDataMethod() {
- when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+ when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
}
private static CompositeNode prepareCompositeNodeWithIetfInterfacesInterfacesData() {
toSimpleNodeData(toNestedQName("depth3-leaf2"), "depth3-leaf2-value")),
toSimpleNodeData(toNestedQName("depth2-leaf1"), "depth2-leaf1-value")));
- when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(depth1Cont);
+ when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(depth1Cont);
// Test config with depth 1
toSimpleNodeData(toNestedQName("depth4-leaf1"), "depth4-leaf1-value")),
toSimpleNodeData(toNestedQName("depth3-leaf1"), "depth3-leaf1-value")));
- when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(depth2Cont1);
+ when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(depth2Cont1);
response = target("/operational/nested-module:depth1-cont/depth2-cont1").queryParam("depth", "3")
.request("application/xml").get();
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
rpcResult).build();
when(
brokerFacade.commitConfigurationDataPostBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+ any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
dummyFuture = new DummyFuture.Builder<TransactionStatus>().build();
}
- when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(dummyFuture);
}
Future<RpcResult<TransactionStatus>> dummyFuture = new DummyFuture.Builder<TransactionStatus>().rpcResult(
rpcResult).build();
- when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(dummyFuture);
- ArgumentCaptor<InstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(InstanceIdentifier.class);
+ ArgumentCaptor<YangInstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(YangInstanceIdentifier.class);
ArgumentCaptor<CompositeNode> compNodeCaptor = ArgumentCaptor.forClass(CompositeNode.class);
String URI_1 = "/config";
public void createConfigurationDataNullTest() throws UnsupportedEncodingException {
initMocking();
- when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(null);
String URI_1 = "/config";
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class RestPutOperationTest extends JerseyTest {
rpcResult).build();
when(
brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+ any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
rpcResult).build();
when(
brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+ any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
.build();
Future<RpcResult<TransactionStatus>> dummyFuture = new DummyFuture.Builder<TransactionStatus>().rpcResult(
rpcResult).build();
- when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(dummyFuture);
}
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
CompositeNode loadedCompositeNode = TestUtils.readInputToCnSn("/parts/ietf-interfaces_interfaces.xml",
XmlToCompositeNodeProvider.INSTANCE);
BrokerFacade brokerFacade = mock(BrokerFacade.class);
- when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
+ when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(loadedCompositeNode);
assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));
}
import org.opendaylight.controller.sal.restconf.impl.StructuredData;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
controllerContext.setSchemas(TestUtils.loadSchemaContext(modules));
- when(mockedBrokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(mockedBrokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(
new DummyFuture.Builder().rpcResult(
new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
} else {
when(mountInstance.getSchemaContext()).thenReturn(null);
}
- when(mountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
}
}
import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSchemaLoader {
private void verifyLeafListPredicate(CompositeNode cnSn) throws URISyntaxException {
SimpleNode<?> lf11 = getSnWithInstanceIdentifierWhenLeafList(cnSn);
Object value = lf11.getValue();
- assertTrue(value instanceof InstanceIdentifier);
+ assertTrue(value instanceof YangInstanceIdentifier);
- InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value;
+ YangInstanceIdentifier instanceIdentifier = (YangInstanceIdentifier) value;
List<PathArgument> pathArguments = instanceIdentifier.getPath();
assertEquals(3, pathArguments.size());
String revisionDate = "2014-01-17";
private void verifyListPredicate(CompositeNode cnSn) throws URISyntaxException {
SimpleNode<?> lf111 = getSnWithInstanceIdentifierWhenList(cnSn);
Object value = lf111.getValue();
- assertTrue(value instanceof InstanceIdentifier);
+ assertTrue(value instanceof YangInstanceIdentifier);
- InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value;
+ YangInstanceIdentifier instanceIdentifier = (YangInstanceIdentifier) value;
List<PathArgument> pathArguments = instanceIdentifier.getPath();
assertEquals(4, pathArguments.size());
String revisionDate = "2014-01-17";
import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
private static final String DATASTORES_LABEL = "Datastores";
private MountProvisionService mountService;
- private final Map<InstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
- new Comparator<InstanceIdentifier>() {
+ private final Map<YangInstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
+ new Comparator<YangInstanceIdentifier>() {
@Override
- public int compare(final InstanceIdentifier o1, final InstanceIdentifier o2) {
+ public int compare(final YangInstanceIdentifier o1, final YangInstanceIdentifier o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
});
- private final Map<Long, InstanceIdentifier> longIdToInstanceId = new HashMap<>();
+ private final Map<Long, YangInstanceIdentifier> longIdToInstanceId = new HashMap<>();
private final Object lock = new Object();
private final AtomicLong idKey = new AtomicLong(0);
Map<String, Long> urlToId = new HashMap<>();
synchronized (lock) {
SchemaContext context = globalSchema.getGlobalContext();
- for (Entry<InstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
+ for (Entry<YangInstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
String modName = findModuleName(entry.getKey(), context);
urlToId.put(generateUrlPrefixFromInstanceID(entry.getKey(), modName),
entry.getValue());
this.globalSchema = globalSchema;
}
- private String findModuleName(final InstanceIdentifier id, final SchemaContext context) {
+ private String findModuleName(final YangInstanceIdentifier id, final SchemaContext context) {
PathArgument rootQName = id.getPathArguments().iterator().next();
for (Module mod : context.getModules()) {
if (mod.getDataChildByName(rootQName.getNodeType()) != null) {
return null;
}
- private String generateUrlPrefixFromInstanceID(final InstanceIdentifier key, final String moduleName) {
+ private String generateUrlPrefixFromInstanceID(final YangInstanceIdentifier key, final String moduleName) {
StringBuilder builder = new StringBuilder();
if (moduleName != null) {
builder.append(moduleName);
builder.append('/');
}
builder.append(name);
- if (arg instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
+ if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
NodeIdentifierWithPredicates nodeId = (NodeIdentifierWithPredicates) arg;
for (Entry<QName, Object> entry : nodeId.getKeyValues().entrySet()) {
builder.append('/').append(entry.getValue());
return builder.append('/').toString();
}
- private String getYangMountUrl(final InstanceIdentifier key) {
+ private String getYangMountUrl(final YangInstanceIdentifier key) {
String modName = findModuleName(key, globalSchema.getGlobalContext());
return generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount/";
}
public ResourceList getResourceList(final UriInfo uriInfo, final Long id) {
- InstanceIdentifier iid = getInstanceId(id);
+ YangInstanceIdentifier iid = getInstanceId(id);
if (iid == null) {
return null; // indicating not found.
}
return list;
}
- private InstanceIdentifier getInstanceId(final Long id) {
- InstanceIdentifier instanceId;
+ private YangInstanceIdentifier getInstanceId(final Long id) {
+ YangInstanceIdentifier instanceId;
synchronized (lock) {
instanceId = longIdToInstanceId.get(id);
}
return instanceId;
}
- private SchemaContext getSchemaContext(final InstanceIdentifier id) {
+ private SchemaContext getSchemaContext(final YangInstanceIdentifier id) {
if (id == null) {
return null;
}
public ApiDeclaration getMountPointApi(final UriInfo uriInfo, final Long id, final String module, final String revision) {
- InstanceIdentifier iid = getInstanceId(id);
+ YangInstanceIdentifier iid = getInstanceId(id);
SchemaContext context = getSchemaContext(iid);
String urlPrefix = getYangMountUrl(iid);
if (context == null) {
}
@Override
- public void onMountPointCreated(final InstanceIdentifier path) {
+ public void onMountPointCreated(final YangInstanceIdentifier path) {
synchronized (lock) {
Long idLong = idKey.incrementAndGet();
instanceIdToLongId.put(path, idLong);
}
@Override
- public void onMountPointRemoved(final InstanceIdentifier path) {
+ public void onMountPointRemoved(final YangInstanceIdentifier path) {
synchronized (lock) {
Long id = instanceIdToLongId.remove(path);
longIdToInstanceId.remove(id);
import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class MountPointSwaggerTest {
private static final String HTTP_URL = "http://localhost/path";
- private static final InstanceIdentifier instanceId = InstanceIdentifier.builder()
+ private static final YangInstanceIdentifier instanceId = YangInstanceIdentifier.builder()
.node(QName.create("nodes"))
.nodeWithKey(QName.create("node"), QName.create("id"), "123").build();
private static final String INSTANCE_URL = "nodes/node/123/";
import java.util.Collections;
import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.ChoiceNodeBaseSerializer;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
protected NodeSerializerDispatcher<String> getNodeDispatcher() {
return dispatcher;
}
-}
\ No newline at end of file
+}
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@Override
public final Iterable<String> dispatchChildElement(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
if (dataContainerChild instanceof ContainerNode) {
return onContainerNode(childSchema, dataContainerChild);
} else if (dataContainerChild instanceof LeafNode<?>) {
}
private Iterable<String> onAugmentationSchema(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, AugmentationSchema.class, dataContainerChild);
return factory.getAugmentationNodeSerializer().serialize((AugmentationSchema) childSchema,
(AugmentationNode) dataContainerChild);
}
private Iterable<String> onChoiceNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, org.opendaylight.yangtools.yang.model.api.ChoiceNode.class,
dataContainerChild);
return factory.getChoiceNodeSerializer().serialize(
}
private Iterable<String> onListNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, ListSchemaNode.class, dataContainerChild);
return factory.getMapNodeSerializer().serialize((ListSchemaNode) childSchema, (MapNode) dataContainerChild);
}
private Iterable<String> onLeafListNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, LeafListSchemaNode.class, dataContainerChild);
return factory.getLeafSetNodeSerializer().serialize((LeafListSchemaNode) childSchema,
(LeafSetNode<?>) dataContainerChild);
}
private Iterable<String> onLeafNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, LeafSchemaNode.class, dataContainerChild);
final Iterable<String> elements = factory.getLeafNodeSerializer().serialize((LeafSchemaNode) childSchema,
(LeafNode<?>) dataContainerChild);
}
private static void checkOnlyOneSerializedElement(final Iterable<?> elements,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
final int size = Iterables.size(elements);
Preconditions.checkArgument(size == 1,
"Unexpected count of elements for entry serialized from: %s, should be 1, was: %s", dataContainerChild,
}
private Iterable<String> onContainerNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, ContainerSchemaNode.class, dataContainerChild);
final Iterable<String> elements = factory.getContainerNodeSerializer().serialize(
}
private static void checkSchemaCompatibility(final Object childSchema, final Class<?> containerSchemaNodeClass,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
Preconditions.checkArgument(containerSchemaNodeClass.isAssignableFrom(childSchema.getClass()),
"Incompatible schema: %s with node: %s, expected: %s", childSchema, dataContainerChild,
containerSchemaNodeClass);
}
-}
\ No newline at end of file
+}
import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
import org.opendaylight.controller.netconf.cli.writer.WriteException;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
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;
return null;
}
-}
\ No newline at end of file
+}