[VOL-3989] Added keyword Get Bandwidth Profile Details Rest

Change-Id: Ifd4db810ff2bd327c916ea36af1c0606822cdf90
diff --git a/libraries/onos.robot b/libraries/onos.robot
index fa9560e..8243f6c 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -346,6 +346,28 @@
     ...    Set Variable    ${bw_val_air[0]}
     [Return]    ${cir}    ${cbs}    ${eir}    ${ebs}    ${air}
 
+Get Bandwidth Profile Details Rest
+    [Arguments]    ${bw_profile_id}
+    [Documentation]    Retrieves the details of the given bandwidth profile using REST API
+    ${resp}=    Get Request    ONOS    onos/sadis/bandwidthprofile/${bw_profile_id}
+    ${jsondata}=    To Json    ${resp.content}
+    Should Not Be Empty    ${jsondata['entry']}
+    ${length}=    Get Length    ${jsondata['entry']}
+    ${matched}=    Set Variable    False
+    FOR    ${INDEX}    IN RANGE    0    ${length}
+        ${value}=    Get From List    ${jsondata['entry']}    ${INDEX}
+        ${bw_id}=    Get From Dictionary    ${value}    id
+        ${matched}=    Set Variable If    '${bw_id}' == '${bw_profile_id}'    True    False
+        ${eir}=    Get From Dictionary    ${value}    eir
+        ${ebs}=    Get From Dictionary    ${value}    ebs
+        ${cir}=    Get From Dictionary    ${value}    cir
+        ${cbs}=    Get From Dictionary    ${value}    cbs
+        ${air}=    Get From Dictionary    ${value}    air
+        Exit For Loop If    ${matched}
+    END
+    Should Be True    ${matched}    No bandwidth profile found for id: ${bw_profile_id}
+    [Return]    ${cir}    ${cbs}    ${eir}    ${ebs}    ${air}
+
 Verify Meters in ONOS
     [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${onu_port}
     [Documentation]    Verifies the meters