|
@@ 204-217 (lines=14) @@
|
| 201 |
|
self.napp.event_add_flow(event) |
| 202 |
|
mock_install_flows.assert_called_with('add', mock_flow_dict, [switch]) |
| 203 |
|
|
| 204 |
|
@patch('napps.kytos.flow_manager.main.Main._install_flows') |
| 205 |
|
def test_event_add_flow_delete(self, mock_install_flows): |
| 206 |
|
"""Test method for removing flows on the switches through events.""" |
| 207 |
|
dpid = "00:00:00:00:00:00:00:01" |
| 208 |
|
switch = get_switch_mock(dpid) |
| 209 |
|
self.napp.controller.switches = {dpid: switch} |
| 210 |
|
mock_flow_dict = MagicMock() |
| 211 |
|
event = get_kytos_event_mock(name='kytos.flow_manager.flows.delete', |
| 212 |
|
content={'dpid': dpid, |
| 213 |
|
'command': 'delete', |
| 214 |
|
'flow_dict': mock_flow_dict}) |
| 215 |
|
self.napp.event_add_flow(event) |
| 216 |
|
mock_install_flows.assert_called_with('delete', mock_flow_dict, |
| 217 |
|
[switch]) |
| 218 |
|
|
| 219 |
|
def test_add_flow_mod_sent(self): |
| 220 |
|
"""Test _add_flow_mod_sent method.""" |
|
@@ 190-202 (lines=13) @@
|
| 187 |
|
mock_send_napp_event.assert_called_with(self.switch_01, flow, |
| 188 |
|
'delete_strict') |
| 189 |
|
|
| 190 |
|
@patch('napps.kytos.flow_manager.main.Main._install_flows') |
| 191 |
|
def test_event_add_flow(self, mock_install_flows): |
| 192 |
|
"""Test method for installing flows on the switches through events.""" |
| 193 |
|
dpid = "00:00:00:00:00:00:00:01" |
| 194 |
|
switch = get_switch_mock(dpid) |
| 195 |
|
self.napp.controller.switches = {dpid: switch} |
| 196 |
|
mock_flow_dict = MagicMock() |
| 197 |
|
event = get_kytos_event_mock(name='kytos.flow_manager.flows.install', |
| 198 |
|
content={'dpid': dpid, |
| 199 |
|
'command': 'add', |
| 200 |
|
'flow_dict': mock_flow_dict}) |
| 201 |
|
self.napp.event_add_flow(event) |
| 202 |
|
mock_install_flows.assert_called_with('add', mock_flow_dict, [switch]) |
| 203 |
|
|
| 204 |
|
@patch('napps.kytos.flow_manager.main.Main._install_flows') |
| 205 |
|
def test_event_add_flow_delete(self, mock_install_flows): |