I am looking to refine our deployment procedures. Is it possible (and if so, how) to set a protocol's Production version to be a new explicit version using an Automation Script?
Likewise, is it possible to set a specific subset of elements within a protocol to an explicit version number?
The aim here would be to set a group of elements (perhaps hosted on one DMA) to the newest version through script, then rollout slowly to the remaining agents once it had been validated.
Hello,
For setting a protocol to production, this is an example from one of our regression tests.
note: This is an internal call and we do not recommend using this, as it is not officially supported and we cannot guarantee that it will still work in the future. As a rule, you should avoid using SLNet calls, as these are subject to change without notice.
public void SetAsProduction(string protocolName,string protocolVersion,Engine engine){
SetDataMinerInfoMessage request1 = new SetDataMinerInfoMessage();
request1.bInfo1 = 2147483647;
request1.bInfo2 = 1;
request1.DataMinerID = iDMAid;
request1.ElementID = -1;
request1.HostingDataMinerID = iDMAid;
request1.IInfo1 = 2147483647;
request1.IInfo2 = 2147483647;
string[] sa = new string[2];
sa[0] = protocolName;
sa[1] = protocolVersion;
request1.Sa1 = new SA(sa);
request1.What = 55;
SetDataMinerInfoResponseMessage response = Engine.SLNet.SendSingleResponseMessage(request1) as SetDataMinerInfoResponseMessage;
if (response.iRet != 0)
{
engine.GenerateInformation("Setting protocol version not correct");
}
}
Note that changing the production version of a protocol will apply across the DMS (elements on every agent will be updated). So it won’t be possible to gradually roll out the update to elements on specific agents using this approach. You can achieve something similar by updating the elements based on their “HostingAgentId”. See the code below.
int currentDmaId = (engine.SendSLNetSingleResponseMessage(new GetInfoMessage(InfoType.LocalDataMinerInfo)) as GetDataMinerInfoResponseMessage).ID;
var elements = engine.FindElementsByProtocol(“protocolName”, “protocolVersion”);
var localElements = elements.Where(e => e.ElementInfo.HostingAgentID == currentDmaId);
foreach(var localElement in localElements) {
// update element code
}