2 Documentation Test Suite for Interface manager
3 Suite Setup Genius Suite Setup
4 Suite Teardown Genius Suite Teardown
5 Test Teardown Get Model Dump ${ODL_SYSTEM_IP} ${data_models}
6 Library OperatingSystem
8 Library RequestsLibrary
11 Variables ../../variables/genius/Modules.py
12 Resource ../../libraries/DataModels.robot
13 Resource ../../libraries/Genius.robot
14 Resource ../../libraries/Utils.robot
15 Resource ../../variables/Variables.robot
18 ${genius_config_dir} ${CURDIR}/../../variables/genius
20 ${interface_name} l2vlan-trunk
21 ${trunk_json} l2vlan.json
22 ${trunk_member_json} l2vlan_member.json
25 Create l2vlan transparent interface
26 [Documentation] This testcase creates a l2vlan transparent interface between 2 dpns.
27 Log >>>> Creating L2vlan interface <<<<<
28 Create Interface ${trunk_json} transparent
29 Log >>>> Get interface config <<<<<
30 @{l2vlan} create list l2vlan-trunk l2vlan transparent l2vlan true
31 Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
32 Log >>>>> Get interface operational state<<<<
33 Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
34 ${ovs-check} Wait Until Keyword Succeeds 40 10 table0 entry ${conn_id_1} ${bridgename}
36 Delete l2vlan transparent interface
37 [Documentation] This testcase deletes the l2vlan transparent interface created between 2 dpns.
38 Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
39 No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
40 Wait Until Keyword Succeeds 30 10 no table0 entry
42 Create l2vlan trunk interface
43 [Documentation] This testcase creates a l2vlan trunk interface between 2 DPNs.
44 Log >>>> Getting file for posting json <<<<<<<
45 Create Interface ${trunk_json} trunk
46 Log >>>> Get interface config <<<<<
47 @{l2vlan} create list l2vlan-trunk l2vlan trunk tap8ed70586-6c true
48 Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
49 Log >>>>> Get interface operational state<<<<
50 Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
51 Wait Until Keyword Succeeds 30 10 table0 entry ${conn_id_1} ${bridgename}
53 Create l2vlan Trunk member interface
54 [Documentation] This testcase creates a l2vlan Trunk member interface for the l2vlan trunk interface created in 1st testcase.
55 Log >>>> Creating L2vlan member interface <<<<<
56 Log >>>> Getting file for posting json <<<<<<<
57 ${body} OperatingSystem.Get File ${genius_config_dir}/l2vlan_member.json
58 ${post_resp} RequestsLibrary.Post Request session ${CONFIG_API}/ietf-interfaces:interfaces/ data=${body}
59 Log ${post_resp.content}
60 Log ${post_resp.status_code}
61 Should Be Equal As Strings ${post_resp.status_code} 204
62 Log >>>> Get interface config <<<<<
63 @{l2vlan} create list l2vlan-trunk1 l2vlan trunk-member 1000 l2vlan-trunk
65 Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
66 Log >>>>> Get interface operational state<<<<
67 Wait Until Keyword Succeeds 10 5 get operational interface ${l2vlan[0]}
68 Wait Until Keyword Succeeds 40 10 ovs check for member interface creation ${conn_id_1} ${bridgename}
70 Bind service on Interface
71 [Documentation] This testcase binds service to the interface created .
72 Log >>>> Getting file for posting json <<<<<<<
73 ${body} OperatingSystem.Get File ${genius_config_dir}/bind_service.json
74 ${body} replace string ${body} service1 VPN
75 ${body} replace string ${body} service2 elan
77 ${service_mode} Set Variable interface-service-bindings:service-mode-ingress
78 ${post_resp} RequestsLibrary.Post Request session ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/ data=${body}
79 log ${post_resp.content}
80 log ${post_resp.status_code}
81 Should Be Equal As Strings ${post_resp.status_code} 204
82 Log >>>>> Verifying Binded interface <<<<<
83 @{bind_array} create list 2 3 VPN elan 50
85 Check For Elements At URI ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/ ${bind_array}
86 Log >>>>> OVS check for table enteries <<<<
87 ${command} set variable sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
88 Wait Until Keyword Succeeds 40 10 table entry ${command}
90 unbind service on interface
91 [Documentation] This testcase Unbinds the service which is binded by the 3rd testcase.
92 Log >>>>>>Unbinding the service on interface <<<<
93 ${service-priority-1} set variable 3
94 ${service-priority-2} set variable 4
95 ${service_mode} Set Variable interface-service-bindings:service-mode-ingress
96 Remove All Elements At URI And Verify ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-1}/
97 log >>>> Ovs check for table 21 absence <<<
98 ${table-id} set variable 21
99 Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
100 Remove All Elements At URI And Verify ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
101 No Content From URI session ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
102 log >>>> Ovs check for table 50 absence <<<
103 ${table-id} set variable 50
104 Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
106 Delete l2vlan trunk interface
107 [Documentation] Deletion of l2vlan trunk interface is done.
108 Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
109 No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
110 ${resp} Wait Until Keyword Succeeds 30 10 no table0 entry
113 get operational interface
114 [Arguments] ${interface_name}
115 [Documentation] checks operational status of the interface.
116 ${get_oper_resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${interface_name}/
117 ${respjson} RequestsLibrary.To Json ${get_oper_resp.content} pretty_print=True
119 log ${get_oper_resp.status_code}
120 Should Be Equal As Strings ${get_oper_resp.status_code} 200
121 Should not contain ${get_oper_resp.content} down
122 Should Contain ${get_oper_resp.content} up up
125 [Arguments] ${command}
126 [Documentation] Checks for tables entry wrt the service the Interface is binded.
127 switch connection ${conn_id_1}
128 ${result} execute command ${command}
130 should contain ${result} table=17
131 should contain ${result} goto_table:21
132 should contain ${result} goto_table:50
135 [Documentation] After Deleting trunk interface, checking for absence of table 0 in the flow dumps
136 switch connection ${conn_id_1}
137 ${bridgename} set variable BR1
138 ${ovs-check} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
140 should not contain ${ovs-check} table=0
141 should not contain ${ovs-check} goto_table:17
144 [Arguments] ${table-id}
145 [Documentation] Checks for absence of no goto_table after unbinding the service on the interface.
146 switch connection ${conn_id_1}
147 ${ovs-check1} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
149 should not contain ${ovs-check1} goto_table:${table-id}
152 [Arguments] ${connection-id} ${bridgename}
153 [Documentation] After Creating the trunk interface , checking for table 0 entry exist in the flow dumps
154 switch connection ${connection-id}
155 log switch connection
156 ${ovs-check} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
157 log sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
159 should contain ${ovs-check} table=0
161 ovs check for member interface creation
162 [Arguments] ${connection-id} ${bridgename}
163 [Documentation] This keyword verifies the member interface created on OVS by checking the table0 ,vlan and action=pop_vlan entries
164 switch connection ${connection-id}
165 ${ovs-check} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
167 should contain ${ovs-check} table=0
168 should contain ${ovs-check} dl_vlan=1000
169 should contain ${ovs-check} actions=pop_vlan
172 [Arguments] ${json_file} ${interface_mode}
173 [Documentation] Creates an trunk/transparent interface based on input provided to the json body
174 ${body} OperatingSystem.Get File ${genius_config_dir}/${json_file}
175 log ${genius_config_dir}/${json_file}
176 ${body} replace string ${body} "l2vlan-mode":"trunk" "l2vlan-mode":"${interface_mode}"
177 log "l2vlan-mode":"${interface_mode}"
179 ${post_resp} RequestsLibrary.Post Request session ${CONFIG_API}/ietf-interfaces:interfaces/ data=${body}
180 Log ${post_resp.content}
181 Log ${post_resp.status_code}
182 Should Be Equal As Strings ${post_resp.status_code} 204