Hello,
I am trying to access the NRP from a jupyter notebook in the backend container (docker installation on Ubuntu 20.04).
After successful import of the virtual coach, when I run the line
vc = VirtualCoach('http://localhost:9000', storage_username='nrpuser', storage_password='password')
I get:
NFO: [2022-04-19 11:51:59,128 - Configuration] Loading configuration file config.json
WARNING: [2022-04-19 11:51:59,130 - VirtualCoach] No OIDC username supplied, simulation services will fail if OIDC is enabled in this environment (http://localhost:9000).
INFO: [2022-04-19 11:51:59,130 - VirtualCoach] Logging into the Storage Server as: nrpuser
---------------------------------------------------------------------------
ConnectionRefusedError Traceback (most recent call last)
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/connection.py in _new_conn(self)
158 try:
--> 159 conn = connection.create_connection(
160 (self._dns_host, self.port), self.timeout, **extra_kw
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
83 if err is not None:
---> 84 raise err
85
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
73 sock.bind(source_address)
---> 74 sock.connect(sa)
75 return sock
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
669 # Make the request on the httplib connection object.
--> 670 httplib_response = self._make_request(
671 conn,
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
391 else:
--> 392 conn.request(method, url, **httplib_request_kw)
393
/usr/lib/python3.8/http/client.py in request(self, method, url, body, headers, encode_chunked)
1251 """Send a complete request to the server."""
-> 1252 self._send_request(method, url, body, headers, encode_chunked)
1253
/usr/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1297 body = _encode(body, 'body')
-> 1298 self.endheaders(body, encode_chunked=encode_chunked)
1299
/usr/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked)
1246 raise CannotSendHeader()
-> 1247 self._send_output(message_body, encode_chunked=encode_chunked)
1248
/usr/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked)
1006 del self._buffer[:]
-> 1007 self.send(msg)
1008
/usr/lib/python3.8/http/client.py in send(self, data)
946 if self.auto_open:
--> 947 self.connect()
948 else:
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/connection.py in connect(self)
186 def connect(self):
--> 187 conn = self._new_conn()
188 self._prepare_conn(conn)
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/connection.py in _new_conn(self)
170 except SocketError as e:
--> 171 raise NewConnectionError(
172 self, "Failed to establish a new connection: %s" % e
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9b468be580>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
~/.opt/platform_venv/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
438 if not chunked:
--> 439 resp = conn.urlopen(
440 method=request.method,
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
725
--> 726 retries = retries.increment(
727 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
~/.opt/platform_venv/lib/python3.8/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
445 if new_retry.is_exhausted():
--> 446 raise MaxRetryError(_pool, url, error or ResponseError(cause))
447
MaxRetryError: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /proxy/authentication/authenticate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9b468be580>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
ConnectionError Traceback (most recent call last)
~/nrp/src/VirtualCoach/hbp_nrp_virtual_coach/pynrp/virtual_coach.py in __get_storage_token(self, user_name, password)
239 try:
--> 240 resp = requests.post(self.__config['proxy-services']['storage-authentication'],
241 json={'user': user_name, 'password': password})
~/.opt/platform_venv/lib/python3.8/site-packages/requests/api.py in post(url, data, json, **kwargs)
116
--> 117 return request('post', url, data=data, json=json, **kwargs)
118
~/.opt/platform_venv/lib/python3.8/site-packages/requests/api.py in request(method, url, **kwargs)
60 with sessions.Session() as session:
---> 61 return session.request(method=method, url=url, **kwargs)
62
~/.opt/platform_venv/lib/python3.8/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
541 send_kwargs.update(settings)
--> 542 resp = self.send(prep, **send_kwargs)
543
~/.opt/platform_venv/lib/python3.8/site-packages/requests/sessions.py in send(self, request, **kwargs)
654 # Send the request
--> 655 r = adapter.send(request, **kwargs)
656
~/.opt/platform_venv/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
515
--> 516 raise ConnectionError(e, request=request)
517
ConnectionError: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /proxy/authentication/authenticate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9b468be580>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
<ipython-input-5-21338c2d2121> in <module>
----> 1 vc = VirtualCoach('http://localhost:9000', storage_username='nrpuser', storage_password='password')
~/nrp/src/VirtualCoach/hbp_nrp_virtual_coach/pynrp/virtual_coach.py in __init__(self, environment, oidc_username, oidc_password, oidc_token, storage_username, storage_password)
127 if not storage_password:
128 storage_password = getpass.getpass()
--> 129 token = self.__get_storage_token(storage_username, storage_password)
130 else:
131 raise Exception('Virtual Coach instantiated without storage server credentials or oidc'
~/nrp/src/VirtualCoach/hbp_nrp_virtual_coach/pynrp/virtual_coach.py in __get_storage_token(self, user_name, password)
242 # pylint: disable=broad-except
243 except Exception as e:
--> 244 raise Exception('Storage Server authentication failed, with exception: {}'.format(e))
245
246 if resp.status_code != 200:
Exception: Storage Server authentication failed, with exception: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /proxy/authentication/authenticate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9b468be580>: Failed to establish a new connection: [Errno 111] Connection refused'))
Trying to access the NRP online
vc = VirtualCoach('http://148.187.149.212', oidc_username='mmiekus2')
results in:
INFO: [2022-04-19 11:42:02,545 - Configuration] Loading configuration file config.json
INFO: [2022-04-19 11:42:02,547 - VirtualCoach] Logging into OIDC as: mmiekus2
input your OIDC password: ...
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-4-b4d276f93385> in <module>
----> 1 vc = VirtualCoach('http://148.187.149.212', oidc_username='mmiekus2')
~/nrp/src/VirtualCoach/hbp_nrp_virtual_coach/pynrp/virtual_coach.py in __init__(self, environment, oidc_username, oidc_password, oidc_token, storage_username, storage_password)
113 if not oidc_password:
114 oidc_password = getpass.getpass(prompt='input your OIDC password: ')
--> 115 token = self.__get_oidc_token(oidc_username, oidc_password)
116 else:
117 if self.__oidc_token_is_valid(token):
~/nrp/src/VirtualCoach/hbp_nrp_virtual_coach/pynrp/virtual_coach.py in __get_oidc_token(self, user_name, password)
212 break
213 else:
--> 214 raise Exception('OIDC authorization failed. Probably you used wrong credentials.')
215
216 # the user is forwarded to the approve page if not approved yet
Exception: OIDC authorization failed. Probably you used wrong credentials.
I have no problems with accessing the NRP using the web cockpit (locally and online). My login and password work there.