You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

For JS7 - Management of Standalone Agents a number of users wish to create Agents automatically from individual sources such as a database.

Documentation

The REST Web Service API provides the functionality to automate JS7 operation.

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

Examples

The following examples makes use of the JS7 PowerShell Module to manage Standalone Agents:

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

# Parameterization

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

$TestCaseAgentId    = "TestCase_AgentID"
$TestCaseAgentName  = "TestCase_AgentName"
$TestCaseAgentUrl  = "http://TestCase_AgentUrl"

# Connection

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

# ----- create Standalone Agents -----

Set-JS7Agent -AgentId "$TestCaseAgentId-001" -AgentName "$TestCaseAgentName-001" -Url "$TestCaseAgentUrl-001:4443" -ControllerId $ControllerId
Set-JS7Agent -AgentId "$TestCaseAgentId-002" -AgentName "$TestCaseAgentName-002" -Url "$TestCaseAgentUrl-002:4443" -ControllerId $ControllerId

# ----- manage Standalone Agents -----

# store Agent configurations to inventory
$agent1 = Get-JS7Agent -AgentId "$TestCaseAgentId-001"
$agent2 = Get-JS7Agent -AgentId "$TestCaseAgentId-002"

# deploy Agents to Controller
Publish-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# reset Agents if required
Reset-JS7Agent -AgentId "$TestCaseAgentId-001"
Reset-JS7Agent -AgentId "$TestCaseAgentId-001" -Force

# disable Agents that should not be considered for job execution
Disable-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# hide Agents that should not be considered for assignment to jobs
Hide-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# make hidden Agents visible again
Show-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# enable Agents
Enable-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# ----- remove Standalone Agents -----

Remove-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# 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 user browser to access JOC Cockpit.
  • Line 6: The Controller ID is specified during setup of a Controller. Find the Controller ID in the right upper corner of any JOC Cockpit page.




  • No labels