completed REST/JSON interface generation integration with yang-js and yang-express. now supports complete CRUD operations against the subscriber model. need to update documentation to reflect latest changes
diff --git a/package.json b/package.json
index 47f925a..cff7ca7 100644
--- a/package.json
+++ b/package.json
@@ -31,8 +31,8 @@
"dependencies": {
"node-uuid": "^1.4.7",
"superagent": "^2.0.0",
- "yang-express": "^0.2.1",
- "yang-js": "^0.14.20"
+ "yang-express": "^0.2.2",
+ "yang-js": "^0.14.22"
},
"optionalDependencies": {
"corenova": "^1.0.0"
diff --git a/sample-data.json b/sample-data.json
index 5e5377e..b879e51 100644
--- a/sample-data.json
+++ b/sample-data.json
@@ -1,12 +1,10 @@
{
- "api": {
+ "xos-core:api": {
"service": {},
"tenant": {}
},
- "cord": {
- "subscriber": [
- { "id": 1, "service-specific-id": 1000 },
- { "id": 2, "service-specific-id": 1001 }
- ]
- }
+ "cord-core:subscriber": [
+ { "id": 1, "service-specific-id": 1000 },
+ { "id": 2, "service-specific-id": 1001 }
+ ]
}
diff --git a/schema/cord-core.yang b/schema/cord-core.yang
index 25d3d3a..b399362 100644
--- a/schema/cord-core.yang
+++ b/schema/cord-core.yang
@@ -33,27 +33,26 @@
/*** primary configuration tree for this module ***/
- container cord {
- list subscriber {
- uses csub:subscriber-controller;
- key "id";
+ list subscriber {
+ uses csub:subscriber-controller;
+ key "id";
- description
- "Authorative list of all subscriber instances";
+ description
+ "Authorative list of all subscriber instances";
- leaf humanReadableName {
- config false;
- type string {
- pattern '^cordSubscriber-\w+$';
- }
+ leaf humanReadableName {
+ config false;
+ type string {
+ pattern '^cordSubscriber-\w+$';
}
- action delete;
+ }
+ action delete;
+ }
+
+ // here we augment the /api/tenant API configuration tree in 'xos' module
+ augment "/xos:api/xos:tenant" {
+ container cord {
+ node:link subscriber { path "/cord:subscriber"; }
}
}
-
- // here we augment the /api/tenant/cord API configuration tree in 'xos' module
- augment "/xos:api/xos:tenant" {
- container cord { node:map "/cord:cord"; }
- }
-
}
diff --git a/schema/cord-subscriber.yang b/schema/cord-subscriber.yang
index 8f3dae5..7fa098e 100644
--- a/schema/cord-subscriber.yang
+++ b/schema/cord-subscriber.yang
@@ -119,11 +119,11 @@
node:view "features identity related";
container features {
- leaf cdn { node:link "../../services/cdn/enabled"; }
- leaf uplink-speed { node:link "../../uplink-speed"; }
- leaf downlink-speed { node:link "../../downlink-speed"; }
- leaf uverse { node:link "../../services/uverse/enabled"; }
- leaf status { node:link "../../status"; }
+ node:link cdn { path "../services/cdn/enabled"; }
+ node:link uplink-speed { path "../uplink-speed"; }
+ node:link downlink-speed { path "../downlink-speed"; }
+ node:link uverse { path "../services/uverse/enabled"; }
+ node:link status { path "../status"; }
action update {
description "when invoked, updates the features container (PUT)";
@@ -131,8 +131,8 @@
}
container identity {
- leaf account-num { node:link "../../service-specific-id"; }
- leaf name { node:link "../../name"; }
+ node:link account-num { path "../service-specific-id"; }
+ node:link name { path "../name"; }
action update {
description "when invoked, updates the identity container (PUT)";
diff --git a/schema/corenova-node.yang b/schema/corenova-node.yang
index 104c2e4..e0873e0 100644
--- a/schema/corenova-node.yang
+++ b/schema/corenova-node.yang
@@ -15,29 +15,18 @@
feature corenova-node {
description
"this is to indicate the agent supports dynamic schema node
- link/map/view.";
+ link and view constraints.";
}
extension link {
description
- "Links the current leaf (or leaf-list) to an alternate leaf in the
- schema data tree. The current leaf becomes a 'mirror' instance
- of the target node.";
- argument target-node-path {
- yin-element true;
- }
- }
-
- extension map {
- description
- "Maps the current container (or list entry) to an alternate container
- in the schema data tree. The target-node-path must not map to
- leaf or leaf-list nodes. The current container will map to
- additional data nodes found inside the alternate container. The
- mapped data nodes behave similarly to the 'link' extension
- case. It can be defined one or more times within the same
- container to map across modules and other subtrees.";
- argument target-node-path {
+ "Links a new 'link-name' element to an alternate data node element in
+ the schema data tree referenced by the 'path' sub statement. It
+ can be used within 'container' or 'list' type data element to
+ hold one or more such 'links' as part of its configuration data
+ tree. The new link element becomes a 'mirror' instance of the
+ target node found in the path expression.";
+ argument link-name {
yin-element true;
}
}
diff --git a/schema/xos-core.yang b/schema/xos-core.yang
index 82d1a7e..3de5ba3 100644
--- a/schema/xos-core.yang
+++ b/schema/xos-core.yang
@@ -41,9 +41,9 @@
typedef unique-identifier {
description "defines valid formats for external reference id";
type union {
+ type uint32 { range 1..max; }
type yang:uuid;
type inet:uri;
- type uint32 { range 1..max; }
}
}
diff --git a/src/cord-core.coffee b/src/cord-core.coffee
index 1d27a26..c4f7ac7 100644
--- a/src/cord-core.coffee
+++ b/src/cord-core.coffee
@@ -11,7 +11,7 @@
module.exports = require('../schema/cord-core.yang').bind {
- '/cord/subscriber/humanReadableName': -> "cordSubscriber-#{@get '../id'}"
+ '/cord:subscriber/humanReadableName': -> "cordSubscriber-#{@get '../id'}"
- '/cord/subscriber/delete': (input, resolve, reject) -> reject "not yet implemented"
+ '/cord:subscriber/delete': (input, resolve, reject) -> reject "not yet implemented"
}
diff --git a/src/server.coffee b/src/server.coffee
index 7e7b46c..6601402 100644
--- a/src/server.coffee
+++ b/src/server.coffee
@@ -5,6 +5,7 @@
port: 5050
models: [
yang.require 'cord-core'
+ yang.require 'xos-core'
]
data: require '../sample-data.json'