update to latest yang-express with OPTIONS, update API doc to explain usage
diff --git a/package.json b/package.json
index 5759107..14e4cb3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "yang-cord",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "YANG model-driven CORD",
"author": "Peter K. Lee <peter@corenova.com>",
"license": "Apache-2.0",
@@ -32,8 +32,8 @@
"minimist": "^1.2.0",
"node-uuid": "^1.4.7",
"superagent": "^2.0.0",
- "yang-express": "^0.2.6",
- "yang-js": "^0.15.1"
+ "yang-express": "^0.2.7",
+ "yang-js": "^0.15.3"
},
"optionalDependencies": {
"corenova": "^1.0.0"
@@ -54,7 +54,6 @@
"prepublish": "npm run build",
"pretest": "npm run build",
"test": "mocha",
- "prestart": "npm run build",
"start": "node lib/api/server.js"
}
}
diff --git a/src/api/README.md b/src/api/README.md
index c19b3b9..43de746 100644
--- a/src/api/README.md
+++ b/src/api/README.md
@@ -161,7 +161,7 @@
basically means they spring to life once valid data gets placed into
it but stays *invisible* otherwise.
-### DELETE a Subscriber
+### Delete a Subscriber
Valid URIs:
@@ -212,6 +212,168 @@
well as `rpc` and `action` elements. This operation also accepts
**bulk create** request data by supplying a JSON array.
+### Describe the Subscriber Model
+
+This operation provides discovery of a given data model's
+characteristics as well as other data node elements available inside
+the data model. It can be used by REST API consumers to auto-discover
+additional paths and metadata associated with the target entity. It's
+also useful for *dynamically generating API documentation* for a given
+data model.
+
+Valid URIs:
+
+- OPTIONS /cord-core:subscriber
+- OPTIONS /cord:subscriber
+- OPTIONS /subscriber
+
+Request:
+```bash
+$ curl -X OPTIONS localhost:5050/cord:subscriber
+```
+Response:
+```json
+{
+ "name": "cord-core:subscriber",
+ "kind": "list",
+ "path": "/cord-core:subscriber",
+ "exists": true,
+ "key": "id",
+ "description": "Authorative list of all subscriber instances",
+ "data": {
+ "humanReadableName": {
+ "kind": "leaf",
+ "config": false,
+ "type": {
+ "string": {
+ "pattern": "/^cordSubscriber-\\w+$/"
+ }
+ }
+ },
+ "status": {
+ "kind": "leaf",
+ "type": {
+ "enumeration": {
+ "enum": {
+ "enabled": {
+ "description": "Enabled",
+ "value": "1"
+ },
+ "suspended": {
+ "description": "Suspended",
+ "value": "2"
+ },
+ "delinquent": {
+ "description": "Delinquent",
+ "value": "3"
+ },
+ "violation": {
+ "description": "Copyright Violation",
+ "value": "4"
+ }
+ }
+ }
+ },
+ "default": "enabled"
+ },
+ "demo": {
+ "kind": "leaf",
+ "type": "boolean",
+ "default": "false"
+ },
+ "uplink-speed": {
+ "kind": "leaf",
+ "type": {
+ "dev:bandwidth": {
+ "range": "1000000..max"
+ }
+ },
+ "default": "1000000000",
+ "units": "bps"
+ },
+ "downlink-speed": {
+ "kind": "leaf",
+ "type": {
+ "dev:bandwidth": {
+ "range": "1000000..max"
+ }
+ },
+ "default": "1000000000",
+ "units": "bps"
+ },
+ "id": {
+ "kind": "leaf",
+ "type": {
+ "unique-identifier": {
+ "type": {
+ "uint32": {
+ "range": "1..max"
+ },
+ "yang:uuid": {
+ "pattern": "/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/"
+ }
+ }
+ }
+ },
+ "mandatory": true
+ },
+ "kind": {
+ "kind": "leaf",
+ "type": {
+ "identityref": {
+ "base": "kind"
+ }
+ },
+ "default": "generic"
+ },
+ "name": {
+ "kind": "leaf",
+ "type": {
+ "string": {
+ "length": "0..255"
+ }
+ },
+ "description": "Specify name of the TenantRoot"
+ },
+ "service-specific-attribute": {
+ "kind": "leaf",
+ "type": "string"
+ },
+ "service-specific-id": {
+ "kind": "leaf",
+ "type": {
+ "unique-identifier": {
+ "type": {
+ "uint32": {
+ "range": "1..max"
+ },
+ "yang:uuid": {
+ "pattern": "/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/"
+ }
+ }
+ }
+ },
+ "mandatory": true
+ },
+ "delete": {
+ "kind": "action"
+ },
+ "services": {
+ "kind": "container",
+ "description": "Contains various services available to the subscriber"
+ },
+ "device": {
+ "kind": "list",
+ "key": "mac"
+ },
+ "subscribed-tenants": {
+ "kind": "list",
+ "config": false
+ }
+ }
+}
+```
+
### Additional Endpoints
There are a number of additional operational endpoints dynamically