2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024 Ericsson
4 * Modifications Copyright (C) 2024 OpenInfra Foundation Europe
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
21 package org.oran.smo.yangtools.parser.model.statements.threegpp;
23 import java.util.Arrays;
24 import java.util.List;
26 import org.oran.smo.yangtools.parser.ParserExecutionContext;
27 import org.oran.smo.yangtools.parser.findings.Finding;
28 import org.oran.smo.yangtools.parser.findings.ParserFindingType;
29 import org.oran.smo.yangtools.parser.model.statements.AbstractStatement;
30 import org.oran.smo.yangtools.parser.model.statements.ExtensionStatement;
31 import org.oran.smo.yangtools.parser.model.statements.StatementModuleAndName;
32 import org.oran.smo.yangtools.parser.model.statements.yang.CY;
33 import org.oran.smo.yangtools.parser.model.yangdom.YangDomElement;
36 * Type-safe 3GPP statement.
38 * @author Mark Hollmann
40 public class Y3gppNotNotifyable extends ExtensionStatement {
42 public Y3gppNotNotifyable(final AbstractStatement parentStatement, final YangDomElement domNode) {
43 super(parentStatement, domNode);
47 public StatementArgumentType getArgumentType() {
48 return StatementArgumentType.NO_ARG;
52 public StatementModuleAndName getStatementModuleAndName() {
53 return C3GPP.THREEGPP_COMMON_YANG_EXTENSIONS__NOT_NOTIFYABLE;
56 private static final List<StatementModuleAndName> REQUIRED_PARENTS = Arrays.asList(CY.STMT_LEAF, CY.STMT_LEAF_LIST,
57 CY.STMT_LIST, CY.STMT_CONTAINER, CY.STMT_ANYDATA, CY.STMT_ANYXML);
60 public boolean canBeChildOf(final StatementModuleAndName parentSman) {
61 return REQUIRED_PARENTS.contains(parentSman);
65 protected void validate(final ParserExecutionContext context) {
67 * From module _3gpp-common-yang-extensions:
69 * Indicates that data change notifications shall not be sent
70 * for this attribute. If the extension is not present and other
71 * conditions are fulfilled data change notification should be sent.
72 * If a list or container already has the notNotifyable
73 * extension, that is also valid for all contained data nodes.
75 * The statement MUST only be a substatement of a leaf, leaf-list, list,
76 * container statement that is contained within the 'attributes'
77 * container of an IOC and that represents an attribute or sub-parts of
80 * Zero or one notNotifyable statement is allowed per parent statement.
81 * NO substatements are allowed.
83 * Adding this statement is an NBC change, removing it is BC.";
85 checkParentAlsoAllowDeviateOrRefine(context);
86 checkCardinalityUnderParent(context, 1);
88 if (getValue() != null) {
89 context.addFinding(new Finding(this, ParserFindingType.P015_INVALID_SYNTAX_IN_DOCUMENT,
90 "'notNotifyable' extension does not allow for an argument."));