rmp-common-library/src/main/java/org/gcube/resourcemanagement/support/server/gcube/queries/xquery/sweeper/expiredGhns.xq

27 lines
1.2 KiB
Plaintext

<!--
These are the GHNs that are declared certified and must be passed to
down status.
The choice is done by minutes elapsed from last update.
-->
let $RIs := collection("/db/Profiles/RunningInstance")//Document/Data/child::*[local-name()='Profile']/Resource
for $GHNs in collection("/db/Profiles/GHN")//Document/Data/child::*[local-name()='Profile']/Resource
let $RIinstalled := $RIs[Profile/GHN/string(@UniqueID)=$GHNs/ID]
let $scopes := string-join( $GHNs/Scopes//Scope/text(), ';')
where $GHNs/Profile/GHNDescription/Status/string() != 'down' and $GHNs/Profile/GHNDescription/Status/string() != 'unreachable'
return
<Resource>
{$GHNs/ID}
{$GHNs/Profile/GHNDescription/Name}
{$GHNs/Profile/GHNDescription/Status}
{$GHNs/Profile/GHNDescription/Type}
{$GHNs/Profile/Site/Location}
{$GHNs/Profile/Site/Domain}
<IPAddress>{$GHNs/Profile/GHNDescription/NetworkAdapter/@IPAddress/string()}</IPAddress>
<!--
Other info
-->
<Scopes>{$scopes}</Scopes>
<AllocatedRI>{count($RIinstalled)}</AllocatedRI>
{$GHNs/Profile/GHNDescription/LastUpdate}
<Actions><ACTION ISdefault ='APPLY_GHN_MOVE_TO_UNREACHABLE'/></Actions>
</Resource>