def open_config(self): self._open() self.jnprdev.bind(cu=Config) try: self.jnprdev.cu.lock() except jnpr.junos.exception.LockError as err: raise jException(err, self.hostname)
def _open(self): try: self.jnprdev.open() except (jnpr.junos.exception.ConnectAuthError, jnpr.junos.exception.ConnectUnknownHostError, jnpr.junos.exception.ConnectRefusedError, jnpr.junos.exception.ProbeError, jnpr.junos.exception.ConnectTimeoutError) as err: raise jException(err)
def commit(self, comment): try: self.jnprdev.cu.commit(comment=comment, sync=True) except jnpr.junos.exception.CommitError as err: raise jException(err)
def load_configuration(self, configuration): try: self.jnprdev.cu.load(configuration, format='set', merge=False) except jnpr.junos.exception.ConfigLoadError as err: raise jException(err, self.hostname)
def fileloader(self, package, remotepath): with SCP(self.jnprdev) as scp: try: scp.put(package, remotepath) except Exception as err: raise jException(err, self.hostname)
def facts(self): try: inventory = self.jnprdev.facts return inventory except (jnpr.junos.exception.ProbeError) as err: raise jException(err)