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
8 Variables ../variables/Variables.py
12 ${OVSDB_CONFIG_DIR} ${CURDIR}/../variables/ovsdb
15 Check Ovsdb Shards Status
16 [Arguments] ${controller_index_list}
17 [Documentation] Check Status for all shards in Ovsdb application.
18 ${topo_conf_leader} ${topo_conf_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} config topology
19 ${topo_oper_leader} ${topo_oper_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} operational topology
20 ${owner_oper_leader} ${owner_oper_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} operational entity-ownership
21 Log config topology Leader is ${topo_conf_leader} and followers are ${topo_conf_followers_list}
22 Log operational topology Leader is ${topo_oper_leader} and followers are ${topo_oper_followers_list}
23 Log operational entity-ownership Leader is ${owner_oper_leader} and followers are ${owner_oper_followers_list}
25 Check Ovsdb Shards Status After Cluster Event
26 [Arguments] ${controller_index_list}
27 [Documentation] Check Shard Status after some cluster event.
28 Wait Until Keyword Succeeds 90s 1s Check Ovsdb Shards Status ${controller_index_list}
30 Get Cluster Entity Owner For Ovsdb
31 [Arguments] ${controller_index_list} ${device_type} ${device}
32 [Documentation] Checks Entity Owner status for a ${device} and returns owner index and list of candidates from a ${controller_index_list}.
33 ... ${device_type} is openflow, ovsdb, etc...
34 ${length}= Get Length ${controller_index_list}
35 ${candidates_list}= Create List
36 ${data}= Utils.Get Data From URI controller@{controller_index_list}[0] /restconf/operational/entity-owners:entity-owners
38 ${data}= Replace String ${data} /network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id=' ${EMPTY}
40 ${clear_data}= Replace String ${data} '] ${EMPTY}
42 ${json}= To Json ${clear_data}
43 ${entity_type_list}= Get From Dictionary &{json}[entity-owners] entity-type
44 ${entity_type_index}= Get Index From List Of Dictionaries ${entity_type_list} type ${device_type}
45 Should Not Be Equal ${entity_type_index} -1 No Entity Owner found for ${device_type}
46 ${entity_list}= Get From Dictionary @{entity_type_list}[${entity_type_index}] entity
47 ${entity_index}= Get Index From List Of Dictionaries ${entity_list} id ${device}
48 Should Not Be Equal ${entity_index} -1 Device ${device} not found in Entity Owner ${device_type}
49 ${entity_owner}= Get From Dictionary @{entity_list}[${entity_index}] owner
50 Should Not Be Empty ${entity_owner} No owner found for ${device}
51 ${owner}= Replace String ${entity_owner} member- ${EMPTY}
52 ${owner}= Convert To Integer ${owner}
53 List Should Contain Value ${controller_index_list} ${owner} Owner ${owner} not exisiting in ${controller_index_list}
54 ${entity_candidates_list}= Get From Dictionary @{entity_list}[${entity_index}] candidate
55 ${list_length}= Get Length ${entity_candidates_list}
56 : FOR ${entity_candidate} IN @{entity_candidates_list}
57 \ ${candidate}= Replace String &{entity_candidate}[name] member- ${EMPTY}
58 \ ${candidate}= Convert To Integer ${candidate}
59 \ Append To List ${candidates_list} ${candidate}
60 List Should Contain Sublist ${candidates_list} ${controller_index_list} Candidates are missing in ${candidates_list}
61 Remove Values From List ${candidates_list} ${owner}
62 [Return] ${owner} ${candidates_list}
64 Get Ovsdb Entity Owner Status For One Device
65 [Arguments] ${controller_index_list} ${device}
66 [Documentation] Check Entity Owner Status and identify owner and candidate for an ovs device ${device}.
67 ${owner} ${candidates_list} Wait Until Keyword Succeeds 20s 1s Get Cluster Entity Owner For Ovsdb ${controller_index_list}
69 [Return] ${owner} ${candidates_list}
71 Create Sample Bridge Manually And Verify
72 [Arguments] ${controller_index_list}
73 [Documentation] Create bridge br-s1 using OVS command and verify it gets created in all instances in ${controller_index_list}.
74 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br br-s1
75 ${dictionary_operational}= Create Dictionary br-s1=5
76 ${dictionary_config}= Create Dictionary br-s1=0
77 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_config} ${CONFIG_TOPO_API}
78 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_operational} ${OPERATIONAL_TOPO_API}
80 Add Sample Port To The Manual Bridge And Verify
81 [Arguments] ${controller_index_list}
82 [Documentation] Add Port vx1 to br-s1 using OVS command and verify it gets added in all instances in ${controller_index_list}.
83 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-port br-s1 vx1 -- set Interface vx1 type=vxlan
84 ${dictionary_operational}= Create Dictionary vx1=2
85 ${dictionary_config}= Create Dictionary vx1=0
86 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_config} ${CONFIG_TOPO_API}
87 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_operational} ${OPERATIONAL_TOPO_API}
89 Delete Sample Bridge Manually And Verify
90 [Arguments] ${controller_index_list}
91 [Documentation] Delete bridge br-s1 using OVS command and verify it gets applied in all instances in ${controller_index_list}.
92 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-br br-s1
93 ${dictionary}= Create Dictionary br-s1=0
94 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
96 Create Sample Bridge And Verify
97 [Arguments] ${controller_index_list} ${controller_index}
98 [Documentation] Create bridge ${BRIDGE} in controller ${controller_index} and verify it gets created in all instances in ${controller_index_list}.
99 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/ovsdb/create_bridge_3node.json
100 ${body} Replace String ${body} ovsdb://127.0.0.1:61644 ovsdb://uuid/${ovsdb_uuid}
101 ${body} Replace String ${body} tcp:controller1:6633 tcp:${ODL_SYSTEM_1_IP}:6633
102 ${body} Replace String ${body} tcp:controller2:6633 tcp:${ODL_SYSTEM_2_IP}:6633
103 ${body} Replace String ${body} tcp:controller3:6633 tcp:${ODL_SYSTEM_3_IP}:6633
104 ${body} Replace String ${body} 127.0.0.1 ${TOOLS_SYSTEM_IP}
105 ${body} Replace String ${body} br01 ${BRIDGE}
106 ${body} Replace String ${body} 61644 ${OVSDB_PORT}
108 ${TOOLS_SYSTEM_IP1} Replace String ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_IP} "${TOOLS_SYSTEM_IP}"
109 ${dictionary}= Create Dictionary ${TOOLS_SYSTEM_IP1}=1 ${OVSDBPORT}=4 ${BRIDGE}=1
110 Wait Until Keyword Succeeds 20s 1s ClusterKeywords.Put And Check At URI In Cluster ${controller_index_list} ${controller_index} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
112 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}
114 Create Sample Port And Verify
115 [Arguments] ${controller_index_list} ${controller_index}
116 [Documentation] Add Port vx2 to bridge ${BRIDGE} in controller ${controller_index} and verify it gets added in all instances in ${controller_index_list}.
117 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_port_3node.json
118 ${body} Replace String ${sample} 192.168.1.10 ${TOOLS_SYSTEM_IP}
120 Log URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/
121 ${port_dictionary}= Create Dictionary ${BRIDGE}=7 vx2=3
122 ClusterKeywords.Put And Check At URI In Cluster ${controller_index_list} ${controller_index} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/ ${body}
123 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${port_dictionary} ${OPERATIONAL_TOPO_API}
125 Modify the destination IP of Sample Port
126 [Arguments] ${controller_index_list} ${controller_index}
127 [Documentation] Modify the dst ip of port vx2 in bridge ${BRIDGE} in controller ${controller_index}.
128 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_port_3node.json
129 ${body} Replace String ${sample} 192.168.1.10 10.0.0.19
130 Log URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/
132 ClusterKeywords.Put And Check At URI In Cluster ${controller_index_list} ${controller_index} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/ ${body}
134 Verify Sample Port Is Modified
135 [Arguments] ${controller_index_list}
136 [Documentation] Verify dst ip of port vx2 in bridge ${BRIDGE} gets modified in all instances in ${controller_index_list}.
137 ${port_dictionary} Create Dictionary br01=7 vx2=3 10.0.0.19=1
138 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${port_dictionary} ${OPERATIONAL_TOPO_API}
140 Delete Sample Port And Verify
141 [Arguments] ${controller_index_list} ${controller_index}
142 [Documentation] Delete port vx2 from bridge ${BRIDGE} in controller ${controller_index} and verify it gets deleted in all instances in ${controller_index_list}.
143 ${dictionary}= Create Dictionary vx2=0
144 ClusterKeywords.Delete And Check At URI In Cluster ${controller_index_list} ${controller_index} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/
145 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
147 Delete Sample Bridge And Verify
148 [Arguments] ${controller_index_list} ${controller_index}
149 [Documentation] Delete bridge ${BRIDGE} in ${controller_index} and verify it gets deleted in all instances in ${controller_index_list}.
150 ${dictionary}= Create Dictionary ${BRIDGE}=0
151 Wait Until Keyword Succeeds 20s 1s ClusterKeywords.Delete And Check At URI In Cluster ${controller_index_list} ${controller_index} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
152 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}
154 Configure Exit OVSDB Connection
155 [Arguments] ${controller_index_list}
156 [Documentation] Cleans up test environment, close existing sessions.
157 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
158 ${dictionary}= Create Dictionary ovsdb://uuid=0
159 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}