From: Tony Tkacik Date: Thu, 3 Sep 2015 17:29:02 +0000 (+0200) Subject: Removed not-building code. X-Git-Tag: release/beryllium~124^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=c3b3ca496873ed617e84b360df3149f963e34ec6;p=mdsal.git Removed not-building code. Change-Id: Id89947a47aa2e5de19ac967013892a1e6a132fd3 Signed-off-by: Tony Tkacik --- diff --git a/binding/samples/maven-code-gen-sample/pom.xml b/binding/samples/maven-code-gen-sample/pom.xml deleted file mode 100644 index 060990bc03..0000000000 --- a/binding/samples/maven-code-gen-sample/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - 4.0.0 - - org.opendaylight.mdsal - binding-generator - 0.8.0-SNAPSHOT - - maven-code-gen-sample - - - - - org.opendaylight.yangtools - yang-maven-plugin - ${yang.version} - - - - generate-sources - - - src/main/yang - - - - org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl - - - target/generated-sources/sal - - - - false - - - - - - - org.opendaylight.mdsal - maven-sal-api-gen-plugin - jar - - - - - - - - org.opendaylight.mdsal - yang-binding - - - diff --git a/binding/samples/maven-code-gen-sample/src/main/java/Example.java b/binding/samples/maven-code-gen-sample/src/main/java/Example.java deleted file mode 100644 index b15c0e5122..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/java/Example.java +++ /dev/null @@ -1,34 +0,0 @@ -import java.util.List; - -import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.network.rev2013520.ControllerNetworkData; -import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.network.rev2013520.Network; -import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.network.rev2013520.network.topologies.Topology; -import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.network.rev2013520.network.topologies.topology.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.openflow.rev2013520.Node1; - -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -public class Example { - - - - void udpateTopology(ControllerNetworkData network) { - List topologies = network.getNetwork().getTopologies().getTopology(); - for (Topology topology : topologies) { - List nodes = topology.getNodes().getNode(); - for (Node node : nodes) { - - - Node1 ofNode = node.getAugmentation(Node1.class); - ofNode.getDatapathId(); - } - } - - } -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/augment-monitoring@2013-07-01.yang b/binding/samples/maven-code-gen-sample/src/main/yang/augment-monitoring@2013-07-01.yang deleted file mode 100644 index a9c357ac63..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/augment-monitoring@2013-07-01.yang +++ /dev/null @@ -1,88 +0,0 @@ -module augment-monitoring { - yang-version 1; - namespace "urn:ietf:params:xml:ns:yang:augment-monitoring"; - prefix "amon"; - - import choice-monitoring { prefix nm; } - - organization "OPEN DAYLIGHT"; - contact "http://www.opendaylight.org/"; - - revision "2013-07-01" { - reference "NO REF"; - } - - augment "/nm:netconf-state/nm:datastores/nm:datastore/nm:locks/nm:lock-type" { - case autonomous-lock { - container autonomous-def { - leaf lock-id { - type int32; - } - - leaf lock-time { - type uint32; - } - } - } - - case anonymous-lock { - leaf lock-time { - type uint32; - } - } - - leaf leaf-aug-case { - type string; - } - } - - augment "/nm:netconf-state/nm:datastores/nm:datastore/nm:locks/nm:lock-type/nm:partial-lock" { - choice aug-case-by-choice { - case foo { - leaf foo { - type string; - } - } - - case bar { - leaf bar { - type boolean; - } - } - } - } - - augment "/nm:netconf-state/nm:datastores/nm:datastore" { - choice storage-format { - case _xml { - container _xml-def { - leaf file-name { - type string; - } - } - } - - case yang { - leaf yang-file-name { - type string; - } - } - - case unknown-files { - list files { - key "file-name"; - - leaf file-name { - type string; - } - - container file-data { - leaf utf8-data { - type string; - } - } - } - } - } - } -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/bit_and_union_in_leaf.yang b/binding/samples/maven-code-gen-sample/src/main/yang/bit_and_union_in_leaf.yang deleted file mode 100644 index 2a7c366a32..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/bit_and_union_in_leaf.yang +++ /dev/null @@ -1,55 +0,0 @@ -module bit-and-union-in-leaf { - - namespace "urn:bit:union:in:leaf"; - prefix "sbd"; - - organization "OPEN DAYLIGHT"; - contact "http://www.opendaylight.org/"; - - revision 2013-06-26 { - - } - - typedef union-typedef { - type union { - type string { - pattern "[a-g]"; - } - type int16; - } - } - - typedef union-typedef2 { - type union { - type string; - type int16; - } - } - - container parent-container { - leaf bit-leaf { - type bits { - bit first-bit; - bit second-bit; - bit third-bit; - } - } - - leaf union-leaf { - type union { - type int32; - type string { - pattern "[a-z]"; - } - type string { - pattern "[0-9]*" - } - type string { - pattern "[a-d]*"; - pattern "[0-5]*"; - } - type uint8; - } - } - } -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/choice-monitoring@2013-07-01.yang b/binding/samples/maven-code-gen-sample/src/main/yang/choice-monitoring@2013-07-01.yang deleted file mode 100644 index 2362783edd..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/choice-monitoring@2013-07-01.yang +++ /dev/null @@ -1,129 +0,0 @@ -module choice-monitoring { - yang-version 1; - namespace "urn:ietf:params:xml:ns:yang:choice-monitoring"; - prefix "ncm"; - - import ietf-yang-types { prefix yang; } - import ietf-inet-types { prefix inet; } - - organization "OPEN DAYLIGHT"; - contact "http://www.opendaylight.org/"; - - description - "Test model for testing of resolving choice, case nodes and generation types from them."; - - revision 2013-07-01 { - - } - - typedef tls-fingerprint-type { - type string { - pattern '([0-9a-fA-F]){2}(:([0-9a-fA-F]){2})*'; - } - } - - typedef netconf-datastore-type { - type enumeration { - enum running; - enum candidate; - enum startup; - } - } - - container netconf-state { - config false; - - container datastores { - list datastore { - key name; - - leaf name { - type netconf-datastore-type; - } - container locks { - choice lock-type { - - case global-lock { - container global-lock { - - leaf locked-by-session { - type uint32; - mandatory true; - } - - leaf locked-time { - type yang:date-and-time; - mandatory true; - } - - container capabilities { - leaf-list capability { - type inet:uri; - } - } - } - } - - case partial-lock { - list partial-lock { - key lock-id; - - leaf lock-id { - type uint32; - } - leaf-list select { - type yang:xpath1.0; - min-elements 1; - } - leaf-list locked-node { - type string; - } - } - } - - case fingerprint { - choice algorithm-and-hash { - mandatory true; - case md5 { - leaf md5 { - type tls-fingerprint-type; - } - } - - case sha1 { - leaf sha1 { - type tls-fingerprint-type; - } - } - - case sha224 { - leaf sha224 { - type tls-fingerprint-type; - } - } - - case sha256 { - leaf sha256 { - type tls-fingerprint-type; - } - } - - case sha384 { - leaf sha384 { - type tls-fingerprint-type; - } - } - - case sha512 { - leaf sha512 { - type tls-fingerprint-type; - } - } - } - } - } - } - } - } - } -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/controller-network-ne.yang b/binding/samples/maven-code-gen-sample/src/main/yang/controller-network-ne.yang deleted file mode 100644 index ca8507f9f4..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/controller-network-ne.yang +++ /dev/null @@ -1,54 +0,0 @@ -module controller-openflow-ne { - yang-version 1; - namespace "urn:opendaylight:controller:network:openflow"; - prefix "of"; - - import controller-network { - prefix cn; - } - import ietf-inet-types { prefix "inet"; } - - revision 2013-06-07 { - description "Initial demo"; - } - - augment "/cn:network/cn:network-elements/cn:network-element" { - - container flow-tables2 { - list flow-table { - - key "id"; - leaf id { - type int32; - } - - container flows { - list flow { - key "name"; - leaf name { - type string; - } - container match { - leaf input-port { - type cn:tp-ref; - } - leaf nl-src { - type inet:ipv4-address; - } - leaf nl-dst { - type inet:ipv4-address; - } - } - container actions { - list action { - leaf type { - type string; - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/controller-network.yang b/binding/samples/maven-code-gen-sample/src/main/yang/controller-network.yang deleted file mode 100644 index ce0b6b0824..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/controller-network.yang +++ /dev/null @@ -1,167 +0,0 @@ -module controller-network { - yang-version 1; - namespace "urn:opendaylight:controller:network"; - prefix "topos"; - - import ietf-inet-types { prefix "inet"; } - - revision 2013-05-20 { - description "Initial demo"; - } - - typedef topology-id { - type string; - } - - typedef node-id { - type string; - } - - typedef link-id { - type string; - } - - typedef tp-id { - type string; - description "identifier for termination points on a port"; - } - - typedef tp-ref { - type leafref { - path "/network/topologies/topology/nodes/node/termination-points/termination-point/tp-id"; - } - } - typedef topology-ref { - type leafref { - path "/network/topologies/topology/topology-id"; - } - description "This type is used for leafs that reference topology identifier instance."; - // currently not used - } - - typedef node-ref { - type leafref { - path "/network/topologies/topology/nodes/node/node-id"; - } - description "This type is used for leafs that reference a node instance."; - } - - typedef link-ref { - type leafref { - path "/network/topologies/topology/links/link/link-id"; - } - description "This type is used for leafs that reference a link instance."; - // currently not used - } - - typedef network-element-ref { - type leafref { - path "/network/network-elements/network-element/element-id"; - } - } - - typedef element-id { - type string; - } - - container network { - container topologies { - list topology { - description " - This is the model of abstract topology which contains only Network - Nodes and Network Links. Each topology MUST be identified by - unique topology-id for reason that the store could contain many - topologies. - "; - key "topology-id"; - leaf topology-id { - type topology-id; - description " - It is presumed that datastore will contain many topologies. To - distinguish between topologies it is vital to have UNIQUE - topology identifier. - "; - } - - container types { - description " - The container for definition of topology types. - The augmenting modules should add empty optional leaf - to this container to signalize topology type."; - } - - container nodes { - list node { - description "The list of network nodes defined for topology."; - - key "node-id"; - leaf node-id { - type node-id; - description "The Topology identifier of network-node."; - } - - leaf supporting-ne { - type network-element-ref; - } - - container termination-points { - list termination-point { - key "tp-id"; - leaf tp-id { - type tp-id; - } - } - } - } - } - - container links { - list link { - description " - The Network Link which is defined by Local (Source) and - Remote (Destination) Network Nodes. Every link MUST be - defined either by identifier and his local and remote - Network Nodes (in real applications it is common that many - links are originated from one node and end up in same - remote node). To ensure that we would always know to - distinguish between links, every link SHOULD have - identifier. - "; - key "link-id"; - - leaf link-id { - type link-id; - } - container source { - leaf source-node { - type node-ref; - description "Source node identifier."; - } - leaf source-tp { - type tp-ref; - } - } - container destination { - leaf dest-node { - type node-ref; - description "Destination node identifier."; - } - leaf dest-tp { - type tp-ref; - } - } - } - } - } - } - container network-elements { - config true; - list network-element { - key "element-id"; - leaf element-id { - type element-id; - } - } - } - } -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/controller-openflow-ipv6.yang b/binding/samples/maven-code-gen-sample/src/main/yang/controller-openflow-ipv6.yang deleted file mode 100644 index eec19092fd..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/controller-openflow-ipv6.yang +++ /dev/null @@ -1,17 +0,0 @@ -module controller-openflow-ipv6 { - yang-version 1; - namespace "urn:opendaylight:controller:network:openflow:ipv6"; - prefix "of6"; - - import controller-network { - prefix cn; - } - import ietf-inet-types { prefix "inet"; } - import controller-openflow-ne {prefix "of";} - - revision 2013-06-07 { - description "Initial demo"; - } -} - - \ No newline at end of file diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/controller-openflow.yang b/binding/samples/maven-code-gen-sample/src/main/yang/controller-openflow.yang deleted file mode 100644 index 83a0459cf3..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/controller-openflow.yang +++ /dev/null @@ -1,74 +0,0 @@ -module controller-openflow { - - namespace "urn:opendaylight:controller:openflow"; - prefix "of"; - import controller-network {prefix cn;} - - revision 2013-05-20 { - description "Initial demo"; - } - - typedef datapath-id { - type string { - length 16; - } - } - - - augment "/cn:network/cn:topologies/cn:topology/cn:types" { - leaf openflow {type string;} - } - - augment "/cn:network/cn:topologies/cn:topology/cn:links/cn:link/cn:source" { - when "../../../cn:types/of:openflow"; - - leaf logical-port { - type int32; - } - } - - augment "/cn:network/cn:topologies/cn:topology/cn:links/cn:link/cn:destination" { - when "../../../cn:types/of:openflow"; - - leaf logical-port { - type int32; - } - } - - augment "/cn:network/cn:topologies/cn:topology/cn:nodes/cn:node" { - when "../../../cn:types/of:openflow"; - leaf datapath-id { - type datapath-id; - } - } - - augment "/cn:network/cn:network-elements/cn:network-element" { - leaf datapath-id { - type datapath-id; - } - - container ports { - list port { - key "logical-port-id"; - - leaf logical-port-id { - type int32; - } - - // Should be replaced with ref to interface - leaf physical-name { - type string; - } - } - } - container flow-tables { - list flow-table { - key "flow-table-id"; - leaf flow-table-id { - type string; - } - - } - } - } -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/demo-topology.yang b/binding/samples/maven-code-gen-sample/src/main/yang/demo-topology.yang deleted file mode 100644 index 4fef1cddd2..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/demo-topology.yang +++ /dev/null @@ -1,121 +0,0 @@ -module demo-topology { - yang-version 1; - namespace "urn:model.1demo-275topology.4.5.my"; - prefix "tp"; - - organization "OPEN DAYLIGHT"; - contact "http://www.opendaylight.org/"; - - description " - This module contains the definitions of elements that creates network - topology i.e. definition of network nodes and links. This module is - not designed to be used solely for network representation. This module - SHOULD be used as base module in defining the network topology. - "; - - revision "2013-02-08"{ - reference " WILL BE DEFINED LATER"; - } - - container topology { - description " - This is the model of abstract topology which contains only Network - Nodes and Network Links. Each topology MUST be identified by - unique topology-id for reason that the store could contain many - topologies. - "; - - leaf topology-id { - type string; - description " - It is presumed that datastore will contain many topologies. To - distinguish between topologies it is vital to have UNIQUE - topology identifier. - "; - } - - container network-nodes { - list network-node { - description "The list of network nodes defined for topology."; - - key "node-id"; - - leaf node-id { - type string; - description "The Topology identifier of network-node."; - } - - list network-interface { - key "interface-id"; - - leaf interface-id { - type uint8; - } - - leaf interface-address { - type string; - } - } - - container node-attributes { - description " - Additional attributes that can Network Node contains. - "; - - leaf geo-latitude { - type decimal64 { - fraction-digits 2; - } - config true; - } - - leaf geo-longitude { - type decimal64 { - fraction-digits 2; - } - config true; - } - } - } - } - - container network-links { - list network-link { - description " - The Network Link which is defined by Local (Source) and - Remote (Destination) Network Nodes. Every link MUST be - defined either by identifier and his local and remote - Network Nodes (in real applications it is common that many - links are originated from one node and end up in same - remote node). To ensure that we would always know to - distinguish between links, every link SHOULD have - identifier. - "; - key "link-id"; - - leaf link-id { - type string; - description ""; - } - - container source { - leaf node-id { - type string; - description "Source node identifier."; - } - } - - container destination { - leaf node-id { - type string; - description "Destination node identifier."; - } - } - - container link-attributes { - description "Aditional attributes that can Network Link contains."; - } - } - } - } -} \ No newline at end of file diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/ietf-inet-types@2010-09-24.yang b/binding/samples/maven-code-gen-sample/src/main/yang/ietf-inet-types@2010-09-24.yang deleted file mode 100644 index de20febbb7..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/ietf-inet-types@2010-09-24.yang +++ /dev/null @@ -1,418 +0,0 @@ - module ietf-inet-types { - - namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types"; - prefix "inet"; - - organization - "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; - - contact - "WG Web: - WG List: - - WG Chair: David Partain - - - WG Chair: David Kessens - - - Editor: Juergen Schoenwaelder - "; - - description - "This module contains a collection of generally useful derived - YANG data types for Internet addresses and related things. - - Copyright (c) 2010 IETF Trust and the persons identified as - authors of the code. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, is permitted pursuant to, and subject to the license - terms contained in, the Simplified BSD License set forth in Section - 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents - (http://trustee.ietf.org/license-info). - - This version of this YANG module is part of RFC 6021; see - the RFC itself for full legal notices."; - - revision 2010-09-24 { - description - "Initial revision."; - reference - "RFC 6021: Common YANG Data Types"; - } - - /*** collection of protocol field related types ***/ - - typedef ip-version { - type enumeration { - enum unknown { - value "0"; - description - "An unknown or unspecified version of the Internet protocol."; - } - enum ipv4 { - value "1"; - description - "The IPv4 protocol as defined in RFC 791."; - } - enum ipv6 { - value "2"; - description - "The IPv6 protocol as defined in RFC 2460."; - } - } - description - "This value represents the version of the IP protocol. - - In the value set and its semantics, this type is equivalent - to the InetVersion textual convention of the SMIv2."; - reference - "RFC 791: Internet Protocol - RFC 2460: Internet Protocol, Version 6 (IPv6) Specification - RFC 4001: Textual Conventions for Internet Network Addresses"; - } - - typedef dscp { - type uint8 { - range "0..63"; - } - description - "The dscp type represents a Differentiated Services Code-Point - that may be used for marking packets in a traffic stream. - - In the value set and its semantics, this type is equivalent - to the Dscp textual convention of the SMIv2."; - reference - "RFC 3289: Management Information Base for the Differentiated - Services Architecture - RFC 2474: Definition of the Differentiated Services Field - (DS Field) in the IPv4 and IPv6 Headers - RFC 2780: IANA Allocation Guidelines For Values In - the Internet Protocol and Related Headers"; - } - - typedef ipv6-flow-label { - type uint32 { - range "0..1048575"; - } - description - "The flow-label type represents flow identifier or Flow Label - in an IPv6 packet header that may be used to discriminate - traffic flows. - - In the value set and its semantics, this type is equivalent - to the IPv6FlowLabel textual convention of the SMIv2."; - reference - "RFC 3595: Textual Conventions for IPv6 Flow Label - RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"; - } - - typedef port-number { - type uint16 { - range "0..65535"; - } - description - "The port-number type represents a 16-bit port number of an - Internet transport layer protocol such as UDP, TCP, DCCP, or - SCTP. Port numbers are assigned by IANA. A current list of - all assignments is available from . - - Note that the port number value zero is reserved by IANA. In - situations where the value zero does not make sense, it can - be excluded by subtyping the port-number type. - - In the value set and its semantics, this type is equivalent - to the InetPortNumber textual convention of the SMIv2."; - reference - "RFC 768: User Datagram Protocol - RFC 793: Transmission Control Protocol - RFC 4960: Stream Control Transmission Protocol - RFC 4340: Datagram Congestion Control Protocol (DCCP) - RFC 4001: Textual Conventions for Internet Network Addresses"; - } - - /*** collection of autonomous system related types ***/ - - typedef as-number { - type uint32; - description - "The as-number type represents autonomous system numbers - which identify an Autonomous System (AS). An AS is a set - of routers under a single technical administration, using - an interior gateway protocol and common metrics to route - packets within the AS, and using an exterior gateway - protocol to route packets to other ASs'. IANA maintains - the AS number space and has delegated large parts to the - regional registries. - - Autonomous system numbers were originally limited to 16 - bits. BGP extensions have enlarged the autonomous system - number space to 32 bits. This type therefore uses an uint32 - base type without a range restriction in order to support - a larger autonomous system number space. - - In the value set and its semantics, this type is equivalent - to the InetAutonomousSystemNumber textual convention of - the SMIv2."; - reference - "RFC 1930: Guidelines for creation, selection, and registration - of an Autonomous System (AS) - RFC 4271: A Border Gateway Protocol 4 (BGP-4) - RFC 4893: BGP Support for Four-octet AS Number Space - RFC 4001: Textual Conventions for Internet Network Addresses"; - } - - /*** collection of IP address and hostname related types ***/ - - typedef ip-address { - type union { - type inet:ipv4-address; - type inet:ipv6-address; - } - description - "The ip-address type represents an IP address and is IP - version neutral. The format of the textual representations - implies the IP version."; - } - - typedef ipv4-address { - type string { - pattern - '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' - + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' - + '(%[\p{N}\p{L}]+)?'; - } - description - "The ipv4-address type represents an IPv4 address in - dotted-quad notation. The IPv4 address may include a zone - index, separated by a % sign. - - The zone index is used to disambiguate identical address - values. For link-local addresses, the zone index will - typically be the interface index number or the name of an - interface. If the zone index is not present, the default - zone of the device will be used. - - The canonical format for the zone index is the numerical - format"; - } - - typedef ipv6-address { - type string { - pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' - + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' - + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' - + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' - + '(%[\p{N}\p{L}]+)?'; - pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' - + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' - + '(%.+)?'; - } - description - "The ipv6-address type represents an IPv6 address in full, - mixed, shortened, and shortened-mixed notation. The IPv6 - address may include a zone index, separated by a % sign. - - The zone index is used to disambiguate identical address - values. For link-local addresses, the zone index will - typically be the interface index number or the name of an - interface. If the zone index is not present, the default - zone of the device will be used. - - The canonical format of IPv6 addresses uses the compressed - format described in RFC 4291, Section 2.2, item 2 with the - following additional rules: the :: substitution must be - applied to the longest sequence of all-zero 16-bit chunks - in an IPv6 address. If there is a tie, the first sequence - of all-zero 16-bit chunks is replaced by ::. Single - all-zero 16-bit chunks are not compressed. The canonical - format uses lowercase characters and leading zeros are - not allowed. The canonical format for the zone index is - the numerical format as described in RFC 4007, Section - 11.2."; - reference - "RFC 4291: IP Version 6 Addressing Architecture - RFC 4007: IPv6 Scoped Address Architecture - RFC 5952: A Recommendation for IPv6 Address Text Representation"; - } - - typedef ip-prefix { - type union { - type inet:ipv4-prefix; - type inet:ipv6-prefix; - } - description - "The ip-prefix type represents an IP prefix and is IP - version neutral. The format of the textual representations - implies the IP version."; - } - - typedef ipv4-prefix { - type string { - pattern - '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' - + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' - + '/(([0-9])|([1-2][0-9])|(3[0-2]))'; - } - description - "The ipv4-prefix type represents an IPv4 address prefix. - The prefix length is given by the number following the - slash character and must be less than or equal to 32. - - A prefix length value of n corresponds to an IP address - mask that has n contiguous 1-bits from the most - significant bit (MSB) and all other bits set to 0. - - The canonical format of an IPv4 prefix has all bits of - the IPv4 address set to zero that are not part of the - IPv4 prefix."; - } - - typedef ipv6-prefix { - type string { - pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' - + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' - + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' - + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' - + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'; - pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' - + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' - + '(/.+)'; - } - description - "The ipv6-prefix type represents an IPv6 address prefix. - The prefix length is given by the number following the - slash character and must be less than or equal 128. - - A prefix length value of n corresponds to an IP address - mask that has n contiguous 1-bits from the most - significant bit (MSB) and all other bits set to 0. - - The IPv6 address should have all bits that do not belong - to the prefix set to zero. - - The canonical format of an IPv6 prefix has all bits of - the IPv6 address set to zero that are not part of the - IPv6 prefix. Furthermore, IPv6 address is represented - in the compressed format described in RFC 4291, Section - 2.2, item 2 with the following additional rules: the :: - substitution must be applied to the longest sequence of - all-zero 16-bit chunks in an IPv6 address. If there is - a tie, the first sequence of all-zero 16-bit chunks is - replaced by ::. Single all-zero 16-bit chunks are not - compressed. The canonical format uses lowercase - characters and leading zeros are not allowed."; - reference - "RFC 4291: IP Version 6 Addressing Architecture"; - } - - /*** collection of domain name and URI types ***/ - - typedef domain-name { - type string { - pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' - + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' - + '|\.'; - length "1..253"; - } - description - "The domain-name type represents a DNS domain name. The - name SHOULD be fully qualified whenever possible. - - Internet domain names are only loosely specified. Section - 3.5 of RFC 1034 recommends a syntax (modified in Section - 2.1 of RFC 1123). The pattern above is intended to allow - for current practice in domain name use, and some possible - future expansion. It is designed to hold various types of - domain names, including names used for A or AAAA records - (host names) and other records, such as SRV records. Note - that Internet host names have a stricter syntax (described - in RFC 952) than the DNS recommendations in RFCs 1034 and - 1123, and that systems that want to store host names in - schema nodes using the domain-name type are recommended to - adhere to this stricter standard to ensure interoperability. - - The encoding of DNS names in the DNS protocol is limited - to 255 characters. Since the encoding consists of labels - prefixed by a length bytes and there is a trailing NULL - byte, only 253 characters can appear in the textual dotted - notation. - - The description clause of schema nodes using the domain-name - type MUST describe when and how these names are resolved to - IP addresses. Note that the resolution of a domain-name value - may require to query multiple DNS records (e.g., A for IPv4 - and AAAA for IPv6). The order of the resolution process and - which DNS record takes precedence can either be defined - explicitely or it may depend on the configuration of the - resolver. - - Domain-name values use the US-ASCII encoding. Their canonical - format uses lowercase US-ASCII characters. Internationalized - domain names MUST be encoded in punycode as described in RFC - 3492"; - reference - "RFC 952: DoD Internet Host Table Specification - RFC 1034: Domain Names - Concepts and Facilities - RFC 1123: Requirements for Internet Hosts -- Application - and Support - RFC 2782: A DNS RR for specifying the location of services - (DNS SRV) - RFC 3492: Punycode: A Bootstring encoding of Unicode for - Internationalized Domain Names in Applications - (IDNA) - RFC 5891: Internationalizing Domain Names in Applications - (IDNA): Protocol"; - } - - typedef host { - type union { - type inet:ip-address; - type inet:domain-name; - } - description - "The host type represents either an IP address or a DNS - domain name."; - } - - typedef uri { - type string; - description - "The uri type represents a Uniform Resource Identifier - (URI) as defined by STD 66. - - Objects using the uri type MUST be in US-ASCII encoding, - and MUST be normalized as described by RFC 3986 Sections - 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary - percent-encoding is removed, and all case-insensitive - characters are set to lowercase except for hexadecimal - digits, which are normalized to uppercase as described in - Section 6.2.2.1. - - The purpose of this normalization is to help provide - unique URIs. Note that this normalization is not - sufficient to provide uniqueness. Two URIs that are - textually distinct after this normalization may still be - equivalent. - - Objects using the uri type may restrict the schemes that - they permit. For example, 'data:' and 'urn:' schemes - might not be appropriate. - - A zero-length URI is not a valid URI. This can be used to - express 'URI absent' where required. - - In the value set and its semantics, this type is equivalent - to the Uri SMIv2 textual convention defined in RFC 5017."; - reference - "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax - RFC 3305: Report from the Joint W3C/IETF URI Planning Interest - Group: Uniform Resource Identifiers (URIs), URLs, - and Uniform Resource Names (URNs): Clarifications - and Recommendations - RFC 5017: MIB Textual Conventions for Uniform Resource - Identifiers (URIs)"; - } - - } diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/ietf-yang-types@2010-09-24.yang b/binding/samples/maven-code-gen-sample/src/main/yang/ietf-yang-types@2010-09-24.yang deleted file mode 100644 index 51d9f8b887..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/ietf-yang-types@2010-09-24.yang +++ /dev/null @@ -1,396 +0,0 @@ - module ietf-yang-types { - - namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types"; - prefix "yang"; - - organization - "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; - - contact - "WG Web: - WG List: - - WG Chair: David Partain - - - WG Chair: David Kessens - - - Editor: Juergen Schoenwaelder - "; - - description - "This module contains a collection of generally useful derived - YANG data types. - - Copyright (c) 2010 IETF Trust and the persons identified as - authors of the code. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, is permitted pursuant to, and subject to the license - terms contained in, the Simplified BSD License set forth in Section - 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents - (http://trustee.ietf.org/license-info). - - This version of this YANG module is part of RFC 6021; see - the RFC itself for full legal notices."; - - revision 2010-09-24 { - description - "Initial revision."; - reference - "RFC 6021: Common YANG Data Types"; - } - - /*** collection of counter and gauge types ***/ - - typedef counter32 { - type uint32; - description - "The counter32 type represents a non-negative integer - that monotonically increases until it reaches a - maximum value of 2^32-1 (4294967295 decimal), when it - wraps around and starts increasing again from zero. - - Counters have no defined 'initial' value, and thus, a - single value of a counter has (in general) no information - content. Discontinuities in the monotonically increasing - value normally occur at re-initialization of the - management system, and at other times as specified in the - description of a schema node using this type. If such - other times can occur, for example, the creation of - a schema node of type counter32 at times other than - re-initialization, then a corresponding schema node - should be defined, with an appropriate type, to indicate - the last discontinuity. - - The counter32 type should not be used for configuration - schema nodes. A default statement SHOULD NOT be used in - combination with the type counter32. - - In the value set and its semantics, this type is equivalent - to the Counter32 type of the SMIv2."; - reference - "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; - } - - typedef zero-based-counter32 { - type yang:counter32; - default "0"; - description - "The zero-based-counter32 type represents a counter32 - that has the defined 'initial' value zero. - - A schema node of this type will be set to zero (0) on creation - and will thereafter increase monotonically until it reaches - a maximum value of 2^32-1 (4294967295 decimal), when it - wraps around and starts increasing again from zero. - - Provided that an application discovers a new schema node - of this type within the minimum time to wrap, it can use the - 'initial' value as a delta. It is important for a management - station to be aware of this minimum time and the actual time - between polls, and to discard data if the actual time is too - long or there is no defined minimum time. - - In the value set and its semantics, this type is equivalent - to the ZeroBasedCounter32 textual convention of the SMIv2."; - reference - "RFC 4502: Remote Network Monitoring Management Information - Base Version 2"; - } - - typedef counter64 { - type uint64; - description - "The counter64 type represents a non-negative integer - that monotonically increases until it reaches a - maximum value of 2^64-1 (18446744073709551615 decimal), - when it wraps around and starts increasing again from zero. - - Counters have no defined 'initial' value, and thus, a - single value of a counter has (in general) no information - content. Discontinuities in the monotonically increasing - value normally occur at re-initialization of the - management system, and at other times as specified in the - description of a schema node using this type. If such - other times can occur, for example, the creation of - a schema node of type counter64 at times other than - re-initialization, then a corresponding schema node - should be defined, with an appropriate type, to indicate - the last discontinuity. - - The counter64 type should not be used for configuration - schema nodes. A default statement SHOULD NOT be used in - combination with the type counter64. - - In the value set and its semantics, this type is equivalent - to the Counter64 type of the SMIv2."; - reference - "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; - } - - typedef zero-based-counter64 { - type yang:counter64; - default "0"; - description - "The zero-based-counter64 type represents a counter64 that - has the defined 'initial' value zero. - - A schema node of this type will be set to zero (0) on creation - and will thereafter increase monotonically until it reaches - a maximum value of 2^64-1 (18446744073709551615 decimal), - when it wraps around and starts increasing again from zero. - - Provided that an application discovers a new schema node - of this type within the minimum time to wrap, it can use the - 'initial' value as a delta. It is important for a management - station to be aware of this minimum time and the actual time - between polls, and to discard data if the actual time is too - long or there is no defined minimum time. - - In the value set and its semantics, this type is equivalent - to the ZeroBasedCounter64 textual convention of the SMIv2."; - reference - "RFC 2856: Textual Conventions for Additional High Capacity - Data Types"; - } - - typedef gauge32 { - type uint32; - description - "The gauge32 type represents a non-negative integer, which - may increase or decrease, but shall never exceed a maximum - value, nor fall below a minimum value. The maximum value - cannot be greater than 2^32-1 (4294967295 decimal), and - the minimum value cannot be smaller than 0. The value of - a gauge32 has its maximum value whenever the information - being modeled is greater than or equal to its maximum - value, and has its minimum value whenever the information - being modeled is smaller than or equal to its minimum value. - If the information being modeled subsequently decreases - below (increases above) the maximum (minimum) value, the - gauge32 also decreases (increases). - - In the value set and its semantics, this type is equivalent - to the Gauge32 type of the SMIv2."; - reference - "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; - } - - typedef gauge64 { - type uint64; - description - "The gauge64 type represents a non-negative integer, which - may increase or decrease, but shall never exceed a maximum - value, nor fall below a minimum value. The maximum value - cannot be greater than 2^64-1 (18446744073709551615), and - the minimum value cannot be smaller than 0. The value of - a gauge64 has its maximum value whenever the information - being modeled is greater than or equal to its maximum - value, and has its minimum value whenever the information - being modeled is smaller than or equal to its minimum value. - If the information being modeled subsequently decreases - below (increases above) the maximum (minimum) value, the - gauge64 also decreases (increases). - - In the value set and its semantics, this type is equivalent - to the CounterBasedGauge64 SMIv2 textual convention defined - in RFC 2856"; - reference - "RFC 2856: Textual Conventions for Additional High Capacity - Data Types"; - } - - /*** collection of identifier related types ***/ - - typedef object-identifier { - type string { - pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))' - + '(\.(0|([1-9]\d*)))*'; - } - description - "The object-identifier type represents administratively - assigned names in a registration-hierarchical-name tree. - - Values of this type are denoted as a sequence of numerical - non-negative sub-identifier values. Each sub-identifier - value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers - are separated by single dots and without any intermediate - whitespace. - - The ASN.1 standard restricts the value space of the first - sub-identifier to 0, 1, or 2. Furthermore, the value space - of the second sub-identifier is restricted to the range - 0 to 39 if the first sub-identifier is 0 or 1. Finally, - the ASN.1 standard requires that an object identifier - has always at least two sub-identifier. The pattern - captures these restrictions. - - Although the number of sub-identifiers is not limited, - module designers should realize that there may be - implementations that stick with the SMIv2 limit of 128 - sub-identifiers. - - This type is a superset of the SMIv2 OBJECT IDENTIFIER type - since it is not restricted to 128 sub-identifiers. Hence, - this type SHOULD NOT be used to represent the SMIv2 OBJECT - IDENTIFIER type, the object-identifier-128 type SHOULD be - used instead."; - reference - "ISO9834-1: Information technology -- Open Systems - Interconnection -- Procedures for the operation of OSI - Registration Authorities: General procedures and top - arcs of the ASN.1 Object Identifier tree"; - } - - - - - typedef object-identifier-128 { - type object-identifier { - pattern '\d*(\.\d*){1,127}'; - } - description - "This type represents object-identifiers restricted to 128 - sub-identifiers. - - In the value set and its semantics, this type is equivalent - to the OBJECT IDENTIFIER type of the SMIv2."; - reference - "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; - } - - /*** collection of date and time related types ***/ - - typedef date-and-time { - type string { - pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?' - + '(Z|[\+\-]\d{2}:\d{2})'; - } - description - "The date-and-time type is a profile of the ISO 8601 - standard for representation of dates and times using the - Gregorian calendar. The profile is defined by the - date-time production in Section 5.6 of RFC 3339. - - The date-and-time type is compatible with the dateTime XML - schema type with the following notable exceptions: - - (a) The date-and-time type does not allow negative years. - - (b) The date-and-time time-offset -00:00 indicates an unknown - time zone (see RFC 3339) while -00:00 and +00:00 and Z all - represent the same time zone in dateTime. - - (c) The canonical format (see below) of data-and-time values - differs from the canonical format used by the dateTime XML - schema type, which requires all times to be in UTC using the - time-offset 'Z'. - - This type is not equivalent to the DateAndTime textual - convention of the SMIv2 since RFC 3339 uses a different - separator between full-date and full-time and provides - higher resolution of time-secfrac. - - The canonical format for date-and-time values with a known time - zone uses a numeric time zone offset that is calculated using - the device's configured known offset to UTC time. A change of - the device's offset to UTC time will cause date-and-time values - to change accordingly. Such changes might happen periodically - in case a server follows automatically daylight saving time - (DST) time zone offset changes. The canonical format for - date-and-time values with an unknown time zone (usually referring - to the notion of local time) uses the time-offset -00:00."; - reference - "RFC 3339: Date and Time on the Internet: Timestamps - RFC 2579: Textual Conventions for SMIv2 - XSD-TYPES: XML Schema Part 2: Datatypes Second Edition"; - } - - typedef timeticks { - type uint32; - description - "The timeticks type represents a non-negative integer that - represents the time, modulo 2^32 (4294967296 decimal), in - hundredths of a second between two epochs. When a schema - node is defined that uses this type, the description of - the schema node identifies both of the reference epochs. - - In the value set and its semantics, this type is equivalent - to the TimeTicks type of the SMIv2."; - reference - "RFC 2578: Structure of Management Information Version 2 (SMIv2)"; - } - - typedef timestamp { - type yang:timeticks; - description - "The timestamp type represents the value of an associated - timeticks schema node at which a specific occurrence happened. - The specific occurrence must be defined in the description - of any schema node defined using this type. When the specific - occurrence occurred prior to the last time the associated - timeticks attribute was zero, then the timestamp value is - zero. Note that this requires all timestamp values to be - reset to zero when the value of the associated timeticks - attribute reaches 497+ days and wraps around to zero. - - The associated timeticks schema node must be specified - in the description of any schema node using this type. - - In the value set and its semantics, this type is equivalent - to the TimeStamp textual convention of the SMIv2."; - reference - "RFC 2579: Textual Conventions for SMIv2"; - } - - /*** collection of generic address types ***/ - - typedef phys-address { - type string { - pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?'; - } - description - "Represents media- or physical-level addresses represented - as a sequence octets, each octet represented by two hexadecimal - numbers. Octets are separated by colons. The canonical - representation uses lowercase characters. - - In the value set and its semantics, this type is equivalent - to the PhysAddress textual convention of the SMIv2."; - reference - "RFC 2579: Textual Conventions for SMIv2"; - } - - typedef mac-address { - type string { - pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'; - } - description - "The mac-address type represents an IEEE 802 MAC address. - The canonical representation uses lowercase characters. - - In the value set and its semantics, this type is equivalent - to the MacAddress textual convention of the SMIv2."; - reference - "IEEE 802: IEEE Standard for Local and Metropolitan Area - Networks: Overview and Architecture - RFC 2579: Textual Conventions for SMIv2"; - } - - /*** collection of XML specific types ***/ - - typedef xpath1.0 { - type string; - description - "This type represents an XPATH 1.0 expression. - - When a schema node is defined that uses this type, the - description of the schema node MUST specify the XPath - context in which the XPath expression is evaluated."; - reference - "XPATH: XML Path Language (XPath) Version 1.0"; - } - - } diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/simple-string-demo.yang b/binding/samples/maven-code-gen-sample/src/main/yang/simple-string-demo.yang deleted file mode 100644 index c0f87dd910..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/simple-string-demo.yang +++ /dev/null @@ -1,22 +0,0 @@ -module simple-string-demo { - - namespace "urn:simple:string:demo"; - prefix "sbd"; - - organization "OPEN DAYLIGHT"; - contact "http://www.opendaylight.org/"; - - revision 2013-06-18 { - - } - - typedef typedef-string { - type string { - length "40"; - pattern "[0-9A-F]\.*"; - pattern "[B-D]*"; - pattern "[4-7]*"; - } - } - -} diff --git a/binding/samples/maven-code-gen-sample/src/main/yang/typedef_of_typedef.yang b/binding/samples/maven-code-gen-sample/src/main/yang/typedef_of_typedef.yang deleted file mode 100644 index b8558b3426..0000000000 --- a/binding/samples/maven-code-gen-sample/src/main/yang/typedef_of_typedef.yang +++ /dev/null @@ -1,91 +0,0 @@ -module typedef_typedef { - - namespace "urn:typedef:typedef"; - prefix "sbd"; - - import ietf-inet-types { - prefix "inet"; - revision-date 2010-09-24; - } - - - organization "OPEN DAYLIGHT"; - contact "http://www.opendaylight.org/"; - - revision 2013-07-09 { - - } - - - typedef typedef-from-import { - type inet:ipv4-address; - } - - - typedef byte-type { - type bits { - bit first-bit { - position 10; - } - bit second-bit { - position 20; - } - } - } - - - typedef typedef-enum-fruit { - type enumeration { - enum "apple" { - value 1; - description "gold"; - } - enum "pear" { - value 2; - } - } - } - - typedef simple-typedef1 { - type uint8; - } - - typedef simple-typedef2 { - type simple-typedef1; - } - - typedef simple-typedef3 { - type simple-typedef2; - } - - typedef simple-typedef4 { - type simple-typedef3; - } - - typedef simple-typedef1-1 { - type uint16; - } - - - typedef union-typedef { - type union { - type simple-typedef1; - type simple-typedef4; - type byte-type; - type typedef-enum-fruit; - } - } - - typedef extended-typedef-union { - type union-typedef; - } - - - typedef extended-typedef-simple { - type simple-typedef1; - } - - typedef extended-typedef-enum { - type typedef-enum-fruit; - } -} \ No newline at end of file diff --git a/binding/samples/modeling-sample/pom.xml b/binding/samples/modeling-sample/pom.xml deleted file mode 100644 index d9228c3874..0000000000 --- a/binding/samples/modeling-sample/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - 4.0.0 - - org.opendaylight.mdsal - binding-generator - 0.8.0-SNAPSHOT - - modeling-sample - - - - - org.opendaylight.yangtools - yang-maven-plugin - - - - generate-sources - - - src/main/yang - - - - org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl - - - target/generated-sources/sal - - - - false - - - - - - - org.opendaylight.mdsal - maven-sal-api-gen-plugin - jar - - - - - - - - org.opendaylight.mdsal - yang-binding - - - org.opendaylight.yangtools - yang-common - - - diff --git a/binding/samples/modeling-sample/src/main/yang/toaster.yang b/binding/samples/modeling-sample/src/main/yang/toaster.yang deleted file mode 100644 index fc9b6656c0..0000000000 --- a/binding/samples/modeling-sample/src/main/yang/toaster.yang +++ /dev/null @@ -1,187 +0,0 @@ -module toaster { - - yang-version 1; - - namespace - "http://netconfcentral.org/ns/toaster"; - - prefix toast; - - organization "Netconf Central"; - - contact - "Andy Bierman "; - - description - "YANG version of the TOASTER-MIB."; - - revision "2009-11-20" { - description - "Toaster module in progress."; - } - - - identity toast-type { - description - "Base for all bread types supported by the toaster. - New bread types not listed here nay be added in the - future."; - } - - identity white-bread { - base toast:toast-type; - description "White bread."; - } - - identity wheat-bread { - base toast-type; - description "Wheat bread."; - } - - identity wonder-bread { - base toast-type; - description "Wonder bread."; - } - - identity frozen-waffle { - base toast-type; - description "Frozen waffle."; - } - - identity frozen-bagel { - base toast-type; - description "Frozen bagel."; - } - - identity hash-brown { - base toast-type; - description "Hash browned potatos."; - } - - typedef DisplayString { - type string; - description - "YANG version of the SMIv2 DisplayString TEXTUAL-CONVENTION."; - reference - "RFC 2579, section 2."; - - } - - container toaster { - presence - "Indicates the toaster service is available"; - description - "Top-level container for all toaster database objects."; - leaf toasterManufacturer { - type DisplayString; - config false; - mandatory true; - description - "The name of the toaster's manufacturer. For instance, - Microsoft Toaster."; - } - - leaf toasterModelNumber { - type DisplayString; - config false; - mandatory true; - description - "The name of the toaster's model. For instance, - Radiant Automatic."; - } - - leaf toasterStatus { - type enumeration { - enum "up" { - value 1; - description - "The toaster knob position is up. - No toast is being made now."; - } - enum "down" { - value 2; - description - "The toaster knob position is down. - Toast is being made now."; - } - } - config false; - mandatory true; - description - "This variable indicates the current state of - the toaster."; - } - } // container toaster - - rpc make-toast { - description - "Make some toast. - The toastDone notification will be sent when - the toast is finished. - An 'in-use' error will be returned if toast - is already being made. - A 'resource-denied' error will be returned - if the toaster service is disabled."; - input { - leaf toasterDoneness { - type uint32 { - range "1 .. 10"; - } - default '5'; - description - "This variable controls how well-done is the - ensuing toast. It should be on a scale of 1 to 10. - Toast made at 10 generally is considered unfit - for human consumption; toast made at 1 is warmed - lightly."; - } - - leaf toasterToastType { - type identityref { - base toast:toast-type; - } - default 'wheat-bread'; - description - "This variable informs the toaster of the type of - material that is being toasted. The toaster - uses this information, combined with - toasterDoneness, to compute for how - long the material must be toasted to achieve - the required doneness."; - } - } - } // rpc make-toast - - rpc cancel-toast { - description - "Stop making toast, if any is being made. - A 'resource-denied' error will be returned - if the toaster service is disabled."; - } // rpc cancel-toast - - notification toastDone { - description - "Indicates that the toast in progress has completed."; - leaf toastStatus { - type enumeration { - enum "done" { - value 0; - description "The toast is done."; - } - enum "cancelled" { - value 1; - description - "The toast was cancelled."; - } - enum "error" { - value 2; - description - "The toaster service was disabled or - the toaster is broken."; - } - } - description - "Indicates the final toast status"; - } - } // notification toastDone - } // module toaster diff --git a/common/sal-common-impl/pom.xml b/common/sal-common-impl/pom.xml deleted file mode 100644 index 1d9745cbf8..0000000000 --- a/common/sal-common-impl/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - sal-parent - 1.3.0-SNAPSHOT - - sal-common-impl - bundle - - - - com.google.guava - guava - - - org.opendaylight.controller - sal-common-api - - - org.opendaylight.controller - sal-common-util - - - org.opendaylight.yangtools - yang-data-impl - - - org.opendaylight.yangtools - yang-model-api - - - junit - junit - test - - - org.mockito - mockito-all - test - - - org.opendaylight.yangtools - yang-parser-impl - test - - - - - - - org.apache.felix - maven-bundle-plugin - - - org.opendaylight.controller.md.sal.common.impl, - org.opendaylight.controller.md.sal.common.impl.* - - - - - - - scm:git:http://git.opendaylight.org/gerrit/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - - - diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java deleted file mode 100644 index f337b5509e..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Collections; -import java.util.EventListener; -import java.util.HashSet; -import java.util.Set; - -import org.opendaylight.yangtools.concepts.AbstractObjectRegistration; -import org.opendaylight.yangtools.concepts.ListenerRegistration; - -public class ListenerRegistry { - - final Set> listeners; - final Set> unmodifiableView; - - public ListenerRegistry() { - listeners = new HashSet<>(); - unmodifiableView = Collections.unmodifiableSet(listeners); - } - - public Iterable> getListeners() { - return unmodifiableView; - } - - - public ListenerRegistration register(T listener) { - checkNotNull(listener, "Listener should not be null."); - ListenerRegistrationImpl ret = new ListenerRegistrationImpl(listener); - listeners.add(ret); - return ret; - } - - - @SuppressWarnings("rawtypes") - private void remove(ListenerRegistrationImpl registration) { - listeners.remove(registration); - } - - private class ListenerRegistrationImpl

// - extends AbstractObjectRegistration

// - implements ListenerRegistration

{ - - public ListenerRegistrationImpl(P instance) { - super(instance); - } - - @Override - protected void removeRegistration() { - ListenerRegistry.this.remove(this); - } - } -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java deleted file mode 100644 index 0672ba2b6d..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.routing; - -import java.util.Map; -import java.util.Set; - -import org.opendaylight.controller.md.sal.common.api.routing.RouteChange; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -public class RoutingUtils { - - public static RouteChange removalChange(C context,P path) { - final ImmutableMap> announcements = ImmutableMap.>of(); - final ImmutableMap> removals = ImmutableMap.>of(context, ImmutableSet.of(path)); - return new RouteChangeImpl(announcements, removals); - } - - public static RouteChange announcementChange(C context,P path) { - final ImmutableMap> announcements = ImmutableMap.>of(context, ImmutableSet.of(path)); - final ImmutableMap> removals = ImmutableMap.>of(); - return new RouteChangeImpl(announcements, removals); - } - - - public static RouteChange change(Map> announcements, - Map> removals) { - final ImmutableMap> immutableAnnouncements = ImmutableMap.>copyOf(announcements); - final ImmutableMap> immutableRemovals = ImmutableMap.>copyOf(removals); - return new RouteChangeImpl(immutableAnnouncements, immutableRemovals); - } - - - private static class RouteChangeImpl implements RouteChange { - private final Map> removal; - private final Map> announcement; - - public RouteChangeImpl(ImmutableMap> announcement, ImmutableMap> removal) { - super(); - this.removal = removal; - this.announcement = announcement; - } - - @Override - public Map> getAnnouncements() { - return announcement; - } - - @Override - public Map> getRemovals() { - return removal; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((announcement == null) ? 0 : announcement.hashCode()); - result = prime * result + ((removal == null) ? 0 : removal.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - RouteChangeImpl other = (RouteChangeImpl) obj; - if (announcement == null) { - if (other.announcement != null) { - return false; - } - } else if (!announcement.equals(other.announcement)) { - return false; - } - if (removal == null) { - if (other.removal != null) { - return false; - } - } else if (!removal.equals(other.removal)) { - return false; - } - return true; - } - } - - - -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java deleted file mode 100644 index f83a77829b..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.service; - -import com.google.common.util.concurrent.AsyncFunction; -import com.google.common.util.concurrent.CheckedFuture; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import org.opendaylight.controller.md.sal.common.api.TransactionStatus; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.yangtools.yang.common.RpcResult; -import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Deprecated -public abstract class AbstractDataTransaction { - private static final Logger LOG = LoggerFactory.getLogger(AbstractDataTransaction.class); - private static final ListenableFuture> SUCCESS_FUTURE = - Futures.immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED).build()); - - public static ListenableFuture> convertToLegacyCommitFuture(final CheckedFuture from) { - return Futures.transform(from, new AsyncFunction>() { - @Override - public ListenableFuture> apply(final Void input) { - return SUCCESS_FUTURE; - } - }); - } -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java deleted file mode 100644 index 4d756f1d67..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.util; - -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import org.opendaylight.yangtools.concepts.Delegator; - -import com.google.common.base.Preconditions; - -public class AbstractLockableDelegator implements Delegator { - - private final ReentrantReadWriteLock delegateLock = new ReentrantReadWriteLock(); - private final ReadLock delegateReadLock = delegateLock.readLock(); - private final WriteLock delegateWriteLock = delegateLock.writeLock(); - - - protected Lock getDelegateReadLock() { - return delegateReadLock; - } - - private T delegate; - - public AbstractLockableDelegator() { - // NOOP - } - - public AbstractLockableDelegator(T initialDelegate) { - delegate = initialDelegate; - } - - @Override - public T getDelegate() { - try { - delegateReadLock.lock(); - return delegate; - } finally { - delegateReadLock.unlock(); - } - } - - public T retrieveDelegate() { - try { - delegateReadLock.lock(); - Preconditions.checkState(delegate != null,"Delegate is null"); - return delegate; - } finally { - delegateReadLock.unlock(); - } - } - - /** - * - * @param newDelegate - * @return oldDelegate - */ - public final T changeDelegate(T newDelegate) { - try { - delegateWriteLock.lock(); - T oldDelegate = delegate; - delegate = newDelegate; - onDelegateChanged(oldDelegate, newDelegate); - return oldDelegate; - } finally { - delegateWriteLock.unlock(); - } - } - - - protected void onDelegateChanged(T oldDelegate, T newDelegate) { - // NOOP in abstract calss; - } -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationException.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationException.java deleted file mode 100644 index daecfdb59b..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationException.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.util.compat; - -public class DataNormalizationException extends Exception { - private static final long serialVersionUID = 1L; - - public DataNormalizationException(String message) { - super(message); - } - - public DataNormalizationException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java deleted file mode 100644 index d75f438144..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java +++ /dev/null @@ -1,643 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.util.compat; - -import com.google.common.base.Optional; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import org.opendaylight.yangtools.concepts.Identifiable; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; -import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.impl.schema.Builders; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder; -import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; -import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; -import org.opendaylight.yangtools.yang.model.api.AugmentationTarget; -import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; -import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; -import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; -import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; -import org.opendaylight.yangtools.yang.model.api.ListSchemaNode; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.model.api.SchemaNode; -import org.opendaylight.yangtools.yang.model.util.EffectiveAugmentationSchema; - -@Deprecated -public abstract class DataNormalizationOperation implements Identifiable { - - private final T identifier; - private final Optional dataSchemaNode; - - @Override - public T getIdentifier() { - return identifier; - }; - - protected DataNormalizationOperation(final T identifier, final SchemaNode schema) { - super(); - this.identifier = identifier; - if(schema instanceof DataSchemaNode) { - this.dataSchemaNode = Optional.of((DataSchemaNode) schema); - } else { - this.dataSchemaNode = Optional.absent(); - } - } - - public boolean isMixin() { - return false; - } - - - public boolean isKeyedEntry() { - return false; - } - - protected Set getQNameIdentifiers() { - return Collections.singleton(identifier.getNodeType()); - } - - public abstract DataNormalizationOperation getChild(final PathArgument child) throws DataNormalizationException; - - public abstract DataNormalizationOperation getChild(QName child) throws DataNormalizationException; - - - public abstract boolean isLeaf(); - - public Optional getDataSchemaNode() { - // FIXME - return dataSchemaNode; - } - - private static abstract class SimpleTypeNormalization extends DataNormalizationOperation { - - protected SimpleTypeNormalization(final T identifier, final DataSchemaNode potential) { - super(identifier,potential); - } - - @Override - public DataNormalizationOperation getChild(final PathArgument child) { - return null; - } - - @Override - public DataNormalizationOperation getChild(final QName child) { - return null; - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return null; - } - - @Override - public boolean isLeaf() { - return true; - } - - } - - private static final class LeafNormalization extends SimpleTypeNormalization { - - protected LeafNormalization(final LeafSchemaNode potential) { - super(new NodeIdentifier(potential.getQName()),potential); - } - - } - - private static final class LeafListEntryNormalization extends SimpleTypeNormalization { - - public LeafListEntryNormalization(final LeafListSchemaNode potential) { - super(new NodeWithValue(potential.getQName(), null),potential); - } - - @Override - public boolean isKeyedEntry() { - return true; - } - } - - private static abstract class CompositeNodeNormalizationOperation extends - DataNormalizationOperation { - - protected CompositeNodeNormalizationOperation(final T identifier, final DataSchemaNode schema) { - super(identifier,schema); - } - - @Override - public boolean isLeaf() { - return false; - } - - - } - - private static abstract class DataContainerNormalizationOperation extends - CompositeNodeNormalizationOperation { - - private final DataNodeContainer schema; - private final Map> byQName; - private final Map> byArg; - - protected DataContainerNormalizationOperation(final T identifier, final DataNodeContainer schema, final DataSchemaNode node) { - super(identifier,node); - this.schema = schema; - this.byArg = new ConcurrentHashMap<>(); - this.byQName = new ConcurrentHashMap<>(); - } - - @Override - public DataNormalizationOperation getChild(final PathArgument child) throws DataNormalizationException { - DataNormalizationOperation potential = byArg.get(child); - if (potential != null) { - return potential; - } - potential = fromLocalSchema(child); - return register(potential); - } - - private DataNormalizationOperation fromLocalSchema(final PathArgument child) throws DataNormalizationException { - if (child instanceof AugmentationIdentifier) { - return fromSchemaAndQNameChecked(schema, ((AugmentationIdentifier) child).getPossibleChildNames() - .iterator().next()); - } - return fromSchemaAndQNameChecked(schema, child.getNodeType()); - } - - @Override - public DataNormalizationOperation getChild(final QName child) throws DataNormalizationException { - DataNormalizationOperation potential = byQName.get(child); - if (potential != null) { - return potential; - } - potential = fromLocalSchemaAndQName(schema, child); - return register(potential); - } - - protected DataNormalizationOperation fromLocalSchemaAndQName(final DataNodeContainer schema2, final QName child) throws DataNormalizationException { - return fromSchemaAndQNameChecked(schema2, child); - } - - private DataNormalizationOperation register(final DataNormalizationOperation potential) { - if (potential != null) { - byArg.put(potential.getIdentifier(), potential); - for (final QName qName : potential.getQNameIdentifiers()) { - byQName.put(qName, potential); - } - } - return potential; - } - - } - - private static final class ListItemNormalization extends - DataContainerNormalizationOperation { - - private final List keyDefinition; - - protected ListItemNormalization(final NodeIdentifierWithPredicates identifier, final ListSchemaNode schema) { - super(identifier, schema,schema); - keyDefinition = schema.getKeyDefinition(); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - final DataContainerNodeAttrBuilder builder = Builders - .mapEntryBuilder().withNodeIdentifier((NodeIdentifierWithPredicates) currentArg); - for (final Entry keyValue : ((NodeIdentifierWithPredicates) currentArg).getKeyValues().entrySet()) { - builder.addChild(Builders.leafBuilder() - // - .withNodeIdentifier(new NodeIdentifier(keyValue.getKey())).withValue(keyValue.getValue()) - .build()); - } - return builder.build(); - } - - - @Override - public boolean isKeyedEntry() { - return true; - } - } - - private static final class UnkeyedListItemNormalization extends DataContainerNormalizationOperation { - - protected UnkeyedListItemNormalization(final ListSchemaNode schema) { - super(new NodeIdentifier(schema.getQName()), schema,schema); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.unkeyedListEntryBuilder().withNodeIdentifier((NodeIdentifier) currentArg).build(); - } - - } - - private static final class ContainerNormalization extends DataContainerNormalizationOperation { - - protected ContainerNormalization(final ContainerSchemaNode schema) { - super(new NodeIdentifier(schema.getQName()),schema, schema); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.containerBuilder().withNodeIdentifier((NodeIdentifier) currentArg).build(); - } - - } - - private static abstract class MixinNormalizationOp extends - CompositeNodeNormalizationOperation { - - protected MixinNormalizationOp(final T identifier, final DataSchemaNode schema) { - super(identifier,schema); - } - - @Override - public final boolean isMixin() { - return true; - } - - } - - - private static final class OrderedLeafListMixinNormalization extends UnorderedLeafListMixinNormalization { - - - public OrderedLeafListMixinNormalization(final LeafListSchemaNode potential) { - super(potential); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.orderedLeafSetBuilder().withNodeIdentifier(getIdentifier()).build(); - } - } - - private static class UnorderedLeafListMixinNormalization extends MixinNormalizationOp { - - private final DataNormalizationOperation innerOp; - - public UnorderedLeafListMixinNormalization(final LeafListSchemaNode potential) { - super(new NodeIdentifier(potential.getQName()),potential); - innerOp = new LeafListEntryNormalization(potential); - } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier()).build(); - } - - @Override - public DataNormalizationOperation getChild(final PathArgument child) { - if (child instanceof NodeWithValue) { - return innerOp; - } - return null; - } - - @Override - public DataNormalizationOperation getChild(final QName child) { - if (getIdentifier().getNodeType().equals(child)) { - return innerOp; - } - return null; - } - } - - private static final class AugmentationNormalization extends DataContainerNormalizationOperation { - - public AugmentationNormalization(final AugmentationSchema augmentation, final DataNodeContainer schema) { - //super(); - super(augmentationIdentifierFrom(augmentation), augmentationProxy(augmentation,schema),null); - } - - @Override - public boolean isMixin() { - return true; - } - - - - @Override - protected DataNormalizationOperation fromLocalSchemaAndQName(final DataNodeContainer schema, final QName child) - throws DataNormalizationException { - final Optional potential = findChildSchemaNode(schema, child); - if (!potential.isPresent()) { - return null; - } - - final DataSchemaNode result = potential.get(); - // We try to look up if this node was added by augmentation - if ((schema instanceof DataSchemaNode) && result.isAugmenting()) { - return fromAugmentation(schema, (AugmentationTarget) schema, result); - } - return fromDataSchemaNode(result); - } - - @Override - protected Set getQNameIdentifiers() { - return getIdentifier().getPossibleChildNames(); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.augmentationBuilder().withNodeIdentifier(getIdentifier()).build(); - } - - } - - private static class UnorderedMapMixinNormalization extends MixinNormalizationOp { - - private final ListItemNormalization innerNode; - - public UnorderedMapMixinNormalization(final ListSchemaNode list) { - super(new NodeIdentifier(list.getQName()),list); - this.innerNode = new ListItemNormalization(new NodeIdentifierWithPredicates(list.getQName(), - Collections. emptyMap()), list); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.mapBuilder().withNodeIdentifier(getIdentifier()).build(); - } - - @Override - public DataNormalizationOperation getChild(final PathArgument child) { - if (child.getNodeType().equals(getIdentifier().getNodeType())) { - return innerNode; - } - return null; - } - - @Override - public DataNormalizationOperation getChild(final QName child) { - if (getIdentifier().getNodeType().equals(child)) { - return innerNode; - } - return null; - } - - } - - - private static class UnkeyedListMixinNormalization extends MixinNormalizationOp { - - private final UnkeyedListItemNormalization innerNode; - - public UnkeyedListMixinNormalization(final ListSchemaNode list) { - super(new NodeIdentifier(list.getQName()),list); - this.innerNode = new UnkeyedListItemNormalization(list); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.unkeyedListBuilder().withNodeIdentifier(getIdentifier()).build(); - } - - @Override - public DataNormalizationOperation getChild(final PathArgument child) { - if (child.getNodeType().equals(getIdentifier().getNodeType())) { - return innerNode; - } - return null; - } - - @Override - public DataNormalizationOperation getChild(final QName child) { - if (getIdentifier().getNodeType().equals(child)) { - return innerNode; - } - return null; - } - - } - - private static final class OrderedMapMixinNormalization extends UnorderedMapMixinNormalization { - - public OrderedMapMixinNormalization(final ListSchemaNode list) { - super(list); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.orderedMapBuilder().withNodeIdentifier(getIdentifier()).build(); - } - - } - - private static class ChoiceNodeNormalization extends MixinNormalizationOp { - - private final ImmutableMap> byQName; - private final ImmutableMap> byArg; - - protected ChoiceNodeNormalization(final ChoiceSchemaNode schema) { - super(new NodeIdentifier(schema.getQName()),schema); - final ImmutableMap.Builder> byQNameBuilder = ImmutableMap.builder(); - final ImmutableMap.Builder> byArgBuilder = ImmutableMap.builder(); - - for (final ChoiceCaseNode caze : schema.getCases()) { - for (final DataSchemaNode cazeChild : caze.getChildNodes()) { - final DataNormalizationOperation childOp = fromDataSchemaNode(cazeChild); - byArgBuilder.put(childOp.getIdentifier(), childOp); - for (final QName qname : childOp.getQNameIdentifiers()) { - byQNameBuilder.put(qname, childOp); - } - } - } - byQName = byQNameBuilder.build(); - byArg = byArgBuilder.build(); - } - - @Override - public DataNormalizationOperation getChild(final PathArgument child) { - return byArg.get(child); - } - - @Override - public DataNormalizationOperation getChild(final QName child) { - return byQName.get(child); - } - - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.choiceBuilder().withNodeIdentifier(getIdentifier()).build(); - } - } - - private static class AnyXmlNormalization extends DataNormalizationOperation { - - protected AnyXmlNormalization( final AnyXmlSchemaNode schema) { - super( new NodeIdentifier(schema.getQName()), schema); - } - - @Override - public DataNormalizationOperation getChild( final PathArgument child ) throws DataNormalizationException { - return null; - } - - @Override - public DataNormalizationOperation getChild( final QName child ) throws DataNormalizationException { - return null; - } - - @Override - public boolean isLeaf() { - return false; - } - - @Override - public NormalizedNode createDefault( final PathArgument currentArg ) { - return null; - } - } - - private static final Optional findChildSchemaNode(final DataNodeContainer parent,final QName child) { - DataSchemaNode potential = parent.getDataChildByName(child); - if (potential == null) { - final Iterable choices = FluentIterable.from(parent.getChildNodes()).filter(ChoiceSchemaNode.class); - potential = findChoice(choices, child); - } - return Optional.fromNullable(potential); - } - - private static DataNormalizationOperation fromSchemaAndQNameChecked(final DataNodeContainer schema, - final QName child) throws DataNormalizationException { - - final Optional potential = findChildSchemaNode(schema, child); - if (!potential.isPresent()) { - throw new DataNormalizationException(String.format("Supplied QName %s is not valid according to schema %s, potential children nodes: %s", child, schema,schema.getChildNodes())); - } - - final DataSchemaNode result = potential.get(); - // We try to look up if this node was added by augmentation - if ((schema instanceof DataSchemaNode) && result.isAugmenting()) { - return fromAugmentation(schema, (AugmentationTarget) schema, result); - } - return fromDataSchemaNode(result); - } - - private static ChoiceSchemaNode findChoice(final Iterable choices, final QName child) { - ChoiceSchemaNode foundChoice = null; - choiceLoop: for (final ChoiceSchemaNode choice : choices) { - for (final ChoiceCaseNode caze : choice.getCases()) { - if (findChildSchemaNode(caze, child).isPresent()) { - foundChoice = choice; - break choiceLoop; - } - } - } - return foundChoice; - } - - public static AugmentationIdentifier augmentationIdentifierFrom(final AugmentationSchema augmentation) { - final ImmutableSet.Builder potentialChildren = ImmutableSet.builder(); - for (final DataSchemaNode child : augmentation.getChildNodes()) { - potentialChildren.add(child.getQName()); - } - return new AugmentationIdentifier(potentialChildren.build()); - } - - private static DataNodeContainer augmentationProxy(final AugmentationSchema augmentation, final DataNodeContainer schema) { - final Set children = new HashSet<>(); - for (final DataSchemaNode augNode : augmentation.getChildNodes()) { - children.add(schema.getDataChildByName(augNode.getQName())); - } - return new EffectiveAugmentationSchema(augmentation, children); - } - - /** - * Returns a DataNormalizationOperation for provided child node - * - * If supplied child is added by Augmentation this operation returns - * a DataNormalizationOperation for augmentation, - * otherwise returns a DataNormalizationOperation for child as - * call for {@link #fromDataSchemaNode(DataSchemaNode)}. - * - * - * @param parent - * @param parentAug - * @param child - * @return - */ - private static DataNormalizationOperation fromAugmentation(final DataNodeContainer parent, - final AugmentationTarget parentAug, final DataSchemaNode child) { - AugmentationSchema augmentation = null; - for (final AugmentationSchema aug : parentAug.getAvailableAugmentations()) { - final DataSchemaNode potential = aug.getDataChildByName(child.getQName()); - if (potential != null) { - augmentation = aug; - break; - } - - } - if (augmentation != null) { - return new AugmentationNormalization(augmentation, parent); - } else { - return fromDataSchemaNode(child); - } - } - - public static DataNormalizationOperation fromDataSchemaNode(final DataSchemaNode potential) { - if (potential instanceof ContainerSchemaNode) { - return new ContainerNormalization((ContainerSchemaNode) potential); - } else if (potential instanceof ListSchemaNode) { - - return fromListSchemaNode((ListSchemaNode) potential); - } else if (potential instanceof LeafSchemaNode) { - return new LeafNormalization((LeafSchemaNode) potential); - } else if (potential instanceof ChoiceSchemaNode) { - return new ChoiceNodeNormalization((ChoiceSchemaNode) potential); - } else if (potential instanceof LeafListSchemaNode) { - return fromLeafListSchemaNode((LeafListSchemaNode) potential); - } else if (potential instanceof AnyXmlSchemaNode) { - return new AnyXmlNormalization( (AnyXmlSchemaNode) potential); - } - return null; - } - - private static DataNormalizationOperation fromListSchemaNode(final ListSchemaNode potential) { - final List keyDefinition = potential.getKeyDefinition(); - if(keyDefinition == null || keyDefinition.isEmpty()) { - return new UnkeyedListMixinNormalization(potential); - } - if(potential.isUserOrdered()) { - return new OrderedMapMixinNormalization(potential); - } - return new UnorderedMapMixinNormalization(potential); - } - - private static DataNormalizationOperation fromLeafListSchemaNode(final LeafListSchemaNode potential) { - if(potential.isUserOrdered()) { - return new OrderedLeafListMixinNormalization(potential); - } - return new UnorderedLeafListMixinNormalization(potential); - } - - - public static DataNormalizationOperation from(final SchemaContext ctx) { - return new ContainerNormalization(ctx); - } - - public abstract NormalizedNode createDefault(PathArgument currentArg); -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java deleted file mode 100644 index 9876a57d1a..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.util.compat; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.google.common.collect.ImmutableList; -import java.util.Iterator; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; - -/** - * @deprecated This class provides compatibility between XML semantics - * and {@link org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree} - */ -@Deprecated -public class DataNormalizer { - - private final DataNormalizationOperation operation; - - public DataNormalizer(final SchemaContext ctx) { - operation = DataNormalizationOperation.from(ctx); - } - - public YangInstanceIdentifier toNormalized(final YangInstanceIdentifier legacy) { - ImmutableList.Builder normalizedArgs = ImmutableList.builder(); - - DataNormalizationOperation currentOp = operation; - Iterator arguments = legacy.getPathArguments().iterator(); - - try { - while (arguments.hasNext()) { - PathArgument legacyArg = arguments.next(); - currentOp = currentOp.getChild(legacyArg); - checkArgument(currentOp != null, - "Legacy Instance Identifier %s is not correct. Normalized Instance Identifier so far %s", - legacy, normalizedArgs.build()); - while (currentOp.isMixin()) { - normalizedArgs.add(currentOp.getIdentifier()); - currentOp = currentOp.getChild(legacyArg.getNodeType()); - } - normalizedArgs.add(legacyArg); - } - } catch (DataNormalizationException e) { - throw new IllegalArgumentException(String.format("Failed to normalize path %s", legacy), e); - } - - return YangInstanceIdentifier.create(normalizedArgs.build()); - } - - public DataNormalizationOperation getOperation(final YangInstanceIdentifier legacy) throws DataNormalizationException { - DataNormalizationOperation currentOp = operation; - Iterator arguments = legacy.getPathArguments().iterator(); - - while (arguments.hasNext()) { - currentOp = currentOp.getChild(arguments.next()); - } - return currentOp; - } - - public YangInstanceIdentifier toLegacy(final YangInstanceIdentifier normalized) throws DataNormalizationException { - ImmutableList.Builder legacyArgs = ImmutableList.builder(); - DataNormalizationOperation currentOp = operation; - for (PathArgument normalizedArg : normalized.getPathArguments()) { - currentOp = currentOp.getChild(normalizedArg); - if (!currentOp.isMixin()) { - legacyArgs.add(normalizedArg); - } - } - return YangInstanceIdentifier.create(legacyArgs.build()); - } - - public DataNormalizationOperation getRootOperation() { - return operation; - } - -} diff --git a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataSchemaContainerProxy.java b/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataSchemaContainerProxy.java deleted file mode 100644 index d243c888bd..0000000000 --- a/common/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataSchemaContainerProxy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.common.impl.util.compat; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; -import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -import org.opendaylight.yangtools.yang.model.api.UsesNode; - -class DataSchemaContainerProxy implements DataNodeContainer { - - private final Set realChildSchemas; - private final Map mappedChildSchemas; - - public DataSchemaContainerProxy(final Set realChildSchema) { - realChildSchemas = realChildSchema; - mappedChildSchemas = new HashMap(); - for(DataSchemaNode schema : realChildSchemas) { - mappedChildSchemas.put(schema.getQName(),schema); - } - } - - @Override - public DataSchemaNode getDataChildByName(final QName name) { - return mappedChildSchemas.get(name); - } - - @Override - public Set getChildNodes() { - return realChildSchemas; - } - - @Override - public DataSchemaNode getDataChildByName(final String arg0) { - throw new UnsupportedOperationException(); - } - - @Override - public Set getGroupings() { - return Collections.emptySet(); - } - - @Override - public Set> getTypeDefinitions() { - return Collections.emptySet(); - } - - @Override - public Set getUses() { - return Collections.emptySet(); - } - -} diff --git a/common/sal-common-impl/src/test/resources/normalization-test.yang b/common/sal-common-impl/src/test/resources/normalization-test.yang deleted file mode 100644 index 6df5306850..0000000000 --- a/common/sal-common-impl/src/test/resources/normalization-test.yang +++ /dev/null @@ -1,74 +0,0 @@ -module normalization-test { - yang-version 1; - namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:normalization:test"; - prefix "norm-test"; - - revision "2014-03-13" { - description "Initial revision."; - } - - grouping outer-grouping { - } - - container test { - list outer-list { - key id; - leaf id { - type uint16; - } - choice outer-choice { - case one { - leaf one { - type string; - } - } - case two-three { - leaf two { - type string; - } - leaf three { - type string; - } - } - } - list inner-list { - key name; - ordered-by user; - - leaf name { - type string; - } - leaf value { - type string; - } - } - } - - list unkeyed-list { - leaf name { - type string; - } - } - - leaf-list unordered-leaf-list { - type string; - } - - leaf-list ordered-leaf-list { - ordered-by user; - type string; - } - - container outer-container { - } - - anyxml any-xml-data; - } - - augment /norm-test:test/norm-test:outer-container { - - leaf augmented-leaf { - type string; - } - } -} \ No newline at end of file