diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-03-01 17:28:46 -0800 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-04-11 21:58:20 -0700 |
commit | 99abbb424007da2e01762f3c040a39c0157cbe1f (patch) | |
tree | baab901a9e7444c9fd36aa4a19c1e51d03cb8e7f /tests/unit/network_services/nfvi/test_resource.py | |
parent | 2240fcc201fa9665e42e92c29e201cb62490acfa (diff) |
standardize ssh auth
we need to be following defautl paramiko rules,
first use pkey, then key_filenames (autodetecting ~/.ssh/ keys),
then password
We have too much boilerplate redudant code everywhere, we need
to standardize on a factory function that takes a node dict.
Using Python3 ChainMap we can layer overrides and defaults.
VNF descriptors have to default key_filename, password to Python None.
The only way to do this is to omit key values if the variable is not
defined, this way the dict will not have the value and it will
default to Python None
Add python2 chainmap backport
Updated unittest mocking to use ssh.SSH.from_node
Change-Id: I80b0cb606e593b33e317c9e5e8ed0b74da591514
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/network_services/nfvi/test_resource.py')
-rw-r--r-- | tests/unit/network_services/nfvi/test_resource.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py index 26d18838b..e2640ac74 100644 --- a/tests/unit/network_services/nfvi/test_resource.py +++ b/tests/unit/network_services/nfvi/test_resource.py @@ -90,7 +90,7 @@ class TestResourceProfile(unittest.TestCase): ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ mock.Mock(return_value=(0, {}, "")) - ssh.return_value = ssh_mock + ssh.from_node.return_value = ssh_mock self.resource_profile = \ ResourceProfile(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0], @@ -120,7 +120,7 @@ class TestResourceProfile(unittest.TestCase): ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ mock.Mock(return_value=(0, "", "")) - ssh.return_value = ssh_mock + ssh.from_node.return_value = ssh_mock resource_profile = \ ResourceProfile(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0], [1, 2, 3]) @@ -132,7 +132,7 @@ class TestResourceProfile(unittest.TestCase): ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ mock.Mock(return_value=(0, "", "")) - ssh.return_value = ssh_mock + ssh.from_node.return_value = ssh_mock resource_profile = \ ResourceProfile(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0], [1, 2, 3]) |