Пример #1
0
 def start(self, ip_address=None, port=None):
     root = RCMPlatformNodeWSHome()
     factory = Site(root)
     if not ip_address:
         import netifaces
         from rcmp_node import RCMPlatformNode
         ip_address = netifaces.ifaddresses(RCMPlatformNode.
                                            NI_ETH)[netifaces.AF_INET][0][RCMPlatformNode.NI_ADDR_KEY]
     if not port:
         port = 80
     logging.getLogger(RCMP_LOGGER_NAME).info("Running RCMPExtConnector on %d" % port)
     self.reactor.listenTCP(port, factory, interface=ip_address)
     self.reactor.run()
Пример #2
0
 def start(self, ip_address=None, port=None):
     root = RCMPlatformNodeWSHome()
     factory = Site(root)
     if not ip_address:
         import netifaces
         from rcmp_node import RCMPlatformNode
         ip_address = netifaces.ifaddresses(RCMPlatformNode.NI_ETH)[
             netifaces.AF_INET][0][RCMPlatformNode.NI_ADDR_KEY]
     if not port:
         port = 80
     logging.getLogger(RCMP_LOGGER_NAME).info(
         "Running RCMPExtConnector on %d" % port)
     self.reactor.listenTCP(port, factory, interface=ip_address)
     self.reactor.run()
 def __init__(self, address=DEFAULT_SERVER_ADDRESS, port=DEFAULT_SERVER_PORT, t_out=60.0):
     self._address = (address, port)
     self._conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self._buf_size = 4096
     self._timeout = t_out
     # we add 2 seconds to the socket timer so that we can use it without impacting the use
     # of the select: in case of network unavailability when the connection is already taken
     # the timer of the select counts otherwise this network timer counts (this happens to be
     # useful when we try to connect but we don't have network)
     self._conn.settimeout(self._timeout + 2)
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)
Пример #4
0
 def __init__(self,
              address=DEFAULT_SERVER_ADDRESS,
              port=DEFAULT_SERVER_PORT,
              t_out=60.0):
     self._address = (address, port)
     self._conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self._buf_size = 4096
     self._timeout = t_out
     # we add 2 seconds to the socket timer so that we can use it without impacting the use
     # of the select: in case of network unavailability when the connection is already taken
     # the timer of the select counts otherwise this network timer counts (this happens to be
     # useful when we try to connect but we don't have network)
     self._conn.settimeout(self._timeout + 2)
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)
 def handle(self):
     """Take the content of the RCMP packet and use the dispatcher
     to handle the command."""
     logger = logging.getLogger(RCMP_LOGGER_NAME)
     # logger.debug("Handling the request from %s:%d" % self.client_address)
     response = RCMPMessage()
     try:
         # TODO see if we need a receive with more data (these are the requests)
         content = self.request.recv(1024)
         if content:
             msg = RCMPMessage()
             msg.set_content(content)
             response = self.server.dispatcher.dispatch(msg.get_dict())
     except Exception as e:
         reason = "Error executing the request: %s" % e
         logger.error(reason)
         response.create_error_response(reason)
     finally:
         try:
             self.request.sendall(response.get_txt())
         except Exception as e:
             logger.error("Error sending the response: %s" % e)
Пример #6
0
 def handle(self):
     """Take the content of the RCMP packet and use the dispatcher
     to handle the command."""
     logger = logging.getLogger(RCMP_LOGGER_NAME)
     # logger.debug("Handling the request from %s:%d" % self.client_address)
     response = RCMPMessage()
     try:
         # TODO see if we need a receive with more data (these are the requests)
         content = self.request.recv(1024)
         if content:
             msg = RCMPMessage()
             msg.set_content(content)
             response = self.server.dispatcher.dispatch(msg.get_dict())
     except Exception as e:
         reason = "Error executing the request: %s" % e
         logger.error(reason)
         response.create_error_response(reason)
     finally:
         try:
             self.request.sendall(response.get_txt())
         except Exception as e:
             logger.error("Error sending the response: %s" % e)
Пример #7
0
 def __init__(self):
     Resource.__init__(self)
     self.logger = logging.getLogger(RCMP_LOGGER_NAME)
Пример #8
0
 def __init__(self, pni):
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)
     self._who = ""
     self.pni = pni
Пример #9
0
 def __init__(self, db_path=DEFAULT_DB_PATH):
     self.db_path = db_path
     self.db = None
     self.crs = None
     # ip_address can be null for enabling 2-step provisioning
     self.__ct_platform_instances_sql = (
         "create table platform_instances(id INTEGER PRIMARY KEY, "
         "name VARCHAR(20) UNIQUE NOT NULL, ip_address VARCHAR(15), "
         "type VARCHAR(1), load INTEGER, "
         "s_logic INTEGER REFERENCES service_logics(id), "
         "free_inbound_ports VARCHAR(20))"
     )
     self.__dt_platform_instances_sql = "drop table platform_instances"
     self.__iit_platform_instances_sql = (
         "insert into platform_instances(name, ip_address, type, load) " "values (?, ?, ?, ?)"
     )
     self.__iit_platform_instances_with_ifp_sql = (
         "insert into platform_instances(name, ip_address, type, load, " "free_inbound_ports) values (?, ?, ?, ?, ?)"
     )
     self.__iit_platform_instances_with_sl_sql = (
         "insert into platform_instances(name, ip_address, type, load, "
         "s_logic) values (?, ?, ?, ?, (select id from service_logics "
         "where name=?))"
     )
     self.__iit_platform_instances_with_sl_and_ifp_sql = (
         "insert into platform_instances(name, ip_address, type, "
         "load, s_logic, free_inbound_ports) values (?, ?, ?, ?, "
         "(select id from service_logics where name=?), ?)"
     )
     self.__ut_platform_instances_ip_address_sql = "update platform_instances set ip_address=? where name=?"
     self.__ut_platform_instances_ifp_sql = (
         "update platform_instances set free_inbound_ports=? " "where name=? and type=?"
     )
     self.__dft_platform_instances_sql = "delete from platform_instances where name=?"
     self.__select_platform_instances_full_sql = (
         "select name, type, ip_address, load, s_logic " "from platform_instances"
     )
     self.__select_platform_instances_full_em_sql = (
         "select name, type, ip_address, load, s_logic " "from platform_instances where name<>?"
     )
     self.__select_platform_instances_sql = (
         "select name, ip_address, s_logic from platform_instances " "where type=?"
     )
     self.__select_platform_instances_load_ordered_sql = (
         "select name, ip_address from platform_instances " "where type=? order by load asc"
     )
     self.__select_pi_ip_address_sql = "select ip_address, type from platform_instances where name=?"
     self.__select_pi_ifp_sql = "select free_inbound_ports from platform_instances where name=?"
     self.__ct_service_spaces_sql = (
         "create table service_spaces(id INTEGER PRIMARY KEY, "
         "name VARCHAR(20) UNIQUE NOT NULL, "
         "p_instance INTEGER REFERENCES platform_instances(id) NOT NULL, "
         "port INTEGER NOT NULL, used_inbound_port INTEGER)"
     )
     self.__dt_service_spaces_sql = "drop table service_spaces"
     self.__iit_service_spaces_sql = (
         "insert into service_spaces(name, p_instance, port) values (?, "
         "(select id from platform_instances where name=?), ?)"
     )
     self.__iit_service_spaces_using_ip_sql = (
         "insert into service_spaces(name, p_instance, port) values (?, "
         "(select id from platform_instances where ip_address=?), ?)"
     )
     self.__ut_service_spaces_uip_sql = "update service_spaces set used_inbound_port=? where name=?"
     self.__dft_service_spaces_from_pi_sql = (
         "delete from service_spaces where p_instance=" "(select id from platform_instances where name=?)"
     )
     self.__dft_service_spaces_sql = (
         "delete from service_spaces where "
         "p_instance=(select id from platform_instances where ip_address=?) and port=?"
     )
     self.__dft_service_spaces_from_name_sql = "delete from service_spaces where name=?"
     self.__select_ss_pi_sql = (
         "select ss.name, ss.port, used_inbound_port from service_spaces ss inner join platform_instances pi "
         "on pi.id=ss.p_instance where pi.name=?"
     )
     self.__select_ss_names_sql = "select name from service_spaces"
     self.__select_ss_ip_address_port_sql = (
         "select pi.ip_address, ss.port from service_spaces ss "
         "inner join platform_instances pi on pi.id=ss.p_instance "
         "where ss.name=?"
     )
     self.__select_last_ss_port_sql = (
         "select max(ss.port) from service_spaces ss "
         "inner join platform_instances pi on pi.id=ss.p_instance "
         "where pi.ip_address=?"
     )
     self.__select_ss_external_access_sql = "select used_inbound_port from service_spaces where name=?"
     self.__select_used_inbound_ports_from_pi_name_sql = (
         "select used_inbound_port from service_spaces ss "
         "inner join platform_instances pi "
         "on pi.id=ss.p_instance where pi.name=?"
     )
     self.__ct_connections_sql = (
         "create table connections(id INTEGER PRIMARY KEY, "
         "p_instance_s INTEGER REFERENCES platform_instances(id), "
         "p_instance_r INTEGER REFERENCES platform_instances(id), "
         "s_space INTEGER REFERENCES service_spaces(id))"
     )
     self.__iit_connections_sql = (
         "insert into connections(p_instance_S, p_instance_R) values ("
         "(select id from platform_instances where name=?), "
         "(select id from platform_instances where name=?))"
     )
     self.__iit_connections_with_ss_sql = (
         "insert into connections(p_instance_S, p_instance_R, s_space) values ("
         "(select id from platform_instances where name=?), "
         "(select id from platform_instances where name=?), "
         "(select id from service_spaces where name=?))"
     )
     # self.__select_cnn_from_pi_r_sql = "select pi_s.name, ss.name from connections cnn " \
     #                                   "inner join platform_instances pi_s on pi_s.id=cnn.p_instance_s " \
     #                                   "inner join service_spaces ss on cnn.s_space=ss.id " \
     #                                   "where cnn.p_instance_r=(select id from platform_instances where name=?)"
     self.__select_cnn_from_pi_r_sql = (
         "select pi_s.name from connections cnn "
         "inner join platform_instances pi_s on pi_s.id=cnn.p_instance_s "
         "where cnn.p_instance_r=(select id from platform_instances where name=?)"
     )
     # self.__select_cnn_from_pi_s_sql = "select pi_r.name, ss.name from connections cnn " \
     #                                   "inner join platform_instances pi_r on pi_r.id=cnn.p_instance_r " \
     #                                   "inner join service_spaces ss on cnn.s_space=ss.id " \
     #                                   "where cnn.p_instance_s=(select id from platform_instances where name=?)"
     self.__select_cnn_from_pi_s_sql = (
         "select pi_r.name from connections cnn "
         "inner join platform_instances pi_r on pi_r.id=cnn.p_instance_r "
         "where cnn.p_instance_s=(select id from platform_instances where name=?)"
     )
     self.__select_cnn_ss_name_sql = (
         "select ss.name from service_spaces ss "
         "where ss.id=(select s_space from connections "
         "where p_instance_s=(select id from platform_instances where name=?) and "
         "p_instance_r=(select id from platform_instances where name=?))"
     )
     # TODO see if we could keep this way
     # even if it is considered one of the call for connection it isn't because the robot has only one server
     self.__select_cnn_pi_r_sl_sql = (
         "select sl.name, sl.ss_pi_type_target, sl.ss_name from service_logics sl "
         "inner join platform_instances pi_r on sl.id=pi_r.s_logic and pi_r.name=?"
     )
     self.__dft_connections_sql = (
         "delete from connections where p_instance_r=(select id from platform_instances " "where name=?)"
     )
     self.__dt_connections_sql = "drop table connections"
     self.__ct_service_logics_sql = (
         "create table service_logics(id INTEGER PRIMARY KEY, "
         "name VARCHAR(20), ss_pi_type_target VARCHAR(1), ss_name_suffix VARCHAR(20))"
     )
     self.__iit_service_logics_sql = "insert into service_logics(name, ss_pi_type_target) values (?, ?)"
     self.__select_sl_name_sql = "select name from service_logics where id=?"
     self.__select_sl_id_sql = "select id from service_logics where name=?"
     self.__select_sl_ss_pi_type_target_sql = (
         "select sl.ss_pi_type_target from service_logics sl "
         "inner join platform_instances pi_r on pi_r.s_logic=sl.id "
         "where pi_r.name=?"
     )
     # the same as before but using the service logic name instead the platform instance
     self.__select_sl_ss_side_sql = "select ss_pi_type_target from service_logics where name=?"
     self.__select_service_logics_sql = "select name from service_logics"
     self.__select_sl_uses_count_sql = (
         "select count(pi.id) from platform_instances pi "
         "inner join service_logics sl on pi.s_logic=sl.id where sl.name=?"
     )
     self.__dft_service_logics_sql = "delete from service_logics where name=?"
     self.__dt_service_logics_sql = "drop table service_logics"
     # TODO not used yet
     self.__ct_service_items_sql = (
         "create table service_items(id INTEGER PRIMARY KEY, package VARCHAR(20), "
         "tag VARCHAR(20), type VARCHAR(1))"
     )
     self.__iit_service_items_sql = "insert into service_items(package, tag, type) values (?, ?, ?)"
     self.__select_service_item_sql = "select id from service_items where package=? and tag=?"
     self.__dft_service_items_sql = "delete from service_items where id=?"
     self.__dt_service_items_sql = "drop table service_items"
     self.__ct_service_logic_items_sql = (
         "create table service_logic_items(id INTEGER PRIMARY KEY, "
         "s_logic INTEGER REFERENCES service_logics(id), "
         "s_item INTEGER REFERENCES service_items(id), "
         "si_pi_type_target VARCHAR(1), si_name VARCHAR(20), si_params VARCHAR(20))"
     )
     self.__iit_service_logic_items_sql = (
         "insert into service_logic_items(s_logic, s_item, si_pi_type_target, "
         "si_name, si_params) values ((select id from service_logics "
         "where name=?), (select id from service_items "
         "where package=? and tag=?), ?, ?, ?)"
     )
     self.__select_sli_sql = (
         "select si.package, si.tag, si.type, sli.si_pi_type_target, sli.si_name, "
         "sli.si_params from service_logic_items sli inner join service_items si "
         "on si.id=sli.s_item inner join platform_instances pi_r "
         "on pi_r.s_logic=sli.s_logic where pi_r.name=?"
     )
     self.__select_sli_from_sl_name_sql = (
         "select si.package, si.tag, si.type, sli.si_pi_type_target, "
         "sli.si_name, sli.si_params from service_logic_items sli "
         "inner join service_items si on si.id=sli.s_item "
         "inner join service_logics sl on sl.id=sli.s_logic where sl.name=?"
     )
     self.__select_si_id_from_sl_name_sql = (
         "select sli.s_item from service_logic_items sli "
         "inner join service_logics sl on sl.id=sli.s_logic where sl.name=?"
     )
     self.__select_si_uses_from_id_sql = "select count(s_logic) from service_logic_items where s_item=?"
     self.__dft_service_logic_items_sql = (
         "delete from service_logic_items " "where s_logic=(select id from service_logics where name=?) and s_item=?"
     )
     self.__dt_service_logic_items_sql = "drop table service_logic_items"
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)
Пример #10
0
 def __init__(self, pni):
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)
     self._who = ""
     self.pni = pni
Пример #11
0
 def __init__(self):
     Resource.__init__(self)
     self.logger = logging.getLogger(RCMP_LOGGER_NAME)
Пример #12
0
 def __init__(self, pni):
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)
     # this is for generic return messages
     self._who = ""
     self.pni = pni
Пример #13
0
 def __init__(self, db_path=DEFAULT_DB_PATH):
     self.db_path = db_path
     self.db = None
     self.crs = None
     # ip_address can be null for enabling 2-step provisioning
     self.__ct_platform_instances_sql = "create table platform_instances(id INTEGER PRIMARY KEY, " \
                                        "name VARCHAR(20) UNIQUE NOT NULL, ip_address VARCHAR(15), " \
                                        "type VARCHAR(1), load INTEGER, " \
                                        "s_logic INTEGER REFERENCES service_logics(id), " \
                                        "free_inbound_ports VARCHAR(20))"
     self.__dt_platform_instances_sql = "drop table platform_instances"
     self.__iit_platform_instances_sql = "insert into platform_instances(name, ip_address, type, load) " \
                                         "values (?, ?, ?, ?)"
     self.__iit_platform_instances_with_ifp_sql = "insert into platform_instances(name, ip_address, type, load, " \
                                                  "free_inbound_ports) values (?, ?, ?, ?, ?)"
     self.__iit_platform_instances_with_sl_sql = "insert into platform_instances(name, ip_address, type, load, " \
                                                 "s_logic) values (?, ?, ?, ?, (select id from service_logics " \
                                                 "where name=?))"
     self.__iit_platform_instances_with_sl_and_ifp_sql = "insert into platform_instances(name, ip_address, type, " \
                                                         "load, s_logic, free_inbound_ports) values (?, ?, ?, ?, " \
                                                         "(select id from service_logics where name=?), ?)"
     self.__ut_platform_instances_ip_address_sql = "update platform_instances set ip_address=? where name=?"
     self.__ut_platform_instances_ifp_sql = "update platform_instances set free_inbound_ports=? " \
                                            "where name=? and type=?"
     self.__dft_platform_instances_sql = "delete from platform_instances where name=?"
     self.__select_platform_instances_full_sql = "select name, type, ip_address, load, s_logic " \
                                                 "from platform_instances"
     self.__select_platform_instances_full_em_sql = "select name, type, ip_address, load, s_logic " \
                                                    "from platform_instances where name<>?"
     self.__select_platform_instances_sql = "select name, ip_address, s_logic from platform_instances " \
                                            "where type=?"
     self.__select_platform_instances_load_ordered_sql = "select name, ip_address from platform_instances " \
                                                         "where type=? order by load asc"
     self.__select_pi_ip_address_sql = "select ip_address, type from platform_instances where name=?"
     self.__select_pi_ifp_sql = "select free_inbound_ports from platform_instances where name=?"
     self.__ct_service_spaces_sql = "create table service_spaces(id INTEGER PRIMARY KEY, " \
                                    "name VARCHAR(20) UNIQUE NOT NULL, " \
                                    "p_instance INTEGER REFERENCES platform_instances(id) NOT NULL, " \
                                    "port INTEGER NOT NULL, used_inbound_port INTEGER)"
     self.__dt_service_spaces_sql = "drop table service_spaces"
     self.__iit_service_spaces_sql = "insert into service_spaces(name, p_instance, port) values (?, " \
                                     "(select id from platform_instances where name=?), ?)"
     self.__iit_service_spaces_using_ip_sql = "insert into service_spaces(name, p_instance, port) values (?, " \
                                              "(select id from platform_instances where ip_address=?), ?)"
     self.__ut_service_spaces_uip_sql = "update service_spaces set used_inbound_port=? where name=?"
     self.__dft_service_spaces_from_pi_sql = "delete from service_spaces where p_instance=" \
                                             "(select id from platform_instances where name=?)"
     self.__dft_service_spaces_sql = "delete from service_spaces where " \
                                     "p_instance=(select id from platform_instances where ip_address=?) and port=?"
     self.__dft_service_spaces_from_name_sql = "delete from service_spaces where name=?"
     self.__select_ss_pi_sql = "select ss.name, ss.port, used_inbound_port from service_spaces ss inner join platform_instances pi " \
                               "on pi.id=ss.p_instance where pi.name=?"
     self.__select_ss_names_sql = "select name from service_spaces"
     self.__select_ss_ip_address_port_sql = "select pi.ip_address, ss.port from service_spaces ss " \
                                            "inner join platform_instances pi on pi.id=ss.p_instance " \
                                            "where ss.name=?"
     self.__select_last_ss_port_sql = "select max(ss.port) from service_spaces ss " \
                                      "inner join platform_instances pi on pi.id=ss.p_instance " \
                                      "where pi.ip_address=?"
     self.__select_ss_external_access_sql = "select used_inbound_port from service_spaces where name=?"
     self.__select_used_inbound_ports_from_pi_name_sql = "select used_inbound_port from service_spaces ss " \
                                                         "inner join platform_instances pi " \
                                                         "on pi.id=ss.p_instance where pi.name=?"
     self.__ct_connections_sql = "create table connections(id INTEGER PRIMARY KEY, " \
                                 "p_instance_s INTEGER REFERENCES platform_instances(id), " \
                                 "p_instance_r INTEGER REFERENCES platform_instances(id), " \
                                 "s_space INTEGER REFERENCES service_spaces(id))"
     self.__iit_connections_sql = "insert into connections(p_instance_S, p_instance_R) values (" \
                                  "(select id from platform_instances where name=?), " \
                                  "(select id from platform_instances where name=?))"
     self.__iit_connections_with_ss_sql = "insert into connections(p_instance_S, p_instance_R, s_space) values (" \
                                          "(select id from platform_instances where name=?), " \
                                          "(select id from platform_instances where name=?), " \
                                          "(select id from service_spaces where name=?))"
     # self.__select_cnn_from_pi_r_sql = "select pi_s.name, ss.name from connections cnn " \
     #                                   "inner join platform_instances pi_s on pi_s.id=cnn.p_instance_s " \
     #                                   "inner join service_spaces ss on cnn.s_space=ss.id " \
     #                                   "where cnn.p_instance_r=(select id from platform_instances where name=?)"
     self.__select_cnn_from_pi_r_sql = "select pi_s.name from connections cnn " \
                                       "inner join platform_instances pi_s on pi_s.id=cnn.p_instance_s " \
                                       "where cnn.p_instance_r=(select id from platform_instances where name=?)"
     # self.__select_cnn_from_pi_s_sql = "select pi_r.name, ss.name from connections cnn " \
     #                                   "inner join platform_instances pi_r on pi_r.id=cnn.p_instance_r " \
     #                                   "inner join service_spaces ss on cnn.s_space=ss.id " \
     #                                   "where cnn.p_instance_s=(select id from platform_instances where name=?)"
     self.__select_cnn_from_pi_s_sql = "select pi_r.name from connections cnn " \
                                       "inner join platform_instances pi_r on pi_r.id=cnn.p_instance_r " \
                                       "where cnn.p_instance_s=(select id from platform_instances where name=?)"
     self.__select_cnn_ss_name_sql = "select ss.name from service_spaces ss " \
                                     "where ss.id=(select s_space from connections " \
                                     "where p_instance_s=(select id from platform_instances where name=?) and " \
                                     "p_instance_r=(select id from platform_instances where name=?))"
     # TODO see if we could keep this way
     # even if it is considered one of the call for connection it isn't because the robot has only one server
     self.__select_cnn_pi_r_sl_sql = "select sl.name, sl.ss_pi_type_target, sl.ss_name from service_logics sl " \
                                     "inner join platform_instances pi_r on sl.id=pi_r.s_logic and pi_r.name=?"
     self.__dft_connections_sql = "delete from connections where p_instance_r=(select id from platform_instances " \
                                  "where name=?)"
     self.__dt_connections_sql = "drop table connections"
     self.__ct_service_logics_sql = "create table service_logics(id INTEGER PRIMARY KEY, " \
                                    "name VARCHAR(20), ss_pi_type_target VARCHAR(1), ss_name_suffix VARCHAR(20))"
     self.__iit_service_logics_sql = "insert into service_logics(name, ss_pi_type_target) values (?, ?)"
     self.__select_sl_name_sql = "select name from service_logics where id=?"
     self.__select_sl_id_sql = "select id from service_logics where name=?"
     self.__select_sl_ss_pi_type_target_sql = "select sl.ss_pi_type_target from service_logics sl " \
                                              "inner join platform_instances pi_r on pi_r.s_logic=sl.id " \
                                              "where pi_r.name=?"
     # the same as before but using the service logic name instead the platform instance
     self.__select_sl_ss_side_sql = "select ss_pi_type_target from service_logics where name=?"
     self.__select_service_logics_sql = "select name from service_logics"
     self.__select_sl_uses_count_sql = "select count(pi.id) from platform_instances pi " \
                                       "inner join service_logics sl on pi.s_logic=sl.id where sl.name=?"
     self.__dft_service_logics_sql = "delete from service_logics where name=?"
     self.__dt_service_logics_sql = "drop table service_logics"
     # TODO not used yet
     self.__ct_service_items_sql = "create table service_items(id INTEGER PRIMARY KEY, package VARCHAR(20), " \
                                   "tag VARCHAR(20), type VARCHAR(1))"
     self.__iit_service_items_sql = "insert into service_items(package, tag, type) values (?, ?, ?)"
     self.__select_service_item_sql = "select id from service_items where package=? and tag=?"
     self.__dft_service_items_sql = "delete from service_items where id=?"
     self.__dt_service_items_sql = "drop table service_items"
     self.__ct_service_logic_items_sql = "create table service_logic_items(id INTEGER PRIMARY KEY, " \
                                         "s_logic INTEGER REFERENCES service_logics(id), " \
                                         "s_item INTEGER REFERENCES service_items(id), " \
                                         "si_pi_type_target VARCHAR(1), si_name VARCHAR(20), si_params VARCHAR(20))"
     self.__iit_service_logic_items_sql = "insert into service_logic_items(s_logic, s_item, si_pi_type_target, " \
                                          "si_name, si_params) values ((select id from service_logics " \
                                          "where name=?), (select id from service_items " \
                                          "where package=? and tag=?), ?, ?, ?)"
     self.__select_sli_sql = "select si.package, si.tag, si.type, sli.si_pi_type_target, sli.si_name, " \
                             "sli.si_params from service_logic_items sli inner join service_items si " \
                             "on si.id=sli.s_item inner join platform_instances pi_r " \
                             "on pi_r.s_logic=sli.s_logic where pi_r.name=?"
     self.__select_sli_from_sl_name_sql = "select si.package, si.tag, si.type, sli.si_pi_type_target, " \
                                          "sli.si_name, sli.si_params from service_logic_items sli " \
                                          "inner join service_items si on si.id=sli.s_item " \
                                          "inner join service_logics sl on sl.id=sli.s_logic where sl.name=?"
     self.__select_si_id_from_sl_name_sql = "select sli.s_item from service_logic_items sli " \
                                            "inner join service_logics sl on sl.id=sli.s_logic where sl.name=?"
     self.__select_si_uses_from_id_sql = "select count(s_logic) from service_logic_items where s_item=?"
     self.__dft_service_logic_items_sql = "delete from service_logic_items " \
                                          "where s_logic=(select id from service_logics where name=?) and s_item=?"
     self.__dt_service_logic_items_sql = "drop table service_logic_items"
     self._logger = logging.getLogger(RCMP_LOGGER_NAME)