netopeerguid compilation requires libjson-devel, libnetconf2, and libyang packages.
run following commands in this directory
$ make $ make install
$ service netopeerguid.rc start
If there is any problem with connection to the UNIX socket, please check file permissions.
(with development packages)
Optionally: libwebsockets
UNIX socket (with default path /tmp/netopeerguid.sock) is used for communication with netopeerguid. Messages are formated using JSON and encoded using
Chunked Framing Mechanism described in RFC6242 (http://tools.ietf.org/html/rfc6242#section-4.2) with the following content.
Client is free to send multiple requests when the communication socket to the netopeerguid is opened.
sJSON: string representation of a JSON object
SID: generated unique session identifier (unsigned integer starting with 1)
Replies are in the format:
{ "<SID#1>": { <reply> }, "<SID#2>": { <reply> }, … "<SID#last>": { <reply> } }
Reply format is defined below.
Optional:
Example reply to connect:
{ "<new-SID>": { "type": 0 } }
Optional:
<get>
(returns merged data)Optional:
<get-config>
(returns array of responses merged with schema)Optional:
<edit-config>
Optional:
<copy-config>
Optional:
<delete-config>
Optional:
<lock>
<unlock>
<kill-session>
Optional:
Required when target is "url":
/* Enumeration of Message type (taken from mod_netconf.c) */ const REPLY_OK = 0; const REPLY_DATA = 1; const REPLY_ERROR = 2; const REPLY_INFO = 3; const MSG_CONNECT = 4; const MSG_DISCONNECT = 5; const MSG_GET = 6; const MSG_GETCONFIG = 7; const MSG_EDITCONFIG = 8; const MSG_COPYCONFIG = 9; const MSG_DELETECONFIG = 10; const MSG_LOCK = 11; const MSG_UNLOCK = 12; const MSG_KILL = 13; const MSG_INFO = 14; const MSG_GENERIC = 15; const MSG_GETSCHEMA = 16; const MSG_RELOADHELLO = 17; const MSG_NTF_GETHISTORY = 18; const MSG_VALIDATE = 19; const MSG_COMMIT = 20; /* Enumeration of Message type - New for libyang */ const SCH_QUERY = 100; const SCH_MERGE = 101;
In module query, the top-nodes array includes only nodes that can appear in data or some descendant can (container, choice, leaf, leaflist, list, anyxml). The rpcs array contains all RPCs defined in the module.
Optional:
(partialy based on https://tools.ietf.org/html/draft-ietf-netmod-yang-json-05#appendix-A)
{ "$@ietf-interfaces:interfaces": { "eltype": "container", "description": "Interface configuration parameters.", "config": true, "status": "current", "mandatory": false, "children": [ "interface" ] }, "ietf-interfaces:interfaces": { "$@interface": { ... } ... } }
{ "$@ietf-interfaces:interface": { "eltype": "list", "description": " ... ", "config": true, "status": "current", "mandatory": false, "keys": [ "name" ], "children": [ "name", "description", "type", "enabled", "link-up-down-trap-enable", "ipv4", "ipv6" ] } }
{ "$@@ietf-interfaces": { "yang-version": "1.0", "namespace": "urn:ietf:params:xml:ns:yang:ietf-interfaces", "prefix": "if", "contact": " ... ", "organization": "IETF NETMOD (NETCONF Data Modeling Language) Working Group", "revision": "2014-05-08", "description": " ... ", "imports": [ { "name": "ietf-yang-types", "prefix": "yang" } ], "top-nodes": [ "interfaces", "interfaces-state" ] } }
{ "$@@ietf-ip": { "yang-version": "1.0", "namespace": "urn:ietf:params:xml:ns:yang:ietf-ip", "prefix": "ip", "contact": " ... ", "organization": "IETF NETMOD (NETCONF Data Modeling Language) Working Group", "revision": "2014-06-16", "description": " ... ", "imports": [ { "name": "ietf-interfaces", "prefix": "if" }, { "name": "ietf-inet-types", "prefix": "inet" }, { "name": "ietf-yang-types", "prefix": "yang" } ] } }
Each node of or request will be "merged" with schema in following scenario:
Example:
{ "$@node_name": { "eltype": "list", "config": true, "type": "enumeration", "iskey": false } }
Example:
{ "$@node_name": { "children": ["interface", "interface-state"] } }
Example:
{ "$@interface": { "eltype": "list", "config": "true", "type": "enumeration", "iskey": "false", }, "interface": [ { "$@type": { "typedef": { // same result as SCH_QUERY for this typedef "type": "uint8", "range": "0 .. 100", "description": "Percentage" } }, "type": "iana-if-type:ethernetCsmacd" } ] }
Example:
{ "$@node_name": { "enumval": [int8, int16, int32, int64, uint8, uint16, uint32, uint64, float, string] } }
Example based on https://tools.ietf.org/html/rfc6020#section-7.9
{ "$@transfer": { "eltype": "container", "config": "true", "choice": ["how"] }, "transfer": { "$@how": { "eltype": "choice", "default": "interval", "cases": ["interval", "daily", "manual"] }, "how": { "$@interval": { "eltype": "case", "children": ["interval"] }, "$@daily": { "eltype": "case", "children": ["daily", "time-of-day"] } "$@manual": { "eltype": "case", "children": ["manual"] } }, "$@interval": { "eltype": "leaf", "type": "uint16", "default": "30", "units": "minutes" }, "$@daily": { "eltype": "leaf", "type": "empty" }, "$@time-of-day": { "eltype": "leaf", "type": "string", "default": "1am", "units": "24-hour-clock" }, "$@manual": { "eltype": "leaf", "type": "string" } } }
{ "$@ietf-interfaces:interfaces": { "eltype": "leaf", "config": "false", "type": "enumeration", "enumval": [int8, int16, int32, int64, uint8, uint16, uint32, uint64, float, string], "description": "The data type of the parameters argument., "mandatory": "false", "iskey": "false", "children": ["interface", "interface-state"] }, "ietf-interfaces:interfaces": { "$@interface": { "eltype": "list", "config": "true", "type": "enumeration", "iskey": "false", }, "interface": [ { "$@name": { "eltype": “leaf”, "config": "true", "type": "string" }, "name": "eth0", "$@type": { "eltype": “leaf”, "config": “true”, "type": “link-load”, "typedef": { // just an example, this differs in the model "type": "uint8", "range": "0 .. 100", description "Percentage" } }, "type": "iana-if-type:ethernetCsmacd", "$@enabled": { "eltype": “leaf”, "config": “true”, "type": "boolean" }, "enabled": false }, { "$@name": { ... } "name": "eth1", "$@type": { ... } "type": "iana-if-type:ethernetCsmacd", "$@enabled": { ... } "enabled": true, "$@ex-vlan:vlan-tagging": { ... } "ex-vlan:vlan-tagging": true } ] }, "$@ietf-interfaces:interfaces-state": { "eltype": "leaf", "config": "false", "type": "enumeration", "enumval": [int8, int16, int32, int64, uint8, uint16, uint32, uint64, float, string], "description": "The data type of the parameters argument., "mandatory": "false", "iskey": "false" } "ietf-interfaces:interfaces-state": { ... } }
anyxml - XML string which should be converted info JSON in mod_netconf (if it is possible) or in NetopeerGUI backend
{ "$@data": { "eltype": “anyxml” }, "data": { "root": { "node": "value" } } }
augment - applied automatically in result
bit- type
{ "bits": [ { "name": “first-bit”, "position": 0 }, { "name": “second-bit”, "position": 1 }, ... ] }
case
{ "children": [“child1”, “child2”, …], "choice": [“choice1”, “choice2”, …] }
choice - defined in example 5
config
{ "config": true/false }
container - defined in "eltype"
{ "$@interface": { "eltype": "container" } }
default
{ "default": "default value of node" }
description
{ "description": "The text of description of node" }
enum - values are transformed into "enumval"
{ "$@ietf-interfaces:interfaces-state": { "type": "enumeration", "enumval": [int8, int16, int32, int64, uint8, uint16, uint32, uint64, float] } }
fraction-digits
{ "fraction-digits": 2 }
grouping - rendered in "uses" statement directly
key
{ "$@list-name": { "eltype": "list" "keys": [“key-element-name”] } }
leaf
{ "$@leaf-name": { "eltype": "leaf", "iskey": true/false } }
leaf-list
{ "$@leaf-name": { "eltype": "leaf-list" } }
length - renders same value as defined in schema
{ "length": "1..255" }
list
{ "$@list-name": { "eltype": "list" }, "list-name": { "$@leaf-name": { "eltype": “leaf”, ... } } }
mandatory
{ "mandatory": "true/false" }
max-elements
{ "max-elements": number }
min-elements
{ "min-elements": number }
ordered-by
{ "order-by": “user/system” }
path - if defined, target schema informations must be defined, even if data does not exists
{ "$@target": { … }, "$@node": { "eltype": “leafref”, "path": “path/to/target” } }
pattern
{ "pattern": ["[0-9a-fA-F]*"] }
position - no semantical informations, see "bits" statement
presence
{ "presence": “the meaning of presence in container” }
range
{ "range": "11..max" }
reference
{ "reference": "[RFC 3986](https://tools.ietf.org/html/rfc3986): Uniform Resource Identifier (URI): Generic Syntax" }
refine - renders target automatically
rpc - rendered as any other data information with schema. In NetopeerGUI is rendered as a standalone tree. Output substatement is not needed in GUI.
{ "$@rock-the-house": { "eltype": "rpc" }, "rock-the-house": { "input": { "$@zip-code": { "eltype": “leaf”, "type": “string” } "zip-code": { … } } } }
status
{ "status": “current/deprecated/obsolete” }
type - same value as defined in schema
{ "type": “string” }
typedef - defined in example 3
union
{ "type": “union”, "types": [ { (type1) }, { (type2) }, ... ] }
unique
{ "$@list-name": { "eltype": “list”, "unique": [“ip”, “port”] } }
units
{ "units": “string of the units” }
uses - renders content of "grouping" statement directly
must
{ "must": [“must-condition-1”, “must-condition-2”, …] }
when
{ "when": “when-condition” }
require-instance
{ "require-instance": true/false }
identity - all values are transformed into "identityval"
{ "ietf-interfaces:interfaces": { "interface": { "$@type": { "type": "identityref", "identityval": [interface-type, iana-if-type:iana-interface-type, iana-if-type:other, iana-if-type:regular1822, ...] } } } } }
extension - support for NACM extensions only
{ "ext": “default-deny-write”/”default-deny-all” }
Only a part of module information:
contact
{ "contact": “contact information” }
organization
{ "organization": “organization information” }
namespace
{ "namespace": “model namespace” }
prefix
{ "prefix": “model prefix” }
revision
{ "revision": “last model revision date” }
revision-date - part of import and include output
yang-version
{ "yang-version": “1.0/1.1” }
import
{ "imports": [ { "name": “import name”, "prefix": “import prefix”, "revision": “import revision date” } ] }
include
{ "includes": [ { "name": “include name”, "revision": “include revision date” } ] }
Not used (we don't need this information):