2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. 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 distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl;
20 import java.util.Optional;
21 import org.eclipse.jdt.annotation.NonNull;
22 import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory;
23 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.OnfMicrowaveModel;
24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev170324;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev180907;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev181010;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Basic;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Microwave;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
30 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
31 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
32 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
37 * Create a Network Element representation according to the capability information. The capabilities are more than an
38 * ODL-QName. After the ? other terms than "revision" are provided.
41 public class ONFCoreNetworkElementFactory implements NetworkElementFactory {
43 private static final Logger log = LoggerFactory.getLogger(ONFCoreNetworkElementFactory.class);
45 private final @NonNull DeviceManagerOnfConfiguration configuration;
47 public ONFCoreNetworkElementFactory(@NonNull DeviceManagerOnfConfiguration configuration) {
48 this.configuration = configuration;
53 public Optional<org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement> create(
54 @NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) {
56 log.info("Enter factory {}", ONFCoreNetworkElementFactory.class.getName(), acessor.getNodeId());
58 Capabilities capabilities = acessor.getCapabilites();
60 if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
61 OnfMicrowaveModel onfMicrowaveModel = null;
63 if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
64 onfMicrowaveModel = new WrapperMicrowaveModelRev170324(acessor, serviceProvider);
65 } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
66 onfMicrowaveModel = new WrapperMicrowaveModelRev180907(acessor, serviceProvider);
67 } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
68 onfMicrowaveModel = new WrapperMicrowaveModelRev181010(acessor, serviceProvider);
71 if (onfMicrowaveModel != null) {
72 return Optional.of(new ONFCoreNetworkElement12Microwave(acessor, serviceProvider, configuration,
75 return Optional.of(new ONFCoreNetworkElement12Basic(acessor, serviceProvider, configuration));
79 return Optional.empty();