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.
4 Library RequestsLibrary
5 Resource ClusterManagement.robot
6 Resource CompareStream.robot
7 Resource MininetKeywords.robot
10 Resource ../variables/ovsdb/Variables.robot
11 Variables ../variables/Variables.py
14 @{SHARD_OPER_LIST} topology default entity-ownership
15 @{SHARD_CONF_LIST} topology default
17 ${OVSDB_CONFIG_DIR} ${CURDIR}/../variables/ovsdb
20 Check Ovsdb Shards Status
21 [Arguments] ${controller_index_list}=${EMPTY}
22 [Documentation] Check Status for all shards in Ovsdb application.
23 CompareStream.Run_Keyword_If_At_Least_Phosphorus Collections.Remove Values From List ${SHARD_OPER_LIST} entity-ownership
24 Log ${SHARD_OPER_LIST}
25 ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_OPER_LIST} shard_type=operational member_index_list=${controller_index_list}
26 ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_CONF_LIST} shard_type=config member_index_list=${controller_index_list}
28 Check Ovsdb Shards Status After Cluster Event
29 [Arguments] ${controller_index_list}=${EMPTY}
30 [Documentation] Check Shard Status after some cluster event.
31 Wait Until Keyword Succeeds 90s 1s Check Ovsdb Shards Status ${controller_index_list}
33 Get Ovsdb Entity Owner Status For One Device
34 [Arguments] ${device} ${controller_index} ${controller_index_list}=${EMPTY}
35 [Documentation] Check Entity Owner Status and identify owner and successors for an ovs device ${device}. Request is sent to controller ${controller_index}.
36 ${owner} ${successor_list} Wait Until Keyword Succeeds 20s 1s ClusterManagement.Verify_Owner_And_Successors_For_Device device_name=${device}
37 ... device_type=ovsdb member_index=${controller_index} candidate_list=${controller_index_list}
38 [Return] ${owner} ${successor_list}
40 Create Sample Bridge Manually And Verify
41 [Arguments] ${ovs_system_ip}=${TOOLS_SYSTEM_IP} ${controller_index_list}=${EMPTY}
42 [Documentation] Create bridge br-s1 using OVS command and verify it gets created in all instances in ${controller_index_list}.
43 Utils.Run Command On Mininet ${ovs_system_ip} sudo ovs-vsctl add-br br-s1
44 ${dictionary_operational}= Create Dictionary br-s1=5
45 ${dictionary_config}= Create Dictionary br-s1=0
46 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_CONFIG_TOPO_API} dictionary=${dictionary_config} member_index_list=${controller_index_list}
47 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_OPERATIONAL_TOPO_API} dictionary=${dictionary_operational} member_index_list=${controller_index_list}
49 Add Sample Port To The Manual Bridge And Verify
50 [Arguments] ${ovs_system_ip}=${TOOLS_SYSTEM_IP} ${controller_index_list}=${EMPTY}
51 [Documentation] Add Port vx1 to br-s1 using OVS command and verify it gets added in all instances in ${controller_index_list}.
52 Utils.Run Command On Mininet ${ovs_system_ip} sudo ovs-vsctl add-port br-s1 vx1 -- set Interface vx1 type=vxlan
53 ${dictionary_operational}= Create Dictionary vx1=2
54 ${dictionary_config}= Create Dictionary vx1=0
55 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_CONFIG_TOPO_API} dictionary=${dictionary_config} member_index_list=${controller_index_list}
56 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_OPERATIONAL_TOPO_API} dictionary=${dictionary_operational} member_index_list=${controller_index_list}
58 Create Sample Tap Device
59 [Arguments] ${ovs_system_ip}=${TOOLS_SYSTEM_IP}
60 [Documentation] Create Tap Device vport1 and vport2 to add to the bridge br-s1 using OVS command.
61 Utils.Run Command On Mininet ${ovs_system_ip} ip tuntap add mode tap vport1
62 Utils.Run Command On Mininet ${ovs_system_ip} ip tuntap add mode tap vport2
63 Utils.Run Command On Mininet ${ovs_system_ip} ifconfig vport1 up
64 Utils.Run Command On Mininet ${ovs_system_ip} ifconfig vport2 up
66 Add Sample Tap Device To The Manual Bridge And Verify
67 [Arguments] ${ovs_system_ip}=${TOOLS_SYSTEM_IP} ${controller_index_list}=${EMPTY}
68 [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}.
69 Utils.Run Command On Mininet ${ovs_system_ip} sudo ovs-vsctl add-port br-s1 vport1 -- add-port br-s1 vport2
70 ${dictionary_operational}= Create Dictionary vport1=2 vport2=2
71 ${dictionary_config}= Create Dictionary vport1=0 vport2=0
72 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_CONFIG_TOPO_API} dictionary=${dictionary_config} member_index_list=${controller_index_list}
73 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_OPERATIONAL_TOPO_API} dictionary=${dictionary_operational} member_index_list=${controller_index_list}
75 Delete Sample Bridge Manually And Verify
76 [Arguments] ${ovs_system_ip}=${TOOLS_SYSTEM_IP} ${controller_index_list}=${EMPTY}
77 [Documentation] Delete bridge br-s1 using OVS command and verify it gets applied in all instances in ${controller_index_list}.
78 Utils.Run Command On Mininet ${ovs_system_ip} sudo ovs-vsctl del-br br-s1
79 ${dictionary}= Create Dictionary br-s1=0
80 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_OPERATIONAL_TOPO_API} dictionary=${dictionary} member_index_list=${controller_index_list}
82 Create Sample Bridge And Verify
83 [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
84 [Documentation] Create bridge ${BRIDGE} in controller ${controller_index} and verify it gets created in all instances in ${controller_index_list}.
85 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/ovsdb/create_bridge_3node.json
86 ${body} Replace String ${body} ovsdb://127.0.0.1:61644 ovsdb://uuid/${ovsdb_uuid}
87 ${body} Replace String ${body} tcp:controller1:6633 tcp:${ODL_SYSTEM_1_IP}:6633
88 ${body} Replace String ${body} tcp:controller2:6633 tcp:${ODL_SYSTEM_2_IP}:6633
89 ${body} Replace String ${body} tcp:controller3:6633 tcp:${ODL_SYSTEM_3_IP}:6633
90 ${body} Replace String ${body} 127.0.0.1 ${TOOLS_SYSTEM_IP}
91 ${body} Replace String ${body} br01 ${BRIDGE}
92 ${body} Replace String ${body} 61644 ${OVSDB_PORT}
94 ${TOOLS_SYSTEM_IP1} Replace String ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_IP} "${TOOLS_SYSTEM_IP}"
95 ${dictionary}= Create Dictionary ${TOOLS_SYSTEM_IP1}=1 ${OVSDBPORT}=4 ${BRIDGE}=1
96 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Put_As_Json_And_Check_Member_List_Or_All ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE} ${body} ${controller_index}
97 ... ${controller_index_list}
98 Wait Until Keyword Succeeds 10s 2s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}?${RFC8040_OPERATIONAL_CONTENT} dictionary=${dictionary} member_index_list=${controller_index_list}
100 Create Sample Port And Verify
101 [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
102 [Documentation] Add Port vx2 to bridge ${BRIDGE} in controller ${controller_index} and verify it gets added in all instances in ${controller_index_list}.
103 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_port_3node.json
104 ${body} Replace String ${sample} 192.168.1.10 ${TOOLS_SYSTEM_IP}
106 Log URL is ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point=vx2
107 ${port_dictionary}= Create Dictionary ${BRIDGE}=1 vx2=3
108 ClusterManagement.Put_As_Json_And_Check_Member_List_Or_All ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point=vx2 ${body} ${controller_index} ${controller_index_list}
109 Wait Until Keyword Succeeds 10s 2s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point=vx2?${RFC8040_OPERATIONAL_CONTENT} dictionary=${port_dictionary} member_index_list=${controller_index_list}
111 Modify the destination IP of Sample Port
112 [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
113 [Documentation] Modify the dst ip of port vx2 in bridge ${BRIDGE} in controller ${controller_index}.
114 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_port_3node.json
115 ${body} Replace String ${sample} 192.168.1.10 10.0.0.19
116 Log URL is ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point=vx2
118 ClusterManagement.Put_As_Json_And_Check_Member_List_Or_All ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point=vx2 ${body} ${controller_index} ${controller_index_list}
120 Verify Sample Port Is Modified
121 [Arguments] ${controller_index_list}=${EMPTY}
122 [Documentation] Verify dst ip of port vx2 in bridge ${BRIDGE} gets modified in all instances in ${controller_index_list}.
123 ${port_dictionary} Create Dictionary br01=6 vx2=3 10.0.0.19=1
124 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}?${RFC8040_OPERATIONAL_CONTENT} dictionary=${port_dictionary} member_index_list=${controller_index_list}
126 Delete Sample Port And Verify
127 [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
128 [Documentation] Delete port vx2 from bridge ${BRIDGE} in controller ${controller_index} and verify it gets deleted in all instances in ${controller_index_list}.
129 ${dictionary}= Create Dictionary vx2=0
130 ClusterManagement.Delete_And_Check_Member_List_Or_All ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}/termination-point=vx2 ${controller_index} ${controller_index_list}
131 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}?${RFC8040_OPERATIONAL_CONTENT} dictionary=${dictionary} member_index_list=${controller_index_list}
133 Delete Sample Bridge And Verify
134 [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
135 [Documentation] Delete bridge ${BRIDGE} in ${controller_index} and verify it gets deleted in all instances in ${controller_index_list}.
136 ${dictionary}= Create Dictionary ${BRIDGE}=0
137 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Delete_And_Check_Member_List_Or_All ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE} ${controller_index} ${controller_index_list}
138 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${ovsdb_uuid}?${RFC8040_OPERATIONAL_CONTENT} dictionary=${dictionary} member_index_list=${controller_index_list}
140 Configure Exit OVSDB Connection
141 [Arguments] ${controller_index_list}=${EMPTY}
142 [Documentation] Cleans up test environment, close existing sessions.
143 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
144 ${dictionary}= Create Dictionary ovsdb://uuid=0
145 Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${RFC8040_OPERATIONAL_TOPO_API} dictionary=${dictionary} member_index_list=${controller_index_list}