34
36
self.install_url = 'http://10.10.10.10/distribution-karaf.tgz'
35
37
self.test_config.set('install-url', self.install_url)
36
38
self.test_config.set('profile', 'default')
39
self.init_is_systemd.return_value = False
38
41
def _call_hook(self, hookname):
39
42
hooks.hooks.execute([
68
71
self.shutil.copy.assert_called_with('files/odl-controller.conf',
75
@patch('os.path.exists')
77
def test_install_hook_systemd(self, mock_listdir,
78
mock_path_exists, mock_symlink):
79
self.init_is_systemd.return_value = True
80
mock_listdir.return_value = ['random-file', 'distribution-karaf.tgz']
81
mock_path_exists.return_value = False
82
self._call_hook('install')
83
self.apt_install.assert_called_with([
84
"default-jre-headless", "python-jinja2"],
87
mock_symlink.assert_called_with('distribution-karaf.tgz',
88
'/opt/opendaylight-karaf')
89
self.adduser.assert_called_with("opendaylight", system_user=True)
90
self.mkdir.assert_has_calls([
91
call('/home/opendaylight', owner="opendaylight",
92
group="opendaylight", perms=0755),
93
call('/var/log/opendaylight', owner="opendaylight",
94
group="opendaylight", perms=0755)
96
self.check_call.assert_called_with([
97
"chown", "-R", "opendaylight:opendaylight",
98
"/opt/distribution-karaf.tgz"
100
self.write_mvn_config.assert_called_with()
101
self.service_start.assert_called_with('odl-controller')
102
self.shutil.copy.assert_called_with('files/odl-controller.service',
103
'/lib/systemd/system')
104
self.service.assert_called_with('enable', 'odl-controller')
71
106
def test_ovsdb_manager_joined_hook(self):
72
107
self._call_hook('ovsdb-manager-relation-joined')
73
108
self.relation_set.assert_called_with(port=6640, protocol="tcp")