2 Documentation Test Suite for Interface manager
5 Library OperatingSystem
6 Library RequestsLibrary
8 Resource ../../libraries/DataModels.robot
9 Resource ../../libraries/Genius.robot
10 Resource ../../libraries/Utils.robot
11 Resource ../../variables/Variables.robot
12 Variables ../../variables/genius/Modules.py
14 Suite Setup Genius Suite Setup
15 Suite Teardown Genius Suite Teardown
16 Test Setup Genius Test Setup
17 Test Teardown Genius Test Teardown ${data_models}
21 ${interface_name} l2vlan-trunk
22 ${trunk_json} l2vlan.json
23 ${trunk_member_json} l2vlan_member.json
27 Create l2vlan transparent interface
28 [Documentation] This testcase creates a l2vlan transparent interface between 2 dpns.
29 Create Interface ${trunk_json} transparent
30 @{l2vlan} = BuiltIn.Create List l2vlan-trunk l2vlan transparent l2vlan true
31 Utils.Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
32 BuiltIn.Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
33 BuiltIn.Wait Until Keyword Succeeds 40 10 table0 entry ${TOOLS_SYSTEM_1_IP}
35 Delete l2vlan transparent interface
36 [Documentation] This testcase deletes the l2vlan transparent interface created between 2 dpns.
37 Utils.Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
38 Utils.No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
39 BuiltIn.Wait Until Keyword Succeeds 30 10 no table0 entry
41 Create l2vlan trunk interface
42 [Documentation] This testcase creates a l2vlan trunk interface between 2 DPNs.
43 Create Interface ${trunk_json} trunk
44 @{l2vlan} = BuiltIn.Create list l2vlan-trunk l2vlan trunk tap0ed70586-6c true
45 Utils.Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
46 BuiltIn.Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
47 BuiltIn.Wait Until Keyword Succeeds 30 10 table0 entry ${TOOLS_SYSTEM_1_IP}
49 Create l2vlan Trunk member interface
50 [Documentation] This testcase creates a l2vlan Trunk member interface for the l2vlan trunk interface created in 1st testcase.
51 ${body} = OperatingSystem.Get File ${genius_config_dir}/l2vlan_member.json
52 ${post_resp} = RequestsLibrary.Post Request
54 ... ${CONFIG_API}/ietf-interfaces:interfaces/
56 BuiltIn.Should Be Equal As Strings ${post_resp.status_code} 204
57 @{l2vlan} = create list l2vlan-trunk1 l2vlan trunk-member 1000 l2vlan-trunk
59 Utils.Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
60 BuiltIn.Wait Until Keyword Succeeds 10 5 get operational interface ${l2vlan[0]}
61 BuiltIn.Wait Until Keyword Succeeds 40 10 ovs check for member interface creation ${TOOLS_SYSTEM_1_IP}
63 Bind service on Interface
64 [Documentation] This testcase binds service to the interface created .
65 ${body} = OperatingSystem.Get File ${genius_config_dir}/bind_service.json
66 ${body} = String.Replace string ${body} service1 VPN
67 ${body} = String.Replace string ${body} service2 elan
69 ${service_mode} = BuiltIn.Set Variable interface-service-bindings:service-mode-ingress
70 ${post_resp} = RequestsLibrary.Post Request
72 ... ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/
74 BuiltIn.Should Be Equal As Strings ${post_resp.status_code} 204
75 @{bind_array} = BuiltIn.Create List 2 3 VPN elan 50
77 Utils.Check For Elements At URI
78 ... ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/
80 BuiltIn.Wait Until Keyword Succeeds 40 10 table entry
82 unbind service on interface
83 [Documentation] This testcase Unbinds the service which is binded by the 3rd testcase.
84 ${service-priority-1} = BuiltIn.Set Variable 3
85 ${service-priority-2} = BuiltIn.Set Variable 4
86 ${service_mode} = BuiltIn.Set Variable interface-service-bindings:service-mode-ingress
87 Utils.Remove All Elements At URI And Verify
88 ... ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-1}/
89 ${table-id} = BuiltIn.Set Variable 21
90 BuiltIn.Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
91 Utils.Remove All Elements At URI And Verify
92 ... ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
93 Utils.No Content From URI
95 ... ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
96 ${table-id} = BuiltIn.Set Variable 50
97 BuiltIn.Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
99 Delete l2vlan trunk interface
100 [Documentation] Deletion of l2vlan trunk interface is done.
101 Utils.Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
102 Utils.No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
103 BuiltIn.Wait Until Keyword Succeeds 30 10 no table0 entry
107 get operational interface
108 [Documentation] checks operational status of the interface.
109 [Arguments] ${interface_name}
110 ${get_oper_resp} = RequestsLibrary.Get Request
112 ... ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${interface_name}/
113 ${respjson} = RequestsLibrary.To Json ${get_oper_resp.content} pretty_print=True
114 BuiltIn.Log ${respjson}
115 BuiltIn.Should Be Equal As Strings ${get_oper_resp.status_code} 200
116 BuiltIn.Should Not Contain ${get_oper_resp.text} down
117 BuiltIn.Should Contain ${get_oper_resp.text} up up
120 [Documentation] Checks for tables entry wrt the service the Interface is binded.
121 ${result} = Utils.Run Command On Remote System
122 ... ${TOOLS_SYSTEM_1_IP}
123 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
124 BuiltIn.Should Contain ${result} table=17
125 BuiltIn.Should Contain ${result} goto_table:21
126 BuiltIn.Should Contain ${result} goto_table:50
129 [Documentation] After Deleting trunk interface, checking for absence of table 0 in the flow dumps
130 ${ovs-check} = Utils.Run Command On Remote System
131 ... ${TOOLS_SYSTEM_1_IP}
132 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
133 BuiltIn.Should Not Contain ${ovs-check} table=0
134 BuiltIn.Should Not Contain ${ovs-check} goto_table:17
137 [Documentation] Checks for absence of no goto_table after unbinding the service on the interface.
138 [Arguments] ${table-id}
139 ${ovs-check1} = Utils.Run Command On Remote System
140 ... ${TOOLS_SYSTEM_1_IP}
141 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
142 BuiltIn.Should Not Contain ${ovs-check1} goto_table:${table-id}
145 [Documentation] After Creating the trunk interface , checking for table 0 entry exist in the flow dumps
146 [Arguments] ${tools_ip}
147 ${ovs-check} = Utils.Run Command On Remote System
149 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
150 BuiltIn.Should Contain ${ovs-check} table=0
152 ovs check for member interface creation
153 [Documentation] This keyword verifies the member interface created on OVS by checking the table0 ,vlan and action=pop_vlan entries
154 [Arguments] ${tools_ip}
155 ${ovs-check} = Utils.Run Command On Remote System
157 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
158 BuiltIn.Should Contain ${ovs-check} table=0
159 BuiltIn.Should Contain ${ovs-check} dl_vlan=1000
160 BuiltIn.Should Contain ${ovs-check} actions=pop_vlan
163 [Documentation] Creates an trunk/transparent interface based on input provided to the json body
164 [Arguments] ${json_file} ${interface_mode}
165 ${body} = OperatingSystem.Get File ${genius_config_dir}/${json_file}
166 ${body} = String.Replace String ${body} "l2vlan-mode":"trunk" "l2vlan-mode":"${interface_mode}"
167 ${post_resp} = RequestsLibrary.Post Request
169 ... ${CONFIG_API}/ietf-interfaces:interfaces/
171 BuiltIn.Should Be Equal As Strings ${post_resp.status_code} 204