def patched_openvswitch_bridge(monkeypatch):
    mocked_bridge = MagicMock()
    mocked_bridge.return_value = {'bridge': 'test-br2', 'parent': 'test-br',
                                  'vlan': 200, 'fail_mode': None,
                                  'external_ids': None, 'set': None}
    monkeypatch.setattr(openvswitch_bridge, 'map_config_to_obj', mocked_bridge)
    return openvswitch_bridge
def patched_openvswitch_db(monkeypatch):
    mocked_ovs_db = MagicMock()
    mocked_ovs_db.return_value = {
        "table": "open_vswitch",
        "record": ".",
        "col": "other_config",
        "key": "pmd-cpu-mask",
        "value": "0xaaa00000000",
    }
    monkeypatch.setattr(openvswitch_db, "map_config_to_obj", mocked_ovs_db)
    return openvswitch_db
Exemple #3
0
def patched_openvswitch_db(monkeypatch):
    mocked_ovs_db = MagicMock()
    mocked_ovs_db.return_value = {
        'table': 'open_vswitch',
        'record': '.',
        'col': 'other_config',
        'key': 'pmd-cpu-mask',
        'value': '0xaaa00000000'
    }
    monkeypatch.setattr(openvswitch_db, 'map_config_to_obj', mocked_ovs_db)
    return openvswitch_db
Exemple #4
0
def patched_openvswitch_bridge(monkeypatch):
    mocked_bridge = MagicMock()
    mocked_bridge.return_value = {
        "bridge": "test-br2",
        "parent": "test-br",
        "vlan": 200,
        "fail_mode": None,
        "external_ids": None,
        "set": None,
    }
    monkeypatch.setattr(openvswitch_bridge, "map_config_to_obj", mocked_bridge)
    return openvswitch_bridge
Exemple #5
0
from ansible_collections.openvswitch.openvswitch.tests.unit.compat.mock import (
    MagicMock, )
from ansible.utils.path import unfrackpath

mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath,
                                  side_effect=lambda x, *args, **kwargs: x)