91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

NETCONF配置CISCO XE(csr1000v)初體驗

發布時間:2020-03-03 18:10:01 來源:網絡 閱讀:2485 作者:重慶YOYOO 欄目:網絡管理

?

1、有用的鏈接

Model Driven Network Automation with IOS-XE?

https://www.ciscolive.com/c/dam/r/ciscolive/emea/docs/2018/pdf/LTRCRT-2700.pdf

?

Configure NETCONF/YANG and Validate Example for Cisco IOS XE 16.x Platforms

https://www.cisco.com/c/en/us/support/docs/storage-networking/management/200933-YANG-NETCONF-Configuration-Validation.html

?

Programmability Configuration Guide, Cisco IOS XE Everest 16.6.x

https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/166/b_166_programmability_cg/configuring_yang_datamodel.html

?

yang-explorer

https://github.com/CiscoDevNet/yang-explorer

?

YangModels

https://github.com/YangModels

?

2、安裝yang-explorer

準備:

? MAC、Linux(不支持windows)

? python 2.7

? pip軟件管理器

? 瀏覽器帶flash plugin(推薦chrome)

//pip install --upgrade pip

//yum install python-virtualenv

//yum install graphviz

a、更改pip源

mkdir ~/.pip

vi ~/.pip/pip.conf

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install]

trusted-host = mirrors.aliyun.com?

yum install python2-pip? python-virtualenv? graphviz????? -y

依賴組件:

yum install? libxml2-devel libxslt-devel? python-devel zlib-devel gcc git? -y

git clone? https://github.com/CiscoDevNet/yang-explorer.git

b、安裝

cd yang-explorer/

bash? setup.sh

?

省略。。。。。。。

Successfully built ydk-models-cisco-ios-xr

Installing collected packages: ydk-models-cisco-ios-xr

Successfully installed ydk-models-cisco-ios-xr-6.2.1

Installing dependencies .. done

Setting up initial database ..

Warning: Setting up database as root, this is not recommended.

Alternatively you can re-run this script as non-root

to setup database without root privilege.

Do you want to continue as root ? (n/N) y? //初始化數據庫

Creating data directories ..

Creating database ..

Operations to perform:

? Synchronize unmigrated apps: staticfiles, messages, explorer

? Apply all migrations: admin, contenttypes, auth, sessions

Synchronizing apps without migrations:

? Creating tables...

??? Creating table explorer_collection

??? Creating table explorer_userprofile

??? Creating table explorer_deviceprofile

??? Running deferred SQL...

? Installing custom SQL...

Running migrations:

? Rendering model states... DONE

? Applying contenttypes.0001_initial... OK

? Applying auth.0001_initial... OK

? Applying admin.0001_initial... OK

? Applying contenttypes.0002_remove_content_type_name... OK

? Applying auth.0002_alter_permission_name_max_length... OK

? Applying auth.0003_alter_user_email_max_length... OK

? Applying auth.0004_alter_user_username_opts... OK

? Applying auth.0005_alter_user_last_login_null... OK

? Applying auth.0006_require_contenttypes_0002... OK

? Applying sessions.0001_initial... OK

Creating default users ..

Copying default models ..

Setup completed..

Use start.sh to start yang-explorer server

安裝完成。

c、修改配置文件并運行yang-exporer

[root@desk yang-explorer]# cd server/static/

[root@desk static]# vi YangExplorer.html?

var swfVersionStr = "16.0.0";

??????????? // To use express install, set to playerProductInstall.swf, otherwise the empty string.

??????????? var xiSwfUrlStr = "expressInstall.swf";

??????????? var flashvars = {};

??????????? flashvars.host = '192.168.0.87';??????? //修改監聽地址和端口

??????????? flashvars.port = '8088';

[root@desk static]# cd ..

[root@desk server]# cd ..

[root@desk yang-explorer]# vi start.sh

#!/usr/bin/env bash

HOST='192.168.0.87'

PORT='8088'

# set timeout value for ncclient

export NCCLIENT_TIMEOUT=90

[root@desk yang-explorer]# ls

default-models? docs? env.sh? LICENSE? README.md? requirements.txt? server? setup.sh? start.sh? v? YangExplorer

[root@desk yang-explorer]# ./start.sh

Activating virtualenv ..

Starting YangExplorer server ..

Use http://192.168.0.87:8088/static/YangExplorer.html

Performing system checks...

System check identified no issues (0 silenced).

July 17, 2019 - 15:22:46

Django version 1.8.3, using settings 'server.settings'

Starting development server at http://192.168.0.87:8088/

Quit the server with CONTROL-C.

打開瀏覽器:

http://192.168.0.87:8088/static/YangExplorer.html

NETCONF配置CISCO XE(csr1000v)初體驗

?

3、導入YangModels

點擊Login

username:guest

password:guess

NETCONF配置CISCO XE(csr1000v)初體驗

NETCONF配置CISCO XE(csr1000v)初體驗

Subscript

?

4、配置XE路由器

XE3(config)#netconf-yang????? //主要配置

?

NETCONF配置CISCO XE(csr1000v)初體驗

Cisco-IOS-XE-native----->native --->interface --->GigabitEthernet????????? name?

????????????????????????????????????????????????????????????????????????????????????????????????????? ip---->address-choice

NETCONF配置CISCO XE(csr1000v)初體驗

<rpc-reply message-id="urn:uuid:79b79a13-844a-4248-aac5-c47401b15745" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">

? <ok/>

</rpc-reply>

檢查

XE3#sh ip inter b

Interface????????????? IP-Address????? OK? Method Status??????????????? Protocol

GigabitEthernet1?????? 192.168.0.29??? YES DHCP?? up??????????????????? up?????

GigabitEthernet2????? 10.1.1.1 ?????? YES other? administratively down down???

GigabitEthernet3?????? unassigned????? YES unset? administratively down down????

NETCONF配置CISCO XE(csr1000v)初體驗

XE3#sh ip inter b

Interface????????????? IP-Address????? OK? Method Status??????????????? Protocol

GigabitEthernet1?????? 192.168.0.29??? YES DHCP?? up??????????????????? up?????

GigabitEthernet2?????? 10.1.1.1??????? YES other? up??????????????????? up?????

GigabitEthernet3?????? unassigned????? YES unset? administratively down down?

產生python文件:

"""

??? Netconf python example by yang-explorer (https://github.com/CiscoDevNet/yang-explorer)

??? Installing python dependencies:

??? > pip install lxml ncclient

??? Running script: (save as example.py)

??? > python example.py -a 192.168.0.29 -u yoyoo -p yoyoo123 --port 830???????? //執行python的方法

"""

import lxml.etree as ET

from argparse import ArgumentParser

from ncclient import manager

from ncclient.operations import RPCError

payload = """

<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

? <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">

??? <interface>

????? <GigabitEthernet>

??????? <name>2</name>

??????? <ip>

????????? <address>

??????????? <primary>

????????????? <address>10.1.1.1</address>

????????????? <mask>255.255.255.0</mask>

??????????? </primary>

????????? </address>

??????? </ip>

????? </GigabitEthernet>

??? </interface>

? </native>

</config>

"""

if __name__ == &apos;__main__&apos;:

??? parser = ArgumentParser(description=&apos;Usage:&apos;)

??? # script arguments

??? parser.add_argument(&apos;-a&apos;, &apos;--host&apos;, type=str, required=True,

??????????????????????? help="Device IP address or Hostname")

??? parser.add_argument(&apos;-u&apos;, &apos;--username&apos;, type=str, required=True,

??????????????????????? help="Device Username (netconf agent username)")

??? parser.add_argument(&apos;-p&apos;, &apos;--password&apos;, type=str, required=True,

??????????????????????? help="Device Password (netconf agent password)")

??? parser.add_argument(&apos;--port&apos;, type=int, default=830,

??????????????????????? help="Netconf agent port")

??? args = parser.parse_args()

??? # connect to netconf agent

??? with manager.connect(host=args.host,

???????????????????????? port=args.port,

???????????????????????? username=args.username,

???????????????????????? password=args.password,

???????????????????????? timeout=90,

???????????????????????? hostkey_verify=False,

???????????????????????? device_params={&apos;name&apos;: &apos;csr&apos;}) as m:

??????? # execute netconf operation

??????? try:

??????????? response = m.edit_config(target=&apos;running&apos;, config=payload).xml

??????????? data = ET.fromstring(response)

??????? except RPCError as e:

??????????? data = e._raw

??????? # beautify output

??????? print(ET.tostring(data, pretty_print=True))

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

兴山县| 长顺县| 石首市| 昌吉市| 宕昌县| 峨边| 毕节市| 定安县| 丹棱县| 新竹县| 温宿县| 临沭县| 河曲县| 昭苏县| 大兴区| 新余市| 达州市| 定结县| 阿克陶县| 开封市| 惠州市| 凤凰县| 巴塘县| 江孜县| 台南县| 景洪市| 安阳市| 应城市| 文成县| 阜城县| 行唐县| 班戈县| 明溪县| 新巴尔虎右旗| 柳河县| 哈巴河县| 天水市| 鹤峰县| 渭南市| 长兴县| 疏勒县|