a20e62cab713e7b60119403d8cdbd83fd0195b07
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk features
4  * ================================================================================
5  * Copyright (C) 2022 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom;
23
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.when;
26 import java.io.IOException;
27 import java.net.URISyntaxException;
28 import java.util.Optional;
29 import javax.xml.stream.XMLStreamException;
30 import org.junit.Test;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.Onf14DomInterfacePacManager;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.util.Onf14DomTestUtils;
33 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
34 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
35 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
38 import org.xml.sax.SAXException;
39
40 public class TestOnf14DomInterfacePacManager {
41
42     private static final Logger log = LoggerFactory.getLogger(TestOnf14DomInterfacePacManager.class);
43
44     @Test
45     public void test() throws XMLStreamException, URISyntaxException, IOException, SAXException {
46         NetconfDomAccessor netconfDomAccessor = mock(NetconfDomAccessor.class);
47         Onf14DomInterfacePacManager interfacePacMgr = mock(Onf14DomInterfacePacManager.class);
48         ContainerNode cn = (ContainerNode) Onf14DomTestUtils.getNormalizedNodeFromXML();
49         //        NormalizedNode ltpData = cn.getChildByArg(new NodeIdentifier(qNames.getQName("logical-termination-point")));
50         //        when(interfacePacMgr.readLtpData(netconfDomAccessor)).thenReturn(Optional.of(ltpData));
51         //        interfacePacMgr.register();
52     }
53
54     @Test
55     public void test1() throws XMLStreamException, URISyntaxException, IOException, SAXException {
56         NetconfDomAccessor netconfDomAccessor = mock(NetconfDomAccessor.class);
57         Onf14DomInterfacePacManager interfacePacMgr = mock(Onf14DomInterfacePacManager.class);
58         ContainerNode cn = (ContainerNode) Onf14DomTestUtils.getNormalizedNodeFromXML("2022");
59
60 //        AugmentationNode cmn = (AugmentationNode) cn
61 //                .childByArg(new AugmentationIdentifier(Sets.newHashSet(Alarms10.ALARM_PAC)));
62 //        ContainerNode mn = (ContainerNode) cmn.childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.ALARM_PAC));
63 //        ContainerNode mn1 = (ContainerNode) mn.childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.CURRENT_ALARMS));
64 //        MapNode mn2 = (MapNode) mn1.childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.CURRENT_ALARM_LIST));
65 //        log.info("{}", mn2);
66 //        Collection<MapEntryNode> mne = mn2.body();
67 //        for (MapEntryNode currentAlarm : mne) {
68 //            //                        resultList.add(netconfDomAccessor.getNodeId(),
69 //            log.info("{} {} {} {} {}",
70 //                    Integer.parseInt(Onf14DMDOMUtility.getLeafValue(currentAlarm,
71 //                            Onf14DevicemanagerQNames.CURRENT_ALARM_IDENTIFIER)),
72 //                    new DateAndTime(
73 //                            Onf14DMDOMUtility.getLeafValue(currentAlarm, Onf14DevicemanagerQNames.ALARM_TIMESTAMP)),
74 //                    Onf14DMDOMUtility.getLeafValue(currentAlarm, Onf14DevicemanagerQNames.RESOURCE),
75 //                    Onf14DMDOMUtility.getLeafValue(currentAlarm, Onf14DevicemanagerQNames.ALARM_TYPE_QUALIFIER),
76 //                    InternalDataModelSeverity.mapSeverity(
77 //                            Onf14DMDOMUtility.getLeafValue(currentAlarm, Onf14DevicemanagerQNames.ALARM_SEVERITY)));
78 //        }
79 //        //        NormalizedNode ltpData = cn.getChildByArg(new NodeIdentifier(qNames.getQName("logical-termination-point")));
80         //        when(interfacePacMgr.readLtpData(netconfDomAccessor)).thenReturn(Optional.of(ltpData));
81         //        interfacePacMgr.register();
82     }
83
84 }