2 Documentation Utils for Restconf operations for GBP
3 Library RequestsLibrary
4 Library OperatingSystem
6 Variables ../../variables/Variables.py
7 Resource ../../variables/gbp/Constants.robot
8 Resource ../Utils.robot
9 Resource RestconfUtils.robot
15 [Arguments] ${subnet_to_check} ${subnet_name} ${ip_prefix_to_check}
16 [Documentation] Checks name and ip prefix of given subnet and returns parent ID
17 ${parent} Assert Forwarding Domain ${subnet_to_check} ${subnet_name} return_parent=TRUE
18 ${ip_prefix} Get Ip Prefix of Subnet ${subnet_to_check}
19 Should Be Equal As Strings ${ip_prefix} ${ip_prefix_to_check}
22 Assert L2-Flood-Domain
23 [Arguments] ${l2_flood_domain_to_check} ${l2_flood_domain_name}
24 [Documentation] Checks name of given l2-flood-domain and returns parent ID
25 ${parent} Assert Forwarding Domain ${l2_flood_domain_to_check} ${l2_flood_domain_name} return_parent=TRUE
28 Assert L2-Bridge-Domain
29 [Arguments] ${l2_bridge_domain_to_check} ${l2_bridge_domain_name}
30 [Documentation] Checks name of given l2-bridge-domain and returns parent ID
31 ${parent} Assert Forwarding Domain ${l2_bridge_domain_to_check} ${l2_bridge_domain_name} return_parent=TRUE
35 [Arguments] ${l3_context_to_check} ${l3_context_name}
36 [Documentation] Checks name of given l3-context
37 ${parent} Assert Forwarding Domain ${l3_context_to_check} ${l3_context_name}
40 Assert Forwarding Domain
41 [Arguments] ${domain_to_check} ${domain_name} ${return_parent}=FALSE
42 [Documentation] Checks name of given l3-context
43 Check Name ${domain_to_check} ${domain_name}
44 Return From Keyword If "${return_parent}" == "FALSE"
45 ${parent} Get Parent ${domain_to_check}
49 [Arguments] ${data} ${name}
50 [Documentation] Checks correct format of a name field in JSON data
51 Should Not Be Empty ${data}
52 Should Match Regexp ${data} \"name\":\"${NAME_PATTERN}\"
55 [Arguments] ${range_value_json} ${min} ${max}
56 [Documentation] Veriefies min and max values of range-value of classifier-instance in JSON format
57 Should Be Equal As Numbers ${min} ${range_value_json['min']}
58 Should Be Equal As Numbers ${max} ${range_value_json['max']}
62 [Documentation] Returns 'parent' value of an JSON object. Can be applied to Subnet, L2-Flood-Domain or L2-Bridge-Domain
63 Should Not Be Empty ${data}
64 ${parent_line} Should Match Regexp ${data} \"parent\":\"${UUID_PATTERN}\"
65 ${parent_uuid} Should Match Regexp ${parent_line} ${UUID_PATTERN}
66 [Return] ${parent_uuid}
69 [Arguments] ${endpoint} ${ip_address} ${epg} ${l3-context} ${network-containment} ${tenant}
70 [Documentation] Verifies parameters of given endpoint in JSON format
71 Should Contain ${endpoint} ofoverlay:port-name
72 @{ep_l3-addresses} Get L3-Addresses of Endpoint ${endpoint}
73 @{ep_endpoint_groups} Get Groups of Endpoint ${endpoint}
74 ${ep_network-containment} Get Network Containment of Endpoint ${endpoint}
75 ${ep_tenant} Get Tenant of Endpoint ${endpoint}
76 @{ep_endpoint_groups} Get Groups of Endpoint ${endpoint}
77 Should Be Equal As Strings ${ep_network-containment} ${network-containment}
78 Should Be Equal As Strings ${ep_tenant} ${tenant}
79 Check Group References ${epg} @{ep_endpoint_groups}
80 LOG ${ep_l3-addresses}
81 : FOR ${l3} IN @{ep_l3-addresses}
84 \ LOG ${l3['l3-context']}
85 \ LOG ${l3['ip-address']}
86 \ Continue For Loop If "${l3['l3-context']}" == "${l3-context}" and "${l3['ip-address']}" == "${ip_address}"
90 [Arguments] ${endpoint-l3} ${mac_address} ${epg} ${l2-context} ${network-containment} ${tenant}
91 [Documentation] Verifies parameters of registerd endpoint-l3 in JSON format
92 Should Contain ${endpoint-l3} ofoverlay:port-name
93 ${ep_l2-context} Get L2 Context of Endpoint-L3 ${endpoint-l3}
94 ${ep_mac_address} Get Mac Address of Endpoint-L3 ${endpoint-l3}
95 ${ep_network-containment} Get Network Containment of Endpoint-L3 ${endpoint-l3}
96 ${ep_tenant} Get Tenant of Endpoint-L3 ${endpoint-l3}
97 @{ep_endpoint_groups} Get Groups of Endpoint-L3 ${endpoint-l3}
98 Should Be Equal As Strings ${ep_mac_address} ${mac_address}
99 Should Be Equal As Strings ${ep_l2-context} ${l2-context}
100 Should Be Equal As Strings ${network-containment} ${network-containment}
101 Should Be Equal As Strings ${tenant} ${tenant}
102 Check Group References ${epg} @{ep_endpoint_groups}
104 Check Group References
105 [Arguments] ${epg_to_look_for} @{endpoint_groups}
106 [Documentation] Verifies presence of endpoint group to which endpoint belongs and presence of network_client group
107 ... among given endpoint groups
108 Should Not Be Empty ${epg_to_look_for}
109 Should Not Be Empty ${endpoint_groups}
110 : FOR ${epg} IN @{endpoint_groups}
111 \ Continue For Loop If "${epg}" == "${epg_to_look_for}"
112 \ Continue For Loop If "${epg}" == "${NETWORK_CLIENT_GROUP}"
115 Check Endpoint Group Name and Selector
116 [Arguments] ${epg_id} ${epg_name} ${tenant_id} ${contract_id} ${named-selector}
117 [Documentation] Verifies data generated by security group and security group rules
118 ${epg_path} Get Endpoint Group Path ${tenant_id} ${epg_id}
119 ${endpoint_group} Get Data From URI session ${epg_path} headers=${headers}
120 Should Not Be Empty ${endpoint_group}
121 Check Name ${endpoint_group} ${epg_name}
122 ${endpoint_group_json} To Json ${endpoint_group}
123 ${named_selectors} Set Variable ${endpoint_group_json['endpoint-group'][0]['${named-selector}']}
124 ${selector_found} Set Variable FALSE
125 : FOR ${selector} IN @{named_selectors}
126 \ Return From Keyword If "${selector['contract'][0]}" == "${contract_id}"