diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/create_pod_file.py | 4 | ||||
-rwxr-xr-x | utils/fetch_os_creds.sh | 2 | ||||
-rw-r--r-- | utils/push-test-logs.sh | 1 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/scenario_models.py | 36 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py | 8 |
7 files changed, 41 insertions, 18 deletions
diff --git a/utils/create_pod_file.py b/utils/create_pod_file.py index e2c57d23f..def5ecca8 100644 --- a/utils/create_pod_file.py +++ b/utils/create_pod_file.py @@ -12,6 +12,8 @@ parser.add_argument("-u", "--user", help="Give username of this pod") parser.add_argument("-k", "--key", help="Give key file of the user") parser.add_argument("-p", "--password", help="Give password of the user") parser.add_argument("-f", "--filepath", help="Give dest path of output file") +parser.add_argument("-s", "--sshkey", default="/root/.ssh/id_rsa", + help="Give the path for ssh key") args = parser.parse_args() @@ -92,7 +94,7 @@ def create_file(handler, INSTALLER_TYPE): item['password'] = 'root' else: for item in node_list: - item['key_filename'] = '/root/.ssh/id_rsa' + item['key_filename'] = args.sshkey data = {'nodes': node_list} with open(args.filepath, "w") as fw: yaml.dump(data, fw) diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index 8374edbbd..312e1ac5c 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -107,7 +107,7 @@ if [ "$installer_type" == "fuel" ]; then # retrieving controller vip controller_ip=$(ssh 2>/dev/null ${ssh_options} ubuntu@${installer_ip} \ - "sudo salt --out txt 'ctl01*' pillar.get _param:openstack_control_address | awk '{print \$2}'" | \ + "sudo salt --out txt 'ctl*' pillar.get _param:openstack_control_address | awk '{print \$2; exit}'" | \ sed 's/ //g') &> /dev/null info "Fetching rc file from controller $controller_ip..." diff --git a/utils/push-test-logs.sh b/utils/push-test-logs.sh index eb57deb7b..79190ec2f 100644 --- a/utils/push-test-logs.sh +++ b/utils/push-test-logs.sh @@ -31,6 +31,7 @@ node_list=(\ 'huawei-pod1' 'huawei-pod2' 'huawei-pod3' 'huawei-pod4' 'huawei-pod5' \ 'huawei-pod6' 'huawei-pod7' 'huawei-pod12' \ 'huawei-virtual1' 'huawei-virtual2' 'huawei-virtual3' 'huawei-virtual4' \ +'huawei-virtual5' 'huawei-virtual8' 'huawei-virtual9' \ 'zte-pod2' \ 'zte-virtual1') diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py index bd06400b4..d215d18b9 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py @@ -255,7 +255,7 @@ class ScenarioUpdater(object): @iter_installers @iter_versions def _update_requests_change_owner(self, version): - version.owner = self.body + version.owner = self.body.get('owner') def _filter_installers(self, installers): return self._filter('installer', installers) @@ -584,7 +584,7 @@ class ScenarioOwnerHandler(GenericScenarioUpdateHandler): installer=<installer_name>& \ version=<version_name> @param body: new owner - @type body: L{string} + @type body: L{ScenarioChangeOwnerRequest} @in body: body @param installer: installer type @type installer: L{string} diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py index 7d0770759..c6da76b81 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py @@ -16,6 +16,13 @@ class ScenarioTI(models.ModelBase): self.date = date self.status = status + def __eq__(self, other): + return (self.date == other.date and + self.status == other.status) + + def __ne__(self, other): + return not self.__eq__(other) + @swagger.model() class ScenarioScore(models.ModelBase): @@ -23,6 +30,13 @@ class ScenarioScore(models.ModelBase): self.date = date self.score = score + def __eq__(self, other): + return (self.date == other.date and + self.score == other.score) + + def __ne__(self, other): + return not self.__eq__(other) + @swagger.model() class ScenarioProject(models.ModelBase): @@ -50,10 +64,10 @@ class ScenarioProject(models.ModelBase): 'trust_indicators': ScenarioTI} def __eq__(self, other): - return [self.project == other.project and + return (self.project == other.project and self._customs_eq(other) and self._scores_eq(other) and - self._ti_eq(other)] + self._ti_eq(other)) def __ne__(self, other): return not self.__eq__(other) @@ -62,10 +76,10 @@ class ScenarioProject(models.ModelBase): return set(self.customs) == set(other.customs) def _scores_eq(self, other): - return set(self.scores) == set(other.scores) + return self.scores == other.scores def _ti_eq(self, other): - return set(self.trust_indicators) == set(other.trust_indicators) + return self.trust_indicators == other.trust_indicators @swagger.model() @@ -84,9 +98,9 @@ class ScenarioVersion(models.ModelBase): return {'projects': ScenarioProject} def __eq__(self, other): - return [self.version == other.version and + return (self.version == other.version and self.owner == other.owner and - self._projects_eq(other)] + self._projects_eq(other)) def __ne__(self, other): return not self.__eq__(other) @@ -116,7 +130,7 @@ class ScenarioInstaller(models.ModelBase): return {'versions': ScenarioVersion} def __eq__(self, other): - return [self.installer == other.installer and self._versions_eq(other)] + return (self.installer == other.installer and self._versions_eq(other)) def __ne__(self, other): return not self.__eq__(other) @@ -147,6 +161,12 @@ class ScenarioCreateRequest(models.ModelBase): @swagger.model() +class ScenarioChangeOwnerRequest(models.ModelBase): + def __init__(self, owner=None): + self.owner = owner + + +@swagger.model() class Scenario(models.ModelBase): """ @property installers: @@ -166,7 +186,7 @@ class Scenario(models.ModelBase): return not self.__eq__(other) def __eq__(self, other): - return [self.name == other.name and self._installers_eq(other)] + return (self.name == other.name and self._installers_eq(other)) def _installers_eq(self, other): for s_install in self.installers: diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json b/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json index b6a3b83ab..980051c4f 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json +++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json @@ -8,7 +8,7 @@ [ { "owner": "Lucky", - "version": "colorado", + "version": "danube", "projects": [ { @@ -29,7 +29,7 @@ "scores": [ { "date": "2017-01-08 22:46:44", - "score": "0" + "score": "0/1" } ], "trust_indicators": [ diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py index 466caaf13..50a8c8d2d 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py @@ -47,8 +47,7 @@ class TestScenarioBase(base.TestBase): req = self.req_d self.assertIsNotNone(scenario._id) self.assertIsNotNone(scenario.creation_date) - - scenario == models.Scenario.from_dict(req) + self.assertEqual(scenario, models.Scenario.from_dict(req)) @staticmethod def _set_query(*args): @@ -298,8 +297,9 @@ class TestScenarioUpdate(TestScenarioBase): @update_partial('_update', '_success') def test_changeOwner(self, scenario): new_owner = 'new_owner' - scenario['installers'][0]['versions'][0]['owner'] = 'www' - return new_owner, scenario + update = models.ScenarioChangeOwnerRequest(new_owner).format() + scenario['installers'][0]['versions'][0]['owner'] = new_owner + return update, scenario def _add(self, update_req, new_scenario): return self.post_direct_url(self.update_url, update_req) |