juniper pyez在ubuntu20.04上的安装与测试

环境: ubuntu20.04

apt-get update

apt-get install python3-dev -y

apt-get install libxslt1-dev libssl-dev libffi-dev -y 

apt install python3-pip -y

pip3 install junos-eznc


VMX设置 set system services netconf ssh


from jinja2 import Template

from jnpr.junos import Device

from jnpr.junos.utils.config import Config

template = Template('set interfaces {{ ifd }} unit {{ unit }} family inet address {{ ip }}')

ifa1 = template.render(ifd='ge-0/0/2',unit='0',ip='10.0.1.1/24')

dev = Device(host='10.x.x.x',user='root',password='Youpassword').open()

with Config(dev, mode='private') as cu: 

    cu.load(ifa1, format='set')

    cu.pdiff()

    cu.commit()

dev.close()

你可能感兴趣的:(juniper pyez在ubuntu20.04上的安装与测试)