示例#1
0
    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)
示例#2
0
    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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 def commit(self, comment):
     try:
         self.jnprdev.cu.commit(comment=comment, sync=True)
     except jnpr.junos.exception.CommitError as err:
         raise jException(err)
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 def facts(self):
     try:
         inventory = self.jnprdev.facts
         return inventory
     except (jnpr.junos.exception.ProbeError) as err:
         raise jException(err)
示例#9
0
 def commit(self, comment):
     try:
         self.jnprdev.cu.commit(comment=comment, sync=True)
     except jnpr.junos.exception.CommitError as err:
         raise jException(err)
示例#10
0
 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)
示例#11
0
 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)