Service Virtualization

 View Only
  • 1.  Automate the process of monitoring the Stub status

    Posted Feb 22, 2019 02:38 AM

    Dear Team,

     

    I have a requirement to automate the process of monitoring the stub status and restart it if its down and send out an email notification. So do we have any inbuilt tool in devtest portal to achieve the same?

     

    Thanks,

    Ashok Chintalapudi



  • 2.  Re: Automate the process of monitoring the Stub status

    Broadcom Employee
    Posted Feb 24, 2019 09:46 AM

    HI Ashok

                     By Stub, do you mean a 'Virtual Service' ? 

    -Sankar



  • 3.  Re: Automate the process of monitoring the Stub status

    Posted Feb 25, 2019 01:54 AM

    Yes Sankar, I mean virtual service.. @



  • 4.  Re: Automate the process of monitoring the Stub status

    Posted Feb 25, 2019 06:47 AM

    You can use lisa invoke API to start a virtual service. VSEs/startVirtualService

    Create a Lisa Test having the above API and deploy it in CVS by mentioning time interval and email ID. Test will run at scheduled time and start the virtual service if it identifies that virtual service is no running.



  • 5.  Re: Automate the process of monitoring the Stub status

    Broadcom Employee
    Posted Feb 25, 2019 07:26 AM

    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'

     

    1. Request URL:
      http://<DevTest Server Hostname>:1505/api/Dcm/VSEs/<VSE NAME>/<Virtual Service Name>/actions/start
    2. Request Method:
      POST
    3. 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.



  • 6.  Re: Automate the process of monitoring the Stub status

    Broadcom Employee
    Posted Feb 25, 2019 11:55 PM

    HI Ashok

               Sorry for being persistent on this. DO you want to Monitor Virtual Service Environment (VSE) or Virtual Services that run within the VSE ?

     

    -Sankar



  • 7.  Re: Automate the process of monitoring the Stub status

    Broadcom Employee
    Posted Mar 03, 2019 09:51 AM

    HI Ashok

                    I have a fully working TESTCASE implemented that monitors all the VirtualServiceEnvironments, identifies the VirtualServices that have stopped, sends an Email to Administrator about the Virtual Service that has stopped and starts the same. The testcase has been deployed as a CVS monitor which continuously monitors the VSEs and starts Virtual Services that has stopped for whatever reason it may be.

     

    NOTE: It is strongly recommend though to inspect why the Virtual Service has gone down.

     

    Here is how the test case works:

    1. Get the list of VSEs by invoking http://localhost:1505/api/Dcm/VSEs 

    2. Filter using XPATH Query and extract the Virtual Services that are in DOWN status and need to be started

    3. Write all the Virtual services start links (from step 2 filtered list) into a .csv file

    4. Iterate through the csv file and invoke the Virtual Service Start link (Eg: http://localhost:1505/api/Dcm/VSEs/VSE/GoogleVS1/actions/start )

    5. Within the same loop an email is sent to the ADMIN about the Virtual Service that is down and that the automatic monitor has started the same.

     

    Hope this satisfies your requirement.

    -Sankar

     

     



  • 8.  Re: Automate the process of monitoring the Stub status

    Broadcom Employee
    Posted Mar 04, 2019 12:30 AM

    HI Ashok

    An Implementation has been shared here that meets your need. Please try this and let me know your feedback.

     

    Building an Active Virtual Service Monitor That Notifies ADMINs By Email When A Virtual Service Goes Down and Starts The Virtual Service Automatically 

     

    regards

    Sankar