Device Software version management
[oam/tr069-adapter.git] / netconf-server / src / main / java / org / commscope / tr069adapter / netconf / operations / CustomOperationsCreator.java
index 5323fd3..5ad9dfd 100644 (file)
@@ -47,17 +47,24 @@ public final class CustomOperationsCreator implements OperationsCreator {
 \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) {\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 = new OperationService(idProvider.getCurrentSessionId(), macID);\r
+      operationService =\r
+          new OperationService(idProvider.getCurrentSessionId(), macID, swVersion, hwVersion);\r
     }\r
     return operationService;\r
   }\r
@@ -66,29 +73,37 @@ public final class CustomOperationsCreator implements OperationsCreator {
 \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) {\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 = new GetOperation(String.valueOf(currentSessionId), storage, macID);\r
-      final GetConfigOperation oGetConfig =\r
-          new GetConfigOperation(String.valueOf(currentSessionId), Optional.empty(), macID);\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);\r
-      final DeleteConfigOperation oDelConfig =\r
-          new DeleteConfigOperation(String.valueOf(currentSessionId), storage, macID);\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 =\r
-          new CreateSubscription(String.valueOf(currentSessionId), Optional.empty(), macID);\r
-      SoftwareDownloadOperation swDownloadOperation = new SoftwareDownloadOperation(macID);\r
-      SoftwareActivateOperation swActivateOperation = new SoftwareActivateOperation(macID);\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