grpc_example.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:ios-xr-grpc-python 作者: cisco-grpc-connection-libs 项目源码 文件源码
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.'
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号