{"id":330476,"date":"2022-03-10T15:00:17","date_gmt":"2022-03-10T15:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=330476"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=330476","title":{"rendered":"<span>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 exception \u043f\u0440\u0438 \u043d\u0430\u043a\u0430\u0442\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Huawei<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ff6\/41f\/0b2\/ff641f0b204c5b9ee849fc64fb57b330.png\" width=\"1200\" height=\"800\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ff6\/41f\/0b2\/ff641f0b204c5b9ee849fc64fb57b330.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0442\u0440\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Python-\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0442\u0438 Huawei (\u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439): \u044d\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 L3 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c, \u044d\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0438 \u044d\u0442\u043e SSH-\u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043b\u044e\u0431\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043b\u043e\u0433, \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0430 \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/huawei\/blog\/648127\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0438\u0442 \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/forum.huawei.com\/enterprise\/ru\/forum.php?mod=viewthread&amp;tid=837149\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0435\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/72d\/976\/9dd\/72d9769dd41b1bf92f9040dfd113c3e6.png\" alt=\"\u0412\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try - except - continue\" title=\"\u0412\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try - except - continue\" width=\"1600\" height=\"910\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/72d\/976\/9dd\/72d9769dd41b1bf92f9040dfd113c3e6.png\"\/><figcaption>\u0412\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try &#8212; except &#8212; continue<\/figcaption><\/figure>\n<p>\u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <strong>try &#8212; except &#8212; continue<\/strong>. <strong>try<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438. <strong>except<\/strong> (exception \u0438\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f) &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432 Python, \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439.\u00a0<\/p>\n<p>\u042f \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <strong>continue<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b\u0441\u044f \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u0410 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>print()<\/strong> \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (except). \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f, \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u0442\u043e \u043a\u043e\u0434 except \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f. \u0415\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443, \u0447\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try &#8212; except &#8212; continue, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0440\u0430\u0437\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u0438 \u0431\u0435c\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c.  <\/p>\n<p>\u0418\u0442\u0430\u043a, Python \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (except), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 &#8212; AuthenticationException<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 &#8212; NetMikoTimeoutException<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 SSH &#8212; SSHException<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1b6\/372\/da3\/1b6372da3bb9a77bc5060a684af33d13.png\" width=\"1357\" height=\"510\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b6\/372\/da3\/1b6372da3bb9a77bc5060a684af33d13.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430 <strong>except<\/strong> \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0430. \u0412 \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u0432\u0445\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f print() \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 continue. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c, \u0442\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u201c\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: ip-\u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u201d. \u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0442\u043e \u0432\u0441\u0435 \u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430 except \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u044b, \u0438 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 &#8212; <strong>send_config_set<\/strong> (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435).<\/p>\n<p>\u0412\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n<pre><code class=\"python\">from netmiko.ssh_exception import NetMikoTimeoutException from paramiko.ssh_exception import SSHException from netmiko.ssh_exception import AuthenticationException<\/code><\/pre>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.\u00a0<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0435\u0441\u0442 \u0432 eNSP. \u0412 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u0438 \u0432\u043e\u0441\u0435\u043c\u044c CloudEngine Huawei \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440. \u0418\u0437 \u043d\u0438\u0445 \u044f \u0432\u043a\u043b\u044e\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 (\u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u201c\u041d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: ip-\u0430\u0434\u0440\u0435\u0441\u201d). \u041f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u043d\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u043d\u0430\u043a\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438), \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u044e \u043f\u0430\u0440\u043e\u043b\u044c, \u0430 \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043e\u0442\u043a\u043b\u044e\u0447\u0443 SSH.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8cf\/2d7\/cf0\/8cf2d7cf01745f1624ced3cd75b355b0.png\" alt=\"\u0422\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044f eNSP \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a\" title=\"\u0422\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044f eNSP \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a\" width=\"1482\" height=\"1010\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8cf\/2d7\/cf0\/8cf2d7cf01745f1624ced3cd75b355b0.png\"\/><figcaption>\u0422\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044f eNSP \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a<\/figcaption><\/figure>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u044e \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 CE2:<\/p>\n<p><em>&lt;CE_2>sys<\/em><\/p>\n<p><em>Enter system view, return user view with return command.<\/em><\/p>\n<p><em>[~CE_2]aaa<\/em><\/p>\n<p><em>[~CE_2-aaa]local-user vasyo1 password irreversible-cipher @ghjcnjnF358986<\/em><strong><em>6<\/em><\/strong><\/p>\n<p><em>[*CE_2-aaa]commit<\/em><\/p>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0430\u044e SSH \u043d\u0430 VTY \u043b\u0438\u043d\u0438\u044f\u0445 \u043d\u0430 CE_3:<\/p>\n<p><em>&lt;CE_3>sys<\/em><\/p>\n<p><em>Enter system view, return user view with return command.<\/em><\/p>\n<p><em>[~CE_3]user-interface vty 0 4<\/em><\/p>\n<p><em>[~CE_3-ui-vty0-4]protocol inbound telnet<\/em><\/p>\n<p><em>[*CE_3-ui-vty0-4]commit<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0449\u0443 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2cb\/d3b\/f21\/2cbd3bf21cbe990727520539eaacb1c1.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 exception \u043f\u0440\u0438 \u043d\u0430\u043a\u0430\u0442\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Huawei \" title=\"\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 exception \u043f\u0440\u0438 \u043d\u0430\u043a\u0430\u0442\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Huawei \" width=\"1341\" height=\"1191\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2cb\/d3b\/f21\/2cbd3bf21cbe990727520539eaacb1c1.png\"\/><figcaption>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 exception \u043f\u0440\u0438 \u043d\u0430\u043a\u0430\u0442\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Huawei <\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 Password &#8212; \u044d\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0438 \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0414\u0430\u043b\u0435\u0435 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043a\u0440\u0430\u0441\u043d\u043e\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043d\u0430\u043a\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043a\u0440\u0430\u0441\u043d\u043e\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (\u0433\u0434\u0435 \u044f \u043f\u043e\u043c\u0435\u043d\u044f\u043b \u043f\u0430\u0440\u043e\u043b\u044c), \u0438 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 SSH (\u0433\u0434\u0435 \u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e telnet). \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u044f\u0442\u044c \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u043e\u0432: \u043d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0438\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u043b).<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <strong>try &#8212; except &#8212; continue<\/strong>.<\/p>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0430\u0440\u0438\u044e \u043d\u0430\u043a\u0430\u0442\u0430, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"https:\/\/habr.com\/ru\/company\/huawei\/blog\/648127\/\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0439 \u0434\u0440\u0443\u0433 Netmiko. \u0427\u0430\u0441\u0442\u044c 2: \u0422\u0440\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/a>.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">from getpass import getpass from netmiko import ConnectHandler from netmiko.ssh_exception import NetMikoTimeoutException from paramiko.ssh_exception import SSHException from netmiko.ssh_exception import AuthenticationException  username = input('\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f SSH: ') password = getpass()  with open('switch_file_config') as f:     config_lines = f.read().splitlines() print (config_lines)  with open('myswitches') as f:     ip_lines = f.read().splitlines() print (ip_lines)  for device in ip_lines:     ip_address_of_device = device     CE = {         'device_type': 'huawei',         'ip':   ip_address_of_device,         'username': username,         'password': password     }      try:         ssh_connect = ConnectHandler(**CE)     except (AuthenticationException):         print ('\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: ' + ip_address_of_device)         continue     except (NetMikoTimeoutException):         print ('\u041d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: ' + ip_address_of_device)         continue     except (SSHException):         print ('SSH \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 SSH? ' + ip_address_of_device)         continue      output = ssh_connect.send_config_set(config_lines)     print(f\"\\n\\n-------------- CE_{CE['ip']} --------------\")     print(output)     print(\"-------------------- End -------------------\")<\/code><\/pre>\n<p>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/5563089\/raw-input-function-in-python\" rel=\"noopener noreferrer nofollow\">https:\/\/stackoverflow.com\/questions\/5563089\/raw-input-function-in-python<\/a><\/p>\n<p><a href=\"https:\/\/pynet.twb-tech.com\/blog\/automation\/netmiko.html\" rel=\"noopener noreferrer nofollow\">https:\/\/pynet.twb-tech.com\/blog\/automation\/netmiko.html<\/a><\/p>\n<p><a href=\"https:\/\/pyneng.readthedocs.io\/en\/latest\/book\/18_ssh_telnet\/netmiko.html\" rel=\"noopener noreferrer nofollow\">https:\/\/pyneng.readthedocs.io\/en\/latest\/book\/18_ssh_telnet\/netmiko.html<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/ktbyers\/netmiko\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/ktbyers\/netmiko<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/ktbyers\/netmiko\/blob\/master\/netmiko\/ssh_dispatcher.py\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/ktbyers\/netmiko\/blob\/master\/netmiko\/ssh_dispatcher.py<\/a><\/p>\n<p>Udemy.com &#8212; Python Network Programming for Network Engineers (Python 3) (David Bombal)<\/p>\n<p><a href=\"https:\/\/www.pythoncentral.io\/pythons-range-function-explained\/\" rel=\"noopener noreferrer nofollow\">https:\/\/www.pythoncentral.io\/pythons-range-function-explained<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/655015\/\"> https:\/\/habr.com\/ru\/post\/655015\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0442\u0440\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Python-\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0442\u0438 Huawei (\u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439): \u044d\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 L3 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c, \u044d\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0438 \u044d\u0442\u043e SSH-\u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043b\u044e\u0431\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043b\u043e\u0433, \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0430 \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/huawei\/blog\/648127\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0438\u0442 \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/forum.huawei.com\/enterprise\/ru\/forum.php?mod=viewthread&amp;tid=837149\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0435\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<figure class=\"full-width\"><figcaption>\u0412\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try &#8212; except &#8212; continue<\/figcaption><\/figure>\n<p>\u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <strong>try &#8212; except &#8212; continue<\/strong>. <strong>try<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438. <strong>except<\/strong> (exception \u0438\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f) &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432 Python, \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439.\u00a0<\/p>\n<p>\u042f \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <strong>continue<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b\u0441\u044f \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u0410 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>print()<\/strong> \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (except). \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f, \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u0442\u043e \u043a\u043e\u0434 except \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f. \u0415\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443, \u0447\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try &#8212; except &#8212; continue, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0440\u0430\u0437\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043a\u0430\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u0438 \u0431\u0435c\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c.  <\/p>\n<p>\u0418\u0442\u0430\u043a, Python \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (except), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 &#8212; AuthenticationException<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 &#8212; NetMikoTimeoutException<\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 SSH &#8212; SSHException<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430 <strong>except<\/strong> \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0430. \u0412 \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u0432\u0445\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f print() \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 continue. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c, \u0442\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u201c\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: ip-\u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u201d. \u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0442\u043e \u0432\u0441\u0435 \u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430 except \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u044b, \u0438 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 &#8212; <strong>send_config_set<\/strong> (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435).<\/p>\n<p>\u0412\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n<pre><code class=\"python\">from netmiko.ssh_exception import NetMikoTimeoutException from paramiko.ssh_exception import SSHException from netmiko.ssh_exception import AuthenticationException<\/code><\/pre>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.\u00a0<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0435\u0441\u0442 \u0432 eNSP. \u0412 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u0438 \u0432\u043e\u0441\u0435\u043c\u044c CloudEngine Huawei \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440. \u0418\u0437 \u043d\u0438\u0445 \u044f \u0432\u043a\u043b\u044e\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 (\u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u201c\u041d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: ip-\u0430\u0434\u0440\u0435\u0441\u201d). \u041f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u043d\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u043d\u0430\u043a\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438), \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u044e \u043f\u0430\u0440\u043e\u043b\u044c, \u0430 \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043e\u0442\u043a\u043b\u044e\u0447\u0443 SSH.<\/p>\n<figure class=\"full-width\"><figcaption>\u0422\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044f eNSP \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a<\/figcaption><\/figure>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u044e \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 CE2:<\/p>\n<p><em>&lt;CE_2>sys<\/em><\/p>\n<p><em>Enter system view, return user view with return command.<\/em><\/p>\n<p><em>[~CE_2]aaa<\/em><\/p>\n<p><em>[~CE_2-aaa]local-user vasyo1 password irreversible-cipher @ghjcnjnF358986<\/em><strong><em>6<\/em><\/strong><\/p>\n<p><em>[*CE_2-aaa]commit<\/em><\/p>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0430\u044e SSH \u043d\u0430 VTY \u043b\u0438\u043d\u0438\u044f\u0445 \u043d\u0430 CE_3:<\/p>\n<p><em>&lt;CE_3>sys<\/em><\/p>\n<p><em>Enter system view, return user view with return command.<\/em><\/p>\n<p><em>[~CE_3]user-interface vty 0 4<\/em><\/p>\n<p><em>[~CE_3-ui-vty0-4]protocol inbound telnet<\/em><\/p>\n<p><em>[*CE_3-ui-vty0-4]commit<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0449\u0443 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 exception \u043f\u0440\u0438 \u043d\u0430\u043a\u0430\u0442\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Huawei <\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 Password &#8212; \u044d\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0438 \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0414\u0430\u043b\u0435\u0435 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043a\u0440\u0430\u0441\u043d\u043e\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043d\u0430\u043a\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043a\u0440\u0430\u0441\u043d\u043e\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (\u0433\u0434\u0435 \u044f \u043f\u043e\u043c\u0435\u043d\u044f\u043b \u043f\u0430\u0440\u043e\u043b\u044c), \u0438 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 SSH (\u0433\u0434\u0435 \u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e telnet). \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u044f\u0442\u044c \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u043e\u0432: \u043d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0438\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u043b).<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <strong>try &#8212; except &#8212; continue<\/strong>.<\/p>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0430\u0440\u0438\u044e \u043d\u0430\u043a\u0430\u0442\u0430, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"https:\/\/habr.com\/ru\/company\/huawei\/blog\/648127\/\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0439 \u0434\u0440\u0443\u0433 Netmiko. \u0427\u0430\u0441\u0442\u044c 2: \u0422\u0440\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/a>.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">from getpass import getpass from netmiko import ConnectHandler from netmiko.ssh_exception import NetMikoTimeoutException from paramiko.ssh_exception import SSHException from netmiko.ssh_exception import AuthenticationException  username = input('\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f SSH: ') password = getpass()  with open('switch_file_config') as f:     config_lines = f.read().splitlines() print (config_lines)  with open('myswitches') as f:     ip_lines = f.read().splitlines() print (ip_lines)  for device in ip_lines:     ip_address_of_device = device     CE = {         'device_type': 'huawei',         'ip':   ip_address_of_device,         'username': username,         'password': password     }      try:         ssh_connect = ConnectHandler(**CE)     except (AuthenticationException):         print ('\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: ' + ip_address_of_device)         continue     except (NetMikoTimeoutException):         print ('\u041d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: ' + ip_address_of_device)         continue     except (SSHException):         print ('SSH \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 SSH? ' + ip_address_of_device)         continue      output = ssh_connect.send_config_set(config_lines)     print(f\"\\n\\n-------------- CE_{CE['ip']} --------------\")     print(output)     print(\"-------------------- End -------------------\")<\/code><\/pre>\n<p>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/5563089\/raw-input-function-in-python\" rel=\"noopener noreferrer nofollow\">https:\/\/stackoverflow.com\/questions\/5563089\/raw-input-function-in-python<\/a><\/p>\n<p><a href=\"https:\/\/pynet.twb-tech.com\/blog\/automation\/netmiko.html\" rel=\"noopener noreferrer nofollow\">https:\/\/pynet.twb-tech.com\/blog\/automation\/netmiko.html<\/a><\/p>\n<p><a href=\"https:\/\/pyneng.readthedocs.io\/en\/latest\/book\/18_ssh_telnet\/netmiko.html\" rel=\"noopener noreferrer nofollow\">https:\/\/pyneng.readthedocs.io\/en\/latest\/book\/18_ssh_telnet\/netmiko.html<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/ktbyers\/netmiko\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/ktbyers\/netmiko<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/ktbyers\/netmiko\/blob\/master\/netmiko\/ssh_dispatcher.py\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/ktbyers\/netmiko\/blob\/master\/netmiko\/ssh_dispatcher.py<\/a><\/p>\n<p>Udemy.com &#8212; Python Network Programming for Network Engineers (Python 3) (David Bombal)<\/p>\n<p><a href=\"https:\/\/www.pythoncentral.io\/pythons-range-function-explained\/\" rel=\"noopener noreferrer nofollow\">https:\/\/www.pythoncentral.io\/pythons-range-function-explained<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/655015\/\"> https:\/\/habr.com\/ru\/post\/655015\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-330476","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/330476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=330476"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/330476\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=330476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=330476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=330476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}