def main():
'''
To not use tls we need to do 2 things.
1. Comment the variables creds and options out
2. Remove creds and options CiscoGRPCClient
ex: client = CiscoGRPCClient('11.1.1.10', 57777, 10, 'vagrant', 'vagrant')
'''
creds = open('ems.pem').read()
options = 'ems.cisco.com'
client = CiscoGRPCClient('127.0.0.1', 57777, 10, 'vagrant', 'vagrant', creds, options)
#Test 1: Test Get config json requests
path = '{"Cisco-IOS-XR-ip-static-cfg:router-static": [null]}'
try:
err, result = client.getconfig(path)
if err:
print(err)
print(json.dumps(json.loads(result)))
except AbortionError:
print(
'Unable to connect to local box, check your gRPC destination.'
)
grpc_example.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录