public static final String URI_BASE = "urn:ietf:params:restconf:capability:";
- public static final String DEPTH = "depth:1.0";
- public static final String FIELDS = "fields:1.0";
- public static final String FILTER = "filter:1.0";
- public static final String REPLAY = "replay:1.0";
- public static final String WITH_DEFAULTS = "with-defaults:1.0";
+ public static final String DEPTH = URI_BASE + "depth:1.0";
+ public static final String FIELDS = URI_BASE + "fields:1.0";
+ public static final String FILTER = URI_BASE + "filter:1.0";
+ public static final String REPLAY = URI_BASE + "replay:1.0";
+ public static final String WITH_DEFAULTS = URI_BASE + "with-defaults:1.0";
}
}
}
};
private ListenerRegistration<SchemaContextListener> listenerRegistration;
+
+ private SchemaContextHandler schemaCtxHandler;
private static TransactionChainHandler transactionChainHandler;
private static DOMDataBroker dataBroker;
private static DOMMountPointServiceHandler mountPointServiceHandler;
RestConnectorProvider.transactionChainHandler = new TransactionChainHandler(RestConnectorProvider.dataBroker
.createTransactionChain(RestConnectorProvider.transactionListener));
- final SchemaContextHandler schemaCtxHandler = new SchemaContextHandler(transactionChainHandler);
- this.listenerRegistration = schemaService.registerSchemaContextListener(schemaCtxHandler);
+ this.schemaCtxHandler = new SchemaContextHandler(transactionChainHandler);
+ this.listenerRegistration = schemaService.registerSchemaContextListener(this.schemaCtxHandler);
final DOMRpcService rpcService = session.getService(DOMRpcService.class);
final RpcServiceHandler rpcServiceHandler = new RpcServiceHandler(rpcService);
final NotificationServiceHandler notificationServiceHandler =
new NotificationServiceHandler(notificationService);
- wrapperServices.setHandlers(schemaCtxHandler, RestConnectorProvider.mountPointServiceHandler,
+ wrapperServices.setHandlers(this.schemaCtxHandler, RestConnectorProvider.mountPointServiceHandler,
RestConnectorProvider.transactionChainHandler, brokerHandler, rpcServiceHandler,
notificationServiceHandler);
}
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.restconf.Draft18.IetfYangLibrary;
+import org.opendaylight.restconf.Draft18.MonitoringModule;
import org.opendaylight.restconf.utils.mapping.RestconfMappingNodeUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
this.moduleSetId++;
final Module ietfYangLibraryModule =
context.findModuleByNamespaceAndRevision(IetfYangLibrary.URI_MODULE, IetfYangLibrary.DATE);
- final NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> normNode =
+ NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> normNode =
RestconfMappingNodeUtil.mapModulesByIetfYangLibraryYang(context.getModules(), ietfYangLibraryModule,
context, String.valueOf(this.moduleSetId));
+ putData(normNode);
+
+ final Module monitoringModule =
+ this.context.findModuleByNamespaceAndRevision(MonitoringModule.URI_MODULE, MonitoringModule.DATE);
+ normNode = RestconfMappingNodeUtil.mapCapabilites(monitoringModule);
+ putData(normNode);
+ }
+
+ @Override
+ public SchemaContext get() {
+ return this.context;
+ }
+
+ private void putData(
+ final NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> normNode) {
final DOMDataWriteTransaction wTx = this.transactionChainHandler.get().newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.OPERATIONAL,
YangInstanceIdentifier.create(NodeIdentifier.create(normNode.getNodeType())), normNode);
throw new RestconfDocumentedException("Problem occured while putting data to DS.", e);
}
}
-
- @Override
- public SchemaContext get() {
- return this.context;
- }
}
import java.util.Set;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.restconf.Draft18.IetfYangLibrary;
+import org.opendaylight.restconf.Draft18.MonitoringModule;
+import org.opendaylight.restconf.Draft18.MonitoringModule.QueryParams;
import org.opendaylight.restconf.utils.schema.context.RestconfSchemaUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.Module.ConformanceType;
import org.opendaylight.yangtools.yang.common.QName;
Preconditions.checkState(schemaNode instanceof LeafSchemaNode);
streamNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) schemaNode).withValue(value).build());
}
+
+ /**
+ * Map capabilites by ietf-restconf-monitoring
+ *
+ * @param monitoringModule
+ * - ietf-restconf-monitoring module
+ * @return mapped capabilites
+ */
+ public static NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>>
+ mapCapabilites(final Module monitoringModule) {
+ final DataSchemaNode restconfState =
+ monitoringModule.getDataChildByName(MonitoringModule.CONT_RESTCONF_STATE_QNAME);
+ final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> restStateContBuilder =
+ Builders.containerBuilder((ContainerSchemaNode) restconfState);
+ final DataSchemaNode capabilitesContSchema =
+ getChildOfCont((ContainerSchemaNode) restconfState, MonitoringModule.CONT_CAPABILITES_QNAME);
+ final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> capabilitesContBuilder =
+ Builders.containerBuilder((ContainerSchemaNode) capabilitesContSchema);
+ final DataSchemaNode leafListCapa = getChildOfCont((ContainerSchemaNode) capabilitesContSchema,
+ MonitoringModule.LEAF_LIST_CAPABILITY_QNAME);
+ final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListCapaBuilder =
+ Builders.orderedLeafSetBuilder((LeafListSchemaNode) leafListCapa);
+ fillLeafListCapa(leafListCapaBuilder, (LeafListSchemaNode) leafListCapa);
+
+ return restStateContBuilder.withChild(capabilitesContBuilder.withChild(leafListCapaBuilder.build()).build())
+ .build();
+ }
+
+ /**
+ * Map data to leaf-list
+ *
+ * @param builder
+ * - builder of parent for children
+ * @param leafListSchema
+ */
+ @SuppressWarnings("unchecked")
+ private static void fillLeafListCapa(final ListNodeBuilder builder, final LeafListSchemaNode leafListSchema) {
+ builder.withChild(leafListEntryBuild(leafListSchema, QueryParams.DEPTH));
+ builder.withChild(leafListEntryBuild(leafListSchema, QueryParams.FIELDS));
+ builder.withChild(leafListEntryBuild(leafListSchema, QueryParams.FILTER));
+ builder.withChild(leafListEntryBuild(leafListSchema, QueryParams.REPLAY));
+ builder.withChild(leafListEntryBuild(leafListSchema, QueryParams.WITH_DEFAULTS));
+ }
+
+ /**
+ * Map value to leaf list entry node
+ *
+ * @param leafListSchema
+ * - leaf list schema of leaf list entry
+ * @param value
+ * - value of leaf entry
+ * @return entry node
+ */
+ @SuppressWarnings("rawtypes")
+ private static LeafSetEntryNode leafListEntryBuild(final LeafListSchemaNode leafListSchema, final String value) {
+ return Builders.leafSetEntryBuilder(leafListSchema).withValue(value).build();
+ }
+
+ /**
+ * Find specific schema node by qname in parent {@link ContainerSchemaNode}
+ *
+ * @param parent
+ * - schemaNode
+ * @param childQName
+ * - specific qname of child
+ * @return schema node of child by qname
+ */
+ private static DataSchemaNode getChildOfCont(final ContainerSchemaNode parent, final QName childQName) {
+ for (final DataSchemaNode child : parent.getChildNodes()) {
+ if (child.getQName().equals(childQName)) {
+ return child;
+ }
+ }
+ throw new RestconfDocumentedException(
+ childQName.getLocalName() + " doesn't exist in container " + MonitoringModule.CONT_RESTCONF_STATE_NAME);
+ }
}
import static org.mockito.Mockito.when;
import com.google.common.collect.Sets;
import java.util.AbstractMap;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.opendaylight.restconf.Draft18;
import org.opendaylight.restconf.Draft18.IetfYangLibrary;
import org.opendaylight.restconf.Draft18.MonitoringModule;
+import org.opendaylight.restconf.Draft18.MonitoringModule.QueryParams;
import org.opendaylight.restconf.Draft18.RestconfModule;
import org.opendaylight.restconf.utils.schema.context.RestconfSchemaUtil;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
private static Set<Module> modules;
private static SchemaContext schemaContext;
+ private static SchemaContext schemaContextCapabilites;
private static Set<Module> modulesRest;
+
private Set<DataSchemaNode> allStreamChildNodes;
@BeforeClass
public static void loadTestSchemaContextAndModules() throws Exception {
RestconfMappingNodeUtilTest.schemaContext = TestRestconfUtils.loadSchemaContext(
"/modules/restconf-module-testing");
- RestconfMappingNodeUtilTest.modules = TestRestconfUtils.loadSchemaContext("/modules").getModules();
+ RestconfMappingNodeUtilTest.schemaContextCapabilites = TestRestconfUtils.loadSchemaContext("/modules");
+ RestconfMappingNodeUtilTest.modules = schemaContextCapabilites.getModules();
RestconfMappingNodeUtilTest.modulesRest =
TestRestconfUtils.loadSchemaContext("/modules/restconf-module-testing").getModules();
}
verifyLoadedModules((ContainerNode) modules);
}
+ @Test
+ public void restconfStateCapabilitesTest() {
+ final Module monitoringModule = schemaContextCapabilites
+ .findModuleByNamespaceAndRevision(MonitoringModule.URI_MODULE, MonitoringModule.DATE);
+ final NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> normNode =
+ RestconfMappingNodeUtil.mapCapabilites(monitoringModule);
+ assertNotNull(normNode);
+ final List<Object> listOfValues = new ArrayList<>();
+
+ for (final DataContainerChild<? extends PathArgument, ?> child : ((ContainerNode) normNode).getValue()) {
+ if (child.getNodeType().equals(MonitoringModule.CONT_CAPABILITES_QNAME)) {
+ for (final DataContainerChild<? extends PathArgument, ?> dataContainerChild : ((ContainerNode) child)
+ .getValue()) {
+ for (final Object entry : ((LeafSetNode) dataContainerChild).getValue()) {
+ listOfValues.add(((LeafSetEntryNode) entry).getValue());
+ }
+ }
+ }
+ }
+ Assert.assertTrue(listOfValues.contains(QueryParams.DEPTH));
+ Assert.assertTrue(listOfValues.contains(QueryParams.FIELDS));
+ Assert.assertTrue(listOfValues.contains(QueryParams.FILTER));
+ Assert.assertTrue(listOfValues.contains(QueryParams.REPLAY));
+ Assert.assertTrue(listOfValues.contains(QueryParams.WITH_DEFAULTS));
+ }
+
/**
* Positive test of writing one stream to {@link MonitoringModule#STREAM_LIST_SCHEMA_NODE} and checking if stream
* was correctly written.
--- /dev/null
+module ietf-restconf-monitoring {
+ namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
+ prefix "rcmon";
+
+ import ietf-yang-types { prefix yang; }
+ import ietf-inet-types { prefix inet; }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ description
+ "This module contains monitoring information for the
+ RESTCONF protocol.
+ Copyright (c) 2016 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+ This version of this YANG module is part of RFC XXXX; see
+ the RFC itself for full legal notices.";
+
+ // RFC Ed.: replace XXXX with actual RFC number and remove this
+ // note.
+
+ // RFC Ed.: remove this note
+ // Note: extracted from draft-ietf-netconf-restconf-17.txt
+
+ // RFC Ed.: update the date below with the date of RFC publication
+ // and remove this note.
+ revision 2016-08-15 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: RESTCONF Protocol.";
+ }
+
+ container restconf-state {
+ config false;
+ description
+ "Contains RESTCONF protocol monitoring information.";
+
+ container capabilities {
+ description
+ "Contains a list of protocol capability URIs";
+
+ leaf-list capability {
+ type inet:uri;
+ description "A RESTCONF protocol capability URI.";
+ }
+ }
+
+ container streams {
+ description
+ "Container representing the notification event streams
+ supported by the server.";
+ reference
+ "RFC 5277, Section 3.4, <streams> element.";
+
+ list stream {
+ key name;
+ description
+ "Each entry describes an event stream supported by
+ the server.";
+
+ leaf name {
+ type string;
+ description "The stream name";
+ reference "RFC 5277, Section 3.4, <name> element.";
+ }
+
+ leaf description {
+ type string;
+ description "Description of stream content";
+ reference
+ "RFC 5277, Section 3.4, <description> element.";
+ }
+
+ leaf replay-support {
+ type boolean;
+ default false;
+ description
+ "Indicates if replay buffer supported for this stream.
+ If 'true', then the server MUST support the 'start-time'
+ and 'stop-time' query parameters for this stream.";
+ reference
+ "RFC 5277, Section 3.4, <replaySupport> element.";
+ }
+
+ leaf replay-log-creation-time {
+ when "../replay-support" {
+ description
+ "Only present if notification replay is supported";
+ }
+ type yang:date-and-time;
+ description
+ "Indicates the time the replay log for this stream
+ was created.";
+ reference
+ "RFC 5277, Section 3.4, <replayLogCreationTime>
+ element.";
+ }
+
+ list access {
+ key encoding;
+ min-elements 1;
+ description
+ "The server will create an entry in this list for each
+ encoding format that is supported for this stream.
+ The media type 'text/event-stream' is expected
+ for all event streams. This list identifies the
+ sub-types supported for this stream.";
+
+ leaf encoding {
+ type string;
+ description
+ "This is the secondary encoding format within the
+ 'text/event-stream' encoding used by all streams.
+ The type 'xml' is supported for XML encoding.
+ The type 'json' is supported for JSON encoding.";
+ }
+
+ leaf location {
+ type inet:uri;
+ mandatory true;
+ description
+ "Contains a URL that represents the entry point
+ for establishing notification delivery via server
+ sent events.";
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+module ietf-restconf-monitoring {
+ namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
+ prefix "rcmon";
+
+ import ietf-yang-types { prefix yang; }
+ import ietf-inet-types { prefix inet; }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ description
+ "This module contains monitoring information for the
+ RESTCONF protocol.
+ Copyright (c) 2016 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+ This version of this YANG module is part of RFC XXXX; see
+ the RFC itself for full legal notices.";
+
+ // RFC Ed.: replace XXXX with actual RFC number and remove this
+ // note.
+
+ // RFC Ed.: remove this note
+ // Note: extracted from draft-ietf-netconf-restconf-17.txt
+
+ // RFC Ed.: update the date below with the date of RFC publication
+ // and remove this note.
+ revision 2016-08-15 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: RESTCONF Protocol.";
+ }
+
+ container restconf-state {
+ config false;
+ description
+ "Contains RESTCONF protocol monitoring information.";
+
+ container capabilities {
+ description
+ "Contains a list of protocol capability URIs";
+
+ leaf-list capability {
+ type inet:uri;
+ description "A RESTCONF protocol capability URI.";
+ }
+ }
+
+ container streams {
+ description
+ "Container representing the notification event streams
+ supported by the server.";
+ reference
+ "RFC 5277, Section 3.4, <streams> element.";
+
+ list stream {
+ key name;
+ description
+ "Each entry describes an event stream supported by
+ the server.";
+
+ leaf name {
+ type string;
+ description "The stream name";
+ reference "RFC 5277, Section 3.4, <name> element.";
+ }
+
+ leaf description {
+ type string;
+ description "Description of stream content";
+ reference
+ "RFC 5277, Section 3.4, <description> element.";
+ }
+
+ leaf replay-support {
+ type boolean;
+ default false;
+ description
+ "Indicates if replay buffer supported for this stream.
+ If 'true', then the server MUST support the 'start-time'
+ and 'stop-time' query parameters for this stream.";
+ reference
+ "RFC 5277, Section 3.4, <replaySupport> element.";
+ }
+
+ leaf replay-log-creation-time {
+ when "../replay-support" {
+ description
+ "Only present if notification replay is supported";
+ }
+ type yang:date-and-time;
+ description
+ "Indicates the time the replay log for this stream
+ was created.";
+ reference
+ "RFC 5277, Section 3.4, <replayLogCreationTime>
+ element.";
+ }
+
+ list access {
+ key encoding;
+ min-elements 1;
+ description
+ "The server will create an entry in this list for each
+ encoding format that is supported for this stream.
+ The media type 'text/event-stream' is expected
+ for all event streams. This list identifies the
+ sub-types supported for this stream.";
+
+ leaf encoding {
+ type string;
+ description
+ "This is the secondary encoding format within the
+ 'text/event-stream' encoding used by all streams.
+ The type 'xml' is supported for XML encoding.
+ The type 'json' is supported for JSON encoding.";
+ }
+
+ leaf location {
+ type inet:uri;
+ mandatory true;
+ description
+ "Contains a URL that represents the entry point
+ for establishing notification delivery via server
+ sent events.";
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+module ietf-restconf-monitoring {
+ namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
+ prefix "rcmon";
+
+ import ietf-yang-types { prefix yang; }
+ import ietf-inet-types { prefix inet; }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ description
+ "This module contains monitoring information for the
+ RESTCONF protocol.
+ Copyright (c) 2016 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+ This version of this YANG module is part of RFC XXXX; see
+ the RFC itself for full legal notices.";
+
+ // RFC Ed.: replace XXXX with actual RFC number and remove this
+ // note.
+
+ // RFC Ed.: remove this note
+ // Note: extracted from draft-ietf-netconf-restconf-17.txt
+
+ // RFC Ed.: update the date below with the date of RFC publication
+ // and remove this note.
+ revision 2016-08-15 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: RESTCONF Protocol.";
+ }
+
+ container restconf-state {
+ config false;
+ description
+ "Contains RESTCONF protocol monitoring information.";
+
+ container capabilities {
+ description
+ "Contains a list of protocol capability URIs";
+
+ leaf-list capability {
+ type inet:uri;
+ description "A RESTCONF protocol capability URI.";
+ }
+ }
+
+ container streams {
+ description
+ "Container representing the notification event streams
+ supported by the server.";
+ reference
+ "RFC 5277, Section 3.4, <streams> element.";
+
+ list stream {
+ key name;
+ description
+ "Each entry describes an event stream supported by
+ the server.";
+
+ leaf name {
+ type string;
+ description "The stream name";
+ reference "RFC 5277, Section 3.4, <name> element.";
+ }
+
+ leaf description {
+ type string;
+ description "Description of stream content";
+ reference
+ "RFC 5277, Section 3.4, <description> element.";
+ }
+
+ leaf replay-support {
+ type boolean;
+ default false;
+ description
+ "Indicates if replay buffer supported for this stream.
+ If 'true', then the server MUST support the 'start-time'
+ and 'stop-time' query parameters for this stream.";
+ reference
+ "RFC 5277, Section 3.4, <replaySupport> element.";
+ }
+
+ leaf replay-log-creation-time {
+ when "../replay-support" {
+ description
+ "Only present if notification replay is supported";
+ }
+ type yang:date-and-time;
+ description
+ "Indicates the time the replay log for this stream
+ was created.";
+ reference
+ "RFC 5277, Section 3.4, <replayLogCreationTime>
+ element.";
+ }
+
+ list access {
+ key encoding;
+ min-elements 1;
+ description
+ "The server will create an entry in this list for each
+ encoding format that is supported for this stream.
+ The media type 'text/event-stream' is expected
+ for all event streams. This list identifies the
+ sub-types supported for this stream.";
+
+ leaf encoding {
+ type string;
+ description
+ "This is the secondary encoding format within the
+ 'text/event-stream' encoding used by all streams.
+ The type 'xml' is supported for XML encoding.
+ The type 'json' is supported for JSON encoding.";
+ }
+
+ leaf location {
+ type inet:uri;
+ mandatory true;
+ description
+ "Contains a URL that represents the entry point
+ for establishing notification delivery via server
+ sent events.";
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+module ietf-restconf-monitoring {
+ namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
+ prefix "rcmon";
+
+ import ietf-yang-types { prefix yang; }
+ import ietf-inet-types { prefix inet; }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ description
+ "This module contains monitoring information for the
+ RESTCONF protocol.
+ Copyright (c) 2016 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+ This version of this YANG module is part of RFC XXXX; see
+ the RFC itself for full legal notices.";
+
+ // RFC Ed.: replace XXXX with actual RFC number and remove this
+ // note.
+
+ // RFC Ed.: remove this note
+ // Note: extracted from draft-ietf-netconf-restconf-17.txt
+
+ // RFC Ed.: update the date below with the date of RFC publication
+ // and remove this note.
+ revision 2016-08-15 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: RESTCONF Protocol.";
+ }
+
+ container restconf-state {
+ config false;
+ description
+ "Contains RESTCONF protocol monitoring information.";
+
+ container capabilities {
+ description
+ "Contains a list of protocol capability URIs";
+
+ leaf-list capability {
+ type inet:uri;
+ description "A RESTCONF protocol capability URI.";
+ }
+ }
+
+ container streams {
+ description
+ "Container representing the notification event streams
+ supported by the server.";
+ reference
+ "RFC 5277, Section 3.4, <streams> element.";
+
+ list stream {
+ key name;
+ description
+ "Each entry describes an event stream supported by
+ the server.";
+
+ leaf name {
+ type string;
+ description "The stream name";
+ reference "RFC 5277, Section 3.4, <name> element.";
+ }
+
+ leaf description {
+ type string;
+ description "Description of stream content";
+ reference
+ "RFC 5277, Section 3.4, <description> element.";
+ }
+
+ leaf replay-support {
+ type boolean;
+ default false;
+ description
+ "Indicates if replay buffer supported for this stream.
+ If 'true', then the server MUST support the 'start-time'
+ and 'stop-time' query parameters for this stream.";
+ reference
+ "RFC 5277, Section 3.4, <replaySupport> element.";
+ }
+
+ leaf replay-log-creation-time {
+ when "../replay-support" {
+ description
+ "Only present if notification replay is supported";
+ }
+ type yang:date-and-time;
+ description
+ "Indicates the time the replay log for this stream
+ was created.";
+ reference
+ "RFC 5277, Section 3.4, <replayLogCreationTime>
+ element.";
+ }
+
+ list access {
+ key encoding;
+ min-elements 1;
+ description
+ "The server will create an entry in this list for each
+ encoding format that is supported for this stream.
+ The media type 'text/event-stream' is expected
+ for all event streams. This list identifies the
+ sub-types supported for this stream.";
+
+ leaf encoding {
+ type string;
+ description
+ "This is the secondary encoding format within the
+ 'text/event-stream' encoding used by all streams.
+ The type 'xml' is supported for XML encoding.
+ The type 'json' is supported for JSON encoding.";
+ }
+
+ leaf location {
+ type inet:uri;
+ mandatory true;
+ description
+ "Contains a URL that represents the entry point
+ for establishing notification delivery via server
+ sent events.";
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+module ietf-restconf-monitoring {
+ namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
+ prefix "rcmon";
+
+ import ietf-yang-types { prefix yang; }
+ import ietf-inet-types { prefix inet; }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ description
+ "This module contains monitoring information for the
+ RESTCONF protocol.
+ Copyright (c) 2016 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+ This version of this YANG module is part of RFC XXXX; see
+ the RFC itself for full legal notices.";
+
+ // RFC Ed.: replace XXXX with actual RFC number and remove this
+ // note.
+
+ // RFC Ed.: remove this note
+ // Note: extracted from draft-ietf-netconf-restconf-17.txt
+
+ // RFC Ed.: update the date below with the date of RFC publication
+ // and remove this note.
+ revision 2016-08-15 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: RESTCONF Protocol.";
+ }
+
+ container restconf-state {
+ config false;
+ description
+ "Contains RESTCONF protocol monitoring information.";
+
+ container capabilities {
+ description
+ "Contains a list of protocol capability URIs";
+
+ leaf-list capability {
+ type inet:uri;
+ description "A RESTCONF protocol capability URI.";
+ }
+ }
+
+ container streams {
+ description
+ "Container representing the notification event streams
+ supported by the server.";
+ reference
+ "RFC 5277, Section 3.4, <streams> element.";
+
+ list stream {
+ key name;
+ description
+ "Each entry describes an event stream supported by
+ the server.";
+
+ leaf name {
+ type string;
+ description "The stream name";
+ reference "RFC 5277, Section 3.4, <name> element.";
+ }
+
+ leaf description {
+ type string;
+ description "Description of stream content";
+ reference
+ "RFC 5277, Section 3.4, <description> element.";
+ }
+
+ leaf replay-support {
+ type boolean;
+ default false;
+ description
+ "Indicates if replay buffer supported for this stream.
+ If 'true', then the server MUST support the 'start-time'
+ and 'stop-time' query parameters for this stream.";
+ reference
+ "RFC 5277, Section 3.4, <replaySupport> element.";
+ }
+
+ leaf replay-log-creation-time {
+ when "../replay-support" {
+ description
+ "Only present if notification replay is supported";
+ }
+ type yang:date-and-time;
+ description
+ "Indicates the time the replay log for this stream
+ was created.";
+ reference
+ "RFC 5277, Section 3.4, <replayLogCreationTime>
+ element.";
+ }
+
+ list access {
+ key encoding;
+ min-elements 1;
+ description
+ "The server will create an entry in this list for each
+ encoding format that is supported for this stream.
+ The media type 'text/event-stream' is expected
+ for all event streams. This list identifies the
+ sub-types supported for this stream.";
+
+ leaf encoding {
+ type string;
+ description
+ "This is the secondary encoding format within the
+ 'text/event-stream' encoding used by all streams.
+ The type 'xml' is supported for XML encoding.
+ The type 'json' is supported for JSON encoding.";
+ }
+
+ leaf location {
+ type inet:uri;
+ mandatory true;
+ description
+ "Contains a URL that represents the entry point
+ for establishing notification delivery via server
+ sent events.";
+ }
+ }
+ }
+ }
+ }
+
+}