rename resource nitb_iface to ip_address
I would like to use the IP addresses also for OsmoBSC processes, so it is more than clear now that 'nitb_iface' was the wrong naming choice. The only distinction we may need in the future is public versus loopback interface. To add that, we may add a trait to the 'ip_address' resource like: ip_address: - addr: 10.42.42.1 type: public - addr: 127.0.0.1 type: loopback This way we can substitute public vs loopback addresses flexibly (e.g. using scenarios). Change-Id: I3ad583ae7a33f7a7bb56fe78a125f73c56a0e860
This commit is contained in:
parent
943c81d878
commit
76d8103bfb
|
@ -1,6 +1,6 @@
|
|||
# all hardware and interfaces available to this osmo-gsm-tester
|
||||
|
||||
nitb_iface:
|
||||
ip_address:
|
||||
- addr: 10.42.42.1
|
||||
- addr: 10.42.42.2
|
||||
- addr: 10.42.42.3
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# all hardware and interfaces available to this osmo-gsm-tester
|
||||
|
||||
nitb_iface:
|
||||
ip_address:
|
||||
- addr: 10.42.42.1
|
||||
- addr: 10.42.42.2
|
||||
- addr: 10.42.42.3
|
||||
|
|
|
@ -66,6 +66,12 @@ cnf -: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/state_dir
|
|||
'label': 'nanoBTS 1900',
|
||||
'trx_list': [{'hw_addr': '00:02:95:00:41:b3'}],
|
||||
'type': 'nanobts'}],
|
||||
'ip_address': [{'_hash': 'cde1debf28f07f94f92c761b4b7c6bf35785ced4',
|
||||
'addr': '10.42.42.1'},
|
||||
{'_hash': 'fd103b22c7cf2480d609150e06f4bbd92ac78d8c',
|
||||
'addr': '10.42.42.2'},
|
||||
{'_hash': '1c614d6210c551d142aadca8f25e1534ebb2a70f',
|
||||
'addr': '10.42.42.3'}],
|
||||
'modem': [{'_hash': '19c69e45aa090fb511446bd00797690aa82ff52f',
|
||||
'imsi': '901700000007801',
|
||||
'ki': 'D620F48487B1B782DA55DF6717F08FF9',
|
||||
|
@ -145,13 +151,7 @@ cnf -: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/state_dir
|
|||
'imsi': '901700000007816',
|
||||
'ki': 'BF827D219E739DD189F6F59E60D6455C',
|
||||
'label': 'm7816',
|
||||
'path': '/wavecom_15'}],
|
||||
'nitb_iface': [{'_hash': 'cde1debf28f07f94f92c761b4b7c6bf35785ced4',
|
||||
'addr': '10.42.42.1'},
|
||||
{'_hash': 'fd103b22c7cf2480d609150e06f4bbd92ac78d8c',
|
||||
'addr': '10.42.42.2'},
|
||||
{'_hash': '1c614d6210c551d142aadca8f25e1534ebb2a70f',
|
||||
'addr': '10.42.42.3'}]}
|
||||
'path': '/wavecom_15'}]}
|
||||
*** end: all resources
|
||||
|
||||
- request some resources
|
||||
|
@ -177,6 +177,9 @@ cnf -: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/state_dir
|
|||
trx_list:
|
||||
- hw_addr: 00:0c:90:32:b5:8a
|
||||
type: oct
|
||||
--- testowner: Reserving 1 x ip_address (candidates: 3)
|
||||
--- testowner: DBG: Picked - _hash: cde1debf28f07f94f92c761b4b7c6bf35785ced4
|
||||
addr: 10.42.42.1
|
||||
--- testowner: Reserving 2 x modem (candidates: 16)
|
||||
--- testowner: DBG: Picked - _hash: 19c69e45aa090fb511446bd00797690aa82ff52f
|
||||
imsi: '901700000007801'
|
||||
|
@ -188,9 +191,6 @@ cnf -: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/state_dir
|
|||
ki: 47FDB2D55CE6A10A85ABDAD034A5B7B3
|
||||
label: m7802
|
||||
path: /wavecom_1
|
||||
--- testowner: Reserving 1 x nitb_iface (candidates: 3)
|
||||
--- testowner: DBG: Picked - _hash: cde1debf28f07f94f92c761b4b7c6bf35785ced4
|
||||
addr: 10.42.42.1
|
||||
~~~ currently reserved:
|
||||
arfcn:
|
||||
- _hash: e620569450f8259b3f0212ec19c285dd07df063c
|
||||
|
@ -218,6 +218,10 @@ bts:
|
|||
trx_list:
|
||||
- hw_addr: 00:0c:90:32:b5:8a
|
||||
type: oct
|
||||
ip_address:
|
||||
- _hash: cde1debf28f07f94f92c761b4b7c6bf35785ced4
|
||||
_reserved_by: testowner-123-1490837279
|
||||
addr: 10.42.42.1
|
||||
modem:
|
||||
- _hash: 19c69e45aa090fb511446bd00797690aa82ff52f
|
||||
_reserved_by: testowner-123-1490837279
|
||||
|
@ -231,10 +235,6 @@ modem:
|
|||
ki: 47FDB2D55CE6A10A85ABDAD034A5B7B3
|
||||
label: m7802
|
||||
path: /wavecom_1
|
||||
nitb_iface:
|
||||
- _hash: cde1debf28f07f94f92c761b4b7c6bf35785ced4
|
||||
_reserved_by: testowner-123-1490837279
|
||||
addr: 10.42.42.1
|
||||
|
||||
~~~ end: currently reserved
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ print('*** end: all resources\n')
|
|||
|
||||
print('- request some resources')
|
||||
want = {
|
||||
'nitb_iface': [ { 'times': 1 } ],
|
||||
'ip_address': [ { 'times': 1 } ],
|
||||
'bts': [ { 'type': 'sysmo', 'times': 1 }, { 'type': 'oct', 'times': 1 } ],
|
||||
'arfcn': [ { 'band': 'GSM-1800', 'times': 2 } ],
|
||||
'modem': [ { 'times': 2 } ],
|
||||
|
|
|
@ -16,10 +16,10 @@ defaults:
|
|||
resources:
|
||||
bts:
|
||||
- times: '1'
|
||||
ip_address:
|
||||
- times: '1'
|
||||
modem:
|
||||
- times: '2'
|
||||
nitb_iface:
|
||||
- times: '1'
|
||||
|
||||
- run hello world test
|
||||
cnf -: DBG: Found config file resources.conf as [PATH]/selftest/suite_test/resources.conf in ./suite_test which is [PATH]/selftest/suite_test
|
||||
|
@ -27,7 +27,7 @@ cnf -: DBG: Found path state_dir as [PATH]/selftest/suite_test/test_work/state_d
|
|||
tst test_suite: Suite run start
|
||||
tst test_suite: reserving resources in [PATH]/selftest/suite_test/test_work/state_dir ...
|
||||
tst test_suite: DBG: {combining='resources'} [test_suite↪test_suite]
|
||||
tst test_suite: DBG: {definition_conf={bts=[{'times': '1'}], modem=[{'times': '2'}], nitb_iface=[{'times': '1'}]}} [test_suite↪(combining_scenarios='resources')↪test_suite]
|
||||
tst test_suite: DBG: {definition_conf={bts=[{'times': '1'}], ip_address=[{'times': '1'}], modem=[{'times': '2'}]}} [test_suite↪(combining_scenarios='resources')↪test_suite]
|
||||
tst test_suite: Reserving 1 x bts (candidates: 3) [test_suite↪test_suite]
|
||||
tst test_suite: DBG: Picked - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
|
||||
addr: 10.42.42.114
|
||||
|
@ -36,6 +36,10 @@ tst test_suite: DBG: Picked - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
|
|||
label: sysmoBTS 1002
|
||||
type: sysmo
|
||||
[test_suite↪test_suite]
|
||||
tst test_suite: Reserving 1 x ip_address (candidates: 3) [test_suite↪test_suite]
|
||||
tst test_suite: DBG: Picked - _hash: cde1debf28f07f94f92c761b4b7c6bf35785ced4
|
||||
addr: 10.42.42.1
|
||||
[test_suite↪test_suite]
|
||||
tst test_suite: Reserving 2 x modem (candidates: 16) [test_suite↪test_suite]
|
||||
tst test_suite: DBG: Picked - _hash: 19c69e45aa090fb511446bd00797690aa82ff52f
|
||||
imsi: '901700000007801'
|
||||
|
@ -48,10 +52,6 @@ tst test_suite: DBG: Picked - _hash: 19c69e45aa090fb511446bd00797690aa82ff52f
|
|||
label: m7802
|
||||
path: /wavecom_1
|
||||
[test_suite↪test_suite]
|
||||
tst test_suite: Reserving 1 x nitb_iface (candidates: 3) [test_suite↪test_suite]
|
||||
tst test_suite: DBG: Picked - _hash: cde1debf28f07f94f92c761b4b7c6bf35785ced4
|
||||
addr: 10.42.42.1
|
||||
[test_suite↪test_suite]
|
||||
tst hello_world.py:[LINENR] START [test_suite↪hello_world.py]
|
||||
tst hello_world.py:[LINENR]: hello world [test_suite↪hello_world.py:[LINENR]]
|
||||
tst hello_world.py:[LINENR]: I am 'test_suite' / 'hello_world.py:[LINENR]' [test_suite↪hello_world.py:[LINENR]]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# all hardware and interfaces available to this osmo-gsm-tester
|
||||
|
||||
nitb_iface:
|
||||
ip_address:
|
||||
- addr: 10.42.42.1
|
||||
- addr: 10.42.42.2
|
||||
- addr: 10.42.42.3
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
nitb_iface = resources.nitb_iface()
|
||||
ip_address = resources.ip_address()
|
||||
nitb = resources.nitb()
|
||||
bts = resources.bts()
|
||||
ms_mo = resources.modem()
|
||||
ms_mt = resources.modem()
|
||||
|
||||
nitb.start(nitb_iface)
|
||||
nitb.start(ip_address)
|
||||
bts.start(nitb)
|
||||
|
||||
nitb.add_subscriber(ms_mo, resources.msisdn())
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
nitb_iface = resources.nitb_iface()
|
||||
ip_address = resources.ip_address()
|
||||
nitb = resources.nitb()
|
||||
bts = resources.bts()
|
||||
ms_ext = resources.msisdn()
|
||||
fake_ext = resources.msisdn()
|
||||
ms = resources.modem()
|
||||
|
||||
nitb.configure(nitb_iface, bts)
|
||||
nitb.configure(ip_address, bts)
|
||||
bts.configure(nitb)
|
||||
|
||||
nitb.start()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
resources:
|
||||
nitb_iface:
|
||||
ip_address:
|
||||
- times: 1
|
||||
bts:
|
||||
- times: 1
|
||||
|
|
|
@ -12,11 +12,11 @@ log stderr
|
|||
!
|
||||
line vty
|
||||
no login
|
||||
bind val_nitb_iface_addr
|
||||
bind val_ip_address_addr
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver ipa
|
||||
ipa bind val_nitb_iface_addr
|
||||
ipa bind val_ip_address_addr
|
||||
network
|
||||
network country code val_mcc
|
||||
mobile network code val_mnc
|
||||
|
@ -135,14 +135,14 @@ network
|
|||
timeslot 3
|
||||
phys_chan_config val_phys_chan_config_3
|
||||
smpp
|
||||
local-tcp-ip val_nitb_iface_addr 2775
|
||||
local-tcp-ip val_ip_address_addr 2775
|
||||
system-id test
|
||||
policy closed
|
||||
esme test
|
||||
password test
|
||||
default-route
|
||||
ctrl
|
||||
bind val_nitb_iface_addr
|
||||
bind val_ip_address_addr
|
||||
|
||||
- Testing: expect to fail on invalid templates dir
|
||||
sucess: setting non-existing templates dir raised RuntimeError
|
||||
|
|
|
@ -58,7 +58,7 @@ vals = dict(nitb=dict(
|
|||
bts_list=(mock_bts0, mock_bts1)
|
||||
),
|
||||
),
|
||||
nitb_iface=dict(addr='val_nitb_iface_addr'),
|
||||
ip_address=dict(addr='val_ip_address_addr'),
|
||||
)
|
||||
|
||||
print(template.render('osmo-nitb.cfg', vals))
|
||||
|
|
|
@ -25,17 +25,17 @@ from . import log, util, config, template, process, osmo_ctrl, pcap_recorder
|
|||
|
||||
class OsmoNitb(log.Origin):
|
||||
suite_run = None
|
||||
nitb_iface = None
|
||||
ip_address = None
|
||||
run_dir = None
|
||||
config_file = None
|
||||
process = None
|
||||
bts = None
|
||||
|
||||
def __init__(self, suite_run, nitb_iface):
|
||||
def __init__(self, suite_run, ip_address):
|
||||
self.suite_run = suite_run
|
||||
self.nitb_iface = nitb_iface
|
||||
self.ip_address = ip_address
|
||||
self.set_log_category(log.C_RUN)
|
||||
self.set_name('osmo-nitb_%s' % nitb_iface.get('addr'))
|
||||
self.set_name('osmo-nitb_%s' % ip_address.get('addr'))
|
||||
self.bts = []
|
||||
|
||||
def start(self):
|
||||
|
@ -70,7 +70,7 @@ class OsmoNitb(log.Origin):
|
|||
|
||||
values = dict(nitb=config.get_defaults('nitb'))
|
||||
config.overlay(values, self.suite_run.config())
|
||||
config.overlay(values, dict(nitb_iface=self.nitb_iface))
|
||||
config.overlay(values, dict(ip_address=self.ip_address))
|
||||
|
||||
bts_list = []
|
||||
for bts in self.bts:
|
||||
|
@ -85,7 +85,7 @@ class OsmoNitb(log.Origin):
|
|||
f.write(r)
|
||||
|
||||
def addr(self):
|
||||
return self.nitb_iface.get('addr')
|
||||
return self.ip_address.get('addr')
|
||||
|
||||
def bts_add(self, bts):
|
||||
self.bts.append(bts)
|
||||
|
|
|
@ -41,14 +41,14 @@ RESOURCES_CONF = 'resources.conf'
|
|||
LAST_USED_MSISDN_FILE = 'last_used_msisdn.state'
|
||||
RESERVED_RESOURCES_FILE = 'reserved_resources.state'
|
||||
|
||||
R_NITB_IFACE = 'nitb_iface'
|
||||
R_IP_ADDRESS = 'ip_address'
|
||||
R_BTS = 'bts'
|
||||
R_ARFCN = 'arfcn'
|
||||
R_MODEM = 'modem'
|
||||
R_ALL = (R_NITB_IFACE, R_BTS, R_ARFCN, R_MODEM)
|
||||
R_ALL = (R_IP_ADDRESS, R_BTS, R_ARFCN, R_MODEM)
|
||||
|
||||
RESOURCES_SCHEMA = {
|
||||
'nitb_iface[].addr': schema.IPV4,
|
||||
'ip_address[].addr': schema.IPV4,
|
||||
'bts[].label': schema.STR,
|
||||
'bts[].type': schema.STR,
|
||||
'bts[].ipa_unit_id': schema.INT,
|
||||
|
@ -110,11 +110,11 @@ class ResourcesPool(log.Origin):
|
|||
reserved without further limitations.
|
||||
|
||||
ResourcesPool may also be selected with narrowed down constraints.
|
||||
This would reserve one NITB IP address, two modems, one BTS of type
|
||||
This would reserve one IP address, two modems, one BTS of type
|
||||
sysmo and one of type trx, plus 2 ARFCNs in the 1800 band:
|
||||
|
||||
{
|
||||
'nitb_iface': [ { 'times': 1 } ],
|
||||
'ip_address': [ { 'times': 1 } ],
|
||||
'bts': [ { 'type': 'sysmo', 'times': 1 }, { 'type': 'trx', 'times': 1 } ],
|
||||
'arfcn': [ { 'band': 'GSM-1800', 'times': 2 } ],
|
||||
'modem': [ { 'times': 2 } ],
|
||||
|
@ -123,7 +123,7 @@ class ResourcesPool(log.Origin):
|
|||
A times=1 value is implicit, so the above is equivalent to:
|
||||
|
||||
{
|
||||
'nitb_iface': [ {} ],
|
||||
'ip_address': [ {} ],
|
||||
'bts': [ { 'type': 'sysmo' }, { 'type': 'trx' } ],
|
||||
'arfcn': [ { 'band': 'GSM-1800', 'times': 2 } ],
|
||||
'modem': [ { 'times': 2 } ],
|
||||
|
|
|
@ -266,13 +266,13 @@ class SuiteRun(log.Origin):
|
|||
for process in self._processes:
|
||||
process.terminate()
|
||||
|
||||
def nitb_iface(self):
|
||||
return self.reserved_resources.get(resource.R_NITB_IFACE)
|
||||
def ip_address(self):
|
||||
return self.reserved_resources.get(resource.R_IP_ADDRESS)
|
||||
|
||||
def nitb(self, nitb_iface=None):
|
||||
if nitb_iface is None:
|
||||
nitb_iface = self.nitb_iface()
|
||||
return osmo_nitb.OsmoNitb(self, nitb_iface)
|
||||
def nitb(self, ip_address=None):
|
||||
if ip_address is None:
|
||||
ip_address = self.ip_address()
|
||||
return osmo_nitb.OsmoNitb(self, ip_address)
|
||||
|
||||
def bts(self):
|
||||
return bts_obj(self, self.reserved_resources.get(resource.R_BTS))
|
||||
|
|
|
@ -10,11 +10,11 @@ log stderr
|
|||
!
|
||||
line vty
|
||||
no login
|
||||
bind ${nitb_iface.addr}
|
||||
bind ${ip_address.addr}
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver ipa
|
||||
ipa bind ${nitb_iface.addr}
|
||||
ipa bind ${ip_address.addr}
|
||||
network
|
||||
network country code ${nitb.net.mcc}
|
||||
mobile network code ${nitb.net.mnc}
|
||||
|
@ -75,11 +75,11 @@ network
|
|||
% endfor
|
||||
%endfor
|
||||
smpp
|
||||
local-tcp-ip ${nitb_iface.addr} 2775
|
||||
local-tcp-ip ${ip_address.addr} 2775
|
||||
system-id test
|
||||
policy closed
|
||||
esme test
|
||||
password test
|
||||
default-route
|
||||
ctrl
|
||||
bind ${nitb_iface.addr}
|
||||
bind ${ip_address.addr}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
resources:
|
||||
nitb_iface:
|
||||
ip_address:
|
||||
- times: 1
|
||||
bts:
|
||||
- times: 1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
resources:
|
||||
nitb_iface:
|
||||
ip_address:
|
||||
- times: 1
|
||||
bts:
|
||||
- times: 1
|
||||
|
|
Loading…
Reference in New Issue