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