-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add ssh proxy for grpc #118
Conversation
remote_tunnel_port = sshtunnel.add_tunnel(proxy_conn=proxy_dev.connectionmgr.connections.cli, tunnel_type='remote', target_port=allocated_port) | ||
# create a proxy port on the proxy using socat api for redirecting traffic to the port for remote tunnel | ||
proxy_port = proxy_dev.api.socat_relay('127.0.0.1', remote_tunnel_port) | ||
mgmt_ip = self.access_ip or self.device.management.get('address').get('ipv4') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mgmt_ip = self.access_ip or self.device.management.get('address').get('ipv4') | |
mgmt_ip = self.access_ip or self.device.management.get('address',{}).get('ipv4') |
dev = testbed.devices['router-1'] | ||
dev.connections['grpc'].update({'sshtunnel':{'host':'proxy'}}) | ||
testbed.devices['proxy'] = proxy | ||
with mock.patch('yang.connector.grpc.telegraf.sshtunnel.add_tunnel') as sshtuneel_mock: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with mock.patch('yang.connector.grpc.telegraf.sshtunnel.add_tunnel') as sshtuneel_mock: | |
with mock.patch('yang.connector.grpc.telegraf.sshtunnel.add_tunnel') as sshtunnel_mock: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review comments
# add a remote tunnel on the proxy for the allocated port on the execution host | ||
remote_tunnel_port = sshtunnel.add_tunnel(proxy_conn=proxy_dev.connectionmgr.connections.cli, tunnel_type='remote', target_port=allocated_port) | ||
# create a proxy port on the proxy using socat api for redirecting traffic to the port for remote tunnel | ||
proxy_port = proxy_dev.api.socat_relay('127.0.0.1', remote_tunnel_port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use start_socat_relay (once the API is available in genielibs) and stop_socat_relay in disconnect()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
Note, you can only merge these PRs once the new APIs are available in genielibs
This PR will let the transporter connect to the device using a proxy