Initial commit for NBI
[osm/NBI.git] / osm_nbi / msgbase.py
1
2 from http import HTTPStatus
3
4 __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
5
6
7 class MsgException(Exception):
8 """
9 Base Exception class for all msgXXXX exceptions
10 """
11
12 def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR):
13 """
14 General exception
15 :param message: descriptive text
16 :param http_code: <http.HTTPStatus> type. It contains ".value" (http error code) and ".name" (http error name
17 """
18 self.http_code = http_code
19 Exception.__init__(self, "messaging exception " + message)
20
21
22 class MsgBase(object):
23 """
24 Base class for all msgXXXX classes
25 """
26
27 def __init__(self):
28 pass
29
30 def connect(self, config):
31 pass
32
33 def write(self, msg):
34 pass
35
36 def read(self):
37 pass
38
39 def disconnect(self):
40 pass
41