module config-threads-java { yang-version 1; namespace "urn:opendaylight:params:xml:ns:yang:controller:config:threads:java"; prefix "th-java"; import config-threads { prefix th2; revision-date 2013-04-09; } import config { prefix config; revision-date 2013-04-05; } import rpc-context { prefix rpcx; revision-date 2013-06-17; } description "This module contains the base YANG definitions for NS-OS thread services pure Java implementation."; revision "2013-04-05" { description "Updated to work with new anchors."; } revision "2013-04-03" { description "Initial revision"; } identity thread-rpc-context; identity eventbus { base config:module-type; config:provided-service "th2:eventbus"; config:java-name-prefix EventBus; } identity async-eventbus { base config:module-type; config:provided-service "th2:eventbus"; config:java-name-prefix AsyncEventBus; } identity threadfactory-naming { base config:module-type; config:provided-service "th2:threadfactory"; config:java-name-prefix NamingThreadFactory; } identity threadpool-dynamic { base config:module-type; description "threadpool-dynamic description"; config:provided-service "th2:threadpool"; config:provided-service "th2:scheduled-threadpool"; config:java-name-prefix DynamicThreadPool; } augment "/config:modules/config:module/config:configuration" { case eventbus { when "/config:modules/config:module/config:type = 'eventbus'"; // No real configuration } } augment "/config:modules/config:module/config:configuration" { case async-eventbus { when "/config:modules/config:module/config:type = 'async-eventbus'"; container threadpool { uses config:service-ref { refine type { config:required-identity th2:threadpool; } } } } } augment "/config:modules/config:module/config:state" { case async-eventbus { when "/config:modules/config:module/config:type = 'async-eventbus'"; // simulate not having root runtime bean list event { config:inner-state-bean; key "name"; leaf name { type string; } } } } typedef thread-state { type enumeration { enum "STARTED"; enum "STOPPED"; } description "Enum type holding state in which a thread can be."; } augment "/config:modules/config:module/config:configuration" { case threadfactory-naming { when "/config:modules/config:module/config:type = 'threadfactory-naming'"; leaf name-prefix { description "String that will be prefixed to each created thread. Suffix will be constructed from underscore (_) and auto-incremented index number."; type string; } } } augment "/config:modules/config:module/config:state" { case threadfactory-naming { when "/config:modules/config:module/config:type = 'threadfactory-naming'"; list thread { config:inner-state-bean; key "name"; leaf name { type string; } // add rpc context rpcx:rpc-context-instance "thread-rpc-context"; list stream { config:inner-state-bean; config:java-name-prefix ThreadStream; // no key – key will be generated by incrementing a counter leaf timestamp { type string; } leaf state { type thread-state; } container peer { leaf port { type uint32; default 179; } leaf core-size { type uint32; } } list inner-stream-list { leaf timestamp { type string; } } } } list stream { config:inner-state-bean; leaf timestamp { type string; } } // root runtime bean leaf created-sessions { type uint32; } } } rpc dump-stack { config:java-name-prefix dumpStack; input { uses rpcx:rpc-context-ref { refine context-instance { rpcx:rpc-context-instance thread-rpc-context; } } } } rpc sleep { input { uses rpcx:rpc-context-ref { refine context-instance { rpcx:rpc-context-instance thread-rpc-context; } } leaf millis { type uint32; } } output { leaf result { type thread-state; } } } augment "/config:modules/config:module/config:configuration" { case threadpool-dynamic { when "/config:modules/config:module/config:type = 'threadpool-dynamic'"; leaf core-size { type uint32; } leaf keep-alive { type uint32; units seconds; default 10; } leaf maximum-size { type uint32; description "maximum-size description"; } leaf binary { type binary; } container threadfactory { description "threadfactory description"; uses config:service-ref { refine type { mandatory true; config:required-identity th2:threadfactory; } } } leaf-list users { type string; } leaf-list users-numbers { type uint32; description "numbers of users description"; } } } augment "/config:modules/config:module/config:state" { case threadpool-dynamic { when "/config:modules/config:module/config:type = 'threadpool-dynamic'"; // root runtime bean leaf created-sessions { type uint32; } } } identity threadpool-registry-impl { base config:module-type; config:java-name-prefix ThreadPoolRegistryImpl; } augment "/config:modules/config:module/config:configuration" { case threadpool-registry-impl { when "/config:modules/config:module/config:type = 'threadpool-registry-impl'"; // list of dependencies: list threadpools { uses config:service-ref { refine type { mandatory true; config:required-identity th2:threadpool; } } } } } }