**Stronglink Config Tools (SLKCT)**
-
**Description:** In my free/downtime I will be working on porting the Stronglink Config Tools from Python to Kotlin using Test Driven Development. I am starting by utilizing some of the built functionality of the [sl_automation](https://git.strongboxdata.com:8443/projects/PROT/repos/sl_automation/browse) (ATP) project, with inspiration and reference of the [slk-cli-tools](https://git.strongboxdata.com:8443/projects/SLUI/repos/slk-cli-tools/browse) project as well for consistency with other SL development projects.

**Goal:** To have a way to perform all actions of the CP via a CLI (similar to Cloud Shell for AWS/Azure/GCP) and to automate this process for Development/QA as well as our clients/stakeholders.

---

**Setup/Usage:**
Download the latest Jar on artifactory [here](https://repo.strongboxdata.com/artifactory/maven-sbds-snapshots/com/stronglink/slink-ui/slk-config-tools-kotlin/).  The reccommended setup is on a sole purpose Stronglink 3.3 Develop virtual machine, but can be ran on other systems as long as Java JRE 15 is installed.  A shell wrapper is included in /scripts of this repo and can be used to make it easier to execute the following commands.  Without this, replace `slkct` with `java -jar slk-config-tools-kotlin-x.y-SNAPSHOT.jar` (where X.Y is the major.minor version i.e. 3.3).

**Typical workflow examples:**
Login, create NFS AMS and MS stores, create Smartpool and add AMS, create namespace and then 
perform an ingest

Show help menu:

    slkct help

Login:

    slkct login --user stronglink --password password --domain radium --ip 10.11.40.112

Create stores:

    slkct create-store --name SlkctDemoAMStore1 --description SlkctDemoAMStore1 --url store10-v40:/mnt/data0/LabNFS-0/QA/Jaime/slkct --type NFS --mode advanced --state enabled --archive false --options default
	
	slkct create-store --name SlkctDemoMStore1 --description SlkctDemoMStore1 --url store10-v40:/mnt/data0/LabNFS-0/QA/Jaime/Managed --type NFS --mode managed --state enabled --archive true --options default

Create pool

    slkct create-smart-pool --name SlkctDemoSmartpool1 --description SlkctDemoSmartpool1 --max-container-size 0 --max-container-object-size 0 --smart-pool-type advanced_managed --store SlkctDemoAMStore1

Create namespace:

    slkct create-namespace --name SlkctDemoNamespace1
	
Run ingest job

	slkct create-job --name SlkctDemotIngestJob1 --policy ingest --source-store SlkctDemoMStore1 --path 1Dir --destination-namespace SlkctDemoNamespace1 --destination-pool SlkctDemoSmartpool1 --thumbnail-generation false --harvest-extended-metadata false --ingest-by-reference false --update-permissions-acls false

---

**Other examples:**

Create SMB Store

    slkct create-store --name SlkctDemoAMStore1 --description SlkctDemoAMStore1 --url \\\\ragc1.radium.lab\\Jaime1 --type SMB --mode advanced --state enabled --archive false --options cifsacl,noperm --user raadmin --password p@ssw0rd!
	
	slkct create-store --name SlkctDemoMStore1 --description SlkctDemoMStore1 --url \\\\ragc1.radium.lab\\TestData1 --type SMB --mode managed --state enabled --archive true --options cifsacl,noperm --user raadmin --password p@ssw0rd!

Crate LTFS Store

	slkct create-store --name SlkctDemoLTFSStore1 --description SlkctDemoLTFSStore1 --type LTFS --mode advanced --state enabled --archive true --library-id 1

**Config file examples:**
Performs the same actions as above in one command.  Example config files are provided in /configfiles of this repo

    slkct config-file --file TestConfigFile.json

Perform the same actions but with an LTFS store.

    slkct config-file --file TestConfigFileLtfs.json

---

**Roadmap:**

The basic initial functionality of the control panel will be available via the SlkCt tool, including the creation of:

-   ~~Namespaces~~
    - ~~Create~~
    - ~~Delete~~
    - ~~Bind to smartpools~~
    - List*
-   Stores
    -   Create
        -   ~~NFS~~
        -   ~~LTFS~~
        -   ~~SMB~~
        -   ~~S3~~
        -   ~~BP~~
        -  Lustre* 
    -   ~~Delete (if empty/not bound to smart pool)~~
    -   ~~Edit~~
    -   List*
-   Pools
    -   ~~Create~~
    -   ~~Bind to stores~~
    -   ~~Delete (if not bound)~~
    -   ~~Editing~~
    -   List*
-   Jobs
    -   ~~Create~~
        -   ~~Ingest~~
        -   ~~Hard delete~~
        -   ~~Copy~~
        -   ~~Outgest~~
        -   ~~Verify~~
        -   Tape migration*
    -   Scheduling*
    -   Edit*
    -   Delete*
    -   List*
-   Domains!
	- 	~~Create/Join~~
		- 	~~Local~~
		- 	~~AD~~
		- 	~~LDAP~~
		- 	~~Local Groups~~
		- 	~~Local Users~~
	- 	Edit*
		-	~~Local Users~~
        -	~~Local Groups~~
        -	~~LDAP user as admin~~
		-	AD user as admin*
	- 	~~Delete~~
        - ~~Local domains~~
        - ~~Local users~~
        - ~~Local groups~~ 
    -   List*         
-   Virtual File Systems   
    -   ~~Create~~
        -   ~~NFS~~
        -   ~~SMB~~
    -   ~~Delete~~ 
    -   ~~Edit~~
    -   List*       
-   ~~Keys~~
    - ~~Create~~
    - ~~Delete~~
    - ~~Edit~~
-   Config files!
-   Logging!
-   Input validation!
-   DB Commands*

**TODO:**

- ~~Implement configuration similar to CLI tool for log in process~~
- ~~Fix parent pom dependencies (graal etc.)~~
- ~~Create stronglink project/repo~~
- ~~Setup Jenkins build~~
- Fix uncaught exceptions and error handling!
- DRY/YAGNI/KISS check!
- Fix orange warnings/hints in IntelliJ!
- Fix arguments to be consistent with *Nix (-name should be --name)
- Add abbreviated arguments (-n for name, etc.)        
- Apply [Google Kotlin style guide!](https://developer.android.com/kotlin/style-guide)!
- Switch from map/list for loops to streams where relevant (Erik)
- Add comments/docs
- Add minimal args support for all commands
- Setup install script and shell wrapper
- Add bash tab completion
- Implement interactive mode (user prompted for each field instead of / in addition to having to enter in command-line arguments)
- Refactor slink dataobjects as package for both slk-config-tools and sl_automation

**Key:**  
~~Feature~~ - Currently implemented

'*' - Will be included in future versions.

'!' - In progress/ongoing

'?' - Not sure if we want this implemented here (CLI Tool covers)