From 76d8103bfbaadc7a848f1f76bef4625199542916 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 18 May 2017 18:35:32 +0200 Subject: 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 --- example/resources.conf | 2 +- selftest/conf/resources.conf | 2 +- selftest/resource_test.ok | 28 ++++++++++++------------ selftest/resource_test.py | 2 +- selftest/suite_test.ok | 14 ++++++------ selftest/suite_test/resources.conf | 2 +- selftest/suite_test/test_suite/mo_mt_sms.py | 4 ++-- selftest/suite_test/test_suite/mo_sms.py | 4 ++-- selftest/suite_test/test_suite/suite.conf | 2 +- selftest/template_test.ok | 8 +++---- selftest/template_test.py | 2 +- src/osmo_gsm_tester/osmo_nitb.py | 12 +++++----- src/osmo_gsm_tester/resource.py | 12 +++++----- src/osmo_gsm_tester/suite.py | 12 +++++----- src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl | 8 +++---- suites/debug/suite.conf | 2 +- suites/sms/suite.conf | 2 +- 17 files changed, 59 insertions(+), 59 deletions(-) diff --git a/example/resources.conf b/example/resources.conf index 4cc06d0..8b61248 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -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 diff --git a/selftest/conf/resources.conf b/selftest/conf/resources.conf index 178e13c..2005590 100644 --- a/selftest/conf/resources.conf +++ b/selftest/conf/resources.conf @@ -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 diff --git a/selftest/resource_test.ok b/selftest/resource_test.ok index db6a8bf..cdc3519 100644 --- a/selftest/resource_test.ok +++ b/selftest/resource_test.ok @@ -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 diff --git a/selftest/resource_test.py b/selftest/resource_test.py index 2d0f880..08f1fbf 100755 --- a/selftest/resource_test.py +++ b/selftest/resource_test.py @@ -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 } ], diff --git a/selftest/suite_test.ok b/selftest/suite_test.ok index 30c6915..b9a8fb3 100644 --- a/selftest/suite_test.ok +++ b/selftest/suite_test.ok @@ -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]] diff --git a/selftest/suite_test/resources.conf b/selftest/suite_test/resources.conf index 178e13c..2005590 100644 --- a/selftest/suite_test/resources.conf +++ b/selftest/suite_test/resources.conf @@ -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 diff --git a/selftest/suite_test/test_suite/mo_mt_sms.py b/selftest/suite_test/test_suite/mo_mt_sms.py index cf44357..8b5e1ec 100644 --- a/selftest/suite_test/test_suite/mo_mt_sms.py +++ b/selftest/suite_test/test_suite/mo_mt_sms.py @@ -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()) diff --git a/selftest/suite_test/test_suite/mo_sms.py b/selftest/suite_test/test_suite/mo_sms.py index d9517dd..768a99c 100644 --- a/selftest/suite_test/test_suite/mo_sms.py +++ b/selftest/suite_test/test_suite/mo_sms.py @@ -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() diff --git a/selftest/suite_test/test_suite/suite.conf b/selftest/suite_test/test_suite/suite.conf index 4a03379..376f6cd 100644 --- a/selftest/suite_test/test_suite/suite.conf +++ b/selftest/suite_test/test_suite/suite.conf @@ -1,5 +1,5 @@ resources: - nitb_iface: + ip_address: - times: 1 bts: - times: 1 diff --git a/selftest/template_test.ok b/selftest/template_test.ok index 449bae0..0f896ee 100644 --- a/selftest/template_test.ok +++ b/selftest/template_test.ok @@ -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 diff --git a/selftest/template_test.py b/selftest/template_test.py index 31d9e80..b7d987c 100755 --- a/selftest/template_test.py +++ b/selftest/template_test.py @@ -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)) diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py index 50ce5ae..4596007 100644 --- a/src/osmo_gsm_tester/osmo_nitb.py +++ b/src/osmo_gsm_tester/osmo_nitb.py @@ -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) diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index ebc9457..b146ebd 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -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 } ], diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py index 5d03b95..3f4c552 100644 --- a/src/osmo_gsm_tester/suite.py +++ b/src/osmo_gsm_tester/suite.py @@ -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)) diff --git a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl index 0db7a26..9339545 100644 --- a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl +++ b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl @@ -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} diff --git a/suites/debug/suite.conf b/suites/debug/suite.conf index 04959b8..adfc161 100644 --- a/suites/debug/suite.conf +++ b/suites/debug/suite.conf @@ -1,5 +1,5 @@ resources: - nitb_iface: + ip_address: - times: 1 bts: - times: 1 diff --git a/suites/sms/suite.conf b/suites/sms/suite.conf index 4a03379..376f6cd 100644 --- a/suites/sms/suite.conf +++ b/suites/sms/suite.conf @@ -1,5 +1,5 @@ resources: - nitb_iface: + ip_address: - times: 1 bts: - times: 1 -- cgit v1.2.3