NETCONF協議netopeer軟件安裝與環境搭建
目錄
簡介
最近工作涉及一些NETCONF協議調研與驗證,NETCONF的自動化配置系統採用Client/Server架構,而netopeer即實現了netconf的C/S框架的開源項目,謹以此文總結記錄一下netopeer環境搭建和簡單使用過程。
Netopeer是基於開源項目libnetconf庫完成的,已實現client和server端的代碼。主要涉及的組件爲netopeer-cli和netopeer-server;其中netopeer-cli爲一個CLI程序,允許通過該程序連接到netconf server,和操縱它的配置數據;netopeer-server爲一個netconf服務器端的守護進程,允許與netconf client建立連接,接收配置數據等操作。除了這兩個重要的模塊,netopeer項目還包含了libnetconf transAPI模塊舉例,位於項目源碼transAPI/路徑下,例如cfgsystem模塊,實現的是一個ietf-system數據模型。
本文主要介紹使用ubuntu-14.04.5-server 64位系統作爲基礎環境。
相關網站參考
準備工作
1) ubuntu官網下載ubuntu系統安裝ISO – ubuntu-14.04.5-server-amd64.iso
2) 安裝ubuntu14.04.5 server系統
3) 安裝必要的依賴包# apt-get install libtool python-argparse libtool-bin python-sphinx libffi-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev xsltproc python-setuptools cmake zlib1g-dev libssl-dev python-libxml2 libaugeas-dev openssh-server libreadline-dev
手動編譯安裝部份依賴包
pyang
# git clone https://github.com/mbj4668/pyang.git
# cd pyang
# python setup.py installlibssh (>=0.6.4)
下載libssh源碼包(https://git.libssh.org/projects/libssh.git)# cd libssh
# mkdir build
# cd build
# cmake ..
# make
# make installlibnetconf
# git clone https://github.com/CESNET/libnetconf.git
# cd libnetconf
# ./configure
# make
# make install
手動編譯netopeer
下載netopeer源碼
# git clone https://github.com/CESNET/netopeer.git
編譯安裝netopeer-server
# cd netopeer/server
# ./configure
# make
# make install編譯安裝netopeer-cli
# cd netopeer/cli
# ./configure
# make
# make install
啓動與驗證
啓動netopeer server
# netopeer-server -d
默認監聽端口x.x.x.x:830,連接的用戶名密碼爲系統用戶
驗證netopeer-cli與netopeer-server連接
運行netopeer-cli,連接netopeer server
# netopeer-cli
netconf> connect localhost
netconf> get-config startup
其它操作
a) 配置netopeer server模塊
# netopeer-configuratorb) 檢查默認啓動的模塊
# netopeer-manager list