コード例 #1
0
ファイル: setssh.py プロジェクト: shaitmm/NetDevOps
def set_ssh(device):
    cfgs = render_temp(device)

    tn = Telnet(host="172.20.0.1",
                port=device.get("port"),
                device_type="ios",
                debug=True)
    tn.send_config_set(cfgs)
コード例 #2
0
    },
    {
        'port': 33301,
        'hostname': 'vIOS21',
        'username': '******',
        'password': '******',
        "mgt_ip": "172.20.3.121"
    },
]

for d in devices_info:
    device_type = ""
    if "xrv" in d.get("hostname"):
        device_type = "iosxr"
        tn = Telnet(host="172.20.0.1",
                    port=d.get("port"),
                    device_type=device_type,
                    debug=True)
        cfgs_list = []
        cfgs_list.append("interface mgmtEth 0/0/CPU0/0")
        cfgs_list.append("interface mgmtEth 0/0/CPU0/0")

        tn.send_config_set(cfgs_list)

    if "IOS" in d.get("hostname"):
        device_type = "ios"
        tn = Telnet(host="172.20.0.1",
                    port=d.get("port"),
                    device_type=device_type,
                    debug=True)