ncclient.operations.rpc.RPCError: 'YANG framework' detected the 'fatal' condition 'Operation not supported on this datastore' - ietf-netmod-yang

I am configuring the hostname of my cisco XR using ncclient. But I am receiving bellow an RPCError-
Traceback (most recent call last):
File "obj4.py", line 13, in <module>
edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
File "/usr/local/lib/python3.5/dist-packages/ncclient/manager.py", line 162, in wrapper
return self.execute(op_cls, *args, **kwds)
File "/usr/local/lib/python3.5/dist-packages/ncclient/manager.py", line 232, in execute
raise_mode=self._raise_mode).request(*args, **kwds)
File "/usr/local/lib/python3.5/dist-packages/ncclient/operations/edit.py", line 67, in request
return self._request(node)
File "/usr/local/lib/python3.5/dist-packages/ncclient/operations/rpc.py", line 337, in _request
raise self._reply.error
ncclient.operations.rpc.RPCError: 'YANG framework' detected the 'fatal' condition 'Operation not supported on this datastore'
My code is-
#!/usr/bin/env python3
from ncclient import manager
with manager.connect(host='198.51.100.1',port=830,username='netman',password='netman',hostkey_verify=False,device_params={'name':'iosxr'},allow_agent=True,look_for_keys=False) as device:
host_name = '''<config>
<cli-config-data>
<cmd>hostname Lab9XR</cmd>
</cli-config-data>
</config>'''
edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
print (edit_result)
Configuration on my cisco XR device is-
RP/0/0/CPU0:ios#sh run
Mon Apr 8 02:53:28.496 UTC
Building configuration...
!! IOS XR Configuration 6.1.3
!! Last configuration change at Mon Apr 8 02:08:58 2019 by netman
!
hostname ios
interface MgmtEth0/0/CPU0/0
shutdown
!
interface GigabitEthernet0/0/0/0
ipv4 address 198.51.100.1 255.255.255.0
!
interface GigabitEthernet0/0/0/1
shutdown
!
xml agent
iteration off
!
netconf agent tty
!
netconf-yang agent
ssh
!
ssh server v2
ssh server netconf vrf default
ssh server logging
ssh timeout 120
end
Please help resolve the issue. How to enable cli module on this device's datastore?

It could be due to Cisco XR does not support "urn:ietf:params:netconf:capability:writable-running:1.0". You need to use candidate datastore in that case

Please try candidate store like:
====current code--------
edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
print (edit_result)
----newcode------
edit_result = device.edit_config(target='candidate',config=host_name, default_operation='merge').data_xml
print (edit_result)

Related

How Can I Solve "Failed To Source Bitbake" With Xilinx Petalinux SDK

I am running Ubuntu 16.04 with Xilinx Petalinux 2018.03 SDK. After a number of successful compilations I am now facing this error
$ petalinux-build
[INFO] building project
[INFO] sourcing bitbake
ERROR: Failed to source bitbake
ERROR: Failed to build project
How can I solved this issue?
Another reason to get the errors "ERROR: Failed to source bitbake" as well as "ERROR: Failed to build project" is a possible upgrade of Python on the build machine. The Petalinux SDK requires python v2 (>= 2.7.3) for the 2018.3 edition.
You can check under [YOUR_PROJECT]/build/build.log and you might see a log similar to this one below:
[INFO] building project
[INFO] sourcing bitbake
SDK environment now set up; additionally you may now run devtool to perform development tasks.
Run devtool --help for further details.
OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3.
Please set up python v2 as your default 'python' interpreter.
ERROR: Failed to source bitbake
ERROR: Failed to build project
To remedy this issue remove the symbolic link under /usr/bin and make sure to create a new one that is pointing to Python 2.7:
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
First you need to investigate the error a little further, do this:
source /opt/pkg/petalinux/2018.3/settings.sh
It will return something similar to this below:
PetaLinux environment set to '/opt/pkg/petalinux/2018.3'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
Source the environment setup:
source /opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/environment-setup-aarch64-xilinx-linux
followed by:
devtool --help
In my case I can see more about the actual error:
NOTE: Starting bitbake server...
ERROR: Unable to start bitbake server
ERROR: Last 10 lines of server log for this session (/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/bitbake-cookerdaemon.log):
Traceback (most recent call last):
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/daemonize.py", line 77, in createDaemon
function()
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/server/process.py", line 433, in _startServer
self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/cooker.py", line 178, in __init__
self.configwatcher = pyinotify.WatchManager()
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/pyinotify.py", line 1764, in __init__
raise OSError(err % self._inotify_wrapper.str_errno())
OSError: Cannot initialize new instance of inotify, Errno=Too many open files (EMFILE)
ERROR: Unable to start bitbake server
ERROR: Last 10 lines of server log for this session (/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/bitbake-cookerdaemon.log):
Traceback (most recent call last):
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/daemonize.py", line 77, in createDaemon
function()
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/server/process.py", line 433, in _startServer
self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/cooker.py", line 178, in __init__
self.configwatcher = pyinotify.WatchManager()
File "/opt/pkg/petalinux/2018.3/components/yocto/source/aarch64/layers/core/bitbake/lib/pyinotify.py", line 1764, in __init__
raise OSError(err % self._inotify_wrapper.str_errno())
OSError: Cannot initialize new instance of inotify, **Errno=Too many open files (EMFILE)**
This is pointing to the /proc/sys/fs/inotify/max_user_instances that need to be increased. In my case I went from 128 to 256 by doing this:
sudo su
echo 256 > /proc/sys/fs/inotify/max_user_instances
You need to become root with "su" and change the mac_user_instances.

PyOrient client reports protocol version error when trying to connect to server

I'm getting what appears to be a version mismatch error from client.connect() when using what I believe to be the most recent versions of pyorient and the orientdb server
Protocol version 37 is not supported yet by this client.
Is there a more up-to-date version of pyclient available?
here's the test script
#!/usr/bin/env python
import pyorient
client = pyorient.OrientDB( "localhost", 2424 )
session_id = client.connect( "root", "password" )
Here's the full traceback
Traceback (most recent call last):
File "./test1.py", line 7, in <module>
session_id = client.connect( "root", "D1sOri3nted" )
File "~/.local/lib/python2.7/site-packages/pyorient-1.5.5-py2.7.egg/pyorient/orient.py", line 325, in connect
return self.get_message("ConnectMessage") \
File "~/.local/lib/python2.7/site-packages/pyorient-1.5.5-py2.7.egg/pyorient/orient.py", line 540, in get_message
message_instance = _Message(self._connection)\
File "~/.local/lib/python2.7/site-packages/pyorient-1.5.5-py2.7.egg/pyorient/messages/connection.py", line 17, in __init__
super( ConnectMessage, self ).__init__(_orient_socket)
File "~/.local/lib/python2.7/site-packages/pyorient-1.5.5-py2.7.egg/pyorient/messages/base.py", line 24, in __init__
sock.get_connection()
File "~/.local/lib/python2.7/site-packages/pyorient-1.5.5-py2.7.egg/pyorient/orient.py", line 78, in get_connection
self.connect()
File "~/.local/lib/python2.7/site-packages/pyorient-1.5.5-py2.7.egg/pyorient/orient.py", line 103, in connect
" is not supported yet by this client.", [])
pyorient.exceptions.PyOrientWrongProtocolVersionException: Protocol version 37 is not supported yet by this client.
I'm using the pyorient version from https://github.com/orientechnologies/pyorient
The server comes from the distributed docker image.
I'm uncertain of how to get the server version, but from within the docker container the console reports v3.0.1
Thanks in advance for any help or advice on this!

OSError: [Errno 99] Cannot assign requested address

Trying to run jupyter notebook on a CentOS 7. It comes back with:
OSError: [Errno 99] Cannot assign requested address
And the stack trace:
[user#desktop ~]$ jupyter notebook
Traceback (most recent call last):
File "/home/use/anaconda3/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/home/user/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/user/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/user/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/user/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1296, in initialize
self.init_webapp()
File "/home/user/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1120, in init_webapp
self.http_server.listen(port, self.ip)
File "/home/user/anaconda3/lib/python3.6/site-packages/tornado/tcpserver.py", line 142, in listen
sockets = bind_sockets(port, address=address)
File "/home/user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 197, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
jupyter notebook --ip=127.0.0.1 --port=8888
I had to simply set the ip/port params. The issue was likely caused because the default ip/port that it was previously trying to assign was already taken!
In a remote VM, I solved the issue by
$ jupyter-notebook --ip=0.0.0.0 --port=8888
...
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://0.0.0.0:8888/?token=1234567890abcdefghijklmnopqrstuvwxyz (the token is for demo)
...
Note: do not assign the specific ip
then I can connect to jupyter notebook via:
http://your_vm_ip:8888/?token=1234567890abcdefghijklmnopqrstuvwxyz
(replace 0.0.0.0 with your_vm_ip)
Here is a permanent solution.
Create a configuration file for Jupyter, enter in the terminal: jupyter notebook --generate-config
The last command will create a file in /home/USER/.jupyter/jupyter_notebook_config.py
Open the file jupyter_notebook_config.py and edit the variable c.NotebookApp.ip as follows:
# c.NotebookApp.ip = 'localhost'
c.NotebookApp.ip = '127.0.0.1'
Enter in the terminal: jupyter notebook
Remarks: sometimes need to first chmod to grant permissions, the file
If you've tried several ports already (using --port XXXX), and none work:
Check that the localhost entry in /etc/hosts/ is not set to something other than 127.0.0.1.

Can't connect python with titan db

Following the steps to configure the titan srever
bin/titan.sh
Forking Cassandra...
Running `nodetool statusthrift`... OK (returned exit status 0 and printed string "running").
Forking Elasticsearch...
Connecting to Elasticsearch (127.0.0.1:9300)... OK (connected to 127.0.0.1:9300).
Forking Gremlin-Server...
Connecting to Gremlin-Server (127.0.0.1:8182)... OK (connected to 127.0.0.1:8182).
Run gremlin.sh to connect.
The server started perfectly but when i am connecting with python and then run the script the error which i got mentioned below
Traceback (most recent call last):
File "/home/admin-12/Documents/bitbucket/ecodrone/ecodrone/GremlinConnector.py", line 28, in <module>
data = (execute_query("""g.V()"""))
File "/home/admin-12/Documents/bitbucket/ecodrone/ecodrone/GremlinConnector.py", line 22, in execute_query
results = future_results.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/resultset.py", line 81, in cb
f.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 77, in _receive
self._protocol.data_received(data, self._results)
File "/home/admin-12/.local/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 71, in data_received
result_set = results_dict[request_id]
KeyError: None
versioning i am using
titan - 1.0.0
gremlin-python - 3.3.2
apache-tinkerpop-gremlin-server-3.3.1
Titan supports some an extremely old version of TinkerPop and I'm sure you'll find some incompatibility there if you try to use gremlin-python 3.3.2. As Titan is no longer supported, I suggest you upgrade to JanusGraph, a more current and maintained version of Titan.

Creating ubuntu guest on CentOS7 host fails (VMWare SVGA unavailable)

Description of problem:
Importing an Ubuntu disk image fails with 'Error: VMWare SVGA not available'.
I am using KVM has a hypervisor on CentOS.
I am getting following error.
Unable to complete install: 'internal error: process exited while connecting to monitor: Error: VMWare SVGA not available
'
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/create.py", line 1855, in do_install
guest.start_install(meter=meter)
File "/usr/share/virt-manager/virtinst/guest.py", line 411, in start_install
noboot)
File "/usr/share/virt-manager/virtinst/guest.py", line 475, in _create_guest
dom = self.conn.createLinux(start_xml or final_xml, 0)
File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3401, in createLinux
if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error: process exited while connecting to monitor: Error: VMWare SVGA not available
I was able to work around this problem by using virt-manager to import the guest. I checked the "Customize configuration before install" box on the last page of the wizard and chose "VGA" as the video model.
If using 'virt-install' please specify "--video=vga"