Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: NAT Interface and AddressPool API changes #1595

Merged
merged 9 commits into from
Jan 7, 2020

Conversation

rastislavs
Copy link
Contributor

This PR moves NAT interfaces and NAT address pools from the global NAT44 config into separate NB API entities.

At the same time, it supports full backward compatibility with the old (deprecated) API. This is done by keeping both old (global - deprecated) and new NAT address pool & interface descriptors, which share the same VPPcalls. Once the deprecated API is to be definitively removed, the old descriptors can be just deleted.

Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
@rastislavs rastislavs changed the title NAT Interface and AddressPool API changes refactor: NAT Interface and AddressPool API changes Dec 19, 2019
@codecov
Copy link

codecov bot commented Dec 19, 2019

Codecov Report

Merging #1595 into dev will decrease coverage by 0.07%.
The diff coverage is 61.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1595      +/-   ##
==========================================
- Coverage   52.81%   52.74%   -0.08%     
==========================================
  Files         673      677       +4     
  Lines       79720    80530     +810     
==========================================
+ Hits        42105    42476     +371     
- Misses      34965    35349     +384     
- Partials     2650     2705      +55
Flag Coverage Δ
#e2e 41.32% <55.56%> (-0.89%) ⬇️
#unittests 54.05% <54.89%> (-0.06%) ⬇️

Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
test-e2e

Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
@rewenset
Copy link
Contributor

rewenset commented Dec 20, 2019

Currently vpp-agent/examples/kvscheduler/nat shows:

WARN[0002] NatInterfaces are deprecated in global NAT44 config, use separate Nat44Interface entries.  loc="descriptor/nat44_global.go(118)" logger=vpp-natplugin.nat44-global-descriptor
WARN[0002] AddressPool is deprecated in global NAT44 config, use separate Nat44AddressPool entries.  loc="descriptor/nat44_global.go(121)" logger=vpp-natplugin.nat44-global-descriptor

Probably, examples should be updated too if possible.
Same applies to vpp-agent/examples/localclient_vpp/nat

EDIT: and e2e too. For me, TestSourceNAT fails and TestNATStaticMappings just prints warnings.

Failing TestSourceNAT

--- FAIL: TestSourceNAT (14.84s)
    e2e_test.go:612: VPP start OK (PID: 29453)
    e2e_test.go:156: Using docker client endpoint: unix:///var/run/docker.sock
    e2e_test.go:612: VPP-Agent start OK (PID: 29472)
    e2e_test.go:564: agent ready, took 101.397587ms
    e2e_test.go:299: exec: vppctl show nat44 addresses
    e2e_test.go:299: exec: vppctl show nat44 addresses
    microservice_test.go:177: Linux ping 80.80.80.10: sent=5, received=3, loss=40%
    e2e_test.go:299: exec: vppctl clear trace
    e2e_test.go:299: exec: vppctl trace add virtio-input 100
    e2e_test.go:299: exec: vppctl show trace
    e2e_test.go:299: exec: vppctl clear trace
    e2e_test.go:299: exec: vppctl trace add virtio-input 100
    e2e_test.go:299: exec: vppctl show trace
    testing_t_support.go:22: 
                /home/andrii/go/pkg/mod/github.com/onsi/gomega@v1.4.1/internal/assertion/assertion.go:69 +0x1b4
        github.com/onsi/gomega/internal/assertion.(*Assertion).To(0xc000032dc0, 0xf3d3e0, 0x15fd170, 0xc0005341e0, 0x1, 0x1, 0x1)
                /home/andrii/go/pkg/mod/github.com/onsi/gomega@v1.4.1/internal/assertion/assertion.go:35 +0xac
        go.ligato.io/vpp-agent/v2/tests/e2e.TestSourceNAT(0xc00019c900)
                /home/andrii/Projects/vpp-agent/tests/e2e/050_nat_test.go:190 +0x1af9
        testing.tRunner(0xc00019c900, 0xe38d60)
                /usr/local/go/src/testing/testing.go:909 +0xc9
        created by testing.(*T).Run
                /usr/local/go/src/testing/testing.go:960 +0x350
        
        Agent is not in-sync
        Expected
            <bool>: false
        to be true
    e2e_test.go:208: -----------------
    e2e_test.go:633: VPP-Agent exit OK
    e2e_test.go:633: VPP exit OK
FAIL
-------------------------------------------------------------
 FAILED! (exit code: 1)
-------------------------------------------------------------

(I always look into old PRs to remember how to do this 😃) You may add test-e2e on a new line in commit message and Travis will run E2E tests too.

@rastislavs
Copy link
Contributor Author

rastislavs commented Dec 20, 2019

For me, TestSourceNAT fails and TestNATStaticMappings just prints warnings.

Thanks @rewenset , tests should not fail even if using old API, since this aims to be backward compatible. It seems that I forgot to setup this dependency in address descriptor

Will update e2e-tests as well.

Edit: done, e2e updated & passing. I also kept one e2e test there for legacy API testing.

@ondrej-fabry ondrej-fabry merged commit 3dfa330 into ligato:dev Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants