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 Ovsdb Entity Owner Status For One Device
31 [Arguments] ${controller_index_list} ${device}
32 [Documentation] Check Entity Owner Status and identify owner and candidate for an ovs device ${device}.
33 ${owner} ${candidates_list} Wait Until Keyword Succeeds 20s 1s ClusterKeywords.Get Cluster Entity Owner ${controller_index_list}
35 [Return] ${owner} ${candidates_list}
37 Create Sample Bridge Manually And Verify
38 [Arguments] ${controller_index_list}
39 [Documentation] Create bridge br-s1 using OVS command and verify it gets created in all instances in ${controller_index_list}.
40 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br br-s1
41 ${dictionary_operational}= Create Dictionary br-s1=5
42 ${dictionary_config}= Create Dictionary br-s1=0
43 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_config} ${CONFIG_TOPO_API}
44 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_operational} ${OPERATIONAL_TOPO_API}
46 Add Sample Port To The Manual Bridge And Verify
47 [Arguments] ${controller_index_list}
48 [Documentation] Add Port vx1 to br-s1 using OVS command and verify it gets added in all instances in ${controller_index_list}.
49 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-port br-s1 vx1 -- set Interface vx1 type=vxlan
50 ${dictionary_operational}= Create Dictionary vx1=2
51 ${dictionary_config}= Create Dictionary vx1=0
52 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_config} ${CONFIG_TOPO_API}
53 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_operational} ${OPERATIONAL_TOPO_API}
55 Create Sample Tap Device
56 [Documentation] Create Tap Device vport1 and vport2 to add to the bridge br-s1 using OVS command.
57 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} ip tuntap add mode tap vport1
58 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} ip tuntap add mode tap vport2
59 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} ifconfig vport1 up
60 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} ifconfig vport2 up
62 Add Sample Tap Device To The Manual Bridge And Verify
63 [Arguments] ${controller_index_list}
64 [Documentation] Add Tap Device vport1 and vport2 to br-s1 using OVS command and verify it gets added in all instances in ${controller_index_list}.
65 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-port br-s1 vport1 -- add-port br-s1 vport2
66 ${dictionary_operational}= Create Dictionary vport1=2 vport2=2
67 ${dictionary_config}= Create Dictionary vport1=0 vport2=0
68 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_config} ${CONFIG_TOPO_API}
69 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary_operational} ${OPERATIONAL_TOPO_API}
71 Delete Sample Bridge Manually And Verify
72 [Arguments] ${controller_index_list}
73 [Documentation] Delete bridge br-s1 using OVS command and verify it gets applied in all instances in ${controller_index_list}.
74 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-br br-s1
75 ${dictionary}= Create Dictionary br-s1=0
76 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
78 Create Sample Bridge And Verify
79 [Arguments] ${controller_index_list} ${controller_index}
80 [Documentation] Create bridge ${BRIDGE} in controller ${controller_index} and verify it gets created in all instances in ${controller_index_list}.
81 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/ovsdb/create_bridge_3node.json
82 ${body} Replace String ${body} ovsdb://127.0.0.1:61644 ovsdb://uuid/${ovsdb_uuid}
83 ${body} Replace String ${body} tcp:controller1:6633 tcp:${ODL_SYSTEM_1_IP}:6633
84 ${body} Replace String ${body} tcp:controller2:6633 tcp:${ODL_SYSTEM_2_IP}:6633
85 ${body} Replace String ${body} tcp:controller3:6633 tcp:${ODL_SYSTEM_3_IP}:6633
86 ${body} Replace String ${body} 127.0.0.1 ${TOOLS_SYSTEM_IP}
87 ${body} Replace String ${body} br01 ${BRIDGE}
88 ${body} Replace String ${body} 61644 ${OVSDB_PORT}
90 ${TOOLS_SYSTEM_IP1} Replace String ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_IP} "${TOOLS_SYSTEM_IP}"
91 ${dictionary}= Create Dictionary ${TOOLS_SYSTEM_IP1}=1 ${OVSDBPORT}=4 ${BRIDGE}=1
92 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}
94 Wait Until Keyword Succeeds 20s 2s 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}
96 Create Sample Port And Verify
97 [Arguments] ${controller_index_list} ${controller_index}
98 [Documentation] Add Port vx2 to bridge ${BRIDGE} in controller ${controller_index} and verify it gets added in all instances in ${controller_index_list}.
99 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_port_3node.json
100 ${body} Replace String ${sample} 192.168.1.10 ${TOOLS_SYSTEM_IP}
102 Log URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/
103 ${port_dictionary}= Create Dictionary ${BRIDGE}=6 vx2=3
104 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}
105 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${port_dictionary} ${OPERATIONAL_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
107 Modify the destination IP of Sample Port
108 [Arguments] ${controller_index_list} ${controller_index}
109 [Documentation] Modify the dst ip of port vx2 in bridge ${BRIDGE} in controller ${controller_index}.
110 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_port_3node.json
111 ${body} Replace String ${sample} 192.168.1.10 10.0.0.19
112 Log URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point/vx2/
114 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}
116 Verify Sample Port Is Modified
117 [Arguments] ${controller_index_list}
118 [Documentation] Verify dst ip of port vx2 in bridge ${BRIDGE} gets modified in all instances in ${controller_index_list}.
119 ${port_dictionary} Create Dictionary br01=6 vx2=3 10.0.0.19=1
120 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${port_dictionary} ${OPERATIONAL_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
122 Delete Sample Port And Verify
123 [Arguments] ${controller_index_list} ${controller_index}
124 [Documentation] Delete port vx2 from bridge ${BRIDGE} in controller ${controller_index} and verify it gets deleted in all instances in ${controller_index_list}.
125 ${dictionary}= Create Dictionary vx2=0
126 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/
127 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}
129 Delete Sample Bridge And Verify
130 [Arguments] ${controller_index_list} ${controller_index}
131 [Documentation] Delete bridge ${BRIDGE} in ${controller_index} and verify it gets deleted in all instances in ${controller_index_list}.
132 ${dictionary}= Create Dictionary ${BRIDGE}=0
133 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}
134 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}
136 Configure Exit OVSDB Connection
137 [Arguments] ${controller_index_list}
138 [Documentation] Cleans up test environment, close existing sessions.
139 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
140 ${dictionary}= Create Dictionary ovsdb://uuid=0
141 Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}