DX Infrastructure Management

Expand all | Collapse all

net_config creation using API

  • 1.  net_config creation using API

    Posted 20 days ago
    Edited by devi ojha 20 days ago
      |   view attached
    Hello There , 

    can anyone please check once and let me know what am i doing wrong?
    i am trying to create profiles in net_connect probe using API . command below . It is creating a profile , however ignore rest of the configuration . 
    below command is getting executed  without any error and i can see the profile getting created but with empty fields. Any help would be great .

    we are on UIM 9.10 and i am trying to create this profile on linux robot . 



    curl -trace -X POST -u administrator:'***********' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[{"key": "profiles/c-hongkong/qos_on_packets_lost", "value": "no"}, {"key": "profiles/c-hongkong/ping", "value": "yes"}, {"key": "profiles/c-hongkong/packets_to_send", "value": "0"}, {"key": "profiles/c-hongkong/flags", "value": "0"}, {"key": "profiles/c-hongkong/source", "value": "2"}, {"key": "profiles/c-hongkong/alarm_on_jitter", "value": "0"}, {"key": "profiles/c-hongkong/timeout", "value": "0"}, {"key": "profiles/c-hongkong/hostname", "value": "c-hongkong"}, {"key": "profiles/c-hongkong/QoS", "value": "yes"}, {"key": "profiles/c-hongkong/alarm", "value": "3"}, {"key": "profiles/c-hongkong/delay_between_packet_to_send", "value": "0"}, {"key": "profiles/c-hongkong/icmp_threshold", "value": "1"}, {"key": "profiles/c-hongkong/threshold_fail", "value": "ping threshold failed"}, {"key": "profiles/c-hongkong/msg_ok", "value": "MsgConnectOk"}, {"key": "profiles/c-hongkong/failures", "value": "1"}, {"key": "profiles/c-hongkong/threshold_ok", "value": "ping threshold OK"}, {"key": "profiles/c-hongkong/msg_fail", "value": "MsgConnectFail"}, {"key": "profiles/c-hongkong/ip", "value": "10.20.30.40"}, {"key": "profiles/c-hongkong/active", "value": "yes"}, {"key": "profiles/c-hongkong/target", "value": "2"}, {"key": "profiles/c-hongkong/retries", "value": "3"}, {"key": "profiles/c-hongkong/max_jitter", "value": ""}, {"key": "profiles/c-hongkong/contactinfo", "value": "dojha@mlp.com"}, {"key": "profiles/c-hongkong/max_packets_lost", "value": "0"}, {"key": "profiles/c-hongkong/interval", "value": "5sec"}, {"key": "profiles/c-hongkong/qos_source", "value": "2"}, {"key": "profiles/c-hongkong/alarm_on_packet_loss", "value": "no"}, {"key": "profiles/c-hongkong/icmp_size", "value": "0"}]' 'http://******/rest/probe/UIM_DEV/HUB/ROBOT/net_connect/config'

    Thanks 
    Devi


  • 2.  RE: net_config creation using API

    Posted 20 days ago
    This example works for net_connect:
    curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[
    {
    "key":"profiles/luctest/active",
    "value":"yes"
    },
    {
    "key":"profiles/luctest/hostname",
    "value":"www.luc.be"
    },
    {
    "key":"profiles/luctest/QoS",
    "value":"yes"
    },
    {
    "key":"profiles/luctest/interval",
    "value":"5min"
    },
    {
    "key":"profiles/luctest/group",
    "value":"internet"
    },
    {
    "key":"profiles/luctest/qos_source",
    "value":"0"
    },
    {
    "key":"profiles/luctest/source",
    "value":"1"
    },
    {
    "key":"profiles/luctest/target",
    "value":"1"
    },
    {
    "key":"profiles/luctest/alarm",
    "value":"1"
    }
    ]
    ' 'http://bgbulab57/uimapi/probes/bgbulab57_domain/bgbulab57_hub/bgbulab57/net_connect/config'


  • 3.  RE: net_config creation using API

    Posted 20 days ago
    Hello Luc, 

    Thanks for the response , 
    tried this in my environment, still see the same issue , it is creating the profile but  missing out all the configuration like host-name , interval etc .
    Dont see any error in log too . and the API is working fine with url_response . Its just with net_connect .




  • 4.  RE: net_config creation using API

    Posted 20 days ago
    Did you use the old(er) webservices_rest (like in your initial update: http://******/rest/...) or the 9.0.2 (9.1) uimapi (i used: http://*********/uimapi/...') ?
    I am doing this on a w2012r2 uim: 9.1 environment.


  • 5.  RE: net_config creation using API

    Posted 20 days ago
    Hello Luc , 

    Ah! got you i am using the old rest one , dont have uimapi yet configured . Let me deploy that and test it out . 

    Thanks 
    Devi


  • 6.  RE: net_config creation using API

    Posted 20 days ago
    Hello Luc , 

    I got uimapi sorted out , the get requests are working fine but post request is failing , does this ring any bell to you Luc ?

    b'Cannot deserialize instance of `com.ca.uimapi.model.ProbeConfigKey` out of START_ARRAY token\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 1]'


    Thanks 
    Devi


  • 7.  RE: net_config creation using API

    Posted 20 days ago
    I think you need a PUT instead of the POST.


  • 8.  RE: net_config creation using API

    Posted 20 days ago
    Thanks a lot Luc , It works now :) . Thanks much for your time , really appreciate .


  • 9.  RE: net_config creation using API

    Posted 15 days ago
    Hello @Luc Christiaens​ ,

    bugging you again on this , while it all looks good now with API now , need some input on configuring QOS base line with dynamic Alarm . I am really struggling to get the keys for these properties . I even tried setting up these values manually and used get API to get the profile configs but i dont see any keys represting those parameters .

    I would like tick compute baseline , Dynamic Alarm, and the put some values in Algorithm





    Percent

    >

    >

    >

    >

    >








  • 10.  RE: net_config creation using API

    Posted 15 days ago
    If you go into raw configure of the probe you can see how to code the alarm messages.
    But the baseline and thresholds cannot be set via the API at my knowing.
    They are set via 2 different sets of commands. If you look at: 
    https://community.broadcom.com/enterprisesoftware/communities/community-home/librarydocuments/viewdocument?DocumentKey=01cc3867-3f43-48c2-acbe-81090bb06082
    The zip contains a doc file where the needed commands are explained. Or you can have a look in the online doc.


  • 11.  RE: net_config creation using API

    Posted 15 days ago
    Thanks a lot Luc for a quick response , yeah API would have been great , custom message looks good too . I will take a look at commands too.

    One more quick question , this is lil weird , or may be i am doing it wrong . can you just have a quick glance .
    I am trying to delete a net_connect profile using API 

    curl -X DELETE --header 'Accept: application/json' 'http://twvsmtuim001/uimapi/probes/MLP_NEW_DEV/*******/****/net_connect/config/profiles%252Fchicago-tokyo'

    and getting a success response code .

    Response Code

    204

    however , the profile doesn't get deleted on probe , and then when i manually try to delete the profile after hitting the URL , that also throws error with 'unable to read the profile'

    Note , without hitting API , if i just try to delete the profile manually it works fine .

    is it the issue with the key ?

    Thanks 
    Devi


  • 12.  RE: net_config creation using API

    Posted 15 days ago
    You can try to create your statement via the swagger doc, like:
    http://bgbulab57/uimapi/docs/index.html


  • 13.  RE: net_config creation using API

    Posted 15 days ago
    Hello Luc . 

    That above trial was from swagger doc . Its just not working for delete .


  • 14.  RE: net_config creation using API

    Posted 14 days ago
    I'm afraid that you will need to open a ticket because the only available doc (=swagger) is incorrect.
    And if possible post back the result or correct format if support can help you.