DummyHealthEvents.ps1


#CREATE
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    "lpszEntityType", `
    "lpszEntityKey", `
    "lpszEntityDescription", `
    "lpszEntityLocation", `
    "lpszEntityUniqueKey", `
    0, `
    "lpszFaultType", `
    0, `
    "lpszTitle", `
    "lpszDescription", `
    "lpszActions", `
    0)
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyRelationship(
    "lpszEntityType", `
    "lpszEntityKey", `
    "lpszEntityDescription", `
    "lpszEntityLocation" , `
    "lpszEntityUniqueKey", `
    0, `
    $entityTypeSubSystem, ` #lpszParentEntityType
    $subsystemId, ` # lpszParentEntityKey
    "lpszParentEntityDescription", `
    "lpszParentEntityLocation", `
    $subsystemId, ` #lpszParentEntityUniqueKey
    "lpszGroupKey", `
    2, `
    3, `
    0)

    $FaultingObjectUniqueId = "lpszEntityKey"

    [bool] $done = 0
    do {
         $f = Get-SDNHealthFault -FaultingObjectUniqueId $FaultingObjectUniqueId
         if($f -eq $Null) 
         {
            Write-Host "Fault $FaultingObjectUniqueId is NOT available.."           
         }
         else {
            Write-Host "Fault $FaultingObjectUniqueId available."
         }
         Start-Sleep -Seconds 1
    }until($done)


#DELETE
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    "lpszEntityType", `
    "lpszEntityKey", `
    "lpszEntityDescription", `
    "lpszEntityLocation", `
    "lpszEntityUniqueKey", `
    0, `
    "lpszFaultType", `
    2, `
    "lpszTitle", `
    "lpszDescription", `
    "lpszActions", `
    0)
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    "lpszEntityType", ` # NOT-OPT for DELETE
    "lpszEntityKey", ` # NOT-OPT for DELETE
    "",  `
    "", `
    "", `
    1, `
    "lpszFaultType", `
    2, `
    "", `
    "", `
    "", `
    0)






-----------------------
PSShowComputerName        : True
PerceivedSeverity         : Critical failure
FaultId                   : {07a7c41d-5b17-4563-a5bb-3a955fe66549}
FaultingObjectDescription : Communication failure when establishing connection with host. Please check that only self-signed certificates are present in the trusted root of the host.
FaultingObjectLocation    : 0dcc0704-df95-4a50-8b87-aff998dfe449
FaultingObjectType        : servers
FaultingObjectUniqueId    : servers\0dcc0704-df95-4a50-8b87-aff998dfe449
FaultTime                 : 9/27/2024 2:27:28 PM
FaultType                 : restapiFaultTypeId
Reason                    : Communication failure when establishing connection with host. Please check that only self-signed certificates are present in the trusted root of the host.
RecommendedActions        : {Please contact system administrator}
PSComputerName            : 
CimClass                  : root/mscluster:MSCluster_HealthFault
CimInstanceProperties     : {FaultId, FaultingObjectDescription, FaultingObjectLocation, FaultingObjectType...}
CimSystemProperties       : Microsoft.Management.Infrastructure.CimSystemProperties


$entityType = "SDN-servers"
$entityId = "SDN-servers\\0dcc0704-df95-4a50-8b87-aff998dfe449"
$faultType = "restapiFaultTypeId"
$subsystemId = (get-storagesubsystem Cluster*).UniqueId
$entityTypeSubSystem = "Microsoft.Health.EntityType.Subsystem"
$entityLocation = "0dcc0704-df95-4a50-8b87-aff998dfe449"

[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    $entityType, `
    $entityId, `
    "E Desc", `
    $entityLocation, `
    $entityId, `
    1, `
    $faultType, `
    2, `
    "TF Title", `
    "TF Desc", `
    "TFA", `
    0)
    
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyRelationship(
    $entityType, `
    $entityId, `
    $entityLocation, `
    $null, `
    $entityId, `
    1, `
    $entityTypeSubSystem, `
    $subsystemId, `
    $null, `
    $null, `
    $subsystemId, `
    "TestGroupKey", `
    2, `
    3, `
    0)





$entityType = "SDN-servers"
$entityId = "SDN-servers\\0dcc0704-df95-4a50-8b87-aff998dfe449"
$faultType = "restapiFaultTypeId"
$subsystemId = (get-storagesubsystem Cluster*).UniqueId
$entityTypeSubSystem = "Microsoft.Health.EntityType.Subsystem"
$entityLocation = "0dcc0704-df95-4a50-8b87-aff998dfe449"

# CREATE FAULT
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    $entityType, `
    $entityId, `
    "E Desc", `
    $entityLocation, `
    $entityId, `
    0, `
    $faultType, `
    2, `
    "TF Title", `
    "TF Desc", `
    "TFA", `
    0)

# CREATE RELATIONSHIP
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyRelationship(
    $entityType, `
    $entityId, `
    $entityLocation, `
    $null, `
    $entityId, `
    0, `
    $entityTypeSubSystem, `
    $subsystemId, `
    $null, `
    $null, `
    $subsystemId, `
    "TestGroupKey", `
    2, `
    3, `
    0)


# DELETE FAULT
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    $entityType, `
    $entityId, `
    "", `
    $entityLocation, `
    $entityId, `
    1, `
    $faultType, `
    2, `
    "", `
    "", `
    "", `
    0)
# delete SDN One (WORKING)
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    "networkInterfaces", `
    "51a8398b-GW1.CFDEV.NTTEST.MICROSOFT.COM_BackEnd", `
    "", `
    "51a8398b-GW1.CFDEV.NTTEST.MICROSOFT.COM_BackEnd", `
    "51a8398b-GW1.CFDEV.NTTEST.MICROSOFT.COM_BackEnd", `
    1, `
    "restapiFaultTypeId", `
    2, `
    "", `
    "", `
    "", `
    0)

    [Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyFault( `
    "servers", `
    "servers\\0dcc0704-df95-4a50-8b87-aff998dfe449", `
    "", `
    "servers\\0dcc0704-df95-4a50-8b87-aff998dfe449", `
    "servers\\0dcc0704-df95-4a50-8b87-aff998dfe449", `
    1, `
    "restapiFaultTypeId", `
    2, `
    "", `
    "", `
    "", `
    0)




# DELETE RELATIONSHIP
[Microsoft.NetworkHud.FunctionalTests.Module.HciHealthUtils]::HciModifyRelationship(
    $entityType, `
    $entityId, `
    $entityLocation, `
    $null, `
    $entityId, `
    1, `
    $entityTypeSubSystem, `
    $subsystemId, `
    $null, `
    $null, `
    $subsystemId, `
    "TestGroupKey", `
    2, `
    3, `
    0)