Forum Discussion

Luan_118878's avatar
Luan_118878
Icon for Nimbostratus rankNimbostratus
Mar 26, 2014
Solved

How do I create a route-domain in vcmp using curl?

curl -k -u admin:admin1! -H "Content-Type: \ application/json" -X POST -d {"name":"d2vc1fc1","id":2,"vlans":["vlan1101","vlan1201","vlan101"]} https://10.1.1.12/mgmt/tm/net/route-domain curl: (6) Couldn't resolve host 'id' curl: (3) [globbing] error: bad range specification after pos 8

 

Thanks.

 

Regards,

 

-Luan

 

  • You need to protect your strings from interpolation. See below, I have added single quotes around your username and password, and around your POST data:

    curl -k -u 'admin:admin1!' -H "Content-Type: \ application/json" -X POST -d '{"name":"d2vc1fc1","id":2,"vlans":["vlan1101","vlan1201","vlan101"]}' https://10.1.1.12/mgmt/tm/net/route-domain

6 Replies

  • You need to protect your strings from interpolation. See below, I have added single quotes around your username and password, and around your POST data:

    curl -k -u 'admin:admin1!' -H "Content-Type: \ application/json" -X POST -d '{"name":"d2vc1fc1","id":2,"vlans":["vlan1101","vlan1201","vlan101"]}' https://10.1.1.12/mgmt/tm/net/route-domain

    • uni_87886's avatar
      uni_87886
      Icon for Cirrostratus rankCirrostratus
      Note: I didn't look at what you were trying to achieve, only at why your curl failed
  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus

    You need to protect your strings from interpolation. See below, I have added single quotes around your username and password, and around your POST data:

    curl -k -u 'admin:admin1!' -H "Content-Type: \ application/json" -X POST -d '{"name":"d2vc1fc1","id":2,"vlans":["vlan1101","vlan1201","vlan101"]}' https://10.1.1.12/mgmt/tm/net/route-domain

    • uni's avatar
      uni
      Icon for Altostratus rankAltostratus
      Note: I didn't look at what you were trying to achieve, only at why your curl failed
  • Thank you very much. That works! I was looking at the guide icontrol-rest-user-11-5-0.pdf right after and saw the '' after -d but still failed. You actually need it around the username and password like you suggested as well.

     

    I am trying to create a new route-domain and assign those 3 vlans to it. tmsh command would be as follow: create net route-domain d2vc1fc1 id 2 vlans add { vlan101 vlan1101 vlan1201 }

     

    But now i get authentication error...but that could be fixed...might be because i use curl for windows as well....

     

    Authentication required!

    This server could not verify that you are authorized to access the URL "/mgmt/tm/net/route-domain". You either supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

     

    In case you are allowed to request the document, please check your user-id and password and try again.

     

    Error 401
  • Thanks again uni. It works when i used a linux machine.

     

    [lunguyen@ashnetutil2 ~]$ curl -k -u 'admin:admin1!' -H "Content-Type: application/json" -X POST -d '{"name":"d2vc1fc1","id":2,"vlans":["vlan1101","vlan1201","vlan101"]}' https://10.1.1.12/mgmt/tm/net/route-domain {"kind":"tm:net:route-domain:route-domainstate","name":"d2vc1fc1","fullPath":"d2vc1fc1","generation":158473,"selfLink":"https://localhost/mgmt/tm/net/route-domain/d2vc1fc1?ver=11.5.0","id":2,"strict":"enabled","vlans":["/Common/vlan101","/Common/vlan1201","/Common/vlan1101"],"fwRulesReference":{"link":"https://localhost/mgmt/tm/net/route-domain/~Common~d2vc1fc1/fw-rules?ver=11.5.0","isSubcollection":true}}

     

    root@(vc1fc1)(cfg-sync In Sync)(/S1-green-P:Active)(/Common)(tmos) list net route-domain net route-domain 0 { id 0 vlans { http-tunnel socks-tunnel vlan4093 } } net route-domain d2vc1fc1 { id 2 vlans { vlan101 vlan1201 vlan1101 } }