TT#76851 Extend get_all_ips test cases

Add an entry for PRO, and add output for all IPs. This also covers the
deduplicatioin of IPs, as on PRO and CARRIER, there is a lo interface
per node that has the same 127.0.0.1 address.

Change-Id: I1af28dcf7f9ca99ad169b2f49b4cd6f74858dcfe
changes/27/38227/4
Guillem Jover 6 years ago
parent d9ab5d1f6b
commit ec07460cf7

@ -1,3 +1,7 @@
id(int,auto) setid(int) destination(str) priority(int) flags(int) description(str)
1:8:sip\:127.0.0.1\::1:0:b2bua1
2:9:sip\:127.0.0.1\::1:0:proxy1
- 10.0.2.15
- 127.0.0.1
- 192.168.1.38

@ -1,3 +1,35 @@
id(int,auto) setid(int) destination(str) priority(int) flags(int) description(str)
1:8:sip\:172.30.52.132\::1:0:b2bua1
2:9:sip\:172.30.52.132\::1:0:proxy1
- 127.0.0.1
- 172.30.52.104
- 172.30.52.105
- 172.30.52.133
- 172.30.52.136
- 172.30.52.137
- 172.30.52.139
- 172.30.52.142
- 172.30.52.143
- 172.30.52.145
- 172.30.52.148
- 172.30.52.168
- 172.30.52.169
- 172.30.52.171
- 172.30.52.174
- 172.30.52.175
- 172.30.52.180
- 172.30.52.181
- 172.30.52.197
- 172.30.52.69
- 172.30.52.70
- 192.168.1.2
- 192.168.1.3
- 192.168.25.180
- 192.168.25.181
- 192.168.25.183
- 192.168.25.184
- 192.168.25.186
- 192.168.25.187
- 192.168.25.189
- 192.168.25.190

@ -0,0 +1,10 @@
id(int,auto) setid(int) destination(str) priority(int) flags(int) description(str)
1:8:sip\:127.0.0.1\::1:0:b2bua1
2:9:sip\:127.0.0.1\::1:0:proxy1
- 10.0.2.15
- 127.0.0.1
- 192.168.1.43
- 192.168.22.203
- 192.168.255.251
- 192.168.255.252

@ -9,6 +9,11 @@
PROCESS '../lib/get_all_ips';
sip_int_ips = out;
END;
argv.role = '.*';
argv.type = '.*';
PROCESS '../lib/get_all_ips';
all_ips = out;
-%]
id(int,auto) setid(int) destination(str) priority(int) flags(int) description(str)
[% idx = 1 -%]
@ -24,4 +29,8 @@ id(int,auto) setid(int) destination(str) priority(int) flags(int) description(st
[% FOREACH ip IN sip_int_ips -%]
[% idx %]:9:sip\:[% ip %]\:[% kamailio.proxy.port %]:1:0:proxy[% loop.count %]
[% idx = idx + 1 -%]
[% END -%]
[% END -%]
[% FOREACH ip IN all_ips -%]
- [% ip %]
[% END -%]

@ -14,3 +14,4 @@ markers =
tt_46601
tt_47255
tt_51601
tt_76851

@ -7,7 +7,7 @@ import re
import tempfile
@pytest.mark.tt_17653
@pytest.mark.tt_76851
def test_all_ips(ngcpcfgcli, tmpdir):
tmpdir = tempfile.mkdtemp(prefix='ngcp-', suffix='-pytest-output')
out = ngcpcfgcli("build", "--ignore-branch-check",
@ -15,7 +15,7 @@ def test_all_ips(ngcpcfgcli, tmpdir):
env={
'NGCP_BASE_TT2': os.getcwd(),
'OUTPUT_DIRECTORY': tmpdir,
'NGCPCFG': 'fixtures/ngcpcfg_pro.cfg',
'NGCPCFG': 'fixtures/ngcpcfg.cfg',
})
regex = re.compile(r"Generating " +
tmpdir +
@ -28,6 +28,27 @@ def test_all_ips(ngcpcfgcli, tmpdir):
assert filecmp.cmp(output_file, test_file)
@pytest.mark.tt_17653
def test_all_ips_pro(ngcpcfgcli, tmpdir):
tmpdir = tempfile.mkdtemp(prefix='ngcp-', suffix='-pytest-output')
out = ngcpcfgcli("build", "--ignore-branch-check",
"/etc/kamailio/lb/db/dispatcher",
env={
'NGCP_BASE_TT2': os.getcwd(),
'OUTPUT_DIRECTORY': tmpdir,
'NGCPCFG': 'fixtures/ngcpcfg_pro.cfg',
})
regex = re.compile(r"Generating " +
tmpdir +
r"/etc/kamailio/lb/db/dispatcher: OK")
assert re.search(regex, out.stdout)
output_file = os.path.join(tmpdir, "etc/kamailio/lb/db/dispatcher")
test_file = "fixtures/output/dispatcher_pro"
assert os.path.exists(output_file)
assert os.path.exists(test_file)
assert filecmp.cmp(output_file, test_file)
@pytest.mark.tt_16316
def test_all_ips_carrier(ngcpcfgcli, tmpdir):
tmpdir = tempfile.mkdtemp(prefix='ngcp-', suffix='-pytest-output')

Loading…
Cancel
Save