当我用凝固汽油弹配置自动化时。我尝试使用 load_merge_candidate 但它没有运行。我的文件配置
import json
from napalm import get_network_driver
print ('conecting ssh')
driver = get_network_driver('ios')
iosvl2 = driver('192.168.1.2', 'khamnguyen', 'admin')
iosvl2.open()
print ('Accessing 192.168.1.2')
iosvl2.load_merge_candidate(filename='ACL1.cfg')
diffs = iosvl2.compare_config()
if len(diffs) > 0:
print(diffs)
iosvl2.commit_config()
else:
print('No changes required.')
iosvl2.discard_config()
iosvl2.close()
[enter image description here][1]
和错误
File "ConfACLWithNapalm2.py", line 9, in <module>
iosvl2.load_merge_candidate(filename='ACL1.cfg')
File "/usr/local/lib/python3.8/dist-packages/napalm/ios/ios.py", line 315, in load_merge_candidate
return_status, msg = self._load_candidate_wrapper(
File "/usr/local/lib/python3.8/dist-packages/napalm/ios/ios.py", line 282, in _load_candidate_wrapper
(return_status, msg) = self._scp_file(
File "/usr/local/lib/python3.8/dist-packages/napalm/ios/ios.py", line 620, in _scp_file
return self._xfer_file(
File "/usr/local/lib/python3.8/dist-packages/napalm/ios/ios.py", line 676, in _xfer_file
if not transfer.verify_space_available():
File "/usr/local/lib/python3.8/dist-packages/netmiko/scp_handler.py", line 178 , in verify_space_available
space_avail = self.remote_space_available(search_pattern=search_pattern)
File "/usr/local/lib/python3.8/dist-packages/netmiko/scp_handler.py", line 122 , in remote_space_available
if "kbytes" in match.group(0) or "Kbytes" in match.group(0):
AttributeError: 'NoneType' object has no attribute 'group'
(我是启用SCP)
enter code here