def do_connect(self, inp): ''' Connect to Mikrotik ''' # To Do: Support SSH connections # To Do: Support api_ssl connections device_path = Path(Path.cwd() / '.mso_db' / 'devices' / inp) with open(device_path / 'local_config.json', 'r') as json_config: local_config = json.load(json_config) ip_address = local_config['ip_address'] try: s = mikrotik.open_socket(dst=ip_address, port=8728) mtk = Mikrotik(s) mtk.login(username='******', pwd='') except: print('Failed to connect')