· 6 years ago · Dec 23, 2019, 09:38 AM
1[root@noc noc]# ./noc script --debug get_version BRAS-Yerevan
22019-12-23 12:34:33,578 [noc.core.dcs.base] Resolve near service postgres
32019-12-23 12:34:33,578 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
42019-12-23 12:34:33,582 [noc.core.http.client] HTTP Response 200
52019-12-23 12:34:33,582 [noc.core.dcs.base] Resolved near service postgres to ['10.0.6.11:5432']
62019-12-23 12:34:33,678 [noc.main.models.textindex] Adding FTS index for ip.vrf
72019-12-23 12:34:33,749 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
82019-12-23 12:34:33,795 [noc.main.models.doccategory] Registering Capability
92019-12-23 12:34:33,796 [noc.main.models.doccategory] Registering MetricType
102019-12-23 12:34:33,821 [noc.main.models.doccategory] Registering ConnectionType
112019-12-23 12:34:33,825 [noc.main.models.doccategory] Registering ObjectModel
122019-12-23 12:34:33,849 [noc.main.models.textindex] Adding FTS index for sa.managedobject
132019-12-23 12:34:33,860 [noc.core.dcs.base] Running resolver for service mongo
142019-12-23 12:34:33,861 [noc.core.dcs.base] [mongo] Starting resolver
152019-12-23 12:34:33,861 [noc.core.dcs.base] [mongo] Requesting changes from index 0
162019-12-23 12:34:33,861 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
172019-12-23 12:34:33,863 [noc.core.http.client] HTTP Response 200
182019-12-23 12:34:33,863 [noc.core.dcs.base] [mongo] Index changed 0 -> 6892950. Applying changes
192019-12-23 12:34:33,863 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.0.6.11:27017
202019-12-23 12:34:33,863 [noc.core.dcs.base] [mongo] Requesting changes from index 6892950
212019-12-23 12:34:33,863 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?index=6892950&passing=1
222019-12-23 12:34:33,864 [noc.core.mongo.connection] Connecting to MongoDB {'username': 'noc', 'authentication_source': 'noc', 'readPreference': 'secondaryPreferred', 'replicaSet': 'noc', 'maxIdleTimeMS': 60000, 'db': 'noc', 'host': 'mongodb://noc:********@10.0.6.11:27017/noc', 'password': '********'}
232019-12-23 12:34:33,924 [noc.core.loader.base] [script] Loading script Juniper.JUNOS.get_version
242019-12-23 12:34:33,926 [noc.core.mib] Loading compiled MIBs
252019-12-23 12:34:33,926 [noc.core.mib] Loading compiled MIBs from 'cmibs'
262019-12-23 12:34:33,927 [noc.core.mib] Loading MIB: AIRESPACE-SWITCHING-MIB
272019-12-23 12:34:33,928 [noc.core.mib] Loading MIB: AIRESPACE-WIRELESS-MIB
282019-12-23 12:34:33,928 [noc.core.mib] Loading MIB: BRIDGE-MIB
292019-12-23 12:34:33,928 [noc.core.mib] Loading MIB: CISCO-CDP-MIB
302019-12-23 12:34:33,929 [noc.core.mib] Loading MIB: CISCO-PORT-CHANNEL-MIB
312019-12-23 12:34:33,929 [noc.core.mib] Loading MIB: CISCO-PPPOE-MIB
322019-12-23 12:34:33,929 [noc.core.mib] Loading MIB: CISCO-VLAN-MEMBERSHIP-MIB
332019-12-23 12:34:33,929 [noc.core.mib] Loading MIB: CISCO-VPDN-MGMT-MIB
342019-12-23 12:34:33,930 [noc.core.mib] Loading MIB: CISCO-VRF-MIB
352019-12-23 12:34:33,930 [noc.core.mib] Loading MIB: CISCO-VTP-MIB
362019-12-23 12:34:33,930 [noc.core.mib] Loading MIB: ENTITY-MIB
372019-12-23 12:34:33,930 [noc.core.mib] Loading MIB: ENTITY-SENSOR-MIB
382019-12-23 12:34:33,930 [noc.core.mib] Loading MIB: ENTITY-STATE-MIB
392019-12-23 12:34:33,931 [noc.core.mib] Loading MIB: EtherLike-MIB
402019-12-23 12:34:33,931 [noc.core.mib] Loading MIB: HUAWEI-L2IF-MIB
412019-12-23 12:34:33,931 [noc.core.mib] Loading MIB: HUAWEI-SYS-MAN-MIB
422019-12-23 12:34:33,932 [noc.core.mib] Loading MIB: HUAWEI-XPON-MIB
432019-12-23 12:34:33,932 [noc.core.mib] Loading MIB: IEEE8023-LAG-MIB
442019-12-23 12:34:33,933 [noc.core.mib] Loading MIB: IF-MIB
452019-12-23 12:34:33,933 [noc.core.mib] Loading MIB: IP-MIB
462019-12-23 12:34:33,933 [noc.core.mib] Loading MIB: LLDP-MIB
472019-12-23 12:34:33,933 [noc.core.mib] Loading MIB: MPLS-L3VPN-STD-MIB
482019-12-23 12:34:33,934 [noc.core.mib] Loading MIB: MPLS-VPN-MIB
492019-12-23 12:34:33,934 [noc.core.mib] Loading MIB: Q-BRIDGE-MIB
502019-12-23 12:34:33,934 [noc.core.mib] Loading MIB: RFC1213-MIB
512019-12-23 12:34:33,934 [noc.core.mib] Loading MIB: RMON2-MIB
522019-12-23 12:34:33,935 [noc.core.mib] Loading MIB: SNMPv2-MIB
532019-12-23 12:34:33,942 [noc.core.loader.base] [profile] Loading profile Juniper.JUNOS
542019-12-23 12:34:33,947 [script] [Juniper.JUNOS.get_version|10.0.1.4] Running. Input arguments: {}, timeout 3600
552019-12-23 12:34:33,948 [script] [Juniper.JUNOS.get_version|10.0.1.4] Open ssh CLI
562019-12-23 12:34:33,959 [script] [Juniper.JUNOS.get_version|10.0.1.4] Disable paging
572019-12-23 12:34:33,959 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Creating IOLoop
582019-12-23 12:34:33,960 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connecting (u'10.0.1.4', 22)
592019-12-23 12:34:33,961 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connected
602019-12-23 12:34:33,961 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Startup ssh session for user 'noc'
612019-12-23 12:34:33,991 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connected. Host fingerprint is 7fea859ae73263e5ad1c0374a8aa907b76c41054
622019-12-23 12:34:33,993 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Supported authentication methods: publickey, password, keyboard-interactive
632019-12-23 12:34:33,993 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying publickey authentication
642019-12-23 12:34:33,993 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] public_key=etc/noc_ssh/id_rsa.pub private_key=etc/noc_ssh/id_rsa
652019-12-23 12:34:33,993 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Failed: Unable to open public key file (Code: -16)
662019-12-23 12:34:33,993 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying password authentication
672019-12-23 12:34:34,014 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Success
682019-12-23 12:34:34,014 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] User is authenticated
692019-12-23 12:34:34,015 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Open channel
702019-12-23 12:34:34,060 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Changing state to <start>
712019-12-23 12:34:34,060 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Setting timeout: 60s
722019-12-23 12:34:34,061 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Received: 'Last login: Mon Dec 23 11:42:34 2019 from 10.0.6.11\r\r\n--- JUNOS 18.4R2-S2.3 Kernel 64-bit JNPR-11.0-20190926.ca2fd68_buil\r\n'
732019-12-23 12:34:34,061 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] SSH session reset
742019-12-23 12:34:34,061 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing channel
752019-12-23 12:34:34,061 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing ssh session
762019-12-23 12:34:34,061 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connection reset. 3 retries left. Waiting 3 seconds
772019-12-23 12:34:37,062 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connecting (u'10.0.1.4', 22)
782019-12-23 12:34:37,063 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Startup ssh session for user 'noc'
792019-12-23 12:34:37,094 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connected. Host fingerprint is 7fea859ae73263e5ad1c0374a8aa907b76c41054
802019-12-23 12:34:37,095 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Supported authentication methods: publickey, password, keyboard-interactive
812019-12-23 12:34:37,095 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying publickey authentication
822019-12-23 12:34:37,095 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] public_key=etc/noc_ssh/id_rsa.pub private_key=etc/noc_ssh/id_rsa
832019-12-23 12:34:37,095 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Failed: Unable to open public key file (Code: -16)
842019-12-23 12:34:37,096 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying password authentication
852019-12-23 12:34:37,116 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Success
862019-12-23 12:34:37,116 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] User is authenticated
872019-12-23 12:34:37,116 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Open channel
882019-12-23 12:34:37,161 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Received: 'Last login: Mon Dec 23 13:34:34 2019 from 10.0.6.11\r\r\n--- JUNOS 18.4R2-S2.3 Kernel 64-bit JNPR-11.0-20190926.ca2fd68_buil\r\n'
892019-12-23 12:34:37,162 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] SSH session reset
902019-12-23 12:34:37,162 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing channel
912019-12-23 12:34:37,162 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing ssh session
922019-12-23 12:34:37,162 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connection reset. 2 retries left. Waiting 3 seconds
932019-12-23 12:34:40,165 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connecting (u'10.0.1.4', 22)
942019-12-23 12:34:40,166 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Startup ssh session for user 'noc'
952019-12-23 12:34:40,197 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connected. Host fingerprint is 7fea859ae73263e5ad1c0374a8aa907b76c41054
962019-12-23 12:34:40,198 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Supported authentication methods: publickey, password, keyboard-interactive
972019-12-23 12:34:40,198 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying publickey authentication
982019-12-23 12:34:40,198 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] public_key=etc/noc_ssh/id_rsa.pub private_key=etc/noc_ssh/id_rsa
992019-12-23 12:34:40,199 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Failed: Unable to open public key file (Code: -16)
1002019-12-23 12:34:40,199 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying password authentication
1012019-12-23 12:34:40,229 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Success
1022019-12-23 12:34:40,229 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] User is authenticated
1032019-12-23 12:34:40,229 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Open channel
1042019-12-23 12:34:40,276 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Received: 'Last login: Mon Dec 23 13:34:37 2019 from 10.0.6.11\r\r\n--- JUNOS 18.4R2-S2.3 Kernel 64-bit JNPR-11.0-20190926.ca2fd68_buil\r\n'
1052019-12-23 12:34:40,276 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] SSH session reset
1062019-12-23 12:34:40,276 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing channel
1072019-12-23 12:34:40,277 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing ssh session
1082019-12-23 12:34:40,277 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connection reset. 1 retries left. Waiting 3 seconds
1092019-12-23 12:34:43,279 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connecting (u'10.0.1.4', 22)
1102019-12-23 12:34:43,280 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Startup ssh session for user 'noc'
1112019-12-23 12:34:43,312 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Connected. Host fingerprint is 7fea859ae73263e5ad1c0374a8aa907b76c41054
1122019-12-23 12:34:43,313 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Supported authentication methods: publickey, password, keyboard-interactive
1132019-12-23 12:34:43,313 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying publickey authentication
1142019-12-23 12:34:43,313 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] public_key=etc/noc_ssh/id_rsa.pub private_key=etc/noc_ssh/id_rsa
1152019-12-23 12:34:43,313 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Failed: Unable to open public key file (Code: -16)
1162019-12-23 12:34:43,313 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Trying password authentication
1172019-12-23 12:34:43,334 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Success
1182019-12-23 12:34:43,334 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] User is authenticated
1192019-12-23 12:34:43,335 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Open channel
1202019-12-23 12:34:43,380 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Received: 'Last login: Mon Dec 23 13:34:40 2019 from 10.0.6.11\r\r\n--- JUNOS 18.4R2-S2.3 Kernel 64-bit JNPR-11.0-20190926.ca2fd68_buil\r\n'
1212019-12-23 12:34:43,381 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] SSH session reset
1222019-12-23 12:34:43,381 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing channel
1232019-12-23 12:34:43,381 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing ssh session
1242019-12-23 12:34:43,383 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing IOStream
1252019-12-23 12:34:43,383 [script] [Juniper.JUNOS.get_version|10.0.1.4] [ssh] Closing IOLoop
1262019-12-23 12:34:43,508 [noc.core.debug] UNHANDLED EXCEPTION (2019-12-23 12:34:43.397361)
127PROCESS: ./commands/script.py
128VERSION: 19.3.1
129BRANCH: HEAD CHANGESET: 5a0012a0
130ERROR FINGERPRINT: 9303f6a8-e725-5878-a4b2-f398c9d2294c
131WORKING DIRECTORY: /opt/noc
132EXCEPTION: <class 'tornado.iostream.StreamClosedError'> Stream is closed
133START OF TRACEBACK
134------------------------------------------------------------------------
135File: core/script/cli/base.py (Line: 336)
136Function: read_until_prompt
137 329 yield self.iostream.startup()
138 330 break
139 331 except tornado.iostream.StreamClosedError:
140 332 if not connect_retries:
141 333 raise tornado.iostream.StreamClosedError()
142 334 continue
143 335 else:
144 336 ==> raise tornado.iostream.StreamClosedError()
145 337 except tornado.gen.TimeoutError:
146 338 self.logger.info("Timeout error")
147 339 # IOStream must be closed to prevent hanging read callbacks
148 340 self.close_iostream()
149 341 raise tornado.gen.TimeoutError("Timeout")
150 342 self.logger.debug("Received: %r", r)
151Variables:
152 f = <tornado.concurrent.Future object at 0x7f8c3d657f90>
153 handler =
154<bound method SSHCLI.on_password of <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>>
155 self = <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>
156 offset = 228
157 rx = <_sre.SRE_Pattern object at 0x7f8c53cedad0>
158 connect_retries = 0
159 r =
160'Last login: Mon Dec 23 13:34:40 2019 from 10.0.6.11\r\r\n--- JUNOS 18.4R2-S2.3 Kernel 64-bit JNPR-11.0-20190926.ca2fd68_buil\r\n'
161 address = (u'10.0.1.4', 22)
162 match = None
163------------------------------------------------------------------------
164File: lib/python2.7/site-packages/tornado/gen.py (Line: 1063)
165Function: run
166 1056 except Exception:
167 1057 self.had_exception = True
168 1058 exc_info = sys.exc_info()
169 1059 future = None
170 1060
171 1061 if exc_info is not None:
172 1062 try:
173 1063 ==> yielded = self.gen.throw(*exc_info)
174 1064 finally:
175 1065 # Break up a reference to itself
176 1066 # for faster GC on CPython.
177 1067 exc_info = None
178 1068 else:
179 1069 yielded = self.gen.send(value)
180Variables:
181 self = <tornado.gen.Runner object at 0x7f8c3d657e90>
182 value =
183'Last login: Mon Dec 23 13:34:40 2019 from 10.0.6.11\r\r\n--- JUNOS 18.4R2-S2.3 Kernel 64-bit JNPR-11.0-20190926.ca2fd68_buil\r\n'
184 yielded = None
185 future = None
186 orig_stack_contexts = ((), None)
187 exc_info = None
188------------------------------------------------------------------------
189File: lib/python2.7/site-packages/tornado/concurrent.py (Line: 238)
190Function: result
191 231 before the `Future` is done, so the ``timeout`` is never used.
192 232 """
193 233 self._clear_tb_log()
194 234 if self._result is not None:
195 235 return self._result
196 236 if self._exc_info is not None:
197 237 try:
198 238 ==> raise_exc_info(self._exc_info)
199 239 finally:
200 240 self = None
201 241 self._check_done()
202 242 return self._result
203 243
204 244 def exception(self, timeout=None):
205Variables:
206 self = None
207 timeout = None
208------------------------------------------------------------------------
209File: lib/python2.7/site-packages/tornado/gen.py (Line: 1055)
210Function: run
211 1048 return
212 1049 self.future = None
213 1050 try:
214 1051 orig_stack_contexts = stack_context._state.contexts
215 1052 exc_info = None
216 1053
217 1054 try:
218 1055 ==> value = future.result()
219 1056 except Exception:
220 1057 self.had_exception = True
221 1058 exc_info = sys.exc_info()
222 1059 future = None
223 1060
224 1061 if exc_info is not None:
225Variables:
226 exc_info = None
227 self = <tornado.gen.Runner object at 0x7f8c3d657e10>
228 future = None
229 orig_stack_contexts = ((), None)
230------------------------------------------------------------------------
231File: core/script/cli/base.py (Line: 239)
232Function: submit
233 232 self.error = CLIConnectionRefused("Connection refused")
234 233 raise tornado.gen.Return(None)
235 234 self.logger.debug("Connected")
236 235 yield self.iostream.startup()
237 236 # Perform all necessary login procedures
238 237 if not self.is_started:
239 238 yield self.on_start()
240 239 ==> self.motd = yield self.read_until_prompt()
241 240 self.script.set_motd(self.motd)
242 241 self.is_started = True
243 242 # Send command
244 243 # @todo: encode to object's encoding
245 244 if self.profile.batch_send_multiline or self.profile.command_submit not in self.command:
246 245 yield self.send(self.command)
247Variables:
248 self = <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>
249 parser =
250<bound method SSHCLI.read_until_prompt of <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>>
251 address = (u'10.0.1.4', 22)
252------------------------------------------------------------------------
253File: lib/python2.7/site-packages/tornado/gen.py (Line: 1063)
254Function: run
255 1056 except Exception:
256 1057 self.had_exception = True
257 1058 exc_info = sys.exc_info()
258 1059 future = None
259 1060
260 1061 if exc_info is not None:
261 1062 try:
262 1063 ==> yielded = self.gen.throw(*exc_info)
263 1064 finally:
264 1065 # Break up a reference to itself
265 1066 # for faster GC on CPython.
266 1067 exc_info = None
267 1068 else:
268 1069 yielded = self.gen.send(value)
269Variables:
270 exc_info = None
271 self = <tornado.gen.Runner object at 0x7f8c3d657e10>
272 future = None
273 orig_stack_contexts = ((), None)
274------------------------------------------------------------------------
275File: lib/python2.7/site-packages/tornado/concurrent.py (Line: 238)
276Function: result
277 231 before the `Future` is done, so the ``timeout`` is never used.
278 232 """
279 233 self._clear_tb_log()
280 234 if self._result is not None:
281 235 return self._result
282 236 if self._exc_info is not None:
283 237 try:
284 238 ==> raise_exc_info(self._exc_info)
285 239 finally:
286 240 self = None
287 241 self._check_done()
288 242 return self._result
289 243
290 244 def exception(self, timeout=None):
291Variables:
292 self = None
293 timeout = None
294------------------------------------------------------------------------
295File: core/script/cli/base.py (Line: 189)
296Function: run_sync
297 182 self.logger.info("Incomplete feature left. Restarting IOStream")
298 183 self.close_iostream()
299 184 # Retain cryptic message as is,
300 185 # Mark feature as done
301 186 future_cell[0].set_exception(
302 187 tornado.gen.TimeoutError("Operation timed out after %s seconds" % None)
303 188 )
304 189 ==> return future_cell[0].result()
305 190
306 191 def execute(self, cmd, obj_parser=None, cmd_next=None, cmd_stop=None, ignore_errors=False):
307 192 if self.close_timeout:
308 193 self.logger.debug("Removing close timeout")
309 194 self.ioloop.remove_timeout(self.close_timeout)
310 195 self.close_timeout = None
311Variables:
312 run = <function run at 0x7f8c3d6470c8>
313 self = <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>
314 args =
315(<bound method SSHCLI.read_until_prompt of <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>>,)
316 func =
317<bound method SSHCLI.submit of <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>>
318 kwargs = {}
319 future_cell = [<tornado.concurrent.Future object at 0x7f8c3d657cd0>]
320------------------------------------------------------------------------
321File: core/script/cli/base.py (Line: 210)
322Function: execute
323 203 if obj_parser:
324 204 parser = functools.partial(self.parse_object_stream, obj_parser, cmd_next, cmd_stop)
325 205 else:
326 206 parser = self.read_until_prompt
327 207 with Span(
328 208 server=self.script.credentials.get("address"), service=self.name, in_label=cmd
329 209 ) as s:
330 210 ==> self.run_sync(self.submit, parser)
331 211 if self.error:
332 212 if s:
333 213 s.error_text = str(self.error)
334 214 raise self.error
335 215 else:
336 216 return self.result
337Variables:
338 cmd = 'set cli screen-length 0\n'
339 obj_parser = None
340 self = <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>
341 parser =
342<bound method SSHCLI.read_until_prompt of <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>>
343 cmd_stop = None
344 cmd_next = None
345 s = <noc.core.span.Span object at 0x7f8c3d657c90>
346 ignore_errors = True
347------------------------------------------------------------------------
348File: core/script/base.py (Line: 829)
349Function: cli
350 822 if self.to_track:
351 823 self.cli_tracked_command = cmd
352 824 r = stream.execute(
353 825 cmd + command_submit,
354 826 obj_parser=obj_parser,
355 827 cmd_next=cmd_next,
356 828 cmd_stop=cmd_stop,
357 829 ==> ignore_errors=ignore_errors,
358 830 )
359 831 if isinstance(r, six.string_types):
360 832 # Check for syntax errors
361 833 if not ignore_errors:
362 834 # Then check for operation error
363 835 if (
364Variables:
365 command_submit = '\n'
366 format_result = <function format_result at 0x7f8c3dbf6398>
367 nowait = False
368 stream = <noc.core.script.cli.ssh.SSHCLI object at 0x7f8c3dbd3ad0>
369 cached = False
370 obj_parser = None
371 bulk_lines = None
372 cmd = 'set cli screen-length 0'
373 cmd_stop = None
374 cmd_next = None
375 file = None
376 list_re = None
377 ignore_errors = True
378 self =
379<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
380------------------------------------------------------------------------
381File: core/script/base.py (Line: 890)
382Function: get_cli_stream
383 883 self.cli_stream.setup_session()
384 884 # Disable pager when nesessary
385 885 # @todo: Move to CLI
386 886 if self.to_disable_pager:
387 887 self.logger.debug("Disable paging")
388 888 self.to_disable_pager = False
389 889 if isinstance(self.profile.command_disable_pager, six.string_types):
390 890 ==> self.cli(self.profile.command_disable_pager, ignore_errors=True)
391 891 elif isinstance(self.profile.command_disable_pager, list):
392 892 for cmd in self.profile.command_disable_pager:
393 893 self.cli(cmd, ignore_errors=True)
394 894 else:
395 895 raise UnexpectedResultError
396 896 return self.cli_stream
397Variables:
398 self =
399<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
400 protocol = 'ssh'
401------------------------------------------------------------------------
402File: core/script/base.py (Line: 821)
403Function: cli
404 814 return format_result(f.read())
405 815 if cached:
406 816 r = self.root.cli_cache.get(cmd)
407 817 if r is not None:
408 818 self.logger.debug("Use cached result")
409 819 return format_result(r)
410 820 command_submit = command_submit or self.profile.command_submit
411 821 ==> stream = self.get_cli_stream()
412 822 if self.to_track:
413 823 self.cli_tracked_command = cmd
414 824 r = stream.execute(
415 825 cmd + command_submit,
416 826 obj_parser=obj_parser,
417 827 cmd_next=cmd_next,
418Variables:
419 command_submit = '\n'
420 format_result = <function format_result at 0x7f8c4ec0cb90>
421 nowait = False
422 cached = False
423 obj_parser = None
424 bulk_lines = None
425 cmd = 'show version'
426 cmd_stop = None
427 cmd_next = None
428 file = None
429 list_re = None
430 ignore_errors = False
431 self =
432<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
433------------------------------------------------------------------------
434File: sa/profiles/Juniper/JUNOS/get_version.py (Line: 45)
435Function: execute_cli
436 38 return {
437 39 "vendor": "Juniper",
438 40 "platform": match.group("platform"),
439 41 "version": match.group("version"),
440 42 }
441 43
442 44 def execute_cli(self):
443 45 ==> v = self.cli("show version")
444 46 match = self.rx_ver.search(v)
445 47 if not match:
446 48 match = self.rx_ver2.search(v)
447 49 return {
448 50 "vendor": "Juniper",
449 51 "platform": match.group("platform"),
450Variables:
451 self =
452<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
453------------------------------------------------------------------------
454File: core/script/base.py (Line: 463)
455Function: call_method
456 456 if isinstance(handler, six.string_types):
457 457 handler = getattr(self, handler, None)
458 458 if handler is None:
459 459 self.logger.debug("No '%s' handler. Passing to next method" % m)
460 460 continue
461 461 # Call handler
462 462 try:
463 463 ==> r = handler(**kwargs)
464 464 if isinstance(r, PartialResult):
465 465 if self.partial_result:
466 466 self.partial_result.update(r.result)
467 467 else:
468 468 self.partial_result = r.result
469 469 self.logger.debug(
470Variables:
471 self =
472<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
473 m = u'C'
474 fallback_handler = None
475 cli_handler =
476<bound method Script.execute_cli of <noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>>
477 handler =
478<bound method Script.execute_cli of <noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>>
479 kwargs = {}
480 snmp_handler =
481<bound method Script.execute_snmp of <noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>>
482 access_preference = u'C*'
483------------------------------------------------------------------------
484File: core/script/base.py (Line: 427)
485Function: execute
486 420 if f._match(self, self.version):
487 421 return f(self, **kwargs)
488 422 # Raise error
489 423 raise self.NotSupportedError()
490 424 else:
491 425 # New SNMP/CLI API
492 426 return self.call_method(
493 427 ==> cli_handler=self.execute_cli, snmp_handler=self.execute_snmp, **kwargs
494 428 )
495 429
496 430 def call_method(self, cli_handler=None, snmp_handler=None, fallback_handler=None, **kwargs):
497 431 """
498 432 Call function depending on access_preference
499 433 :param cli_handler: String or callable to call on CLI access method
500Variables:
501 self =
502<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
503 kwargs = {}
504------------------------------------------------------------------------
505File: core/script/base.py (Line: 286)
506Function: run
507 279 self.logger.info("Using cached result")
508 280 cache_hit = True
509 281 except KeyError:
510 282 pass
511 283 # Execute script
512 284 if not cache_hit:
513 285 try:
514 286 ==> result = self.execute(**self.args)
515 287 if self.cache and self.parent and result:
516 288 self.logger.info("Caching result")
517 289 self.set_cache(self.name, self.args, result)
518 290 finally:
519 291 if not self.parent:
520 292 # Close SNMP socket when necessary
521Variables:
522 cache_hit = False
523 self =
524<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
525------------------------------------------------------------------------
526File: commands/script.py (Line: 130)
527Function: handle
528 123 args=args,
529 124 version=version,
530 125 timeout=3600,
531 126 name=script,
532 127 )
533 128 span_sample = 1 if update_spec or beef_output else 0
534 129 with Span(sample=span_sample):
535 130 ==> result = scr.run()
536 131 if pretty:
537 132 pprint.pprint(result)
538 133 elif yaml_o:
539 134 import sys
540 135
541 136 yaml.dump(result, sys.stdout)
542Variables:
543 obj = <ManagedObject: BRAS-Yerevan>
544 service = <__main__.ServiceStub object at 0x7f8c4ec3f6d0>
545 script = u'Juniper.JUNOS.get_version'
546 script_class = <class 'noc.sa.profiles.Juniper.JUNOS.get_version.Script'>
547 beef_output = None
548 update_spec = None
549 args = {}
550 use_snmp = True
551 caps =
552{u'Network | LACP': True,
553 u'SNMP': False,
554 u'SNMP | v1': False,
555 u'SNMP | v2c': False}
556 self = <__main__.Command object at 0x7f8c5b871350>
557 object_name = ['BRAS-Yerevan']
558 version =
559{'image': None,
560 'platform': u'mx480',
561 'vendor': u'Juniper Networks',
562 'version': u'17.3R3-S6.3'}
563 arguments = []
564 pretty = False
565 yaml_o = False
566 credentials =
567{'access_preference': u'C',
568 'address': u'10.0.1.4',
569 'cli_protocol': 'ssh',
570 'password': u'RxaZV4HT',
571 'path': None,
572 'raise_privileges': True,
573 'super_password': u'test123',
574 'user': u'noc'}
575 access_preference = None
576 options = {}
577 span_sample = 0
578 scr =
579<noc.sa.profiles.Juniper.JUNOS.get_version.Script object at 0x7f8c4ec3f990>
580------------------------------------------------------------------------
581File: core/management/base.py (Line: 83)
582Function: run_from_argv
583 76 self.no_progressbar = cmd_options.pop("no_progressbar", False)
584 77 if enable_profiling:
585 78 # Start profiler
586 79 import yappi
587 80
588 81 yappi.start()
589 82 try:
590 83 ==> return self.handle(*args, **cmd_options) or 0
591 84 except CommandError as e:
592 85 self.print(str(e))
593 86 return 1
594 87 except KeyboardInterrupt:
595 88 self.print("Ctrl+C")
596 89 return 3
597Variables:
598 parser =
599ArgumentParser(prog='noc script', usage=None, description=None, version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
600 loglevel = 'debug'
601 enable_profiling = False
602 args = ()
603 cmd_options =
604{'access_preference': None,
605 'arguments': [],
606 'beef_output': None,
607 'object_name': ['BRAS-Yerevan'],
608 'pretty': False,
609 'script': ['get_version'],
610 'update_spec': None,
611 'use_snmp': True,
612 'yaml_o': False}
613 argv = ['--debug', 'get_version', 'BRAS-Yerevan']
614 self = <__main__.Command object at 0x7f8c5b871350>
615 show_metrics = False
616 error_report = <function error_report at 0x7f8c64e00d70>
617 options =
618Namespace(access_preference=None, arguments=[], beef_output=None, object_name=['BRAS-Yerevan'], pretty=False, script=['get_version'], update_spec=None, use_snmp=True, yaml_o=False)
619------------------------------------------------------------------------
620END OF TRACEBACK
6212019-12-23 12:34:43,512 [noc.core.debug] Writing CP report to /var/lib/noc/cp/crashinfo/new/9303f6a8-e725-5878-a4b2-f398c9d2294c.json