Beispiel #1
0
def test_l7rulemgr_delete(happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    l7rule_mgr = dv2.L7RuleManager(mock_driver)
    fake_l7rule = FakeRule()
    l7rule_mgr.delete(mock_ctx, fake_l7rule)
    assert mock_driver.agent_rpc.delete_l7rule.call_args == \
        mock.call(mock_ctx, fake_l7rule.to_dict(), {}, 'test_agent')
Beispiel #2
0
def test_mgr__call_rpc_mismatch_tenant_exception(mock_log, happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    rule_mgr = dv2.L7RuleManager(mock_driver)
    rule_mgr._setup_crud = mock.MagicMock(
        name='mock_setup_crud', side_effect=f5_exc.F5MismatchedTenants)
    fake_rule = FakeRule(id='test_lb')
    rule_mgr.create(mock_ctx, fake_rule)
    assert mock_log.error.call_args == mock.call(
        'Exception: create_l7rule: Tenant Id of network and loadbalancer '
        'mismatched')
Beispiel #3
0
def test_l7rulemgr_update(happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    l7rule_mgr = dv2.L7RuleManager(mock_driver)
    fake_old_l7rule = FakeRule(id='old_rule')
    fake_new_l7rule = FakeRule(id='new_rule')
    l7rule_mgr.update(mock_ctx, fake_old_l7rule, fake_new_l7rule)
    assert mock_driver.agent_rpc.update_l7rule.call_args == \
        mock.call(
            mock_ctx,
            fake_old_l7rule.to_dict(),
            fake_new_l7rule.to_dict(),
            {},
            'test_agent')
Beispiel #4
0
def test_mgr__call_rpc_mismatch_tenant_exception(mock_log, happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    rule_mgr = dv2.L7RuleManager(mock_driver)
    rule_mgr._setup_crud = mock.MagicMock(
        name='mock_setup_crud', side_effect=f5_exc.F5MismatchedTenants)
    fake_rule = FakeRule(id='test_lb')
    with pytest.raises(f5_exc.F5MismatchedTenants) as ex:
        rule_mgr.create(mock_ctx, fake_rule)
    assert 'Tenant Id of network and loadbalancer mismatched' in \
        ex.value.message
    assert mock_log.error.call_args == mock.call(
        'Exception: create_l7rule: Tenant Id of network and loadbalancer '
        'mismatched')
    assert mock_driver.plugin.db.update_status.call_args is None