Connect Openstack API with Robot Framework

365 views
Skip to first unread message

Johan

unread,
Jul 4, 2017, 4:41:45 PM7/4/17
to robotframework-users
I'm very new to Robot Framework. I'm trying to get the parameters like image name or id from the Openstack rest API. 
Following below is my RF code. 

*** Settings ***
Library    OperatingSystem
Library    Collections
Library    RequestsLibrary
Library    Selenium2Library

*** Test Cases ***

Get Requests
    Create Session      openstackNet    http://10.20.30.40:5000
    ${resp}=    Get Request     openstackNet    /v2.0
    Should Be Equal As Strings  ${resp.status_code}     200 # 
   # ${token}=    Collections.Get From Dictionary    ${resp.json()}    /images/6bb323ef-bf47-4d58-a497-ccb11a8a39dc
    ${token}=     Get Json Value    ${resp.json()}    /images/{6bb323ef-bf47-4d58-a497-ccb11a8a39dc}
    Log     ${resp}

I would like to find the details of the image id "6bb323ef-bf47-4d58-a497-ccb11a8a39dc" . But this code "${token}=     Get Json Value    ${resp.json()}    /images/{6bb323ef-bf47-4d58-a497-ccb11a8a39dc}" does not work.

Error massage is "No keyword with name 'Get Json Value' found."

Please help me to find the parameter of the image by using the rest API.

Tatu Aalto

unread,
Jul 5, 2017, 10:11:15 AM7/5/17
to balaje...@gmail.com, robotframework-users
Ugh

The keyword Get Json Value does not exist in the libraries you imported. But if you want to access the value, then | ${dict} = | Set Variable |  ${resp.json()} | should return you a dictionary. And then using dictionaries is explained in the user guide: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#dictionary-variables

-Tatu
Send from my mobile


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsubscrib...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Johan

unread,
Jul 6, 2017, 12:30:50 PM7/6/17
to robotframework-users
Hi Tatu,

Thanks for your response. I can now query the api request. It works fine.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages