Adding demo yang models and working on yang model packaging.
Change-Id: Ief674880920cf6165c863909298eb4fa6dd3fb64
diff --git a/models/demo/BUCK b/models/demo/BUCK
new file mode 100644
index 0000000..6b4456a
--- /dev/null
+++ b/models/demo/BUCK
@@ -0,0 +1,57 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+]
+
+
+# The following will be wrapped into a macro to be used something like this:
+#
+# yang_model (
+# app_name = 'org.onosproject.models.foobar',
+# title = 'Demo YANG Model',
+# url = 'http://onosproject.org',
+# )
+
+
+YANG_TOOLS = [
+ '//apps/yang:onos-apps-yang',
+ '//lib:onos-yang-runtime',
+]
+
+yang_library(
+ name = 'yang',
+ srcs = glob(['src/**/*.yang']),
+)
+
+genrule(
+ name = 'schema',
+ srcs = [ ':yang#srcs' ],
+ cmd = '$(location //buck-tools:yang-schema) $OUT $SRCS',
+ out = 'yang'
+)
+
+genrule(
+ name = 'registrator',
+ srcs = glob(['src/**/*.yang']),
+ cmd = '$(location //buck-tools:yang-registrator) $OUT org.onosproject.models.demo $SRCS',
+ out = 'YangModelRegistrator.java'
+)
+
+osgi_jar(
+ name = 'onos-models-demo',
+ # srcs = [ ':registrator' ],
+ srcs = [ ':yang#srcs', ':registrator' ],
+ deps = COMPILE_DEPS + YANG_TOOLS,
+ resources = [ ':schema' ],
+ resources_root = ".",
+ do_checkstyle = False,
+ do_javadocs = False,
+)
+
+onos_app (
+ app_name = 'org.onosproject.models.demo',
+ title = 'Demo YANG Model',
+ category = 'Model',
+ url = 'http://onosproject.org',
+ description = 'Demo YANG model extension.',
+ required_apps = [ 'org.onosproject.yang' ],
+)
diff --git a/models/demo/src/ne-l3vpn-api.yang b/models/demo/src/ne-l3vpn-api.yang
new file mode 100644
index 0000000..5b0181c
--- /dev/null
+++ b/models/demo/src/ne-l3vpn-api.yang
@@ -0,0 +1,82 @@
+/*
+WARNING:
+This yang model is just for fuction ONOS opensource project demo purpose only,
+And is subject to change in future, Huawei does not commit provide compatibilty
+in commercial product.
+*/
+module ne-l3vpn-api {
+ namespace "ne-l3vpn-api";
+ prefix l3vpn-api;
+ import ne-l3vpncomm-type {
+ prefix l3vpncomm-type;
+ }
+ import ne-l3vpncomm {
+ prefix l3vpncomm;
+ }
+ organization "Huawei Technologies Co., Ltd";
+ contact "Huawei Industrial Base
+ Bantian, Longgang
+ Shenzhen 518129
+ People's Republic of China
+ Website: http://www.huawei.com
+ Email: support@huawei.com";
+ description "VRP V800R010 Schema";
+ revision "2014-12-25" {
+ reference "Huawei VRPV8 Schema";
+ }
+ container devices {
+ list device {
+ key deviceid;
+ leaf deviceid {
+ type string;
+ }
+ container l3vpn {
+ container l3vpncomm {
+ container l3vpnInstances {
+ description "";
+ list l3vpnInstance {
+ key "vrfName";
+ leaf vrfName {
+ type string;
+ }
+ leaf vrfDescription {
+ type string;
+ }
+ uses l3vpncomm:l3vpnIfs;
+ container vpnInstAFs {
+ description "";
+ list vpnInstAF {
+ key "afType";
+ description "Address family";
+ leaf afType {
+ type "l3vpncomm-type:l3vpncommonL3vpnPrefixType";
+ description "Address family";
+ }
+ leaf vrfRD {
+ when "vrfName != '_public_'";
+ type "string";
+ description "route-distinguisher.";
+ }
+ container vpnTargets {
+ description "";
+ list vpnTarget {
+ must "vrfName != '_public_' and vpnTarget = '0'";
+ key "vrfRTValue vrfRTType";
+ description "L3vpn vpntarget configure class";
+ leaf vrfRTValue {
+ type "string";
+ }
+ leaf vrfRTType {
+ type "l3vpncomm-type:l3vpncommonVrfRtType";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/models/demo/src/ne-l3vpncomm-type.yang b/models/demo/src/ne-l3vpncomm-type.yang
new file mode 100644
index 0000000..3e4e10c
--- /dev/null
+++ b/models/demo/src/ne-l3vpncomm-type.yang
@@ -0,0 +1,54 @@
+/*
+WARNING:
+This yang model is just for fuction ONOS opensource project demo purpose only,
+And is subject to change in future, Huawei does not commit provide compatibilty
+in commercial product.
+*/
+module ne-l3vpncomm-type {
+ namespace "l3vpn-comm-type";
+ prefix l3vpncomm-type;
+ organization "Huawei Technologies Co., Ltd";
+ contact "Huawei Industrial Base
+ Bantian, Longgang
+ Shenzhen 518129
+ People's Republic of China
+ Website: http://www.huawei.com
+ Email: support@huawei.com";
+ description "";
+ revision "2014-12-25" {
+ description "Initial version";
+ }
+ typedef l3vpncommonL3vpnPrefixType {
+ type enumeration {
+ enum "ipv4uni" {
+ value 0;
+ description "ipv4uni:";
+ }
+ enum "ipv6uni" {
+ value 1;
+ description "ipv6uni:";
+ }
+ }
+ description "";
+ }
+ typedef l3vpncommonVrfRtType {
+ type enumeration {
+ enum "export_extcommunity" {
+ value 0;
+ description "export-extcommunity:";
+ }
+ enum "import_extcommunity" {
+ value 1;
+ description "import-extcommunity:";
+ }
+ }
+ description "";
+ }
+ typedef ipv4Address {
+ type string {
+ length "0..255";
+ pattern "((([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}
+ ([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))";
+ }
+ }
+}
diff --git a/models/demo/src/ne-l3vpncomm.yang b/models/demo/src/ne-l3vpncomm.yang
new file mode 100644
index 0000000..b03c382
--- /dev/null
+++ b/models/demo/src/ne-l3vpncomm.yang
@@ -0,0 +1,49 @@
+/*
+WARNING:
+This yang model is just for fuction ONOS opensource project demo purpose only,
+And is subject to change in future, Huawei does not commit provide compatibilty
+in commercial product.
+*/
+module ne-l3vpncomm {
+ namespace "ne-l3vpn-comm";
+ prefix "l3vpncomm";
+ import ne-l3vpncomm-type {
+ prefix l3vpncomm-type;
+ }
+ organization "Huawei Technologies Co., Ltd";
+ contact "Huawei Industrial Base
+ Bantian, Longgang
+ Shenzhen 518129
+ People's Republic of China
+ Website: http://www.huawei.com
+ Email: support@huawei.com";
+ description "";
+ revision "2014-12-25" {
+ description "Initial version";
+ }
+ grouping l3vpnIfs {
+ container l3vpnIfs {
+ description "";
+ list l3vpnIf {
+ key "ifName";
+ description "interface Name.";
+ leaf ifName {
+ type string;
+ description "interface Name";
+ }
+ leaf ipv4Addr {
+ when "subnetMask != null";
+ mandatory "true";
+ type "l3vpncomm-type:ipv4Address";
+ description "Interface Address.";
+ }
+ leaf subnetMask {
+ when "ipv4Addr != null";
+ mandatory "true";
+ type "l3vpncomm-type:ipv4Address";
+ description "Interface address mask.";
+ }
+ }
+ }
+ }
+}