osmo-bts-trx: Big refactor and cleanup of osmo-trx related code

* This commit is a preparation for future commits to add support for
different osmo-trx devices and backends like osmo-trx-lms.

* Drop deprecated osmo-trx-* cmd line params and use VTY cfg to set them.

* As number of osmo-trx related osmo-gsm-tester attributes grow, group
them togther in an "osmo_trx" dictionary.

Change-Id: I77d29413c9e3b600b796627ba366f80c3281b7e1
diff --git a/selftest/conf/resources.conf b/selftest/conf/resources.conf
index 51f4abc..84d0ab9 100644
--- a/selftest/conf/resources.conf
+++ b/selftest/conf/resources.conf
@@ -23,7 +23,9 @@
   ipa_unit_id: 6
   addr: 10.42.42.50
   band: GSM-1800
-  launch_trx: true
+  osmo_trx:
+    launch_trx: true
+    clock_reference: external
   ciphers:
   - 'a5_0'
   - 'a5_1'
@@ -33,7 +35,10 @@
   ipa_unit_id: 7
   addr: 10.42.42.51
   band: GSM-1800
-  trx_remote_ip: 10.42.42.112
+  osmo_trx:
+    launch_trx: false
+    clock_reference: external
+    trx_ip: 10.42.42.112  
   ciphers:
   - 'a5_0'
   - 'a5_1'
diff --git a/selftest/resource_test.ok b/selftest/resource_test.ok
index 3ec922b..08989a2 100644
--- a/selftest/resource_test.ok
+++ b/selftest/resource_test.ok
@@ -54,21 +54,23 @@
           'ipa_unit_id': '1',
           'label': 'sysmoBTS 1002',
           'type': 'osmo-bts-sysmo'},
-         {'_hash': '6a9c9fbd364e1563a5b9f0826030a7888fd19575',
+         {'_hash': '2158317d5e0055070e7174c2498dedf53a2957e9',
           'addr': '10.42.42.50',
           'band': 'GSM-1800',
           'ciphers': ['a5_0', 'a5_1'],
           'ipa_unit_id': '6',
           'label': 'Ettus B200',
-          'launch_trx': 'True',
+          'osmo_trx': {'clock_reference': 'external', 'launch_trx': 'True'},
           'type': 'osmo-bts-trx'},
-         {'_hash': 'e50fd38e3bfe8039ac13bc315bc84f46110b7443',
+         {'_hash': 'f964ba5fe7a37b97ec3e0c4ef21c9231a19de45d',
           'addr': '10.42.42.51',
           'band': 'GSM-1800',
           'ciphers': ['a5_0', 'a5_1'],
           'ipa_unit_id': '7',
           'label': 'sysmoCell 5000',
-          'trx_remote_ip': '10.42.42.112',
+          'osmo_trx': {'clock_reference': 'external',
+                       'launch_trx': 'False',
+                       'trx_ip': '10.42.42.112'},
           'type': 'osmo-bts-trx'}],
  'ip_address': [{'_hash': 'fd103b22c7cf2480d609150e06f4bbd92ac78d8c',
                  'addr': '10.42.42.2'},
@@ -129,7 +131,7 @@
   ipa_unit_id: '1'
   label: sysmoBTS 1002
   type: osmo-bts-sysmo
-- _hash: 6a9c9fbd364e1563a5b9f0826030a7888fd19575
+- _hash: 2158317d5e0055070e7174c2498dedf53a2957e9
   addr: 10.42.42.50
   band: GSM-1800
   ciphers:
@@ -137,7 +139,9 @@
   - a5_1
   ipa_unit_id: '6'
   label: Ettus B200
-  launch_trx: 'True'
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'True'
   type: osmo-bts-trx
 --- testowner: Reserving 1 x ip_address (candidates: 5)
 --- testowner: DBG: Picked - _hash: fd103b22c7cf2480d609150e06f4bbd92ac78d8c
@@ -183,7 +187,7 @@
   ipa_unit_id: '1'
   label: sysmoBTS 1002
   type: osmo-bts-sysmo
-- _hash: 6a9c9fbd364e1563a5b9f0826030a7888fd19575
+- _hash: 2158317d5e0055070e7174c2498dedf53a2957e9
   _reserved_by: testowner-123-1490837279
   addr: 10.42.42.50
   band: GSM-1800
@@ -192,7 +196,9 @@
   - a5_1
   ipa_unit_id: '6'
   label: Ettus B200
-  launch_trx: 'True'
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'True'
   type: osmo-bts-trx
 ip_address:
 - _hash: fd103b22c7cf2480d609150e06f4bbd92ac78d8c
@@ -240,15 +246,15 @@
           'ipa_unit_id': '1',
           'label': 'sysmoBTS 1002',
           'type': 'osmo-bts-sysmo'},
-         {'_hash': '6a9c9fbd364e1563a5b9f0826030a7888fd19575',
+         {'_hash': '2158317d5e0055070e7174c2498dedf53a2957e9',
           '_reserved_by': 'testowner-123-1490837279',
           'addr': '10.42.42.50',
           'band': 'GSM-1800',
           'ciphers': ['a5_0', 'a5_1'],
           'ipa_unit_id': '6',
           'label': 'Ettus B200',
-          'launch_trx': 'True',
           'num_trx': 2,
+          'osmo_trx': {'clock_reference': 'external', 'launch_trx': 'True'},
           'type': 'osmo-bts-trx'}],
  'ip_address': [{'_hash': 'fd103b22c7cf2480d609150e06f4bbd92ac78d8c',
                  '_reserved_by': 'testowner-123-1490837279',
diff --git a/selftest/suite_test.ok b/selftest/suite_test.ok
index b792b57..908f24f 100644
--- a/selftest/suite_test.ok
+++ b/selftest/suite_test.ok
@@ -37,28 +37,34 @@
 tst test_suite: DBG: {combining='modifiers'}
 tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}}  [test_suite↪{combining_scenarios='modifiers'}]
 tst test_suite: Reserving 3 x bts (candidates: 6)
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - max_power_red: '3'
     nominal_power: '10'
   - max_power_red: '0'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - nominal_power: '10'
   - max_power_red: '1'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
 - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
   addr: 10.42.42.114
@@ -183,28 +189,34 @@
 tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}}  [test_suite↪{combining_scenarios='modifiers'}]  [suite.py:[LINENR]]
 tst {combining_scenarios='modifiers', scenario='foo'}: DBG: {conf={}, scenario='foo'}  [test_suite↪{combining_scenarios='modifiers', scenario='foo'}]  [suite.py:[LINENR]]
 tst test_suite: Reserving 3 x bts (candidates: 6)  [resource.py:[LINENR]]
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - max_power_red: '3'
     nominal_power: '10'
   - max_power_red: '0'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - nominal_power: '10'
   - max_power_red: '1'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
 - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
   addr: 10.42.42.114
@@ -264,28 +276,34 @@
 tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}}  [test_suite↪{combining_scenarios='modifiers'}]  [suite.py:[LINENR]]
 tst {combining_scenarios='modifiers', scenario='foo'}: DBG: {conf={}, scenario='foo'}  [test_suite↪{combining_scenarios='modifiers', scenario='foo'}]  [suite.py:[LINENR]]
 tst test_suite: Reserving 3 x bts (candidates: 6)  [resource.py:[LINENR]]
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - max_power_red: '3'
     nominal_power: '10'
   - max_power_red: '0'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - nominal_power: '10'
   - max_power_red: '1'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
 - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
   addr: 10.42.42.114
@@ -341,28 +359,34 @@
 tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}}  [test_suite↪{combining_scenarios='modifiers'}]  [suite.py:[LINENR]]
 tst {combining_scenarios='modifiers', scenario='foo'}: DBG: {conf={bts=[{'trx_list': [{'nominal_power': '20'}, {'nominal_power': '20'}]}, {'trx_list': [{'nominal_power': '20'}, {'nominal_power': '20'}]}, {'type': 'sysmo'}]}, scenario='foo'}  [test_suite↪{combining_scenarios='modifiers', scenario='foo'}]  [suite.py:[LINENR]]
 tst test_suite: Reserving 3 x bts (candidates: 6)  [resource.py:[LINENR]]
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - max_power_red: '3'
     nominal_power: '10'
   - max_power_red: '0'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
   addr: 10.42.42.53
   band: GSM-1800
   ipa_unit_id: '7'
   label: sysmoCell 5000
+  osmo_trx:
+    clock_reference: external
+    launch_trx: 'False'
+    trx_ip: 10.42.42.112
   trx_list:
   - nominal_power: '10'
   - max_power_red: '1'
     nominal_power: '12'
-  trx_remote_ip: 10.42.42.112
   type: osmo-bts-trx
 - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
   addr: 10.42.42.114
@@ -387,25 +411,29 @@
   label: m7802
   path: /wavecom_1
   [resource.py:[LINENR]]
-resources(test_suite)={'bts': [{'_hash': '076ff06a4b719e61779492d3fb99f42a6635bb72',
+resources(test_suite)={'bts': [{'_hash': 'a59640b8ba6a373552b24a6f9f65cadd2347bace',
           '_reserved_by': 'test_suite-[ID_NUM]-[ID_NUM]',
           'addr': '10.42.42.53',
           'band': 'GSM-1800',
           'ipa_unit_id': '7',
           'label': 'sysmoCell 5000',
+          'osmo_trx': {'clock_reference': 'external',
+                       'launch_trx': 'False',
+                       'trx_ip': '10.42.42.112'},
           'trx_list': [{'max_power_red': '3', 'nominal_power': '20'},
                        {'max_power_red': '0', 'nominal_power': '20'}],
-          'trx_remote_ip': '10.42.42.112',
           'type': 'osmo-bts-trx'},
-         {'_hash': '9eaa928b04ce04b19dbae972f9bfc3eea6f5e249',
+         {'_hash': 'c2feabd082c36a1cdeccb9a5237dfff7dbadb009',
           '_reserved_by': 'test_suite-[ID_NUM]-[ID_NUM]',
           'addr': '10.42.42.53',
           'band': 'GSM-1800',
           'ipa_unit_id': '7',
           'label': 'sysmoCell 5000',
+          'osmo_trx': {'clock_reference': 'external',
+                       'launch_trx': 'False',
+                       'trx_ip': '10.42.42.112'},
           'trx_list': [{'nominal_power': '20'},
                        {'max_power_red': '1', 'nominal_power': '20'}],
-          'trx_remote_ip': '10.42.42.112',
           'type': 'osmo-bts-trx'},
          {'_hash': '07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9',
           '_reserved_by': 'test_suite-[ID_NUM]-[ID_NUM]',
diff --git a/selftest/suite_test/resources.conf b/selftest/suite_test/resources.conf
index 440e55c..bd121cb 100644
--- a/selftest/suite_test/resources.conf
+++ b/selftest/suite_test/resources.conf
@@ -33,7 +33,9 @@
   ipa_unit_id: 6
   addr: 10.42.42.52
   band: GSM-1800
-  launch_trx: true
+  osmo_trx:
+    launch_trx: true
+    clock_reference: external
   trx_list:
   - nominal_power: 10
     max_power_red: 2
@@ -44,7 +46,10 @@
   ipa_unit_id: 7
   addr: 10.42.42.53
   band: GSM-1800
-  trx_remote_ip: 10.42.42.112
+  osmo_trx:
+    launch_trx: false
+    clock_reference: external
+    trx_ip: 10.42.42.112
   trx_list:
   - nominal_power: 10
     max_power_red: 3
@@ -56,7 +61,10 @@
   ipa_unit_id: 7
   addr: 10.42.42.53
   band: GSM-1800
-  trx_remote_ip: 10.42.42.112
+  osmo_trx:
+    launch_trx: false
+    clock_reference: external
+    trx_ip: 10.42.42.112
   trx_list:
   - nominal_power: 10
   - nominal_power: 12