set system services netconf ssh connection-limit 10 set system services netconf ssh rate-limit 5 set system services netconf ssh port 17830 set system services netconf rfc-compliant set system services netconf yang-compliant set system services netconf traceoptions file netconf-ops.log set system services netconf traceoptions file size 3m set system services netconf traceoptions file files 20 set system services netconf traceoptions file world-readable set system services netconf traceoptions flag all
wget https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/karaf/0.8.3/karaf-0.8.3.zip unzip karaf-0.8.3.zip mv karaf-0.8.3 karaf
<?xml version="1.0" encoding="UTF-8"?> <!-- vi: set et smarttab sw=4 tabstop=4: --> <!-- Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html --> <snapshot> <configuration> <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> <!-- Loopback connection to netconf server in controller using netconf-connector --> <module> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type> <name>controller-config</name> <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">172.16.0.101</address> <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">17830</port> <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">lab</username> <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">lab123</password> <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only> <reconnect-on-changed-schema xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">true</reconnect-on-changed-schema> <yang-module-capabilities xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <capability> http://xml.juniper.net/xnm/1.1/xnm?module=configuration&revision=2018-01-01 </capability> </yang-module-capabilities> <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type> <name>global-event-executor</name> </event-executor> <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type> <name>binding-osgi-broker</name> </binding-registry> <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type> <name>dom-broker</name> </dom-registry> <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type> <name>global-netconf-dispatcher</name> </client-dispatcher> <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type> <name>global-netconf-processing-executor</name> </processing-executor> <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type> <name>global-netconf-ssh-scheduled-executor</name> </keepalive-executor> </module> </modules> </data> </configuration> <required-capabilities> <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf?module=odl-sal-netconf-connector-cfg&revision=2015-08-03</capability> </required-capabilities> </snapshot>
以上須要更改的部分用%s標示以下(因爲我是18.2版本,上面revision=2018-01-01,其餘版本請着實更改,yang模塊對應版本見這裏https://github.com/Juniper/yang)html
<?xml version="1.0" encoding="UTF-8"?> <!-- vi: set et smarttab sw=4 tabstop=4: --> <!-- Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html --> <snapshot> <configuration> <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> <!-- Loopback connection to netconf server in controller using netconf-connector --> <module> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type> <name>%s</name> <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">%s</address> <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">%s</port> <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">%s</username> <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">%s</password> <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">%s</tcp-only> <reconnect-on-changed-schema xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">true</reconnect-on-changed-schema> <yang-module-capabilities xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <capability> http://xml.juniper.net/xnm/1.1/xnm?module=configuration&revision=%s </capability> </yang-module-capabilities> <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type> <name>global-event-executor</name> </event-executor> <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type> <name>binding-osgi-broker</name> </binding-registry> <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type> <name>dom-broker</name> </dom-registry> <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type> <name>global-netconf-dispatcher</name> </client-dispatcher> <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type> <name>global-netconf-processing-executor</name> </processing-executor> <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf"> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type> <name>global-netconf-ssh-scheduled-executor</name> </keepalive-executor> </module> </modules> </data> </configuration> <required-capabilities> <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf?module=odl-sal-netconf-connector-cfg&revision=2015-08-03</capability> </required-capabilities> </snapshot>
opendaylight-user@root> bin/karaf Apache Karaf starting up. Press Enter to open the shell now... 100% [========================================================================] Karaf started in 18s. Bundle stats: 388 active, 389 total ________ ________ .__ .__ .__ __ \_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_ / | \\____ \_/ __ \ / \ | | \\__ \ > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ | \_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__| \/|__| \/ \/ \/ \/\/ /_____/ \/ Hit '' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight. opendaylight-user@root>
安裝以下包node
feature:install odl-netconf-topology odl-restconf odl-netconf-connector-all
安裝完後copy the file 99-netconf-connector.xml to karaf/etc/opendaylight/karaf/git
cp 99-netconf-connector.xml karaf/etc/opendaylight/karaf/
PUT http://<CONTROLLER-IP-ADDRESS:8181>/restconf/config/network-topology:network-topology/topology/topology-netconf/node/<node-name>github
<node xmlns="urn:TBD:params:xml:ns:yang:network-topology"> <node-id>controller-config</node-id> <host xmlns="urn:opendaylight:netconf-node-topology">172.16.0.101</host> <port xmlns="urn:opendaylight:netconf-node-topology">17830</port> <username xmlns="urn:opendaylight:netconf-node-topology">lab</username> <password xmlns="urn:opendaylight:netconf-node-topology">lab123</password> <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only> <keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">0</keepalive-delay> <yang-module-capabilities xmlns="urn:opendaylight:netconf-node-topology"> <capability>http://xml.juniper.net/xnm/1.1/xnm?module=junos-common-types&revision=2018-01-01</capability> <capability>http://xml.juniper.net/xnm/1.1/xnm?module=module=junos-conf-root&revision=2018-01-01</capability> </yang-module-capabilities> </node>
opendaylight-user@root>system:shutdown Confirm: halt instance root (yes/no): yes opendaylight-user@root> [root@Opendaylight-2 sun]# ./karaf-0.8.2/bin/karaf Apache Karaf starting up. Press Enter to open the shell now... opendaylight-user@root>
此處須要等待一會,會去下載對應的yang model文件等shell
查看日誌 tailf data/log/karaf.log 若是發現下面字樣即成功bash
| INFO | sing-executor-22 | NetconfDevice | 304 - org.opendaylight.netconf.sal-netconf-connector - 1.7.2 | RemoteDevice{Manchester}: Netconf connector initialized successfully
也可經過接口dom
http://172.16.0.225:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/查看eclipse
在加載中時是connecting狀態ssh
完成後會顯示tcp
查看node狀態
http://172.16.0.225:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount