2 * ============LICENSE_START========================================================================
3 * ONAP : tr-069-adapter
4 * =================================================================================================
5 * Copyright (C) 2020 CommScope Inc Intellectual Property.
6 * =================================================================================================
7 * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
9 * may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14 * either express or implied. See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ===============LICENSE_END=======================================================================
19 package org.commscope.tr069adapter.netconf.rpc;
21 import org.commscope.tr069adapter.netconf.boot.NetConfServiceBooter;
22 import org.commscope.tr069adapter.netconf.config.NetConfServerProperties;
23 import org.opendaylight.netconf.api.xml.XmlElement;
24 import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27 import org.w3c.dom.Document;
29 public class SoftwareActivateOperation extends GenericOperation {
30 private static final Logger logger = LoggerFactory.getLogger(SoftwareActivateOperation.class);
32 public SoftwareActivateOperation(String deviceID, String swVersion, String hwVersion) {
33 this.deviceID = deviceID;
34 this.swVersion = swVersion;
35 this.hwVersion = hwVersion;
36 setOpString("softwareActivate");
37 setOpName("software-activate");
38 setOpNamespace("urn:o-ran:software-management:1.0");
42 public Document handle(Document requestMessage,
43 NetconfOperationChainedExecution subsequentOperation) {
45 logger.debug("sw-activate rpc recevied in netconf server");
46 final XmlElement requestElement = XmlElement.fromDomDocument(requestMessage);
48 String requestXml = XmlUtility.convertDocumentToString(requestElement);
49 logger.debug("sw-activate rpc recevied requestXml = {}", requestXml);
50 NetConfServerProperties config =
51 NetConfServiceBooter.getApplicationContext().getBean(NetConfServerProperties.class);
53 final String baseUrl = config.getMapperPath() + "/" + getOpString();
54 XmlUtility.invokeMapperCall(baseUrl, requestXml, deviceID, swVersion, hwVersion);