aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/ORANFM.java
blob: 5be18e75be5c0f2c68c99100d5b14fcfd70ad08e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * ============LICENSE_START=======================================================
 * ONAP : ccsdk features
 * ================================================================================
 * Copyright (C) 2023 highstreet technologies GmbH Intellectual Property.
 * All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 *
 */
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.XMLNamespace;

public class ORANFM extends YangModule {

    public static final String NAMESPACE = "urn:o-ran:fm:1.0";
    public static final QNameModule ORANFM_2019_02_04 =
            QNameModule.create(XMLNamespace.of(NAMESPACE), Revision.of("2019-02-04"));
    public static final QNameModule ORANFM_2022_08_15 =
            QNameModule.create(XMLNamespace.of(NAMESPACE), Revision.of("2022-08-15"));
    private static final List<QNameModule> MODULES = Arrays.asList(ORANFM_2019_02_04, ORANFM_2022_08_15);
//    private final QName ORAN_FM_ALARM_NOTIF;
//    private final QName ORAN_FM_FAULT_ID;
//    private final QName ORAN_FM_FAULT_SOURCE;
//    private final QName ORAN_FM_FAULT_SEVERITY;
//    private final QName ORAN_FM_FAULT_TEXT;
//    private final QName ORAN_FM_FAULT_IS_CLEARED;



    ORANFM(NetconfDomAccessor netconfDomAccessor, QNameModule module) {
        super(netconfDomAccessor, module);
//        ORAN_FM_ALARM_NOTIF = QName.create(module, "alarm-notif");
//        ORAN_FM_FAULT_ID = QName.create(module, "fault-id");
//        ORAN_FM_FAULT_SOURCE = QName.create(module, "fault-source");
//        ORAN_FM_FAULT_SEVERITY = QName.create(module, "fault-severity");
//        ORAN_FM_FAULT_TEXT = QName.create(module, "fault-text");
//        ORAN_FM_FAULT_IS_CLEARED = QName.create(module, "is-cleared");
    }

    public QName getFaultSourceQName() {
        return getQName("fault-source");
    }

    public QName getFaultIdQName() {
        return getQName("fault-id");
    }

    public QName getFaultSeverityQName() {
        return getQName("fault-severity");
    }

    public QName getFaultTextQName() {
        return getQName("fault-text");
    }

    public QName getAlarmNotifQName() {
        return getQName("alarm-notif");
    }

    public QName getFaultIsClearedQName() {
        return getQName("is-cleared");
    }

    public QName getFaultEventTimeQName() {
    	return getQName("event-time");
    }
    
    public QName getFaultActiveAlarmListQName() {
    	return getQName("active-alarm-list");
    }
    
    public QName getFaultActiveAlarmsQName() {
    	return getQName("active-alarms");
    }
    
    /**
     * Get specific instance, depending on capabilities
     *
     * @param capabilities
     * @return
     */
    public static Optional<ORANFM> getModule(NetconfDomAccessor netconfDomAccessor) {
        Capabilities capabilities = netconfDomAccessor.getCapabilites();
        for (QNameModule module : MODULES) {
            if (capabilities.isSupportingNamespaceAndRevision(module)) {
                return Optional.of(new ORANFM(netconfDomAccessor, module));
            }
        }
        return Optional.empty();
    }

}