Hi Ashok
There are few different ways by which, this could be achieved. Lets look at the options that we have.
If your requirement is to just keep track of few VirtualServices that are accessible over HTTP, then you could have a simple test case which does a HTTP get using the port of the Virtual Service and have a few assertions to validate HTTP response code to invoke a 'Send Email Step'. I have quickly validated this and found this working well. The test case has been deployed as a Monitor with 1 minute interval. That means, every minute the test case will run and notify the admin via email. In this simple case, I havent added the ability to start the Virtual Service if it is down.
Emails Received:
As I said, this is a plain, simple case where we constantly check on a specific port of Virtual Service.
The better and more generic approach would be to have a test case written that uses LISA INVOKE 2.0 REST APIs.
To invoke the method to get current status of all Virtual Services running across all VSEs, the following method could be used:
http://<devtest server hostname>:1505/api/Dcm/VSEs
The output from this method would look like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<VseList
xmlns="http://www.ca.com/lisa/invoke/v2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/lisa/invoke/v2.0 VseList.xsd" href="http://localhost:1505/api/Dcm/VSEs" type="application/vnd.ca.lisaInvoke.vseList+xml">
<Vse name="VSE" href="http://localhost:1505/api/Dcm/VSEs/VSE" type="application/vnd.ca.lisaInvoke.vse+xml">
<ConsoleURL>http://NATSA03-7520:1505</ConsoleURL>
<HostAddress>NATSA03-7520</HostAddress>
<VirtualServiceList href="http://localhost:1505/api/Dcm/VSEs/VSE" type="application/vnd.ca.lisaInvoke.virtualServiceList+xml">
<VirtualService name="GoogleVS1" href="http://localhost:1505/api/Dcm/VSEs/VSE/GoogleVS1" type="application/vnd.ca.lisaInvoke.virtualService+xml">
<ModelName>GoogleVS1</ModelName>
<EndTime>1970-01-01 05:30:00</EndTime>
<Capacity>1</Capacity>
<UpTime>0:11:08</UpTime>
<TransactionsPerSecond>0</TransactionsPerSecond>
<TransactionCount>0</TransactionCount>
<PeakTransactionsPerSecond>0</PeakTransactionsPerSecond>
<ThinkScale>100</ThinkScale>
<ErrorCount>0</ErrorCount>
<AutoRestartEnabled>true</AutoRestartEnabled>
<Status>2</Status>
<StartTime>2019-02-25 17:12:21</StartTime>
<ExecutionMode>Most Efficient</ExecutionMode>
<ConfigurationName>C:\PROGRA~1\CA\DevTest\lisatmp_10.4.0\lads\69362DA438F211E9B5F6E89EB42804A2\BASELINE_TEST\Configs\project.config</ConfigurationName>
<GroupTag></GroupTag>
<ResourceName>37856 : http : : /</ResourceName>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/GoogleVS1/actions" rel="down"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/GoogleVS1/actions/start" rel="start"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/GoogleVS1/actions/stop" rel="stop"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/GoogleVS1/actions/resetCounts" rel="resetCounts"/>
</VirtualService>
<VirtualService name="S1" href="http://localhost:1505/api/Dcm/VSEs/VSE/S1" type="application/vnd.ca.lisaInvoke.virtualService+xml">
<ModelName>S1</ModelName>
<EndTime>1970-01-01 05:30:00</EndTime>
<Capacity>1</Capacity>
<UpTime>0</UpTime>
<TransactionsPerSecond>0</TransactionsPerSecond>
<TransactionCount>0</TransactionCount>
<PeakTransactionsPerSecond>0</PeakTransactionsPerSecond>
<ThinkScale>100</ThinkScale>
<ErrorCount>0</ErrorCount>
<AutoRestartEnabled>true</AutoRestartEnabled>
<Status>0</Status>
<StartTime>1970-01-01 05:30:00</StartTime>
<ExecutionMode>Most Efficient</ExecutionMode>
<ConfigurationName>C:\PROGRA~1\CA\DevTest\lisatmp_10.4.0\lads\696442A238F211E9B5F6E89EB42804A2\BASELINE_TEST\Configs\project.config</ConfigurationName>
<GroupTag></GroupTag>
<ResourceName>17032 : http : : /</ResourceName>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions" rel="down"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions/start" rel="start"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions/stop" rel="stop"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions/resetCounts" rel="resetCounts"/>
</VirtualService>
<VirtualService name="a1" href="http://localhost:1505/api/Dcm/VSEs/VSE/a1" type="application/vnd.ca.lisaInvoke.virtualService+xml">
<ModelName>a1</ModelName>
<EndTime>1970-01-01 05:30:00</EndTime>
<Capacity>1</Capacity>
<UpTime>0:00:57</UpTime>
<TransactionsPerSecond>0</TransactionsPerSecond>
<TransactionCount>1</TransactionCount>
<PeakTransactionsPerSecond>1</PeakTransactionsPerSecond>
<ThinkScale>100</ThinkScale>
<ErrorCount>0</ErrorCount>
<AutoRestartEnabled>true</AutoRestartEnabled>
<Status>2</Status>
<StartTime>2019-02-25 17:22:32</StartTime>
<ExecutionMode>Most Efficient</ExecutionMode>
<ConfigurationName>C:\PROGRA~1\CA\DevTest\lisatmp_10.4.0\lads\D5C4498438F311E9B5F6E89EB42804A2\BASELINE_TEST\Configs\project.config</ConfigurationName>
<GroupTag></GroupTag>
<ResourceName>20392 : http : : /</ResourceName>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/a1/actions" rel="down"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/a1/actions/start" rel="start"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/a1/actions/stop" rel="stop"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/a1/actions/resetCounts" rel="resetCounts"/>
</VirtualService>
</VirtualServiceList>
<LifetimeTransactionCount>110</LifetimeTransactionCount>
<RollingTransactionCount>108</RollingTransactionCount>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/actions" rel="down"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/actions/deployMar" rel="start"/>
</Vse>
</VseList>
You could Iterate over the XML response and identify the Virtual Services that are not up (Status != 2) and have them started using the following method. In addition, you could send an email using 'Send Email Step'
Request URL:
http://<DevTest Server Hostname>:1505/api/Dcm/VSEs/<VSE NAME>/<Virtual Service Name>/actions/start
Request Method:
POST
- Response:<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<VirtualService
xmlns="http://www.ca.com/lisa/invoke/v2.0" name="S1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/lisa/invoke/v2.0 VirtualService.xsd" href="http://localhost:1505/api/Dcm/VSEs/VSE/S1" type="application/vnd.ca.lisaInvoke.virtualService+xml">
<ModelName>S1</ModelName>
<EndTime>1970-01-01 05:30:00</EndTime>
<Capacity>1</Capacity>
<UpTime>0</UpTime>
<TransactionsPerSecond>0</TransactionsPerSecond>
<TransactionCount>0</TransactionCount>
<PeakTransactionsPerSecond>0</PeakTransactionsPerSecond>
<ThinkScale>100</ThinkScale>
<ErrorCount>0</ErrorCount>
<AutoRestartEnabled>true</AutoRestartEnabled>
<Status>2</Status>
<StartTime>2019-02-25 17:48:09</StartTime>
<ExecutionMode>Most Efficient</ExecutionMode>
<ConfigurationName>C:\PROGRA~1\CA\DevTest\lisatmp_10.4.0\lads\628D102038F711E9855FE89EB42804A2\BASELINE_TEST\Configs\project.config</ConfigurationName>
<GroupTag></GroupTag>
<ResourceName>17032 : http : : /</ResourceName>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions" rel="down"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions/start" rel="start"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions/stop" rel="stop"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/actions/resetCounts" rel="resetCounts"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/sessions" rel="sessions"/>
<Link href="http://localhost:1505/api/Dcm/VSEs/VSE/S1/events" rel="events"/>
</VirtualService>
To get the list of all the available LISA Invoke 2.0 REST APIs, just point your browser to the following URL, you would be able to get complete details as well as try these methods right there.
http://<Devtest server hostname>:1505/api/swagger/#!/VSEs
Please let me know if this answers your question.