2 Documentation Cluster Ovsdb library. So far this library is only to be used by Ovsdb cluster test as it is very specific for this test.
3 Library RequestsLibrary
4 Resource ClusterKeywords.robot
5 Resource MininetKeywords.robot
7 Variables ../variables/Variables.py
10 Check Ovsdb Shards Status
11 [Arguments] ${controller_index_list}
12 [Documentation] Check Status for all shards in Ovsdb application.
13 ${topo_conf_leader} ${topo_conf_followers_list} Wait Until Keyword Succeeds 10s 1s Get Cluster Shard Status ${controller_index_list}
15 ${topo_oper_leader} ${topo_oper_followers_list} Wait Until Keyword Succeeds 10s 1s Get Cluster Shard Status ${controller_index_list}
16 ... operational topology
17 Log config topology Leader is ${topo_conf_leader} and followers are ${topo_conf_followers_list}
18 Log operational topology Leader is ${topo_oper_leader} and followers are ${topo_oper_followers_list}
20 Get Ovsdb Entity Owner Status For One Device
21 [Arguments] ${controller_index_list}
22 [Documentation] Check Entity Owner Status and identify owner and candidate.
23 ${owner} ${candidates_list} Wait Until Keyword Succeeds 10s 1s Get Cluster Entity Owner For Ovsdb ${controller_index_list}
25 [Return] ${owner} ${candidates_list}
27 Get Cluster Entity Owner For Ovsdb
28 [Arguments] ${controller_index_list} ${device_type} ${device}
29 [Documentation] Checks Entity Owner status for a ${device} and returns owner index and list of candidates from a ${controller_index_list}.
30 ... ${device_type} is openflow, ovsdb, etc...
31 ${length}= Get Length ${controller_index_list}
32 ${candidates_list}= Create List
33 ${data}= Get Data From URI controller@{controller_index_list}[0] /restconf/operational/entity-owners:entity-owners
35 ${data}= Replace String ${data} /network-topology:network-topology/network-topology:topology[network-topology:topology-id=' ${EMPTY}
36 ${data}= Replace String ${data} /network-topology:node[network-topology:node-id='ovsdb://uuid/a96ec4e2-c457-4a2c-963c-1e6300210032 ${EMPTY}
37 ${clear_data}= Replace String ${data} '] ${EMPTY}
39 ${json}= To Json ${clear_data}
40 ${entity_type_list}= Get From Dictionary &{json}[entity-owners] entity-type
41 ${entity_type_index}= Get Index From List Of Dictionaries ${entity_type_list} type ${device_type}
42 Should Not Be Equal ${entity_type_index} -1 No Entity Owner found for ${device_type}
43 ${entity_list}= Get From Dictionary @{entity_type_list}[${entity_type_index}] entity
44 ${entity_index}= Get Index From List Of Dictionaries ${entity_list} id ${device}
45 Should Not Be Equal ${entity_index} -1 Device ${device} not found in Entity Owner ${device_type}
46 ${entity_owner}= Get From Dictionary @{entity_list}[${entity_index}] owner
47 Should Not Be Empty ${entity_owner} No owner found for ${device}
48 ${owner}= Replace String ${entity_owner} member- ${EMPTY}
49 ${owner}= Convert To Integer ${owner}
50 List Should Contain Value ${controller_index_list} ${owner} Owner ${owner} not exisiting in ${controller_index_list}
51 ${entity_candidates_list}= Get From Dictionary @{entity_list}[${entity_index}] candidate
52 ${list_length}= Get Length ${entity_candidates_list}
53 : FOR ${entity_candidate} IN @{entity_candidates_list}
54 \ ${candidate}= Replace String &{entity_candidate}[name] member- ${EMPTY}
55 \ ${candidate}= Convert To Integer ${candidate}
56 \ List Should Contain Value ${controller_index_list} ${candidate} Candidate ${candidate} not exisiting in ${controller_index_list}
57 \ Run Keyword If '${candidate}' != '${owner}' Append To List ${candidates_list} ${candidate}
58 [Return] ${owner} ${candidates_list}
60 Create Bridge And Verify
61 [Arguments] ${controller_index_list} ${controller_index}
62 [Documentation] Create bridge in ${controller_index} and verify it gets applied in all instances in ${controller_index_list}.
63 ${sample}= OperatingSystem.Get File ${CURDIR}/../variables/ovsdb/create_bridge_3node.json
65 ${sample1} Replace String ${sample} tcp:controller1:6633 tcp:${ODL_SYSTEM_1_IP}:6640
67 ${sample2} Replace String ${sample1} tcp:controller2:6633 tcp:${ODL_SYSTEM_2_IP}:6640
69 ${sample3} Replace String ${sample2} tcp:controller3:6633 tcp:${ODL_SYSTEM_3_IP}:6640
71 ${sample4} Replace String ${sample3} 127.0.0.1 ${MININET}
73 ${sample5} Replace String ${sample4} br01 ${BRIDGE}
75 ${body} Replace String ${sample5} 61644 ${OVSDB_PORT}
77 ${dictionary}= Create Dictionary ${MININET}=1 ${OVSDBPORT}=4 ${BRIDGE}=1
78 Put And Check At URI In Cluster ${controller_index_list} ${controller_index} ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE} ${body} ${HEADERS}
79 Wait Until Keyword Succeeds 5s 1s Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}