vRealize Orchestrator StoreOnce Workflows

Um auch über neue Artikel auf Englisch informiert zu werden, einfach den neuen RSS Feed abonnieren.

 

 

Zusammen mit dem HPE StoreOnce PowerShell Module habe ich immer auch versucht die gleichen Funktionen im VMware vRealize Orchestrator als HPE StoreOnce Workflows abzubilden. Da beide Varianten die gleiche StoreOnce REST API nutzen, ist es praktisch beides parallel zu entwickeln.

Für den Einstig in das Thema kann ich zwei Lektüren sehr empfehlen:

Ich habe die HPE StoreOnce Workflows unter folgenden Konstellationen getestet:

  • StoreOnce Software Version 3.13
  • VMware vRealize Orchestrator 6.0.2, 7.0.1
    • REST plug-in for vRealize Orchestrator 1.0.8, 2.0.1
Warum überhaupt beide Varianten?
Ich verwende die vRealize Orchestrator HPE StoreOnce Workflows in verschiedenen VMware vRealize Automation XaaS Elementen sowie in einem übergreifenden Workflow zur zentralen Kostenerfassung. Das StoreOnce PowerShell Modul wiederum für alle weiteren Integrationen wie z.B. in dem vSphere vCheck und in Paesler PRTG Sensoren aber auch für das normale Operations.

HPE StoreOnce Workflows – Übersicht

vRealize Orchestrator HPE StoreOnce Workflows

Download Package

 

 

VMware Developer Center

 

 

Ich habe die HPE StoreOnce Workflows in drei Kategorien geteilt:

  • Report
  • Create
  • Config
Reports über den aktuellen Bestand, z.B. Catalyst Stores oder Catalyst Clients
Erstellen neuer StoreOnce Objekte, z.B. Catalyst Stores oder Catalyst Clients
Anpassen bestehender StoreOnce Objekte, z.B. Catalyst Stores oder Catalyst Clients

HPE StoreOnce Actions – Übersicht

actions

Die Actions verwende ich hauptsächlich für die Input Presentation einiger Workflows.

HPE StoreOnce Workflows – Report

Reports über den aktuellen Bestand, z.B. Catalyst Stores oder Catalyst Clients.

Get-SOSIDs

HPE StoreOnce Workflows - Get-SOSIDs

Get-SOSIDs – Schema

//Base Request
var Request = SO_Host.createRequest("GET", '/cluster/servicesets/' , null);
Request.setHeader('Accept', 'text/xml');
var Response = Request.execute();
var Response_XML = new XML(Response.contentAsString)

//Get StoreOnce Service Sets
var servicesets = Response_XML.servicesets.serviceset
var servicesets_Count = servicesets.length();
System.log (servicesets_Count + " SIDs on REST Host: " + SO_Host.name);

//Get StoreOnce Service Set Details
var ssid = Response_XML.servicesets.serviceset.properties.ssid;
var name = Response_XML.servicesets.serviceset.properties.name;
var serialNumber = Response_XML.servicesets.serviceset.properties.serialNumber;
var softwareVersion = Response_XML.servicesets.serviceset.properties.softwareVersion;
var overallHealth = Response_XML.servicesets.serviceset.properties.overallHealth;
var overallStatus = Response_XML.servicesets.serviceset.properties.overallStatus;
var capacityBytes = Response_XML.servicesets.serviceset.properties.capacityBytes;
var freeBytes = Response_XML.servicesets.serviceset.properties.freeBytes;
var userBytes = Response_XML.servicesets.serviceset.properties.userBytes;
var diskBytes = Response_XML.servicesets.serviceset.properties.diskBytes;

var SOServiceSets = new Array();
for (var i = 0; i < servicesets_Count; i++) {
	var ServiceSet = new Object();
	ServiceSet.ssid = String(ssid[i]);
	ServiceSet.name = String(name[i]);
	ServiceSet.serialNumber = String(serialNumber[i]);
	ServiceSet.softwareVersion = String(softwareVersion[i]);
	ServiceSet.overallHealth = String(overallHealth[i]);
	ServiceSet.overallStatus = String(overallStatus[i]);
	ServiceSet.capacityBytes = Number(capacityBytes[i]);
	ServiceSet.freeBytes = Number(freeBytes[i]);
	ServiceSet.userBytes = Number(userBytes[i]);
	ServiceSet.diskBytes = Number(diskBytes[i]);

	SOServiceSets.push(ServiceSet)
}

for (i=0;i<SOServiceSets.length;i++){
	System.debug("SSID: " + SOServiceSets[i].ssid);
	System.debug("Name: " + SOServiceSets[i].name);
	System.debug("serialNumber: " + SOServiceSets[i].serialNumber);
	System.debug("softwareVersion: " + SOServiceSets[i].softwareVersion);
	System.debug("overallHealth: " + SOServiceSets[i].overallHealth);
	System.debug("overallStatus: " + SOServiceSets[i].overallStatus);
	var capacityGBytes = Math.round((SOServiceSets[i].capacityBytes) / 1073741824);
	System.debug("capacityGBytes: " + capacityGBytes);
	var freeGBytes = Math.round((SOServiceSets[i].freeBytes) / 1073741824);
	System.debug("freeGBytes: " + freeGBytes);
	var userGBytes = Math.round((SOServiceSets[i].userBytes) / 1073741824);
	System.debug("userGBytes: " + userGBytes);
	var diskGBytes = Math.round((SOServiceSets[i].diskBytes) / 1073741824);
	System.debug("diskGBytes: " + diskGBytes);
	}

Get-SOCatStores

HPE StoreOnce Workflows - Get-SOCatStores

Get-SOCatStores – Schema

var SOCatStores = new Array();
for (var i = 1; i <= SOServiceSets.length; i++) {
	//Base Request
	var Request = SO_Host.createRequest("GET", '/cluster/servicesets/' + i + '/services/cat/stores/' , null);
	Request.setHeader('Accept', 'text/xml');
	var Response = Request.execute();
	var Response_XML = new XML(Response.contentAsString)
	//Get all StoreOnce Catalyst Stores
	var stores = Response_XML.stores.store.properties
	var stores_Count = stores.length();
	System.log (stores_Count + " Stores On SID " + i)
	//Get all StoreOnce Catalyst Stores Details
	var ssid = Response_XML.stores.store.properties.ssid;
	var name = Response_XML.stores.store.properties.name;
	var id = Response_XML.stores.store.properties.id;
	var status = Response_XML.stores.store.properties.status;
	var health = Response_XML.stores.store.properties.health;
	var userdatastored = Response_XML.stores.store.properties.userdatastored;
	var sizeondisk = Response_XML.stores.store.properties.sizeondisk;
	var deduperatio = Response_XML.stores.store.properties.deduperatio;
	//Fix duplicate Dedup Rates
	for(var k = 0; k < deduperatio.length; k++) {
	    deduperatio.splice(k+1,2);
	}
	//Push details to output array
	for (var j = 0; j < stores_Count; j++) {
		var SOCatStore = new Object();
		SOCatStore.ssid = String(ssid[j]);
		SOCatStore.name = String(name[j]);
		SOCatStore.id = String(id[j]);
		SOCatStore.status = String(status[j]);
		SOCatStore.health = String(health[j]);
		SOCatStore.userdatastored = Number(userdatastored[j]);
		SOCatStore.sizeondisk = Number(sizeondisk[j]);
		SOCatStore.deduperatio = Number(deduperatio[j]);
		
		SOCatStores.push(SOCatStore); 
	}
}

for (i=0;i<SOCatStores.length;i++){
	System.debug("SSID: " + SOCatStores[i].ssid)
	System.debug("name: " + SOCatStores[i].name);
	System.debug("id: " + SOCatStores[i].id);
	System.debug("status: " + SOCatStores[i].status);
	System.debug("health: " + SOCatStores[i].health);
	System.debug("userdatastored: " + SOCatStores[i].userdatastored);
	System.debug("sizeondisk: " + SOCatStores[i].sizeondisk);
	System.debug("deduperatio: " + SOCatStores[i].deduperatio);
	
	}

Get-SOCatClients

HPE StoreOnce Workflows - Get-SOCatClients

Get-SOCatClients – Schema

var SOCatClients = new Array();
for (var i = 1; i <= SOServiceSets.length; i++) {
	//Base Request
	var Request = SO_Host.createRequest("GET", '/cluster/servicesets/' + i + '/services/cat/configs/clients/' , null);
	Request.setHeader('Accept', 'text/xml');
	var Response = Request.execute();
	var Response_XML = new XML(Response.contentAsString)
	//Get all StoreOnce Catalyst Clients
	var clients = Response_XML.clients.client
	var clients_Count = clients.length();
	System.log (clients_Count + " clients On SID " + i)
	//Get all StoreOnce Catalyst Client Details
	var name = Response_XML.clients.client.properties.name;
	var id = Response_XML.clients.client.properties.id;
	var description = Response_XML.clients.client.properties.description;
	var canCreateStores = Response_XML.clients.client.properties.canCreateStores;
	var canSetServerProperties = Response_XML.clients.client.properties.canSetServerProperties;
	var canManageClientPermissions = Response_XML.clients.client.properties.canManageClientPermissions;
	//Push details to output array
	for (var j = 0; j < clients_Count; j++) {
		var SOCatClient = new Object();
		SOCatClient.ssid = i;
		SOCatClient.name = String(name[j]);
		SOCatClient.id = String(id[j]);
		SOCatClient.description = String(description[j]);
		SOCatClient.canCreateStores = String(canCreateStores[j]);
		SOCatClient.canSetServerProperties = String(canSetServerProperties[j]);
		SOCatClient.canManageClientPermissions = String(canManageClientPermissions[j]);
		
		SOCatClients.push(SOCatClient); 
	}
}

for (i=0;i<SOCatClients.length;i++){
	System.debug("ssid: " + SOCatClients[i].ssid);
	System.debug("name: " + SOCatClients[i].name);
	System.debug("id: " + SOCatClients[i].id);
	System.debug("description: " + SOCatClients[i].description);
	System.debug("canCreateStores: " + SOCatClients[i].canCreateStores);
	System.debug("canSetServerProperties: " + SOCatClients[i].canSetServerProperties);
	System.debug("canManageClientPermissions: " + SOCatClients[i].canManageClientPermissions);
	
	}

HPE StoreOnce Workflows – Create

Erstellen neuer StoreOnce Objekte, z.B. Catalyst Stores oder Catalyst Clients.

New-SOCatStore

HPE StoreOnce Workflows - New-SOCatStore

New-SOCatStore – Schema

HPE StoreOnce Workflows - New-SOCatStore Presentation

New-SOCatStore – Presentation

System.log ("Creating new Catralyst Store on SID " + SO_SID + " from Device: " + SO_Host.Name);

//Base Request
var data = "name=" + SO_CatStoreName + "&description=" + SO_CatStoreDesc;
	data += "&primaryTransferPolicy=0";
	data += "&secondaryTransferPolicy=1";
	data += "&userDataSizeLimitBytes=0";
	data += "&dedupedDataSizeOnDiskLimitBytes=0";
	data += "&dataJobRetentionDays=90";
	data += "&inboundCopyJobRetentionDays=90";
	data += "&outboundCopyJobRetentionDays=90";
	data += "&encryption=false";

var Request = SO_Host.createRequest("POST", '/cluster/servicesets/' + SO_SID + '/services/cat/stores/' , data);
Request.setHeader('Content-Type', 'application/x-www-form-urlencoded');
Request.setHeader('Accept', 'text/xml');

var Response = Request.execute();
var Response_XML = new XML(Response.contentAsString);

System.debug (Response_XML);

Für die Stores setze ich folgende Standardeinstellungen:
primaryTransferPolicy=0
[1 for Low Bandwidth, 0 for High Bandwidth]
secondaryTransferPolicy=1
[1 for Low Bandwidth, 0 for High Bandwidth]
userDataSizeLimitBytes=0
dedupedDataSizeOnDiskLimitBytes=0
dataJobRetentionDays=90
inboundCopyJobRetentionDays=90
outboundCopyJobRetentionDays=90
encryption=false

New-SOCatClient

HPE StoreOnce Workflows - New-SOCatClient

New-SOCatClient – Schema

HPE StoreOnce Workflows - New-SOCatClient Presentation

New-SOCatClient – Presentation

System.log ("Creating new Catralyst Client " + SO_CatClientName + " on " + SO_ServiceSetIDs.length + " SIDs from Device: " + SO_Host.Name);

//Build Request Properties
var data = "name=" + SO_CatClientName + "&description=" + SO_CatClientDesc + "&password=" + SO_CatClentPass;
	data += "&canCreateStores=false";
	data += "&canSetServerProperties=false";
	data += "&canManageClientPermissions=false";

//Base Request for each SID
for (var i = 1; i <= SO_ServiceSetIDs.length; i++) {
	var Request = SO_Host.createRequest("POST", '/cluster/servicesets/' + i + '/services/cat/configs/clients/' , data);
	Request.setHeader('Content-Type', 'application/x-www-form-urlencoded');
	Request.setHeader('Accept', 'text/xml');
	
	var Response = Request.execute();
	var Response_XML = new XML(Response.contentAsString);
	
	System.debug (Response_XML);
}

HPE StoreOnce Workflows – Config

Anpassen bestehender StoreOnce Objekte, z.B. Catalyst Stores oder Catalyst Clients.

Set-SOCatClientAccess

HPE StoreOnce Workflows - Set-SOCatClientAccess

Set-SOCatClientAccess – Schema

HPE StoreOnce Workflows - Set-SOCatClientAccess Presentation

Set-SOCatClientAccess – Presentation

HPE StoreOnce Workflows - Set-SOCatClientAccess Presentation SO-CatClient

Set-SOCatClientAccess – Presentation SO-CatClient

HPE StoreOnce Workflows - Set-SOCatClientAccess Presentation SO-CatStore

Set-SOCatClientAccess – Presentation SO-CatStore

HPE StoreOnce Workflows - Set-SOCatClientAccess Presentation SO-ID

Set-SOCatClientAccess – Presentation SO-ID

var SO_CatStore_Split = SO_CatStore.split("--");
System.log ("CatStore ID: " + SO_CatStore_Split[0]);
System.log ("CatStore Name: " + SO_CatStore_Split[1]);
var SO_CatClient_Split = SO_CatClient.split("--");
System.log ("CatClient ID: " + SO_CatClient_Split[0]);
System.log ("CatClient Name: " + SO_CatClient_Split[1]);

System.log ("Grant Catalyst Store " + SO_CatStore_Split[1]  + " access to " +  SO_CatClient_Split[1] + " on SID " + SO_SID + " from Device: " + SO_Host.Name);

//Base Request
var data = "allowAccess=true";
var Request = SO_Host.createRequest("PUT", '/cluster/servicesets/' + SO_SID + '/services/cat/stores/' + SO_CatStore_Split[0] + '/permissions/' + SO_CatClient_Split[0], data);
Request.setHeader('Content-Type', 'application/x-www-form-urlencoded');
Request.setHeader('Accept', 'text/xml');

var Response = Request.execute();
var Response_XML = new XML(Response.contentAsString);

System.debug (Response_XML);

HPE StoreOnce Actions

Wie bereits erwähnt, verwende ich die Actions hauptsächlich für die Input Presentation einiger Workflows. Ausgabe ist immer ein String oder String-Array.

Get_SOCatClientNames

//Base Request
var Request = SO_Host.createRequest("GET", '/cluster/servicesets/' + SO_SID + '/services/cat/configs/clients/' , null);
Request.setHeader('Accept', 'text/xml');
var Response = Request.execute();
var Response_XML = new XML(Response.contentAsString)

//Get all StoreOnce Catalyst Client Details
var id = Response_XML.clients.client.properties.id;
var name = Response_XML.clients.client.properties.name;

//Push details to output array
var SOCatClientNames = new Array()
for (var i = 0; i < name.length(); i++) {
	myname = String(id[i] + "--" + name[i]);
	SOCatClientNames.push(myname); 
}

return SOCatClientNames

Get_SOServiceSetIDs

//Base Request
var Request = SO_Host.createRequest("GET", '/cluster/servicesets/' , null);
Request.setHeader('Accept', 'text/xml');
var Response = Request.execute();
var Response_XML = new XML(Response.contentAsString)

//Get StoreOnce Service Sets
var servicesets = Response_XML.servicesets.serviceset
var servicesets_Count = servicesets.length();
System.log (servicesets_Count + " SIDs on REST Host: " + SO_Host.name);

//Get StoreOnce Service Set Details
var ssid = Response_XML.servicesets.serviceset.properties.ssid;

var SOServiceSetIDs = new Array();
for (var i = 0; i < servicesets_Count; i++) {
	var myssid = String(ssid[i]);

	SOServiceSetIDs.push(myssid)
}

return SOServiceSetIDs

Get_SOCatStoreNames

//Base Request
var Request = SO_Host.createRequest("GET", '/cluster/servicesets/' + SO_SID + '/services/cat/stores/' , null);
Request.setHeader('Accept', 'text/xml');
var Response = Request.execute();
var Response_XML = new XML(Response.contentAsString)

//Get all StoreOnce Catalyst Stores Details
var id = Response_XML.stores.store.properties.id;
var name = Response_XML.stores.store.properties.name;

//Push details to output array
var SOCatStoresNames = new Array()
for (var j = 0; j < name.length(); j++) {
	myname = String(id[j] + "--" + name[j]);
	SOCatStoresNames.push(myname); 
}

return SOCatStoresNames

 

Share with:

Leave a Reply