blob: 5e5701287f14e61b55e9d20ac93644405091cce0 [file] [log] [blame]
Shankara-Huaweidf7b9ca2016-07-14 11:35:34 +05301/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.yangutils.datamodel;
17
18import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
19import org.onosproject.yangutils.datamodel.utils.Parsable;
20import org.onosproject.yangutils.datamodel.utils.YangConstructType;
21
22import java.io.Serializable;
23
24/*-
25 * Reference RFC 6020.
26 *
27 * The "identity" statement is used to define a new globally unique,
28 * abstract, and untyped identity. Its only purpose is to denote its
29 * name, semantics, and existence. An identity can either be defined
30 * from scratch or derived from a base identity. The identity's
31 * argument is an identifier that is the name of the identity. It is
32 * followed by a block of substatements that holds detailed identity
33 * information.
34 *
35 * The identity's Substatements
36 *
37 * +--------------+---------+-------------+-----------------------+
38 * | substatement | section | cardinality | data model mapping |
39 * +--------------+---------+-------------+-----------------------+
40 * | base | 7.16.2 | 0..1 | -YangNodeIdentifier |
41 * | description | 7.19.3 | 0..1 | -string |
42 * | reference | 7.19.4 | 0..1 | -string |
43 * | status | 7.19.2 | 0..1 | -YangStatus |
44 * +--------------+---------+-------------+-----------------------+
45 */
46
47/**
48 * Represents data model node to maintain information defined in YANG identity.
49 */
50public class YangIdentity extends YangNode implements YangCommonInfo, Parsable, Serializable {
51
52 private static final long serialVersionUID = 806201691L;
53
54 //Name of the identity.
55 private String name;
56
57 //Base node of identity.
58 private YangBase baseNode;
59
60 //Status of YANG identity.
61 private YangStatusType status;
62
63 //Description of YANG identity.
64 private String description;
65
66 //YANG reference of the identity.
67 private String reference;
68
69 //Creates a identity type of node.
70 public YangIdentity() {
71 super(YangNodeType.IDENTITY_NODE);
72 }
73
74 /**
75 * Returns the name of identity.
76 *
77 * @return the identity name
78 */
79 public String getName() {
80 return name;
81 }
82
83 /**
84 * Sets the name of identity.
85 *
86 * @param name the identity name to set
87 */
88 public void setName(String name) {
89 this.name = name;
90 }
91
92 @Override
93 public YangStatusType getStatus() {
94 return status;
95 }
96
97 @Override
98 public void setStatus(YangStatusType status) {
99 this.status = status;
100 }
101
102 @Override
103 public String getDescription() {
104 return description;
105 }
106
107 @Override
108 public void setDescription(String description) {
109 this.description = description;
110 }
111
112 @Override
113 public String getReference() {
114 return reference;
115 }
116
117 @Override
118 public void setReference(String reference) {
119 this.reference = reference;
120 }
121
122 @Override
123 public YangConstructType getYangConstructType() {
124 return YangConstructType.IDENTITY_DATA;
125 }
126
127 @Override
128 public void validateDataOnEntry() throws DataModelException {
129 }
130
131 @Override
132 public void validateDataOnExit() throws DataModelException {
133 }
134
135 /**
136 * Returns base node of identity.
137 *
138 * @return the base node of identity
139 */
140 public YangBase getBaseNode() {
141 return baseNode;
142 }
143
144 /**
145 * Sets the base node.
146 *
147 * @param baseNode the base node to set
148 */
149 public void setBaseNode(YangBase baseNode) {
150 this.baseNode = baseNode;
151 }
152}