...
1.2 Build your own Dockerfile based on the template
In Dockerfile, The software listed below are installed:
...
While building the docker image, script script import-yangs.sh is called to import yang models into Netconf datastore sysrepo as listed.
Code Block | ||||
---|---|---|---|---|
| ||||
################################### Clean the default Yang models defined inside the sysrepo, in case of the conflictions ################################### sysrepoctl --uninstall --module=iana-if-type --revision=2014-05-08 sysrepoctl --uninstall --module=ietf-ip revision=2014-06-16 sysrepoctl --uninstall --module=ietf-interfaces revision=2014-05-08 ################################### Make some changes to skip parsing errors ################################### cd /root/yang/openconfig-odtn # Before importing, you need to remove the last augment block for # "/oc-if:interfaces/oc-if:interface/oc-if:state" in openconfig-platform-transceiver.yang. # Because it will cause parsing errors. # line number between [481, 500] sed -i '481,500d' openconfig-platform-transceiver.yang ################################### Install new yang files about openconfig ################################### sysrepoctl --install --yang=ietf-interfaces.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=iana-if-type.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-extensions.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-types.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-yang-types.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-platform-types.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-transport-types.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-interfaces.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-if-ethernet.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-alarm-types.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-platform.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-platform-linecard.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-platform-port.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-platform-transceiver.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-terminal-device.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-transport-line-common.yang --owner=root:root --permissions=666 sysrepoctl --install --yang=openconfig-transport-line-protection.yang --owner=root:root --permissions=666 |
libyang and and sysrepo are not very stable for YANG, and your own yang files may contains some special statements that cannot be recognized by libyang properly. You need to change some details to make your own yang files available in Netconf server.
After yang module installation, ssh into the modules could be listed belowdocker container using the following command,
Code Block | ||||
---|---|---|---|---|
| ||||
docker exec -it <container_name> /bin/bash |
After ssh into the docker container, you can list modules as follows:
Code Block | ||
---|---|---|
| ||
root@b2d61bf9014f:~# sysrepoctl -l Sysrepo schema directory: /etc/sysrepo/yang/ Sysrepo data directory: /etc/sysrepo/data/ (Do not alter contents of these directories manually) Module Name | Revision | Conformance | Data Owner | Permissions | Submodules | Enabled Features ----------------------------------------------------------------------------------------------------------------------------------------------- ietf-netconf-notifications | 2012-02-06 | Installed | root:root | 666 | | ietf-netconf | 2011-06-01 | Installed | root:root | 666 | | writable-running candidate rollback-on-error validate startup xpath url ietf-netconf-acm | 2018-02-14 | Imported | | | | nc-notifications | 2008-07-14 | Installed | root:root | 666 | | notifications | 2008-07-14 | Installed | root:root | 666 | | turing-machine | 2013-12-27 | Installed | root:root | 666 | | ietf-netconf-with-defaults | 2011-06-01 | Installed | | | | ietf-netconf-monitoring | 2010-10-04 | Installed | root:root | 666 | | ietf-yang-library | 2018-01-17 | Installed | root:root | 666 | | ietf-datastores | 2017-08-17 | Imported | | | | ietf-interfaces | 2018-02-20 | Installed | root:root | 666 | | iana-if-type | 2017-01-19 | Installed | | | | openconfig-extensions | 2017-04-11 | Installed | | | | openconfig-types | 2018-05-05 | Installed | | | | openconfig-yang-types | 2018-04-24 | Installed | | | | openconfig-platform-types | 2018-05-05 | Installed | | | | openconfig-transport-types | 2018-05-16 | Installed | | | | openconfig-alarm-types | 2018-01-16 | Installed | | | | openconfig-interfaces | 2018-04-24 | Installed | root:root | 666 | | openconfig-if-ethernet | 2018-04-10 | Installed | | | | openconfig-platform | 2018-06-03 | Installed | root:root | 666 | | openconfig-platform-port | 2018-01-20 | Installed | | | | openconfig-platform-transceiver | 2018-05-15 | Installed | | | | openconfig-terminal-device | 2017-07-08 | Installed | root:root | 666 | | openconfig-platform-linecard | 2017-08-03 | Installed | | | | openconfig-transport-line-common | 2017-09-08 | Installed | | | | openconfig-transport-line-protection | 2017-09-08 | Installed | root:root | 666 | | |
...
1.4 Start Netconf server in push-data.sh
In push-data.sh, you should put the data into sysrepo, and start Netconf server.
...
There are two ways to push data into sysrepo.:
- sysrepocfg: sysrepocfg is the configuration command about sysrepo, you could push init-components data via command like:
Code Block |
---|
sysrepocfg --import=init-components.xml --format=xml openconfig-platform |
netconf-console
...
: netconf-console is a general Netconf client tool. We can use this command to import config-power XML data:
Code Block |
---|
netconf-console --host 127.0.0.1 --port 830 -u root -p root --rpc=/root/script/config-power.xml |
...
1.5. Testing via netconf-console
sysrepo and Netopeer2 provide some useful tools for Netconf testing, however, ouside the docker container, we still recommend netconf-console.. You can find a set of examples here: PowerConfig configuration via ONOS CLI or Netconf. The basic <get> and <merge> <edit-config> operations are executed by the files under directory emulator-test:
...
.
1.6. Notes about modification in yang files under emulator-oc-cassini
directory
You can find some notes about modification in yang files under emulator-oc-cassini yang files here in this link