File: test_fdb.py

package info (click to toggle)
pyroute2 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,700 kB
  • sloc: python: 50,245; makefile: 280; javascript: 183; ansic: 81; sh: 44; awk: 17
file content (26 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pytest
from pr2test.context_manager import make_test_matrix
from pr2test.marks import require_root
from pr2test.tools import fdb_record_exists

pytestmark = [require_root()]

test_matrix = make_test_matrix(
    targets=['local', 'netns'],
    tables=[None],
    dbs=['sqlite3/:memory:', 'postgres/pr2test'],
)


@pytest.mark.parametrize('context', test_matrix, indirect=True)
def test_fdb_create(context):
    spec = {
        'ifindex': context.default_interface.index,
        'lladdr': '00:11:22:33:44:55',
    }

    context.ndb.fdb.create(**spec).commit()
    assert fdb_record_exists(context.netns, **spec)

    context.ndb.fdb[spec].remove().commit()
    assert not fdb_record_exists(context.netns, **spec)