def add_update_topology_db(self, **params):
topo_dict = params.get('<STR_LIT>')<EOL>session = db.get_session()<EOL>host = topo_dict.get('<STR_LIT:host>')<EOL>protocol_interface = topo_dict.get('<STR_LIT>')<EOL>with session.begin(subtransactions=True):<EOL><INDENT>try:<EOL><INDENT>session.query(DfaTopologyDb).filter_by(<EOL>host=host, protocol_interface=protocol_interface).one()<EOL>session.query(DfaTopologyDb).filter_by(<EOL>host=host, protocol_interface=protocol_interface).update(<EOL>topo_dict)<EOL><DEDENT>except orm_exc.NoResultFound:<EOL><INDENT>LOG.info("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT:host>': host, '<STR_LIT>': protocol_interface})<EOL>topo_disc = DfaTopologyDb(<EOL>host=host, protocol_interface=protocol_interface,<EOL>phy_interface=topo_dict.get('<STR_LIT>'),<EOL>created=topo_dict.get('<STR_LIT>'),<EOL>heartbeat=topo_dict.get('<STR_LIT>'),<EOL>remote_mgmt_addr=topo_dict.get('<STR_LIT>'),<EOL>remote_system_name=topo_dict.get('<STR_LIT>'),<EOL>remote_system_desc=topo_dict.get('<STR_LIT>'),<EOL>remote_port_id_mac=topo_dict.get('<STR_LIT>'),<EOL>remote_chassis_id_mac=topo_dict.get(<EOL>'<STR_LIT>'),<EOL>remote_port=topo_dict.get('<STR_LIT>'),<EOL>remote_evb_cfgd=topo_dict.get('<STR_LIT>'),<EOL>remote_evb_mode=topo_dict.get('<STR_LIT>'),<EOL>configurations=topo_dict.get('<STR_LIT>'))<EOL>session.add(topo_disc)<EOL><DEDENT>except orm_exc.MultipleResultsFound:<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT:host>': host, '<STR_LIT>': protocol_interface})<EOL><DEDENT>except Exception as exc:<EOL><INDENT>LOG.error("<STR_LIT>", exc)<EOL><DEDENT><DEDENT>
Add or update an entry to the topology DB.