Introduction

JS7 - Management of Agent Clusters allows users to create Cluster Agents and Subagent Clusters automatically from individual sources such as a database.

Documentation

The REST Web Service API can be used to automate operation of JS7.

To add REST Web Service API calls in your preferred language or to use the PowerShell cmdlets, refer to:

Examples

The following examples use the JS7 PowerShell Module to manage Cluster Agents:

Example for use of PowerShell cmdlets
#!/usr/bin/env pwsh

# Parameterization

$Url = "http://localhost:4446"
$ControllerId = "controller"

$TestCaseClusterAgentId     = "TestCase_ClusterAgentID"
$TestCaseClusterAgentName   = "TestCase_ClusterAgentName"
$TestCaseClusterAgentUrl    = "https://TestCase_ClusterAgentUrl"

$TestCaseSubagentId         = "TestCase_SubagentID"
$TestCaseSubagentUrl        = "http://TestCase_SubagentUrl"

$TestCaseSubagentClusterId  = "TestCase_SubagentClusterID"

# Connection

Import-Module JS7 -Force
Connect-JS7 -Url $Url -Id $ControllerId | Out-Null

# ----- Create Cluster Agent and Subagents -----

# create one Director Agent and two additional Subagents
$subagents = @()
$subagents += New-JS7Subagent -SubagentId "$TestCaseSubagentId-001" -Url "$TestCaseSubagentUrl-001:4443" -DirectorType 'PRIMARY_DIRECTOR'
$subagents += New-JS7Subagent -SubagentId "$TestCaseSubagentId-002" -Url "$TestCaseSubagentUrl-002:4443"
$subagents += New-JS7Subagent -SubagentId "$TestCaseSubagentId-003" -Url "$TestCaseSubagentUrl-003:4443"

# create the Cluster Agent referencing the list of Subagents
Set-JS7ClusterAgent -AgentId "$TestCaseClusterAgentId-001" -AgentName "$TestCaseClusterAgentName-001" -Url "$TestCaseClusterAgentUrl-001:4443" -Subagents $subagents -ControllerId $ControllerId

# ----- Manage Cluster Agent -----

# read the Cluster Agent configuration
$agent = Get-JS7Agent -AgentId "$TestCaseClusterAgentId-001"

# deploy Cluster Agent and Subagents to Controller
Publish-JS7ClusterAgent -AgentId "$TestCaseClusterAgentId-001"

# reset Subagents if required
Reset-JS7Subagent -SubagentId "$TestCaseSubagentId-001"
Reset-JS7Subagent -SubagentId "$TestCaseSubagentId-002" -Force

# disable Subagents that should not be considered for job execution
Disable-JS7Subagent -SubagentId "$TestCaseSubagentId-001","$TestCaseSubagentId-002"
Enable-JS7Subagent -SubagentId "$TestCaseSubagentId-001","$TestCaseSubagentId-002"

#  revoke the Cluster Agent from the Controller
Revoke-JS7ClusterAgent -AgentId "$TestCaseClusterAgentId-001"
Publish-JS7ClusterAgent -AgentId "$TestCaseClusterAgentId-001"

# ----- Manage Subagent Cluster -----

# create an active-active Subagent Cluster from two Subagents using the same priorities
Set-JS7SubagentCluster -AgentId "$TestCaseClusterAgentId-001" -SubagentClusterId "$TestCaseSubagentClusterId-001" -SubagentId "$TestCaseSubagentId-001","$TestCaseSubagentId-002" -Priority 1,1
# create an active-passive Subagent Cluster from two Subagents using different priorities
Set-JS7SubagentCluster -AgentId "$TestCaseClusterAgentId-001" -SubagentClusterId "$TestCaseSubagentClusterId-002" -SubagentId "$TestCaseSubagentId-001","$TestCaseSubagentId-002" -Priority 2,1

# deploy Subagent Clusters to Controller
Publish-JS7SubagentCluster -SubagentClusterId "$TestCaseSubagentClusterId-001","$TestCaseSubagentClusterId-002"

# revoke Subagent Clusters from Controller
Revoke-JS7SubagentCluster -SubagentClusterId "$TestCaseSubagentClusterId-001","$TestCaseSubagentClusterId-002"

# ----- Remove Agent Cluster, Subagent Clusters, Subagents -----

# remove Subagent Clusters individually
Remove-JS7SubagentCluster -SubagentClusterId "$TestCaseSubagentClusterId-001","$TestCaseSubagentClusterId-002"

# remove Subagents individually
Remove-JS7Subagent -SubagentId "$TestCaseSubagentId-002","$TestCaseSubagentId-003"

# remove the Cluster Agent and any Subagents and Subagent Clusters included
Remove-JS7Agent -AgentId "$TestCaseClusterAgentId-001"

# Connection

Disconnect-JS7


Explanation:

  • Line 1: A shebang is used to invoke PowerShell on Unix platforms. For Windows platforms replace this line with:
    • @@findstr/v "^@@f.*&" "%~f0"|pwsh.exe -&goto:eof
    • Optionally adjust pwsh.exe by powershell.exe or similar to locate the PowerShell interpreter.
  • Line 5: The URL to JOC Cockpit is specified. This is the same URL as used from a client browser to access JOC Cockpit.
  • Line 6: The Controller ID is specified during setup of a Controller. The Controller ID can be found in the upper right hand corner of any JOC Cockpit page.