blob: 4892613432b59bd2f46d344b0029ba78d6371512 [file] [log] [blame]
Vinod Kumar S19f39c72016-02-09 20:12:31 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S19f39c72016-02-09 20:12:31 +05303 *
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.parser.Parsable;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053020import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S19f39c72016-02-09 20:12:31 +053021
22/*
23 * Reference:RFC 6020.
24 * The "include" statement is used to make content from a submodule
25 * available to that submodule's parent module, or to another submodule
26 * of that parent module. The argument is an identifier that is the
27 * name of the submodule to include.
28 * The includes's Substatements
29 *
30 * +---------------+---------+-------------+------------------+
31 * | substatement | section | cardinality |data model mapping|
32 * +---------------+---------+-------------+------------------+
33 * | revision-date | 7.1.5.1 | 0..1 | string |
34 * +---------------+---------+-------------+------------------+
35 */
Vinod Kumar Sd4deb062016-04-15 18:08:57 +053036
Vinod Kumar S19f39c72016-02-09 20:12:31 +053037/**
Bharat saraswald9822e92016-04-05 15:13:44 +053038 * Represents the information about the included sub-modules.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053039 */
Vinod Kumar Sd4deb062016-04-15 18:08:57 +053040public class YangInclude
41 implements Parsable {
Vinod Kumar S19f39c72016-02-09 20:12:31 +053042
43 /**
44 * Name of the sub-module that is being included.
45 */
46 private String subModuleName;
47
48 /**
49 * The include's "revision-date" statement is used to specify the exact
50 * version of the submodule to import.
51 */
52 private String revision;
53
54 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053055 * Creates a YANG include.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053056 */
57 public YangInclude() {
58 }
59
60 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053061 * Returns the name of included sub-module.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053062 *
63 * @return the sub-module name
64 */
65 public String getSubModuleName() {
66 return subModuleName;
67 }
68
69 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053070 * Sets the name of included sub-modules.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053071 *
72 * @param subModuleName the sub-module name to set
73 */
74 public void setSubModuleName(String subModuleName) {
75 this.subModuleName = subModuleName;
76 }
77
78 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053079 * Returns the revision.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053080 *
81 * @return the revision
82 */
83 public String getRevision() {
84 return revision;
85 }
86
87 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053088 * Sets the revision.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053089 *
90 * @param revision the revision to set
91 */
92 public void setRevision(String revision) {
93 this.revision = revision;
94 }
95
96 /**
97 * Returns the type of parsed data.
98 *
99 * @return returns INCLUDE_DATA
100 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530101 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530102 public YangConstructType getYangConstructType() {
103 return YangConstructType.INCLUDE_DATA;
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530104 }
105
106 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530107 * Validates the data on entering the corresponding parse tree node.
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530108 *
109 * @throws DataModelException a violation of data model rules
110 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530111 @Override
Vinod Kumar Sd4deb062016-04-15 18:08:57 +0530112 public void validateDataOnEntry()
113 throws DataModelException {
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530114 // TODO auto-generated method stub, to be implemented by parser
115
116 }
117
118 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530119 * Validates the data on exiting the corresponding parse tree node.
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530120 *
121 * @throws DataModelException a violation of data model rules
122 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530123 @Override
Vinod Kumar Sd4deb062016-04-15 18:08:57 +0530124 public void validateDataOnExit()
125 throws DataModelException {
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530126 // TODO auto-generated method stub, to be implemented by parser
127
128 }
129
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530130}