diff --git a/boswatch/network/netCheck.py b/boswatch/network/netCheck.py index 5a4f3b8..0674ec6 100644 --- a/boswatch/network/netCheck.py +++ b/boswatch/network/netCheck.py @@ -30,7 +30,7 @@ class NetCheck: @param timout: timout for connection check in sec. (1)""" self._hostname = hostname self._timeout = timeout - self._connectionState = False + self.connectionState = False self.checkConn() # initiate a first check def checkConn(self): @@ -40,14 +40,9 @@ class NetCheck: try: urlopen(self._hostname, timeout=self._timeout) logging.debug("%s is reachable", self._hostname) - self._connectionState = True + self.connectionState = True return True except: # todo find right exception type logging.warning("%s is not reachable", self._hostname) - self._connectionState = False + self.connectionState = False return False - - @property - def connectionState(self): - """!Property for the last connection state from checkConn()""" - return self._connectionState diff --git a/boswatch/router/route.py b/boswatch/router/route.py index 8ff305b..1161e0e 100644 --- a/boswatch/router/route.py +++ b/boswatch/router/route.py @@ -25,21 +25,6 @@ class Route: @param callback: instance of the callback function @param statsCallback: instance of the callback to get statistics (None) """ - self._name = name - self._callback = callback - self._statsCallback = statsCallback - - @property - def name(self): - """!Property to get the route point name""" - return self._name - - @property - def callback(self): - """!Porperty to get the callback function instance""" - return self._callback - - @property - def statistics(self): - """!Porperty to get the statistics from instance""" - return self._statsCallback + self.name = name + self.callback = callback + self.statistics = statsCallback diff --git a/boswatch/router/router.py b/boswatch/router/router.py index d88def1..69c18db 100644 --- a/boswatch/router/router.py +++ b/boswatch/router/router.py @@ -26,17 +26,17 @@ class Router: """!Create a new router @param name: name of the router""" - self._name = name - self._routeList = [] - logging.debug("[%s] add new router", self._name) + self.name = name + self.routeList = [] + logging.debug("[%s] add new router", self.name) def addRoute(self, route): """!Adds a route point to the router @param route: instance of the Route class """ - logging.debug("[%s] add route: %s", self._name, route.name) - self._routeList.append(route) + logging.debug("[%s] add route: %s", self.name, route.name) + self.routeList.append(route) def runRouter(self, bwPacket): """!Run the router @@ -44,29 +44,19 @@ class Router: @param bwPacket: instance of Packet class @return a instance of Packet class """ - logging.debug("[%s] started", self._name) - for routeObject in self._routeList: - logging.debug("[%s] -> run route: %s", self._name, routeObject.name) + logging.debug("[%s] started", self.name) + for routeObject in self.routeList: + logging.debug("[%s] -> run route: %s", self.name, routeObject.name) bwPacket_tmp = routeObject.callback(copy.deepcopy(bwPacket)) # copy bwPacket to prevent edit the original if bwPacket_tmp is None: # returning None doesnt change the bwPacket continue if bwPacket_tmp is False: # returning False stops the router immediately - logging.debug("[%s] stopped", self._name) + logging.debug("[%s] stopped", self.name) break bwPacket = bwPacket_tmp - logging.debug("[%s] <- bwPacket returned: %s", self._name, bwPacket) - logging.debug("[%s] finished", self._name) + logging.debug("[%s] <- bwPacket returned: %s", self.name, bwPacket) + logging.debug("[%s] finished", self.name) return bwPacket - - @property - def name(self): - """!Property to get the name of the router""" - return self._name - - @property - def routeList(self): - """!Property to get a list of all route points of this router""" - return self._routeList