Change URI to specific ovsdb node
[integration/test.git] / tools / Robot_Tool / suites / base / host_tracker.txt
1 *** Settings ***
2 Documentation     Test suite for the host tracker module.
3 Suite Teardown    Delete All Sessions
4 Library           Collections
5 Library           RequestsLibrary
6 Library           ../../libraries/Common.py
7 Variables         ../../variables/Variables.py
8
9 *** Variables ***
10 ${name}           10.0.1.4
11 ${key}            hostConfig
12 ${REST_CONTEXT}    /controller/nb/v2/hosttracker
13
14 *** Test Cases ***
15 Add a host
16     [Documentation]    Add a host, list to validate the result.
17     [Tags]    add
18     ${body}    Create Dictionary    nodeType=OF    dataLayerAddress=5e:bf:79:84:10:a6
19     ...     vlan=1      nodeId=00:00:00:00:00:00:00:03    nodeConnectorId=9
20     ...     networkAddress=10.0.1.4     staticHost=${True}    nodeConnectorType=OF
21     ${headers}    Create Dictionary    Content-Type=application/json
22     Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
23     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/address/${name}    data=${body}
24     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
25     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/hosts/inactive
26     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
27     ${result}    To JSON    ${resp.content}
28     ${content}    Get From Dictionary    ${result}    ${key}
29     List Should Contain Value    ${content}    ${body}
30
31 Remove a host
32     [Documentation]    Remove a host, list to validate the result.
33     [Tags]    remove
34     ${body}    Create Dictionary    nodeType=OF    dataLayerAddress=5e:bf:79:84:10:a6
35     ...     vlan=1    nodeId=00:00:00:00:00:00:00:03    nodeConnectorId=9
36     ...     networkAddress=10.0.1.4    staticHost=${True}    nodeConnectorType=OF
37     ${headers}    Create Dictionary    Content-Type=application/json
38     Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
39     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/address/${name}
40     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
41     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/hosts/inactive
42     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
43     ${result}    To JSON    ${resp.content}
44     ${content}    Get From Dictionary    ${result}    ${key}
45     List Should Not Contain Value    ${content}    ${body}