-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce36254
commit 45e4b39
Showing
32 changed files
with
885 additions
and
5 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
samples/media-connector-invoke-test/.config_aio_connectors_namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
azure-iot-operations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
azure-iot-operations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${PSScriptRoot}/resources |
34 changes: 34 additions & 0 deletions
34
samples/media-connector-invoke-test/Install-ResourceFile.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#Requires -Version 7 | ||
<# | ||
Install a resource file. | ||
#> | ||
param ( | ||
[Parameter( | ||
Mandatory=$true, | ||
HelpMessage="The resource file.")] | ||
[string]$resourceFile | ||
) | ||
|
||
Write-Host "`n" | ||
Write-Host (Split-Path -Path $PSCommandPath -Leaf).ToUpper() -ForegroundColor White | ||
|
||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
$resourcesDirectory = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_resources_path") -Raw).Trim() | ||
$resourcesDirectory = $ExecutionContext.InvokeCommand.ExpandString(${resourcesDirectory}) | ||
Write-Host "Resources directory: $resourcesDirectory" | ||
|
||
Write-Host "Resource file: $resourceFile" | ||
|
||
$fileFullPath=(Join-Path -Path $resourcesDirectory -ChildPath $resourceFile) | ||
Write-Host "Resource file full path: ${fileFullPath}" | ||
|
||
Write-Host "Applying the resource..." | ||
. kubectl apply -n ${aioConnectorsNamespace} -f ${fileFullPath} | ||
If ($LastExitCode -ne 0) { | ||
Write-Host "Error: The resource could not be applied." | ||
Exit $LastExitCode | ||
} Else { | ||
Write-Host "The resource was applied successfully.`n" | ||
} |
22 changes: 22 additions & 0 deletions
22
samples/media-connector-invoke-test/Invoke-GetTaskDebugInfo.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<# | ||
Get the task debug info | ||
#> | ||
param ( | ||
[Parameter( | ||
HelpMessage="AIO namespace.")] | ||
[string]$aioNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath .aio_namespace) -Raw), | ||
[Parameter( | ||
HelpMessage="Asset name.")] | ||
[string]$assetName, | ||
[Parameter( | ||
HelpMessage="Datapoint name.")] | ||
[string]$datapointName | ||
) | ||
|
||
$mrpcTopic = "$aioNamespace/asset-operations/${assetName}/get-task-debug-info" | ||
|
||
$mrpcResponseTopic = "$mrpcTopic/response" | ||
|
||
$mrpcPayload = "{`"datapoint`":`"${datapointName}`"}" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-mRPC.ps1") -mrpcTopic $mrpcTopic -mrpcResponseTopic $mrpcResponseTopic -mrpcPayload $mrpcPayload |
22 changes: 22 additions & 0 deletions
22
samples/media-connector-invoke-test/Invoke-GetTaskErrorString.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<# | ||
Get the task error string | ||
#> | ||
param ( | ||
[Parameter( | ||
HelpMessage="AIO namespace.")] | ||
[string]$aioNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath .aio_namespace) -Raw), | ||
[Parameter( | ||
HelpMessage="Asset name.")] | ||
[string]$assetName, | ||
[Parameter( | ||
HelpMessage="Datapoint name.")] | ||
[string]$datapointName | ||
) | ||
|
||
$mrpcTopic = "$aioNamespace/asset-operations/${assetName}/get-task-error-string" | ||
|
||
$mrpcResponseTopic = "$mrpcTopic/response" | ||
|
||
$mrpcPayload = "{`"datapoint`":`"${datapointName}`"}" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-mRPC.ps1") -mrpcTopic $mrpcTopic -mrpcResponseTopic $mrpcResponseTopic -mrpcPayload $mrpcPayload |
22 changes: 22 additions & 0 deletions
22
samples/media-connector-invoke-test/Invoke-GetTaskOutputString.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<# | ||
Get the task output string | ||
#> | ||
param ( | ||
[Parameter( | ||
HelpMessage="AIO namespace.")] | ||
[string]$aioNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath .aio_namespace) -Raw), | ||
[Parameter( | ||
HelpMessage="Asset name.")] | ||
[string]$assetName, | ||
[Parameter( | ||
HelpMessage="Datapoint name.")] | ||
[string]$datapointName | ||
) | ||
|
||
$mrpcTopic = "$aioNamespace/asset-operations/${assetName}/get-task-output-string" | ||
|
||
$mrpcResponseTopic = "$mrpcTopic/response" | ||
|
||
$mrpcPayload = "{`"datapoint`":`"${datapointName}`"}" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-mRPC.ps1") -mrpcTopic $mrpcTopic -mrpcResponseTopic $mrpcResponseTopic -mrpcPayload $mrpcPayload |
22 changes: 22 additions & 0 deletions
22
samples/media-connector-invoke-test/Invoke-GetTaskState.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<# | ||
Get the task state | ||
#> | ||
param ( | ||
[Parameter( | ||
HelpMessage="AIO namespace.")] | ||
[string]$aioNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath .aio_namespace) -Raw), | ||
[Parameter( | ||
HelpMessage="Asset name.")] | ||
[string]$assetName, | ||
[Parameter( | ||
HelpMessage="Datapoint name.")] | ||
[string]$datapointName | ||
) | ||
|
||
$mrpcTopic = "$aioNamespace/asset-operations/${assetName}/get-task-state" | ||
|
||
$mrpcResponseTopic = "$mrpcTopic/response" | ||
|
||
$mrpcPayload = "{`"datapoint`":`"${datapointName}`"}" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-mRPC.ps1") -mrpcTopic $mrpcTopic -mrpcResponseTopic $mrpcResponseTopic -mrpcPayload $mrpcPayload |
60 changes: 60 additions & 0 deletions
60
samples/media-connector-invoke-test/Invoke-ResourceInstallMonitorAndUninstall.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#Requires -Version 7 | ||
<# | ||
Install a resource pair (aep/asset), monitor it, and uninstall it. | ||
#> | ||
param ( | ||
[Parameter( | ||
Mandatory, | ||
HelpMessage="The AEP name.")] | ||
[string]$aepName = "", | ||
[Parameter( | ||
Mandatory, | ||
HelpMessage="The asset name.")] | ||
[string]$assetName = "", | ||
[Parameter( | ||
Mandatory, | ||
HelpMessage="The datapoint name.")] | ||
[string]$datapointName = "", | ||
[Parameter( | ||
Mandatory, | ||
HelpMessage="The monitor expression.")] | ||
[string]$monitorExpresion = "" | ||
) | ||
|
||
Write-Host "`n" | ||
Write-Host (Split-Path -Path $PSCommandPath -Leaf).ToUpper() -ForegroundColor White | ||
|
||
(Join-Path -Path $PSScriptRoot -ChildPath "Test-Prerequisites.ps1") | Out-Null | ||
|
||
$aioNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_namespace") -Raw).Trim() | ||
Write-Host "AIO namespace: $aioNamespace" | ||
|
||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
Write-Host "AEP Name: $aepName" | ||
|
||
Write-Host "Asset Name: $assetName" | ||
|
||
Write-Host "Datapoint Name: $datapointName" | ||
|
||
Write-Host "Installing the resource files..." | ||
. (Join-Path -Path $PSScriptRoot -ChildPath "Install-ResourceFile.ps1") -resourceFile "${aepName}.yaml" | ||
. (Join-Path -Path $PSScriptRoot -ChildPath "Install-ResourceFile.ps1") -resourceFile "${assetName}.yaml" | ||
|
||
Write-Host "Waiting for the snapshot-to-mqtt task to be ready...`n" | ||
Start-Sleep -Seconds 3 | ||
|
||
try { | ||
Write-Host "Starting the monitor command...`n" | ||
$monitorExpresion = $ExecutionContext.InvokeCommand.ExpandString(${monitorExpresion}) | ||
Invoke-Expression "${monitorExpresion}" | ||
|
||
} finally { | ||
|
||
Write-Host "Uninstalling the resource files...`n" | ||
. (Join-Path -Path $PSScriptRoot -ChildPath "Uninstall-ResourceFile.ps1") -resourceFile "${assetName}.yaml" | ||
. (Join-Path -Path $PSScriptRoot -ChildPath "Uninstall-ResourceFile.ps1") -resourceFile "${aepName}.yaml" | ||
|
||
Write-Host "Snapshot-to-mqtt task test completed.`n" | ||
} |
20 changes: 20 additions & 0 deletions
20
samples/media-connector-invoke-test/Invoke-TestClipToFsAutostart.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#Requires -Version 7 | ||
|
||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
$aepName = "aep-public-http-anonymous-1" | ||
Write-Host "AEP name: $aepName" | ||
|
||
$assetName = "asset-public-http-anonymous-1-clip-to-fs-autostart" | ||
Write-Host "Asset name: $assetName" | ||
|
||
$datapointName = "clip-to-fs" | ||
Write-Host "Datapoint name: $datapointName" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-ResourceInstallMonitorAndUninstall.ps1") ` | ||
-aepName $aepName ` | ||
-assetName $assetName ` | ||
-datapointName $datapointName ` | ||
-monitorExpresion ` | ||
". (Join-Path -Path $PSScriptRoot -ChildPath `"Start-FileSystemMonitor.ps1`") -pathToMonitor /tmp/$aioConnectorsNamespace/data/$assetName/" |
18 changes: 18 additions & 0 deletions
18
samples/media-connector-invoke-test/Invoke-TestClipToMqttAutostart.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
$aepName = "aep-public-http-anonymous-1" | ||
Write-Host "AEP name: $aepName" | ||
|
||
$assetName = "asset-public-http-anonymous-1-clip-to-mqtt-autostart" | ||
Write-Host "Asset name: $assetName" | ||
|
||
$datapointName = "clip-to-mqtt" | ||
Write-Host "Datapoint name: $datapointName" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-ResourceInstallMonitorAndUninstall.ps1") ` | ||
-aepName $aepName ` | ||
-assetName $assetName ` | ||
-datapointName $datapointName ` | ||
-monitorExpresion ` | ||
". (Join-Path -Path $PSScriptRoot -ChildPath `"Start-MqttListener.ps1`") -listenTopics $aioConnectorsNamespace/data/$assetName/#" |
20 changes: 20 additions & 0 deletions
20
samples/media-connector-invoke-test/Invoke-TestSnapshotToFsAutostart.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#Requires -Version 7 | ||
|
||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
$aepName = "aep-public-http-anonymous-1" | ||
Write-Host "AEP name: $aepName" | ||
|
||
$assetName = "asset-public-http-anonymous-1-snapshot-to-fs-autostart" | ||
Write-Host "Asset name: $assetName" | ||
|
||
$datapointName = "snapshot-to-fs" | ||
Write-Host "Datapoint name: $datapointName" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-ResourceInstallMonitorAndUninstall.ps1") ` | ||
-aepName $aepName ` | ||
-assetName $assetName ` | ||
-datapointName $datapointName ` | ||
-monitorExpresion ` | ||
". (Join-Path -Path $PSScriptRoot -ChildPath `"Start-FileSystemMonitor.ps1`") -pathToMonitor /tmp/$aioConnectorsNamespace/data/$assetName/" |
20 changes: 20 additions & 0 deletions
20
samples/media-connector-invoke-test/Invoke-TestSnapshotToMqttAutostart.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#Requires -Version 7 | ||
|
||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
$aepName = "aep-public-http-anonymous-1" | ||
Write-Host "AEP name: $aepName" | ||
|
||
$assetName = "asset-public-http-anonymous-1-snapshot-to-mqtt-autostart" | ||
Write-Host "Asset name: $assetName" | ||
|
||
$datapointName = "snapshot-to-mqtt" | ||
Write-Host "Datapoint name: $datapointName" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-ResourceInstallMonitorAndUninstall.ps1") ` | ||
-aepName $aepName ` | ||
-assetName $assetName ` | ||
-datapointName $datapointName ` | ||
-monitorExpresion ` | ||
". (Join-Path -Path $PSScriptRoot -ChildPath `"Start-MqttListener.ps1`") -listenTopics $aioConnectorsNamespace/data/$assetName/#" |
21 changes: 21 additions & 0 deletions
21
samples/media-connector-invoke-test/Invoke-TestStreamToRtspAutostart.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#Requires -Version 7 | ||
|
||
$aioConnectorsNamespace = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath ".config_aio_connectors_namespace") -Raw).Trim() | ||
Write-Host "AIO connectors namespace: $aioConnectorsNamespace" | ||
|
||
$aepName = "aep-public-http-anonymous-1" | ||
Write-Host "AEP name: $aepName" | ||
|
||
$assetName = "asset-public-http-anonymous-1-stream-to-rtsp-autostart" | ||
Write-Host "Asset name: $assetName" | ||
|
||
$datapointName = "stream-to-rtsp" | ||
Write-Host "Datapoint name: $datapointName" | ||
|
||
. (Join-Path -Path $PSScriptRoot -ChildPath "Invoke-ResourceInstallMonitorAndUninstall.ps1") ` | ||
-aepName $aepName ` | ||
-assetName $assetName ` | ||
-datapointName $datapointName ` | ||
-monitorExpresion ` | ||
". (Join-Path -Path $PSScriptRoot -ChildPath `"Start-RtspStreamViewer.ps1`") -assetName $assetName ; ` | ||
try { Write-Host `"`nHit Ctrl+C to terminate`" ; Start-Sleep -Seconds 3600 } finally { Write-Host `"`nContinuing...`n`" }" |
Oops, something went wrong.