2 Documentation Robot keyword library (Resource) for BIER information configuration and verification Python utilities.
4 ... Copyright (c) 2016-2017 Zte, Inc. and others. All rights reserved.
6 ... This resource contains some keywords which complete four main functions:
7 ... Send corresponding request to datastore,
8 ... Construct BIER information,
9 ... Verity Configuration success or not and its result,
10 ... Delete BIER configuration and close all session.
12 Library RequestsLibrary
16 Send_Request_To_Query_Topology_Id
17 [Arguments] ${module} ${oper}
18 [Documentation] Send request to controller to query topologyid through REST-API using POST method, ${module} represents yang module and ${oper} represents rpc operation
19 ${resp} Post Request session /restconf/operations/${module}:${oper}
20 BuiltIn.Log ${resp.content}
23 Send_Request_Operation_Besides_QueryTopology_Id
24 [Arguments] ${module} ${oper} ${input}
25 [Documentation] Send other request to controller besides query topologyid, for example configures domain, subdomain, node and so on. ${input} represents the request body
26 ${pkg} Create Dictionary input=${input}
28 ${resp} Post Request session /restconf/operations/${module}:${oper} data=${data}
29 BuiltIn.Log ${resp.content}
33 [Documentation] Send request to query node and verify their existence
34 ${input} Create Dictionary topology-id ${TOPOLOGY_ID} node ${NODE_ID_LIST}
35 ${resp} Send_Request_Operation_Besides_QueryTopology_Id bier-topology-api query-node ${input}
36 BuiltIn.Should_Be_Equal ${resp.status_code} ${STATUS_CODE}
37 ${root} To Json ${resp.content}
38 ${out_put} Get From Dictionary ${root} output
39 ${node_list} Get From Dictionary ${out_put} node
40 ${node_num} Get Length ${node_list}
41 BuiltIn.Should_Be_Equal ${node_num} ${NODE_NUM}
42 @{node_id_list} Create List 1 2 3 4 5
45 \ ${node} Get From List ${node_list} ${i}
46 \ ${node_id} Get From Dictionary ${node} node-id
47 \ List Should Contain Value ${node_id_list} ${node_id}
50 [Arguments] ${ipv4_bsl} ${ipv6_bsl} ${bier_ipv4_mlslab_base} ${bier_ipv6_mlslab_base} ${bier_mlslab_range_size}
51 [Documentation] Construct container af inside single subdomain by given details ${ipv4_bsl}, ${ipv6_bsl}, ${bier_mlslab_base} and ${bier_mlslab_range_size}
52 ${ipv4} Create Dictionary bitstringlength=${ipv4_bsl} bier-mpls-label-base=${bier_ipv4_mlslab_base} bier-mpls-label-range-size=${bier_mlslab_range_size}
53 ${ipv6} Create Dictionary bitstringlength=${ipv6_bsl} bier-mpls-label-base=${bier_ipv6_mlslab_base} bier-mpls-label-range-size=${bier_mlslab_range_size}
54 ${ipv4_list} Create List ${ipv4}
55 ${ipv6_list} Create List ${ipv6}
56 ${af} Create Dictionary ipv4=${ipv4_list} ipv6=${ipv6_list}
60 [Arguments] ${subdomain_id} ${igp_type} ${mt_id} ${bfr_id} ${bit_string_length} ${af}
61 [Documentation] Construct subdomain list in a domain by given details ${subdomain_id}, ${igp_type}, ${mt_id}, ${bfr_id}, ${bit_string_length}, ${af}
62 ${subdomain} Create Dictionary sub-domain-id=${subdomain_id} igp-type=${igp_type} mt-id=${mt_id} bfr-id=${bfr_id} bitstringlength=${bit_string_length}
67 [Arguments] ${encapsulation_type} ${bit_string_length} ${bfr_id} ${ipv4_bfr_prefix} ${ipv6_bfr_prefix} ${subdomain_list}
68 [Documentation] Construct bier global in a domain by given details ${encapsulation_type}, ${bit_string_length}, ${bfr_id}, ${ipv4_bfr_prefix}, ${ipv6_bfr_prefix}, ${subdomain_list}
69 ${bier_global} Create Dictionary encapsulation-type=${encapsulation_type} bitstringlength=${bit_string_length} bfr-id=${bfr_id} ipv4-bfr-prefix=${ipv4_bfr_prefix} ipv6-bfr-prefix=${ipv6_bfr_prefix}
70 ... sub-domain=${subdomain_list}
71 [Return] ${bier_global}
74 [Arguments] ${domain_id} ${bier_global}
75 [Documentation] Construct domain by given details ${domain_id}, ${bier_global}
76 ${domain} Create Dictionary domain-id=${domain_id} bier-global=${bier_global}
80 [Arguments] ${subdomain_bfr_id_value} ${subdomain_list}
81 [Documentation] Construct ${af} to contruct new subdomain and add it to the ${subdomain_list}
82 ${af} Construct_Af ${BSL_OF_IPV4_AND_IPV6[2]} ${BSL_OF_IPV4_AND_IPV6[0]} 9 13 4
83 ${subdomain} Construct_Subdomain ${SUBDOMAIN_ID_LIST[1]} ${IGP_TYPE_LIST[1]} ${MT_ID_LIST[0]} ${subdomain_bfr_id_value} ${BITSTRINGLENGTH_LIST[0]}
85 Append To List ${subdomain_list} ${subdomain}
86 BuiltIn.Log ${subdomain_list}
87 [Return] ${subdomain_list}
90 [Arguments] ${ipv4_bsl} ${ipv6_bsl} ${bier_ipv4_mlslab_base} ${bier_new_ipv4_mlslab_base} ${bier_ipv6_mlslab_base} ${bier_mlslab_range_size}
91 [Documentation] Add or modify ipv4 inside af by given details ${ipv4_bsl}, ${ipv6_bsl}, ${bier_mlslab_base}, ${bier_mlslab_range_size}
92 ${ipv4_one} Create Dictionary bitstringlength=${ipv4_bsl} bier-mpls-label-base=${bier_ipv4_mlslab_base} bier-mpls-label-range-size=${bier_mlslab_range_size}
93 ${ipv4_two} Create Dictionary bitstringlength=${ipv6_bsl} bier-mpls-label-base=${bier_new_ipv4_mlslab_base} bier-mpls-label-range-size=${bier_mlslab_range_size}
94 ${ipv6} Create Dictionary bitstringlength=${ipv6_bsl} bier-mpls-label-base=${bier_ipv6_mlslab_base} bier-mpls-label-range-size=${bier_mlslab_range_size}
95 ${ipv4_list} Create List ${ipv4_one} ${ipv4_two}
96 ${ipv6_list} Create List ${ipv6}
97 ${af} Create Dictionary ipv4=${ipv4_list} ipv6=${ipv6_list}
100 Verify_Configuration_Success_Or_Not
102 [Documentation] Verify the return value ${resp} of request to controller success or not
103 BuiltIn.Should_Be_Equal ${resp.status_code} ${STATUS_CODE}
104 ${root} To Json ${resp.content}
105 ${output} Get From Dictionary ${root} output
106 ${configure_result} Get From Dictionary ${output} configure-result
107 ${result} Get From Dictionary ${configure_result} result
108 BuiltIn.Should_Be_Equal ${result} SUCCESS
110 Extract_NodeConfig_Output_And_Verify_Value
111 [Arguments] ${resp} ${subdomain_index} ${ipv4_list_index} ${node_id_value} ${domain_id_value} ${ipv4_value}
112 ... ${ipv6_value} ${bit_string_length_value} ${bfr_id_value} ${subdomain_id_value} ${igp_type_value} ${subdomain_bit_string_length_value}
113 ... ${subdomain_bfr_id_value} ${mt_id_value} ${ipv4_bit_string_length_value} ${ipv4_bier_mpls_label_base_value} ${ipv4_bier_mpls_label_range_size_value} ${ipv6_bit_string_length_value}
114 ... ${ipv6_bier_mpls_label_base_value} ${ipv6_bier_mpls_label_range_size_value}
115 [Documentation] Extract the output of node configuration request and verify its value
116 ${root} To Json ${resp.content}
117 ${out_put} Get From Dictionary ${root} output
118 ${node_list} Get From Dictionary ${out_put} node
119 ${node} Get From List ${node_list} 0
120 ${node_id} Get From Dictionary ${node} node-id
121 ${bier_node_params} Get From Dictionary ${node} bier-node-params
122 ${domain_list} Get From Dictionary ${bier_node_params} domain
123 ${domain} Get From List ${domain_list} 0
124 ${domain_id} Get From Dictionary ${domain} domain-id
125 ${bier_global} Get From Dictionary ${domain} bier-global
126 ${ipv4_bfr_prefix} Get From Dictionary ${bier_global} ipv4-bfr-prefix
127 ${ipv6_bfr_prefix} Get From Dictionary ${bier_global} ipv6-bfr-prefix
128 ${encapsulation_type} Get From Dictionary ${bier_global} encapsulation-type
129 ${bit_string_length} Get From Dictionary ${bier_global} bitstringlength
130 ${bfr_id} Get From Dictionary ${bier_global} bfr-id
131 ${subdomain_list} Get From Dictionary ${bier_global} sub-domain
132 ${subdomain} Get From List ${subdomain_list} ${subdomain_index}
133 ${subdomain_id} Get From Dictionary ${subdomain} sub-domain-id
134 ${igp_type} Get From Dictionary ${subdomain} igp-type
135 ${subdomain_bit_string_length} Get From Dictionary ${subdomain} bitstringlength
136 ${subdomain_bfr_id} Get From Dictionary ${subdomain} bfr-id
137 ${mt_id} Get From Dictionary ${subdomain} mt-id
138 ${af} Get From Dictionary ${subdomain} af
139 ${ipv4_list} Get From Dictionary ${af} ipv4
140 ${ipv6_list} Get From Dictionary ${af} ipv6
141 ${ipv4} Get From List ${ipv4_list} ${ipv4_list_index}
142 ${ipv6} Get From List ${ipv6_list} 0
143 ${ipv4_bit_string_length} Get From Dictionary ${ipv4} bitstringlength
144 ${ipv4_bier_mpls_label_base} Get From Dictionary ${ipv4} bier-mpls-label-base
145 ${ipv4_bier_mpls_label_range_size} Get From Dictionary ${ipv4} bier-mpls-label-range-size
146 ${ipv6_bit_string_length} Get From Dictionary ${ipv6} bitstringlength
147 ${ipv6_bier_mpls_label_base} Get From Dictionary ${ipv6} bier-mpls-label-base
148 ${ipv6_bier_mpls_label_range_size} Get From Dictionary ${ipv6} bier-mpls-label-range-size
149 BuiltIn.Should_Be_Equal_As_strings ${node_id} ${node_id_value}
150 BuiltIn.Should_Be_Equal ${domain_id} ${domain_id_value}
151 BuiltIn.Should_Be_Equal ${ipv4_bfr_prefix} ${ipv4_value}
152 BuiltIn.Should_Be_Equal ${ipv6_bfr_prefix} ${ipv6_value}
153 BuiltIn.Should_Be_Equal ${bit_string_length} ${bit_string_length_value}
154 BuiltIn.Should_Be_Equal ${bfr_id} ${bfr_id_value}
155 BuiltIn.Should_Be_Equal ${subdomain_id} ${subdomain_id_value}
156 BuiltIn.Should_Be_Equal ${igp_type} ${igp_type_value}
157 BuiltIn.Should_Be_Equal ${subdomain_bit_string_length} ${subdomain_bit_string_length_value}
158 BuiltIn.Should_Be_Equal ${subdomain_bfr_id} ${subdomain_bfr_id_value}
159 BuiltIn.Should_Be_Equal ${mt_id} ${mt_id_value}
160 BuiltIn.Should_Be_Equal ${ipv4_bit_string_length} ${ipv4_bit_string_length_value}
161 BuiltIn.Should_Be_Equal ${ipv4_bier_mpls_label_base} ${ipv4_bier_mpls_label_base_value}
162 BuiltIn.Should_Be_Equal ${ipv4_bier_mpls_label_range_size} ${ipv4_bier_mpls_label_range_size_value}
163 BuiltIn.Should_Be_Equal ${ipv6_bit_string_length} ${ipv6_bit_string_length_value}
164 BuiltIn.Should_Be_Equal ${ipv6_bier_mpls_label_base} ${ipv6_bier_mpls_label_base_value}
165 BuiltIn.Should_Be_Equal ${ipv6_bier_mpls_label_range_size} ${ipv6_bier_mpls_label_range_size_value}
167 Extract_Channel_Output_And_Verify_Value
168 [Arguments] ${resp} ${name} ${src_ip_value} ${dst_group_value} ${domain_id_value} ${subdomain_id_value}
169 ... ${source_wildcard_value} ${group_wildcard_value}
170 [Documentation] Extract the output of channel configuration request and verify its value
171 ${root} To Json ${resp.content}
172 ${out_put} Get From Dictionary ${root} output
173 ${channel_list} Get From Dictionary ${out_put} channel
174 ${channel} Get From List ${channel_list} 0
175 ${channel_name} Get From Dictionary ${channel} name
176 ${src_ip} Get From Dictionary ${channel} src-ip
177 ${subdomain_id} Get From Dictionary ${channel} sub-domain-id
178 ${source_wildcard} Get From Dictionary ${channel} source-wildcard
179 ${dst_group} Get From Dictionary ${channel} dst-group
180 ${domain_id} Get From Dictionary ${channel} domain-id
181 ${group_wildcard} Get From Dictionary ${channel} group-wildcard
182 BuiltIn.Should_Be_Equal ${channel_name} ${name}
183 BuiltIn.Should_Be_Equal ${src_ip} ${src_ip_value}
184 BuiltIn.Should_Be_Equal ${dst_group} ${dst_group_value}
185 BuiltIn.Should_Be_Equal ${domain_id} ${domain_id_value}
186 BuiltIn.Should_Be_Equal ${subdomain_id} ${subdomain_id_value}
187 BuiltIn.Should_Be_Equal ${source_wildcard} ${source_wildcard_value}
188 BuiltIn.Should_Be_Equal ${group_wildcard} ${group_wildcard_value}
191 Extract_Channel_Ingress_And_Egress_Node_Output_And_Verify_Value
192 [Arguments] ${channel} ${ingress_node_value} ${egress_node1_value} ${egress_node2_value}
193 [Documentation] Extract the ingress and egress node of deployed channel and verify its value
194 ${ingress_node} Get From Dictionary ${channel} ingress-node
195 ${egress_node_list} Get From Dictionary ${channel} egress-node
196 ${egress_node1} Get From List ${egress_node_list} 0
197 ${egress_node2} Get From List ${egress_node_list} 1
198 ${node_id1} Get From Dictionary ${egress_node1} node-id
199 ${node_id2} Get From Dictionary ${egress_node2} node-id
200 BuiltIn.Should_Be_Equal ${ingress_node} ${ingress_node_value}
201 BuiltIn.Should_Be_Equal ${node_id1} ${egress_node1_value}
202 BuiltIn.Should_Be_Equal ${node_id2} ${egress_node2_value}
205 [Documentation] Delete domain and subdomain which were configured previous and close restconf session
206 : FOR ${i} IN RANGE 3
207 \ ${input1} Create Dictionary topology-id ${TOPOLOGY_ID} domain-id ${DOMAIN_ID}
208 \ ... sub-domain-id ${i+1}
209 \ ${resp1} Send_Request_Operation_Besides_QueryTopology_Id bier-topology-api delete-subdomain ${input1}
210 \ Verify_Configuration_Success_Or_Not ${resp1}
211 ${input2} Create Dictionary topology-id ${TOPOLOGY_ID} domain-id ${DOMAIN_ID}
212 ${resp2} Send_Request_Operation_Besides_QueryTopology_Id bier-topology-api delete-domain ${input2}
213 Verify_Configuration_Success_Or_Not ${resp2}
214 RequestsLibrary.Delete_All_Sessions