From 932dcbc475aeb7fe1399b0a95c8c8eb26a592f5d Mon Sep 17 00:00:00 2001 From: itsikkes Date: Sun, 29 May 2016 11:44:19 +0300 Subject: [PATCH] add check function --- monkey_business/cc/connectors/__init__.py | 3 +++ monkey_business/cc/connectors/vcenter.py | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/monkey_business/cc/connectors/__init__.py b/monkey_business/cc/connectors/__init__.py index 16c91c013..ad185812a 100644 --- a/monkey_business/cc/connectors/__init__.py +++ b/monkey_business/cc/connectors/__init__.py @@ -12,6 +12,9 @@ class NetControllerConnector(object): else: target[property] = prop[property] + def is_connected(self): + return False + def connect(self): return diff --git a/monkey_business/cc/connectors/vcenter.py b/monkey_business/cc/connectors/vcenter.py index 7aab6a6df..49f743f63 100644 --- a/monkey_business/cc/connectors/vcenter.py +++ b/monkey_business/cc/connectors/vcenter.py @@ -23,10 +23,13 @@ class VCenterConnector(NetControllerConnector): } def connect(self): - self._service_instance = SmartConnect(host=self._address, - port=self._port, - user=self._username, - pwd=self._password) + self._service_instance = SmartConnect(host=self._properties["address"], + port=self._properties["port"], + user=self._properties["username"], + pwd=self._properties["password"]) + + def is_connected(self): + return not self._service_instance == None def get_vlans_list(self): return []