Skip to content
Snippets Groups Projects
Commit fdebc43f authored by David Schmitz's avatar David Schmitz
Browse files

status/fodtest_netconf_get: include further modes for netconf access

parent 0370d2aa
No related branches found
No related tags found
No related merge requests found
...@@ -6,9 +6,18 @@ parsed=0 ...@@ -6,9 +6,18 @@ parsed=0
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
if [ "$1" = "--raw_all" ]; then if [ "$1" = "--raw_netconf__all_conf" ]; then
shift 1 shift 1
parsed=-1 parsed=-1
elif [ "$1" = "--raw_netconf__client_capabilities" ]; then
shift 1
parsed=-2
elif [ "$1" = "--raw_netconf__server_capabilities" ]; then
shift 1
parsed=-3
elif [ "$1" = "--raw_netconf__all" ]; then
shift 1
parsed=-4
elif [ "$1" = "--raw" ]; then elif [ "$1" = "--raw" ]; then
shift 1 shift 1
parsed=0 parsed=0
...@@ -121,13 +130,29 @@ if $old_version: ...@@ -121,13 +130,29 @@ if $old_version:
applier = Applier(); applier = Applier();
result = applier.get_existing_config_xml(); result = applier.get_existing_config_xml();
print(result); print(result);
else: elif $parsed==-1:
from ncclient import manager from ncclient import manager
with manager.connect(host=settings.NETCONF_DEVICE, port=settings.NETCONF_PORT, username=settings.NETCONF_USER, password=settings.NETCONF_PASS, hostkey_verify=False) as m: with manager.connect(host=settings.NETCONF_DEVICE, port=settings.NETCONF_PORT, username=settings.NETCONF_USER, password=settings.NETCONF_PASS, hostkey_verify=False) as m:
#xmlconfig = m.get_config(source='running', filter=('subtree', '<configurationx/>')).data_xml #xmlconfig = m.get_config(source='running', filter=('subtree', '<configurationx/>')).data_xml
xmlconfig = m.get_config(source='running').data_xml xmlconfig = m.get_config(source='running').data_xml
print(xmlconfig);
print(result); elif $parsed==-2:
from ncclient import manager
with manager.connect(host=settings.NETCONF_DEVICE, port=settings.NETCONF_PORT, username=settings.NETCONF_USER, password=settings.NETCONF_PASS, hostkey_verify=False) as m:
for item in m.client_capabilities:
print(item)
elif $parsed==-3:
from ncclient import manager
with manager.connect(host=settings.NETCONF_DEVICE, port=settings.NETCONF_PORT, username=settings.NETCONF_USER, password=settings.NETCONF_PASS, hostkey_verify=False) as m:
for item in m.server_capabilities:
print(item)
elif $parsed==-4:
from ncclient import manager
with manager.connect(host=settings.NETCONF_DEVICE, port=settings.NETCONF_PORT, username=settings.NETCONF_USER, password=settings.NETCONF_PASS, hostkey_verify=False) as m:
#xmlconfig = m.get_data(datastore='xxx').data_xml
#xmlconfig = m.get_schema(identifier="nokia-conf", version="2023-05-19")
xmlconfig = m.get_schema(identifier="nokia-conf")
print(xmlconfig);
else: else:
retriever = PR0.Retriever(); retriever = PR0.Retriever();
if $parsed==1: if $parsed==1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment