-/*\r
- * ============LICENSE_START========================================================================\r
- * ONAP : tr-069-adapter\r
- * =================================================================================================\r
- * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
- * =================================================================================================\r
- * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
- * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
- * may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
- * either express or implied. See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ===============LICENSE_END=======================================================================\r
- */\r
-\r
-package org.commscope.tr069adapter.netconf.operations;\r
-\r
-import com.google.common.collect.Sets;\r
-\r
-import java.util.Optional;\r
-import java.util.Set;\r
-\r
-import org.commscope.tr069adapter.netconf.rpc.CreateSubscription;\r
-import org.commscope.tr069adapter.netconf.rpc.DeleteConfigOperation;\r
-import org.commscope.tr069adapter.netconf.rpc.GetConfigOperation;\r
-import org.commscope.tr069adapter.netconf.rpc.GetOperation;\r
-import org.commscope.tr069adapter.netconf.rpc.OperationCommit;\r
-import org.commscope.tr069adapter.netconf.rpc.OperationLock;\r
-import org.commscope.tr069adapter.netconf.rpc.OperationUnLock;\r
-import org.commscope.tr069adapter.netconf.rpc.SetConfigOperation;\r
-import org.commscope.tr069adapter.netconf.rpc.SoftwareActivateOperation;\r
-import org.commscope.tr069adapter.netconf.rpc.SoftwareDownloadOperation;\r
-import org.opendaylight.netconf.api.capability.Capability;\r
-import org.opendaylight.netconf.impl.SessionIdProvider;\r
-import org.opendaylight.netconf.mapping.api.NetconfOperation;\r
-import org.opendaylight.netconf.mapping.api.NetconfOperationService;\r
-import org.opendaylight.netconf.test.tool.operations.OperationsCreator;\r
-import org.opendaylight.netconf.test.tool.rpc.DataList;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public final class CustomOperationsCreator implements OperationsCreator {\r
- private static final Logger logger = LoggerFactory.getLogger(CustomOperationsCreator.class);\r
-\r
- private String macID = null;\r
-\r
- private String swVersion;\r
-\r
- private String hwVersion;\r
-\r
- private OperationService operationService;\r
-\r
- public CustomOperationsCreator(String macID, String swVersion, String hwVersion) {\r
- this.macID = macID;\r
- this.swVersion = swVersion;\r
- this.hwVersion = hwVersion;\r
- }\r
-\r
- @Override\r
- public NetconfOperationService getNetconfOperationService(final Set<Capability> caps,\r
- final SessionIdProvider idProvider, final String netconfSessionIdForReporting) {\r
- if (null == operationService) {\r
- operationService =\r
- new OperationService(idProvider.getCurrentSessionId(), macID, swVersion, hwVersion);\r
- }\r
- return operationService;\r
- }\r
-\r
- static class OperationService implements NetconfOperationService {\r
-\r
- private final long currentSessionId;\r
- private String macID;\r
- private String swVersion;\r
- private String hwVersion;\r
-\r
- OperationService(final long currentSessionId, String macID, String swVersion,\r
- String hwVersion) {\r
- this.currentSessionId = currentSessionId;\r
- this.macID = macID;\r
- this.swVersion = swVersion;\r
- this.hwVersion = hwVersion;\r
- }\r
-\r
- @Override\r
- public Set<NetconfOperation> getNetconfOperations() {\r
- final DataList storage = new DataList();\r
- final GetOperation oGet =\r
- new GetOperation(String.valueOf(currentSessionId), storage, macID, swVersion, hwVersion);\r
- final GetConfigOperation oGetConfig = new GetConfigOperation(String.valueOf(currentSessionId),\r
- Optional.empty(), macID, swVersion, hwVersion);\r
- final SetConfigOperation oSetConfig =\r
- new SetConfigOperation(String.valueOf(currentSessionId), macID, swVersion, hwVersion);\r
- final DeleteConfigOperation oDelConfig = new DeleteConfigOperation(\r
- String.valueOf(currentSessionId), storage, macID, swVersion, hwVersion);\r
- final OperationCommit oCommit = new OperationCommit(String.valueOf(currentSessionId));\r
- final OperationLock oLock = new OperationLock(String.valueOf(currentSessionId));\r
- final OperationUnLock oUnlock = new OperationUnLock(String.valueOf(currentSessionId));\r
- final CreateSubscription sCreateSubs = new CreateSubscription(\r
- String.valueOf(currentSessionId), Optional.empty(), macID, swVersion, hwVersion);\r
- SoftwareDownloadOperation swDownloadOperation =\r
- new SoftwareDownloadOperation(macID, swVersion, hwVersion);\r
- SoftwareActivateOperation swActivateOperation =\r
- new SoftwareActivateOperation(macID, swVersion, hwVersion);\r
- return Sets.newHashSet(oGet, oGetConfig, oSetConfig, oDelConfig, oCommit, oLock, oUnlock,\r
- sCreateSubs, swDownloadOperation, swActivateOperation);\r
- }\r
-\r
- @Override\r
- public void close() {\r
- logger.debug("close called on CustomOperationsCreator");\r
- }\r
-\r
- }\r
-}\r
+/*
+ * ============LICENSE_START========================================================================
+ * ONAP : tr-069-adapter
+ * =================================================================================================
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.
+ * =================================================================================================
+ * This tr-069-adapter software file is distributed by CommScope Inc 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
+ *
+ * This file 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.commscope.tr069adapter.netconf.operations;
+
+import com.google.common.collect.Sets;
+
+import java.util.Optional;
+import java.util.Set;
+
+import org.commscope.tr069adapter.netconf.rpc.AddObjectOperation;
+import org.commscope.tr069adapter.netconf.rpc.ConnectionStatus;
+import org.commscope.tr069adapter.netconf.rpc.CreateSubscription;
+import org.commscope.tr069adapter.netconf.rpc.DeleteConfigOperation;
+import org.commscope.tr069adapter.netconf.rpc.DeleteObjectOperation;
+import org.commscope.tr069adapter.netconf.rpc.DownloadOperation;
+import org.commscope.tr069adapter.netconf.rpc.GPAObjectOperation;
+import org.commscope.tr069adapter.netconf.rpc.GetConfigOperation;
+import org.commscope.tr069adapter.netconf.rpc.GetOperation;
+import org.commscope.tr069adapter.netconf.rpc.OperationCommit;
+import org.commscope.tr069adapter.netconf.rpc.OperationLock;
+import org.commscope.tr069adapter.netconf.rpc.OperationUnLock;
+import org.commscope.tr069adapter.netconf.rpc.RebootOperation;
+import org.commscope.tr069adapter.netconf.rpc.ResetOperation;
+import org.commscope.tr069adapter.netconf.rpc.SPAObjectOperation;
+import org.commscope.tr069adapter.netconf.rpc.SetConfigOperation;
+import org.commscope.tr069adapter.netconf.rpc.SoftwareActivateOperation;
+import org.commscope.tr069adapter.netconf.rpc.SoftwareDownloadOperation;
+import org.opendaylight.netconf.api.capability.Capability;
+import org.opendaylight.netconf.impl.SessionIdProvider;
+import org.opendaylight.netconf.mapping.api.NetconfOperation;
+import org.opendaylight.netconf.mapping.api.NetconfOperationService;
+import org.opendaylight.netconf.test.tool.operations.OperationsCreator;
+import org.opendaylight.netconf.test.tool.rpc.DataList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class CustomOperationsCreator implements OperationsCreator {
+ private static final Logger logger = LoggerFactory.getLogger(CustomOperationsCreator.class);
+
+ private String macID = null;
+
+ private String swVersion;
+
+ private String hwVersion;
+
+ private OperationService operationService;
+
+ public CustomOperationsCreator(String macID, String swVersion, String hwVersion) {
+ this.macID = macID;
+ this.swVersion = swVersion;
+ this.hwVersion = hwVersion;
+ }
+
+ @Override
+ public NetconfOperationService getNetconfOperationService(final Set<Capability> caps,
+ final SessionIdProvider idProvider, final String netconfSessionIdForReporting) {
+ if (null == operationService) {
+ operationService =
+ new OperationService(idProvider.getCurrentSessionId(), macID, swVersion, hwVersion);
+ }
+ return operationService;
+ }
+
+ static class OperationService implements NetconfOperationService {
+
+ private final long currentSessionId;
+ private String macID;
+ private String swVersion;
+ private String hwVersion;
+
+ OperationService(final long currentSessionId, String macID, String swVersion,
+ String hwVersion) {
+ this.currentSessionId = currentSessionId;
+ this.macID = macID;
+ this.swVersion = swVersion;
+ this.hwVersion = hwVersion;
+ }
+
+ @Override
+ public Set<NetconfOperation> getNetconfOperations() {
+ final DataList storage = new DataList();
+ final GetOperation oGet =
+ new GetOperation(String.valueOf(currentSessionId), storage, macID, swVersion, hwVersion);
+ final GetConfigOperation oGetConfig = new GetConfigOperation(String.valueOf(currentSessionId),
+ Optional.empty(), macID, swVersion, hwVersion);
+ final SetConfigOperation oSetConfig =
+ new SetConfigOperation(String.valueOf(currentSessionId), macID, swVersion, hwVersion);
+ final DeleteConfigOperation oDelConfig = new DeleteConfigOperation(
+ String.valueOf(currentSessionId), storage, macID, swVersion, hwVersion);
+ final OperationCommit oCommit = new OperationCommit(String.valueOf(currentSessionId));
+ final OperationLock oLock = new OperationLock(String.valueOf(currentSessionId));
+ final OperationUnLock oUnlock = new OperationUnLock(String.valueOf(currentSessionId));
+ final CreateSubscription sCreateSubs = new CreateSubscription(
+ String.valueOf(currentSessionId), Optional.empty(), macID, swVersion, hwVersion);
+ SoftwareDownloadOperation swDownloadOperation =
+ new SoftwareDownloadOperation(macID, swVersion, hwVersion);
+ SoftwareActivateOperation swActivateOperation =
+ new SoftwareActivateOperation(macID, swVersion, hwVersion);
+ AddObjectOperation addObjectOperation = new AddObjectOperation(macID, swVersion, hwVersion);
+ DeleteObjectOperation deleteObjectOperation =
+ new DeleteObjectOperation(macID, swVersion, hwVersion);
+ GPAObjectOperation gpaObjectOperation = new GPAObjectOperation(macID, swVersion, hwVersion);
+ SPAObjectOperation spaObjectOperation = new SPAObjectOperation(macID, swVersion, hwVersion);
+ ConnectionStatus connStatus = new ConnectionStatus(macID, swVersion, hwVersion);
+ RebootOperation rebootOperation = new RebootOperation(macID, swVersion, hwVersion);
+ ResetOperation resetOperation = new ResetOperation(macID, swVersion, hwVersion);
+ DownloadOperation downloadOp = new DownloadOperation(macID, swVersion, hwVersion);
+ return Sets.newHashSet(oGet, oGetConfig, oSetConfig, oDelConfig, oCommit, oLock, oUnlock,
+ sCreateSubs, swDownloadOperation, swActivateOperation, addObjectOperation,
+ deleteObjectOperation, gpaObjectOperation, spaObjectOperation, connStatus,
+ rebootOperation, resetOperation, downloadOp);
+ }
+
+ @Override
+ public void close() {
+ logger.debug("close called on CustomOperationsCreator");
+ }
+
+ }
+}