69a920a6c5d27653babd646a5c5dc0355932a32e
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / Deviation.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.model.api;
9
10 import com.google.common.base.Preconditions;
11 import java.util.List;
12
13 /**
14  * Interface describing YANG 'deviation' statement.
15  * <p>
16  * The 'deviation' statement defines a hierarchy of a module that the device
17  * does not implement faithfully. Deviations define the way a device deviate
18  * from a standard.
19  * </p>
20  */
21 public interface Deviation {
22
23     /**
24      * Enum describing YANG deviation 'deviate' statement. It defines how the
25      * device's implementation of the target node deviates from its original
26      * definition.
27      */
28     enum Deviate {
29         NOT_SUPPORTED("not-supported"), ADD("add"), REPLACE("replace"), DELETE("delete");
30
31         private final String keyword;
32
33         private Deviate(final String keyword) {
34             this.keyword = Preconditions.checkNotNull(keyword);
35         }
36
37         /**
38          * @return String that corresponds to the yang keyword.
39          */
40         public String getKeyword() {
41             return keyword;
42         }
43     }
44
45     /**
46      * @return SchemaPath that identifies the node in the schema tree where a
47      *         deviation from the module occurs.
48      */
49     SchemaPath getTargetPath();
50
51     /**
52      * @return deviate statement of this deviation
53      */
54     Deviate getDeviate();
55
56     /**
57      * @return textual cross-reference to an external document that provides
58      *         additional information relevant to this node.
59      */
60     String getReference();
61
62     /**
63      * @return collection of all unknown nodes defined under this schema node.
64      */
65     List<UnknownSchemaNode> getUnknownSchemaNodes();
66
67 }