DX NetOps

  • 1.  Automating the addition of SPM tests

    Posted Feb 01, 2012 04:05 AM
    Hi All,

    I've been looking at the /connect API and been wondering if anyone has managed to automate adding response tests at all?

    It seems to be possible but I think there are many models with children and not sure how these are linked. I need to create a mesh of tests (ICMP) and doing it manually can take some time since each device needs to do an ICMP test to each other device. with 40+ devices that is a lot of tests!

    Anyone have any ideas how this can be done, or perhaps have already ventured down this road?

    Regards,

    Frank


  • 2.  RE: Automating the addition of SPM tests

    Posted Feb 01, 2012 07:47 AM

    franktonjes wrote:

    Hi All,

    I've been looking at the /connect API and been wondering if anyone has managed to automate adding response tests at all?

    It seems to be possible but I think there are many models with children and not sure how these are linked. I need to create a mesh of tests (ICMP) and doing it manually can take some time since each device needs to do an ICMP test to each other device. with 40+ devices that is a lot of tests!

    Anyone have any ideas how this can be done, or perhaps have already ventured down this road?

    Regards,

    Frank
    Frank, I've not used the API, but I've done bulk creation of SPM tests with CLI before.
    I had a SystemEDGE server but you should be able to sub in your relevant source IPs.
    Here's a write-up:

    The following example describes how to use a spreadsheet program to generate a set of CLI commands to create SPM tests.
    The example is for a DNS lookup test; different tests will have different fields, but the concepts should be similar.
    The Spectrum attributes shown are the minimum attributes required in order to create a DNS lookup test with the CLI.

    1.
    Create an Excel spreadsheet with the following columns:
    A – Destination Name – this is the name of the server or device to test
    B – Test Type – for DNS lookup tests, the test type is 4
    C – Source IP – this is the IP address of your SystemEDGE server, which will run the tests
    D – Destination IP – This is the target IP address for the host in column A
    E – Lookup Address – this is the DNS lookup to be performed
    F – Latency Timeout (ms) – enter a value in milliseconds for the test to timeout
    G – Schedule State – enter 1 to enable the test to run on the default 24/7 schedule
    H – Repeat Interval (s) – enter a value in seconds for the test to repeat
    I – Command – this column will build the CLI commands using a formula
    J – Model Handle – this column will hold the created test model handles

    2.
    Populate cells in columns A,B,C,D,E,F,G,H with test values, starting in row 2.

    3.
    In cell I2, add the formula shown (the formula should be entered on a single line, with all double-quote characters entered exactly as shown):
    =CONCATENATE( "create model mth=0x4560000
    attr=0x1006e,val=""", A2, "_Internal DNS Lookup""
    attr=0x4560005,val=", B2, " attr=0x4560006,val=", C2,
    " attr=0x456001f,val=", D2, " attr=0x456000a,val=", E2,
    " attr=0x4560025,val=", F2, " attr=0x4560022,val=", G2,
    " attr=0x4560014,val=", H2, " >> TestCreation.log"

    4.
    Fill down the column. This creates the CLI commands that will be required to create the tests in bulk.
    create model mth=0x4560000
    attr=0x1006e,val="server1_Internal DNS Lookup"
    attr=0x4560005,val=4 attr=0x4560006,val=10.120.16.25
    attr=0x456001f,val=10.64.8.63 attr=0x456000a,val=www.url.com
    attr=0x4560025,val=10000 attr=0x4560022,val=1
    attr=0x4560014,val=600 >> TestCreation.log

    5.
    Copy column I to a CLI script; ensure that you enclose all the create commands within connect and disconnect commands.
    6.
    Execute the CLI script
    7.
    Paste the contents of TestCreation.log in column J, and save the spreadsheet for your records.

    HTH,
    --Mark S

    Mark Serencha – Inforonics Global Services, LLC – (m) +1-781-439-0519 – Mark.Serencha_AT_inforonics.com


  • 3.  Re: Automating the addition of SPM tests

    Posted Oct 26, 2018 01:16 PM

    I use Spectrum to create SystemEdge tests (which often ends up somehow deleting all my tests or adding many duplicate tests, CA please look into this). Once Spectrum works properly, its actually quite easy to make a clone of an existing test and just change the IP that you want to test to.



  • 4.  Re: Automating the addition of SPM tests

    Posted Nov 21, 2018 04:42 PM

    Thanks,

     

    I have managed to do this a few days after I raised the question.

     

    The idea was to simply create the tests using the REST API. All you are effectively doing is creating a model for each test.

     

    You can do it via 'POST' REST API by creating a long string containing all the model information:

     

    The tests here were from our MLS ($mlsMh). Other variables:

     

    $modelName is the name of the test

    $ip is the destination IP addres

    $description is a description for the test

    $scheduleMh is the model handle of the Schedule to be used (if you want it scheduled)

    $priMlsIp I think was the source IP address

     

    my $url = "http://oneclick:port/spectrum/restulf/model?landscapeid=$mlsMh".
    "&attr=0x1006e&val=$modelName".
    "&mtypeid=0x4560000".
    "&attr=0x4560005&val=0".
    "&attr=0x456001f&val=$ip".
    "&attr=0x4560014&val=60".
    "&attr=0x456002a&val=$description".
    "&attr=0x4560068&val=1".
    "&attr=0x4560067&val=64".
    "&attr=0x4560016&val=450".
    "&attr=0x456009b&val=500".
    "&attr=0x456009c&val=2000".
    "&attr=0x456009d&val=5000".
    "&attr=0x4560026&val=1".
    "&attr=0x4560027&val=2".
    "&attr=0x4560017&val=449".
    "&attr=0x456002c&val=15".
    "&attr=0x456009e&val=20".
    "&attr=0x456009f&val=80".
    "&attr=0x45600a0&val=100".
    "&attr=0x456002d&val=1".
    "&attr=0x456002f&val=2".
    "&attr=0x456002e&val=19".
    "&attr=0x456008f&val=$scheduleMh".
    "&attr=0x45600f1&val=$priMlsIp".
    "&attr=0x45600f2&val=$priMlsIp".
    "&attr=0x4560034&val=1".
    "&attr=0x4560022&val=1".
    "&attr=0x4560035&val=1".
    "&attr=0x1134e&val=1".
    "&attr=0x10009&val=ADMIN";

     

    If the model is correctly created you should get the usual 'create-model-response' of 'Success'.

     

    This just creates the test. I then had to create associations between the test and the Schedule model (I used the 24/7 one) and the RTM Host models

     

    e.g.: $

     

    url = "http://oneclick:port/spectrum/restful/associations/relation/0x4560000/leftmodel/$rtmHostMh/rightmodel/$testMh"

     

    and

     

    $url = "http://oneclick:port/spectrum/restful/associations/relation/0x4560004/leftmodel/$testMh/rightmodel/$scheduleMh"

     

    Hope this helps!

     

    Frank