2 Documentation Test Suite for Interface manager
3 Suite Setup Genius Suite Setup
4 Suite Teardown Genius Suite Teardown
5 Test Setup Genius Test Setup
6 Test Teardown Genius Test Teardown ${data_models}
8 Library OperatingSystem
9 Library RequestsLibrary
11 Resource ../../libraries/DataModels.robot
12 Resource ../../libraries/Genius.robot
13 Resource ../../libraries/Utils.robot
14 Resource ../../variables/Variables.robot
15 Variables ../../variables/genius/Modules.py
18 ${interface_name} l2vlan-trunk
19 ${trunk_json} l2vlan.json
20 ${trunk_member_json} l2vlan_member.json
23 Create l2vlan transparent interface
24 [Documentation] This testcase creates a l2vlan transparent interface between 2 dpns.
25 Create Interface ${trunk_json} transparent
26 @{l2vlan} = BuiltIn.Create List l2vlan-trunk l2vlan transparent l2vlan true
27 Utils.Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
28 BuiltIn.Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
29 BuiltIn.Wait Until Keyword Succeeds 40 10 table0 entry ${TOOLS_SYSTEM_1_IP}
31 Delete l2vlan transparent interface
32 [Documentation] This testcase deletes the l2vlan transparent interface created between 2 dpns.
33 Utils.Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
34 Utils.No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
35 BuiltIn.Wait Until Keyword Succeeds 30 10 no table0 entry
37 Create l2vlan trunk interface
38 [Documentation] This testcase creates a l2vlan trunk interface between 2 DPNs.
39 Create Interface ${trunk_json} trunk
40 @{l2vlan} = BuiltIn.Create list l2vlan-trunk l2vlan trunk tap0ed70586-6c true
41 Utils.Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
42 BuiltIn.Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
43 BuiltIn.Wait Until Keyword Succeeds 30 10 table0 entry ${TOOLS_SYSTEM_1_IP}
45 Create l2vlan Trunk member interface
46 [Documentation] This testcase creates a l2vlan Trunk member interface for the l2vlan trunk interface created in 1st testcase.
47 ${body} = OperatingSystem.Get File ${genius_config_dir}/l2vlan_member.json
48 ${post_resp} = RequestsLibrary.Post Request session ${CONFIG_API}/ietf-interfaces:interfaces/ data=${body}
49 BuiltIn.Should Be Equal As Strings ${post_resp.status_code} 204
50 @{l2vlan} = create list l2vlan-trunk1 l2vlan trunk-member 1000 l2vlan-trunk
52 Utils.Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
53 BuiltIn.Wait Until Keyword Succeeds 10 5 get operational interface ${l2vlan[0]}
54 BuiltIn.Wait Until Keyword Succeeds 40 10 ovs check for member interface creation ${TOOLS_SYSTEM_1_IP}
56 Bind service on Interface
57 [Documentation] This testcase binds service to the interface created .
58 ${body} = OperatingSystem.Get File ${genius_config_dir}/bind_service.json
59 ${body} = String.Replace string ${body} service1 VPN
60 ${body} = String.Replace string ${body} service2 elan
62 ${service_mode} = BuiltIn.Set Variable interface-service-bindings:service-mode-ingress
63 ${post_resp} = RequestsLibrary.Post Request session ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/ data=${body}
64 BuiltIn.Should Be Equal As Strings ${post_resp.status_code} 204
65 @{bind_array} = BuiltIn.Create List 2 3 VPN elan 50
67 Utils.Check For Elements At URI ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/ ${bind_array}
68 BuiltIn.Wait Until Keyword Succeeds 40 10 table entry
70 unbind service on interface
71 [Documentation] This testcase Unbinds the service which is binded by the 3rd testcase.
72 ${service-priority-1} = BuiltIn.Set Variable 3
73 ${service-priority-2} = BuiltIn.Set Variable 4
74 ${service_mode} = BuiltIn.Set Variable interface-service-bindings:service-mode-ingress
75 Utils.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}/
76 ${table-id} = BuiltIn.Set Variable 21
77 BuiltIn.Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
78 Utils.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}/
79 Utils.No Content From URI session ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
80 ${table-id} = BuiltIn.Set Variable 50
81 BuiltIn.Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
83 Delete l2vlan trunk interface
84 [Documentation] Deletion of l2vlan trunk interface is done.
85 Utils.Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
86 Utils.No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
87 BuiltIn.Wait Until Keyword Succeeds 30 10 no table0 entry
90 get operational interface
91 [Arguments] ${interface_name}
92 [Documentation] checks operational status of the interface.
93 ${get_oper_resp} = RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${interface_name}/
94 ${respjson} = RequestsLibrary.To Json ${get_oper_resp.content} pretty_print=True
95 BuiltIn.Log ${respjson}
96 BuiltIn.Should Be Equal As Strings ${get_oper_resp.status_code} 200
97 BuiltIn.Should Not Contain ${get_oper_resp.content} down
98 BuiltIn.Should Contain ${get_oper_resp.content} up up
101 [Documentation] Checks for tables entry wrt the service the Interface is binded.
102 ${result} = Utils.Run Command On Remote System ${TOOLS_SYSTEM_1_IP} sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
103 BuiltIn.Should Contain ${result} table=17
104 BuiltIn.Should Contain ${result} goto_table:21
105 BuiltIn.Should Contain ${result} goto_table:50
108 [Documentation] After Deleting trunk interface, checking for absence of table 0 in the flow dumps
109 ${ovs-check} = Utils.Run Command On Remote System ${TOOLS_SYSTEM_1_IP} sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
110 BuiltIn.Should Not Contain ${ovs-check} table=0
111 BuiltIn.Should Not Contain ${ovs-check} goto_table:17
114 [Arguments] ${table-id}
115 [Documentation] Checks for absence of no goto_table after unbinding the service on the interface.
116 ${ovs-check1} = Utils.Run Command On Remote System ${TOOLS_SYSTEM_1_IP} sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
117 BuiltIn.Should Not Contain ${ovs-check1} goto_table:${table-id}
120 [Arguments] ${tools_ip}
121 [Documentation] After Creating the trunk interface , checking for table 0 entry exist in the flow dumps
122 ${ovs-check} = Utils.Run Command On Remote System ${tools_ip} sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
123 BuiltIn.Should Contain ${ovs-check} table=0
125 ovs check for member interface creation
126 [Arguments] ${tools_ip}
127 [Documentation] This keyword verifies the member interface created on OVS by checking the table0 ,vlan and action=pop_vlan entries
128 ${ovs-check} = Utils.Run Command On Remote System ${tools_ip} sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridge}
129 BuiltIn.Should Contain ${ovs-check} table=0
130 BuiltIn.Should Contain ${ovs-check} dl_vlan=1000
131 BuiltIn.Should Contain ${ovs-check} actions=pop_vlan
134 [Arguments] ${json_file} ${interface_mode}
135 [Documentation] Creates an trunk/transparent interface based on input provided to the json body
136 ${body} = OperatingSystem.Get File ${genius_config_dir}/${json_file}
137 ${body} = String.Replace String ${body} "l2vlan-mode":"trunk" "l2vlan-mode":"${interface_mode}"
138 ${post_resp} = RequestsLibrary.Post Request session ${CONFIG_API}/ietf-interfaces:interfaces/ data=${body}
139 BuiltIn.Should Be Equal As Strings ${post_resp.status_code} 204