Cmdline arg -c sets main configuration file (old paths.conf) instead of dir containing it

It has been notified that current configuration system is difficult to
understand and to use, so it has been envisioned to refactor it a bit.
The idea is that the user passes a -c path/to/main.conf file, which in
turn contains whatever osmo-gsm-tester main settings supports (basically
what old paths.conf used to be, plus some files harcoded to the same -c
directory are now configurable through the main configuration file).

Change-Id: Ieca65b71b543c44cfcec8e83efd0fe053c432e55
diff --git a/selftest/resource_test/resource_test.ok b/selftest/resource_test/resource_test.ok
index bbdbc5b..8a0b52f 100644
--- a/selftest/resource_test/resource_test.ok
+++ b/selftest/resource_test/resource_test.ok
@@ -9,12 +9,14 @@
 ok, caused exception RuntimeError: Refusing to drop a list of resources from itself. This is probably a bug where a list of Resources() should have been copied but is passed as-is. use Resources.clear() instead.
 - test removing a Resources list from one with the same list in it
 - test resources config and state dir:
-cnf -: DBG: Found config file paths.conf as [PATH]/selftest/resource_test/conf/paths.conf in [PATH]/selftest/resource_test/conf which is [PATH]/selftest/resource_test/conf
-cnf -: DBG: [PATH]/selftest/resource_test/conf/paths.conf: relative path ./test_work/state_dir is [PATH]/selftest/resource_test/conf/test_work/state_dir
-cnf -: DBG: [PATH]/selftest/resource_test/conf/paths.conf: relative path ./suite_test is [PATH]/selftest/resource_test/conf/suite_test
-cnf -: DBG: Found path state_dir as [PATH]/selftest/resource_test/conf/test_work/state_dir
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/resource_test/conf/resources.conf in [PATH]/selftest/resource_test/conf which is [PATH]/selftest/resource_test/conf
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/resource_test/conf/test_work/state_dir
+cnf -: DBG: Found main configuration file in  [PATH]/selftest/resource_test/conf/paths.conf which is [PATH]/selftest/resource_test/conf/paths.conf
+cnf -: DBG: MAIN CONFIG:
+{'default_suites_conf_path': '[PATH]/selftest/resource_test/conf/default-suites.conf',
+ 'defaults_conf_path': '[PATH]/selftest/resource_test/conf/defaults.conf',
+ 'resource_conf_path': '[PATH]/selftest/resource_test/conf/resources.conf',
+ 'scenarios_dir': '[PATH]/selftest/resource_test/conf/scenarios',
+ 'state_dir': '[PATH]/selftest/resource_test/conf/test_work/state_dir',
+ 'suites_dir': '[PATH]/selftest/resource_test/conf/suite_test'}
 *** all resources:
 {'arfcn': [{'_hash': 'e620569450f8259b3f0212ec19c285dd07df063c',
             'arfcn': '512',
diff --git a/selftest/resource_test/resource_test.py b/selftest/resource_test/resource_test.py
index b74ba2a..f18aa73 100755
--- a/selftest/resource_test/resource_test.py
+++ b/selftest/resource_test/resource_test.py
@@ -13,7 +13,7 @@
 workdir = util.get_tempdir()
 
 # override config locations to make sure we use only the test conf
-config.override_conf = os.path.join(os.path.dirname(sys.argv[0]), 'conf')
+config.override_conf = os.path.join(os.path.dirname(sys.argv[0]), 'conf', 'paths.conf')
 
 log.get_process_id = lambda: '123-1490837279'
 
diff --git a/selftest/scenario_test/scenario_test.ok b/selftest/scenario_test/scenario_test.ok
index 7fe2049..e37ef57 100644
--- a/selftest/scenario_test/scenario_test.ok
+++ b/selftest/scenario_test/scenario_test.ok
@@ -1,32 +1,28 @@
-cnf -: DBG: Found config file paths.conf as [PATH]/selftest/scenario_test/paths.conf in [PATH]/selftest/scenario_test which is [PATH]/selftest/scenario_test
-cnf -: DBG: [PATH]/selftest/scenario_test/paths.conf: relative path . is [PATH]/selftest/scenario_test
-cnf -: DBG: [PATH]/selftest/scenario_test/paths.conf: relative path ./test_work/state_dir is [PATH]/selftest/scenario_test/test_work/state_dir
-cnf -: DBG: [PATH]/selftest/scenario_test/paths.conf: relative path . is [PATH]/selftest/scenario_test
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
+cnf -: DBG: Found main configuration file in  [PATH]/selftest/scenario_test/paths.conf which is [PATH]/selftest/scenario_test/paths.conf
+cnf -: DBG: MAIN CONFIG:
+{'default_suites_conf_path': '[PATH]/selftest/scenario_test/default-suites.conf',
+ 'defaults_conf_path': '[PATH]/selftest/scenario_test/defaults.conf',
+ 'resource_conf_path': '[PATH]/selftest/scenario_test/resources.conf',
+ 'scenarios_dir': '[PATH]/selftest/scenario_test',
+ 'state_dir': '[PATH]/selftest/scenario_test/test_work/state_dir',
+ 'suites_dir': '[PATH]/selftest/scenario_test'}
 scenario_case_01.conf
 {'anotherlist': ['4', '0'],
  'foobar': 'True',
  'somelist': [{'somelistitem': 'firststring'},
               {'somelistitem': 'secondstring'},
               {'somelistitem': 'thirdstring'}]}
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 scenario_case_01.conf
 {'anotherlist': ['4', '0'],
  'foobar': 'True',
  'somelist': [{'somelistitem': 'firststring'},
               {'somelistitem': 'secondstring'},
               {'somelistitem': 'thirdstring'}]}
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 OK: expected RuntimeError: No such scenario file: '[PATH]/selftest/scenario_test/scenario_case_01@.conf' (nor scenario_case_01@.conf)
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 OK: expected ValueError
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 OK: expected ValueError
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 OK: expected RuntimeError: No such scenario file: '[PATH]/selftest/scenario_test/scenario_case_03.conf'
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 OK: expected RuntimeError: No such scenario file: '[PATH]/selftest/scenario_test/scenario_case_03.conf'
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 tst scenario_case_03@heyho,1,yes.conf: DBG: {param_dict={param1='heyho', param2='1', param3='yes'}}
 scenario_case_03@heyho,1,yes.conf
 {'anotherlist': ['1', '0'],
@@ -34,7 +30,6 @@
  'somelist': [{'somelistitem': 'firststring'},
               {'somelistitem': 'heyho'},
               {'somelistitem': 'thirdstring'}]}
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 tst scenario_case_03@heyho,1,yes.conf: DBG: {param_dict={param1='heyho', param2='1', param3='yes'}}
 scenario_case_03@heyho,1,yes.conf
 {'anotherlist': ['1', '0'],
@@ -42,17 +37,13 @@
  'somelist': [{'somelistitem': 'firststring'},
               {'somelistitem': 'heyho'},
               {'somelistitem': 'thirdstring'}]}
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 tst scenario_case_03@heyho,1.conf: DBG: {param_dict={param1='heyho', param2='1'}}
 OK: expected NameError: Undefined
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 tst scenario_case_03@heyho,1.conf: DBG: {param_dict={param1='heyho', param2='1'}}
 OK: expected NameError: Undefined
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 tst scenario_case_03@specific.conf: DBG: {param_dict={param1='specific'}}
 scenario_case_03@specific.conf
 {'somelist': [{'somelistitem': 'specific'}]}
-cnf -: DBG: Found path scenarios_dir as [PATH]/selftest/scenario_test
 tst scenario_case_03@specific.conf: DBG: {param_dict={param1='specific'}}
 scenario_case_03@specific.conf
 {'somelist': [{'somelistitem': 'specific'}]}
diff --git a/selftest/scenario_test/scenario_test.py b/selftest/scenario_test/scenario_test.py
index f5f42f7..15f8983 100755
--- a/selftest/scenario_test/scenario_test.py
+++ b/selftest/scenario_test/scenario_test.py
@@ -18,7 +18,7 @@
     'foobar' : schema.BOOL_STR,
     }
 
-config.override_conf = os.path.join(os.path.dirname(sys.argv[0]))
+config.override_conf = os.path.join(os.path.dirname(sys.argv[0]), 'paths.conf')
 
 def print_scenario(sc):
     # we use copy() to be able to get the dictionary in super class of Scenario:
diff --git a/selftest/suite_test/suite_test.ok b/selftest/suite_test/suite_test.ok
index fa38605..fb26a06 100644
--- a/selftest/suite_test/suite_test.ok
+++ b/selftest/suite_test/suite_test.ok
@@ -1,15 +1,17 @@
 - non-existing suite dir
-cnf -: DBG: Found config file paths.conf as [PATH]/selftest/suite_test/paths.conf in [PATH]/selftest/suite_test which is [PATH]/selftest/suite_test
-cnf -: DBG: [PATH]/selftest/suite_test/paths.conf: relative path ./test_work/state_dir is [PATH]/selftest/suite_test/test_work/state_dir
-cnf -: DBG: [PATH]/selftest/suite_test/paths.conf: relative path . is [PATH]/selftest/suite_test
-cnf -: DBG: Found path suites_dir as [PATH]/selftest/suite_test
+cnf -: DBG: Found main configuration file in  [PATH]/selftest/suite_test/paths.conf which is [PATH]/selftest/suite_test/paths.conf
+cnf -: DBG: MAIN CONFIG:
+{'default_suites_conf_path': '[PATH]/selftest/suite_test/default-suites.conf',
+ 'defaults_conf_path': '[PATH]/selftest/suite_test/defaults.conf',
+ 'resource_conf_path': '[PATH]/selftest/suite_test/resources.conf',
+ 'scenarios_dir': '[PATH]/selftest/suite_test/scenarios',
+ 'state_dir': '[PATH]/selftest/suite_test/test_work/state_dir',
+ 'suites_dir': '[PATH]/selftest/suite_test'}
 --- -: ERR: RuntimeError: Suite not found: 'does_not_exist' in [PATH]/selftest/suite_test
 - no suite.conf
-cnf -: DBG: Found path suites_dir as [PATH]/selftest/suite_test
 cnf empty_dir: DBG: reading suite.conf
 cnf [PATH]/selftest/suite_test/empty_dir/suite.conf: ERR: FileNotFoundError: [Errno 2] No such file or directory: '[PATH]/selftest/suite_test/empty_dir/suite.conf'  [empty_dir↪[PATH]/selftest/suite_test/empty_dir/suite.conf]
 - valid suite dir
-cnf -: DBG: Found path suites_dir as [PATH]/selftest/suite_test
 cnf test_suite: DBG: reading suite.conf
 defaults:
   timeout: 60s
@@ -25,8 +27,6 @@
   - times: '2'
 
 - run hello world test
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/suite_test/resources.conf in [PATH]/selftest/suite_test which is [PATH]/selftest/suite_test
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/suite_test/test_work/state_dir
 
 ---------------------------------------------------------------------
 trial test_suite
@@ -179,8 +179,6 @@
     FAIL: test_fail_raise.py (N.N sec) ExpectedFail: This failure is expected
     skip: test_suite_params.py
 - test with half empty scenario
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/suite_test/resources.conf in [PATH]/selftest/suite_test which is [PATH]/selftest/suite_test  [config.py:[LINENR]]
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/suite_test/test_work/state_dir  [config.py:[LINENR]]
 
 ---------------------------------------------------------------------
 trial test_suite
@@ -267,8 +265,6 @@
     skip: test_fail_raise.py
     skip: test_suite_params.py
 - test with scenario
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/suite_test/resources.conf in [PATH]/selftest/suite_test which is [PATH]/selftest/suite_test  [config.py:[LINENR]]
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/suite_test/test_work/state_dir  [config.py:[LINENR]]
 
 ---------------------------------------------------------------------
 trial test_suite
@@ -355,8 +351,6 @@
     skip: test_fail_raise.py
     skip: test_suite_params.py
 - test with scenario and modifiers
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/suite_test/resources.conf in [PATH]/selftest/suite_test which is [PATH]/selftest/suite_test  [config.py:[LINENR]]
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/suite_test/test_work/state_dir  [config.py:[LINENR]]
 tst test_suite: reserving resources in [PATH]/selftest/suite_test/test_work/state_dir ...  [suite.py:[LINENR]]
 tst test_suite: DBG: {combining='resources'}  [suite.py:[LINENR]]
 tst {combining_scenarios='resources'}: DBG: {definition_conf={bts=[{'label': 'sysmoCell 5000'}, {'label': 'sysmoCell 5000'}, {'type': 'sysmo'}], ip_address=[{}], modem=[{}, {}]}}  [test_suite↪{combining_scenarios='resources'}]  [suite.py:[LINENR]]
@@ -489,8 +483,6 @@
     skip: test_fail_raise.py
     skip: test_suite_params.py
 - test with suite-specific config
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/suite_test/resources.conf in [PATH]/selftest/suite_test which is [PATH]/selftest/suite_test  [config.py:[LINENR]]
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/suite_test/test_work/state_dir  [config.py:[LINENR]]
 tst test_suite: reserving resources in [PATH]/selftest/suite_test/test_work/state_dir ...  [suite.py:[LINENR]]
 tst test_suite: DBG: {combining='resources'}  [suite.py:[LINENR]]
 tst {combining_scenarios='resources'}: DBG: {definition_conf={bts=[{'label': 'sysmoCell 5000'}, {'label': 'sysmoCell 5000'}, {'type': 'sysmo'}], ip_address=[{}], modem=[{}, {}]}}  [test_suite↪{combining_scenarios='resources'}]  [suite.py:[LINENR]]
diff --git a/selftest/suite_test/suite_test.py b/selftest/suite_test/suite_test.py
index a096027..4b32439 100755
--- a/selftest/suite_test/suite_test.py
+++ b/selftest/suite_test/suite_test.py
@@ -11,7 +11,7 @@
 from osmo_gsm_tester.core import suite
 from osmo_gsm_tester.core.schema import generate_schemas, get_all_schema
 
-config.override_conf = os.path.join(os.path.dirname(sys.argv[0]))
+config.override_conf = os.path.join(os.path.dirname(sys.argv[0]), 'paths.conf')
 
 example_trial_dir = os.path.join('test_trial_tmp')