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
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 @@
           '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 @@
             '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 @@
   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 @@
   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 @@
   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 @@
   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('- 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 @@
 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 @@
 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 @@
   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 @@
   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 @@
 !
 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 @@
    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 @@
                         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))