| @@ 160-206 (lines=47) @@ | ||
| 157 | '.*.switch.port.created'] |
|
| 158 | self.assertCountEqual(expected_events, actual_events) |
|
| 159 | ||
| 160 | def test_verify_api_urls(self): |
|
| 161 | """Verify all APIs registered.""" |
|
| 162 | expected_urls = [ |
|
| 163 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/interfaces'), |
|
| 164 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/switches'), |
|
| 165 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/links'), |
|
| 166 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/'), |
|
| 167 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 168 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/disable'), |
|
| 169 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 170 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/enable'), |
|
| 171 | ({'key': '[key]', 'interface_id': '[interface_id]'}, |
|
| 172 | {'OPTIONS', 'DELETE'}, |
|
| 173 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata/<key>'), |
|
| 174 | ({'interface_id': '[interface_id]'}, {'POST', 'OPTIONS'}, |
|
| 175 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 176 | ({'interface_id': '[interface_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 177 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 178 | ({'interface_disable_id': '[interface_disable_id]'}, |
|
| 179 | {'POST', 'OPTIONS'}, |
|
| 180 | '/api/kytos/topology/v3/interfaces/<interface_disable_id>/disable'), |
|
| 181 | ({'interface_enable_id': '[interface_enable_id]'}, |
|
| 182 | {'POST', 'OPTIONS'}, |
|
| 183 | '/api/kytos/topology/v3/interfaces/<interface_enable_id>/enable'), |
|
| 184 | ({'dpid': '[dpid]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 185 | '/api/kytos/topology/v3/switches/<dpid>/metadata/<key>'), |
|
| 186 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 187 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 188 | ({'dpid': '[dpid]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 189 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 190 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 191 | '/api/kytos/topology/v3/switches/<dpid>/disable'), |
|
| 192 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 193 | '/api/kytos/topology/v3/switches/<dpid>/enable'), |
|
| 194 | ({'link_id': '[link_id]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 195 | '/api/kytos/topology/v3/links/<link_id>/metadata/<key>'), |
|
| 196 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 197 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 198 | ({'link_id': '[link_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 199 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 200 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 201 | '/api/kytos/topology/v3/links/<link_id>/disable'), |
|
| 202 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 203 | '/api/kytos/topology/v3/links/<link_id>/enable')] |
|
| 204 | ||
| 205 | urls = self.get_napp_urls(self.napp) |
|
| 206 | self.assertEqual(expected_urls, urls) |
|
| 207 | ||
| 208 | @staticmethod |
|
| 209 | def get_napp_urls(napp): |
|
| @@ 93-139 (lines=47) @@ | ||
| 90 | actual_events = self.napp.listeners() |
|
| 91 | self.assertCountEqual(expected_events, actual_events) |
|
| 92 | ||
| 93 | def test_verify_api_urls(self): |
|
| 94 | """Verify all APIs registered.""" |
|
| 95 | expected_urls = [ |
|
| 96 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/interfaces'), |
|
| 97 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/switches'), |
|
| 98 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/links'), |
|
| 99 | ({}, {'GET', 'OPTIONS', 'HEAD'}, '/api/kytos/topology/v3/'), |
|
| 100 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 101 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/disable'), |
|
| 102 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 103 | '/api/kytos/topology/v3/interfaces/switch/<dpid>/enable'), |
|
| 104 | ({'key': '[key]', 'interface_id': '[interface_id]'}, |
|
| 105 | {'OPTIONS', 'DELETE'}, |
|
| 106 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata/<key>'), |
|
| 107 | ({'interface_id': '[interface_id]'}, {'POST', 'OPTIONS'}, |
|
| 108 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 109 | ({'interface_id': '[interface_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 110 | '/api/kytos/topology/v3/interfaces/<interface_id>/metadata'), |
|
| 111 | ({'interface_disable_id': '[interface_disable_id]'}, |
|
| 112 | {'POST', 'OPTIONS'}, |
|
| 113 | '/api/kytos/topology/v3/interfaces/<interface_disable_id>/disable'), |
|
| 114 | ({'interface_enable_id': '[interface_enable_id]'}, |
|
| 115 | {'POST', 'OPTIONS'}, |
|
| 116 | '/api/kytos/topology/v3/interfaces/<interface_enable_id>/enable'), |
|
| 117 | ({'dpid': '[dpid]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 118 | '/api/kytos/topology/v3/switches/<dpid>/metadata/<key>'), |
|
| 119 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 120 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 121 | ({'dpid': '[dpid]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 122 | '/api/kytos/topology/v3/switches/<dpid>/metadata'), |
|
| 123 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 124 | '/api/kytos/topology/v3/switches/<dpid>/disable'), |
|
| 125 | ({'dpid': '[dpid]'}, {'POST', 'OPTIONS'}, |
|
| 126 | '/api/kytos/topology/v3/switches/<dpid>/enable'), |
|
| 127 | ({'link_id': '[link_id]', 'key': '[key]'}, {'OPTIONS', 'DELETE'}, |
|
| 128 | '/api/kytos/topology/v3/links/<link_id>/metadata/<key>'), |
|
| 129 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 130 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 131 | ({'link_id': '[link_id]'}, {'GET', 'OPTIONS', 'HEAD'}, |
|
| 132 | '/api/kytos/topology/v3/links/<link_id>/metadata'), |
|
| 133 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 134 | '/api/kytos/topology/v3/links/<link_id>/disable'), |
|
| 135 | ({'link_id': '[link_id]'}, {'POST', 'OPTIONS'}, |
|
| 136 | '/api/kytos/topology/v3/links/<link_id>/enable')] |
|
| 137 | ||
| 138 | urls = get_napp_urls(self.napp) |
|
| 139 | self.assertEqual(expected_urls, urls) |
|
| 140 | ||
| 141 | def test_get_link_or_create(self): |
|
| 142 | """Test _get_link_or_create.""" |
|