| @@ 58-104 (lines=47) @@ | ||
| 55 | actual_events = self.napp.listeners() |
|
| 56 | self.assertCountEqual(expected_events, actual_events) |
|
| 57 | ||
| 58 | def test_verify_api_urls(self): |
|
| 59 | """Verify all APIs registered.""" |
|
| 60 | expected_urls = [ |
|
| 61 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/interfaces'), |
|
| 62 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/switches'), |
|
| 63 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/links'), |
|
| 64 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/'), |
|
| 65 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 66 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/disable'), |
|
| 67 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 68 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/enable'), |
|
| 69 | ({'key': '[key]', 'interface_id': '[interface_id]'}, |
|
| 70 | {'OPTIONS', 'DELETE'}, |
|
| 71 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata/<key>'), |
|
| 72 | ({'interface_id': '[interface_id]'}, {'POST', 'OPTIONS'}, |
|
| 73 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 74 | ({'interface_id': '[interface_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 75 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 76 | ({'interface_disable_id': '[interface_disable_id]'}, |
|
| 77 | {'POST', 'OPTIONS'}, |
|
| 78 | '/api/kytos/topology/v3/interfaces/<interface_disable_id>/disable'), |
|
| 79 | ({'interface_enable_id': '[interface_enable_id]'}, |
|
| 80 | {'POST', 'OPTIONS'}, |
|
| 81 | '/api/kytos/topology/v3/interfaces/<interface_enable_id>/enable'), |
|
| 82 | ({'dpid': '[dpid]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 83 | '/api/kytos/topology/v3/switches/<dpid>/metadata/<key>'), |
|
| 84 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 85 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 86 | ({'dpid': '[dpid]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 87 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 88 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 89 | '/api/kytos/topology/v3/switches/<dpid>/disable'), |
|
| 90 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 91 | '/api/kytos/topology/v3/switches/<dpid>/enable'), |
|
| 92 | ({'link_id': '[link_id]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 93 | '/api/kytos/topology/v3/links/<link_id>/metadata/<key>'), |
|
| 94 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 95 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 96 | ({'link_id': '[link_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 97 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 98 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 99 | '/api/kytos/topology/v3/links/<link_id>/disable'), |
|
| 100 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 101 | '/api/kytos/topology/v3/links/<link_id>/enable')] |
|
| 102 | ||
| 103 | urls = get_napp_urls(self.napp) |
|
| 104 | self.assertEqual(expected_urls, urls) |
|
| 105 | ||
| 106 | def test_get_link_or_create(self): |
|
| 107 | """Test _get_link_or_create.""" |
|
| @@ 167-213 (lines=47) @@ | ||
| 164 | actual_events = self.napp.listeners() |
|
| 165 | self.assertCountEqual(expected_events, actual_events) |
|
| 166 | ||
| 167 | def test_verify_api_urls(self): |
|
| 168 | """Verify all APIs registered.""" |
|
| 169 | expected_urls = [ |
|
| 170 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/interfaces'), |
|
| 171 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/switches'), |
|
| 172 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/links'), |
|
| 173 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/'), |
|
| 174 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 175 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/disable'), |
|
| 176 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 177 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/enable'), |
|
| 178 | ({'key': '[key]', 'interface_id': '[interface_id]'}, |
|
| 179 | {'OPTIONS', 'DELETE'}, |
|
| 180 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata/<key>'), |
|
| 181 | ({'interface_id': '[interface_id]'}, {'POST', 'OPTIONS'}, |
|
| 182 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 183 | ({'interface_id': '[interface_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 184 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 185 | ({'interface_disable_id': '[interface_disable_id]'}, |
|
| 186 | {'POST', 'OPTIONS'}, |
|
| 187 | '/api/kytos/topology/v3/interfaces/<interface_disable_id>/disable'), |
|
| 188 | ({'interface_enable_id': '[interface_enable_id]'}, |
|
| 189 | {'POST', 'OPTIONS'}, |
|
| 190 | '/api/kytos/topology/v3/interfaces/<interface_enable_id>/enable'), |
|
| 191 | ({'dpid': '[dpid]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 192 | '/api/kytos/topology/v3/switches/<dpid>/metadata/<key>'), |
|
| 193 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 194 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 195 | ({'dpid': '[dpid]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 196 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 197 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 198 | '/api/kytos/topology/v3/switches/<dpid>/disable'), |
|
| 199 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 200 | '/api/kytos/topology/v3/switches/<dpid>/enable'), |
|
| 201 | ({'link_id': '[link_id]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 202 | '/api/kytos/topology/v3/links/<link_id>/metadata/<key>'), |
|
| 203 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 204 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 205 | ({'link_id': '[link_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 206 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 207 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 208 | '/api/kytos/topology/v3/links/<link_id>/disable'), |
|
| 209 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 210 | '/api/kytos/topology/v3/links/<link_id>/enable')] |
|
| 211 | ||
| 212 | urls = self.get_napp_urls(self.napp) |
|
| 213 | self.assertEqual(expected_urls, urls) |
|
| 214 | ||
| 215 | @staticmethod |
|
| 216 | def get_napp_urls(napp): |
|