|
@@ 213-225 (lines=13) @@
|
| 210 |
|
self.napp.event_flows_install_delete(event) |
| 211 |
|
mock_install_flows.assert_called_with('add', mock_flow_dict, [switch]) |
| 212 |
|
|
| 213 |
|
@patch('napps.kytos.flow_manager.main.Main._install_flows') |
| 214 |
|
def test_event_flows_install_delete(self, mock_install_flows): |
| 215 |
|
"""Test method for removing flows on the switches through events.""" |
| 216 |
|
dpid = "00:00:00:00:00:00:00:01" |
| 217 |
|
switch = get_switch_mock(dpid) |
| 218 |
|
self.napp.controller.switches = {dpid: switch} |
| 219 |
|
mock_flow_dict = MagicMock() |
| 220 |
|
event = get_kytos_event_mock(name='kytos.flow_manager.flows.delete', |
| 221 |
|
content={'dpid': dpid, |
| 222 |
|
'flow_dict': mock_flow_dict}) |
| 223 |
|
self.napp.event_flows_install_delete(event) |
| 224 |
|
mock_install_flows.assert_called_with('delete', mock_flow_dict, |
| 225 |
|
[switch]) |
| 226 |
|
|
| 227 |
|
def test_add_flow_mod_sent(self): |
| 228 |
|
"""Test _add_flow_mod_sent method.""" |
|
@@ 200-211 (lines=12) @@
|
| 197 |
|
mock_send_napp_event.assert_called_with(self.switch_01, flow, |
| 198 |
|
'delete_strict') |
| 199 |
|
|
| 200 |
|
@patch('napps.kytos.flow_manager.main.Main._install_flows') |
| 201 |
|
def test_event_add_flow(self, mock_install_flows): |
| 202 |
|
"""Test method for installing flows on the switches through events.""" |
| 203 |
|
dpid = "00:00:00:00:00:00:00:01" |
| 204 |
|
switch = get_switch_mock(dpid) |
| 205 |
|
self.napp.controller.switches = {dpid: switch} |
| 206 |
|
mock_flow_dict = MagicMock() |
| 207 |
|
event = get_kytos_event_mock(name='kytos.flow_manager.flows.install', |
| 208 |
|
content={'dpid': dpid, |
| 209 |
|
'flow_dict': mock_flow_dict}) |
| 210 |
|
self.napp.event_flows_install_delete(event) |
| 211 |
|
mock_install_flows.assert_called_with('add', mock_flow_dict, [switch]) |
| 212 |
|
|
| 213 |
|
@patch('napps.kytos.flow_manager.main.Main._install_flows') |
| 214 |
|
def test_event_flows_install_delete(self, mock_install_flows): |