|
6 | 6 |
|
7 | 7 | import time
|
8 | 8 | import collections
|
9 |
| -import pytest |
10 | 9 |
|
11 | 10 | from swsscommon import swsscommon
|
12 | 11 |
|
13 |
| -APP_DB_ID = 0 |
14 |
| -ASIC_DB_ID = 1 |
15 |
| -COUNTERS_DB_ID = 2 |
16 |
| -CONFIG_DB_ID = 4 |
17 |
| -FLEX_COUNTER_DB_ID = 5 |
18 |
| -STATE_DB_ID = 6 |
19 |
| - |
20 | 12 |
|
21 | 13 | # PollingConfig provides parameters that are used to control polling behavior
|
22 | 14 | # when accessing redis:
|
@@ -46,10 +38,6 @@ def __init__(self, db_id, connector):
|
46 | 38 | instance in redis.
|
47 | 39 | connector (str): The I/O connection used to communicate with
|
48 | 40 | redis (e.g. unix socket, tcp socket, etc.).
|
49 |
| -
|
50 |
| - NOTE: Currently it's most convenient to let the user specify the |
51 |
| - connector since it's set up in the dvs fixture. We may abstract |
52 |
| - this further in the future as we refactor dvs. |
53 | 41 | """
|
54 | 42 |
|
55 | 43 | self.db_connection = swsscommon.DBConnector(db_id, connector, 0)
|
@@ -264,115 +252,3 @@ def _db_poll(polling_config, access_function):
|
264 | 252 | assert False
|
265 | 253 |
|
266 | 254 | return None
|
267 |
| - |
268 |
| - |
269 |
| -@pytest.fixture |
270 |
| -def app_db(dvs): |
271 |
| - """ |
272 |
| - Provides access to the SONiC APP DB. |
273 |
| -
|
274 |
| - Args: |
275 |
| - dvs (DockerVirtualSwitch): The dvs fixture, automatically injected |
276 |
| - by pytest. |
277 |
| -
|
278 |
| - Returns: |
279 |
| - DVSDatabase: An instance of APP DB |
280 |
| - """ |
281 |
| - |
282 |
| - return DVSDatabase(APP_DB_ID, dvs.redis_sock) |
283 |
| - |
284 |
| - |
285 |
| -@pytest.fixture |
286 |
| -def asic_db(dvs): |
287 |
| - """ |
288 |
| - Provides access to the SONiC ASIC DB. |
289 |
| -
|
290 |
| - Args: |
291 |
| - dvs (DockerVirtualSwitch): The dvs fixture, automatically injected |
292 |
| - by pytest. |
293 |
| -
|
294 |
| - Attributes: |
295 |
| - default_acl_tables (List[str]): IDs for the ACL tables that are |
296 |
| - configured in SONiC by default |
297 |
| - default_acl_entries (List[str]): IDs for the ACL rules that are |
298 |
| - configured in SONiC by default |
299 |
| - port_name_map (Dict[str, str]): A mapping from interface names |
300 |
| - (e.g. Ethernet0) to port IDs |
301 |
| -
|
302 |
| - Returns: |
303 |
| - DVSDatabase: An instance of ASIC DB |
304 |
| - """ |
305 |
| - |
306 |
| - db = DVSDatabase(ASIC_DB_ID, dvs.redis_sock) # pylint: disable=invalid-name |
307 |
| - |
308 |
| - # NOTE: This is an ugly hack to emulate the current asic db behavior, |
309 |
| - # this will be refactored along with the dvs fixture. |
310 |
| - db.default_acl_tables = dvs.asicdb.default_acl_tables # pylint: disable=attribute-defined-outside-init |
311 |
| - db.default_acl_entries = dvs.asicdb.default_acl_entries # pylint: disable=attribute-defined-outside-init |
312 |
| - db.port_name_map = dvs.asicdb.portnamemap # pylint: disable=attribute-defined-outside-init |
313 |
| - |
314 |
| - return db |
315 |
| - |
316 |
| - |
317 |
| -@pytest.fixture |
318 |
| -def counters_db(dvs): |
319 |
| - """ |
320 |
| - Provides access to the SONiC Counters DB. |
321 |
| -
|
322 |
| - Args: |
323 |
| - dvs (DockerVirtualSwitch): The dvs fixture, automatically injected |
324 |
| - by pytest. |
325 |
| -
|
326 |
| - Returns: |
327 |
| - DVSDatabase: An instance of Counters DB |
328 |
| - """ |
329 |
| - |
330 |
| - return DVSDatabase(COUNTERS_DB_ID, dvs.redis_sock) |
331 |
| - |
332 |
| - |
333 |
| -@pytest.fixture |
334 |
| -def config_db(dvs): |
335 |
| - """ |
336 |
| - Provides access to the SONiC Config DB. |
337 |
| -
|
338 |
| - Args: |
339 |
| - dvs (DockerVirtualSwitch): The dvs fixture, automatically injected |
340 |
| - by pytest. |
341 |
| -
|
342 |
| - Returns: |
343 |
| - DVSDatabase: An instance of Config DB |
344 |
| - """ |
345 |
| - |
346 |
| - return DVSDatabase(CONFIG_DB_ID, dvs.redis_sock) |
347 |
| - |
348 |
| - |
349 |
| -@pytest.fixture |
350 |
| -def flex_counter_db(dvs): |
351 |
| - """ |
352 |
| - Provides access to the SONiC Flex Counter DB. |
353 |
| -
|
354 |
| - Args: |
355 |
| - dvs (DockerVirtualSwitch): The dvs fixture, automatically injected |
356 |
| - by pytest. |
357 |
| -
|
358 |
| - Returns: |
359 |
| - DVSDatabase: An instance of Flex Counter DB |
360 |
| - """ |
361 |
| - |
362 |
| - return DVSDatabase(FLEX_COUNTER_DB_ID, dvs.redis_sock) |
363 |
| - |
364 |
| - |
365 |
| -@pytest.fixture |
366 |
| -def state_db(dvs): |
367 |
| - """ |
368 |
| - Provides access to the SONiC State DB. |
369 |
| -
|
370 |
| - Args: |
371 |
| - dvs (DockerVirtualSwitch): The dvs fixture, automatically injected |
372 |
| - by pytest. |
373 |
| -
|
374 |
| - Returns: |
375 |
| - DVSDatabase: An instance of State DB |
376 |
| - """ |
377 |
| - |
378 |
| - return DVSDatabase(STATE_DB_ID, dvs.redis_sock) |
0 commit comments