Exemplo n.º 1
0
 def edit_config(config, format='xml', target='candidate',
                 default_operation=None, test_option=None,
                 error_option=None):
     if not _fake_is_pingable(rc_emul.host_ip):
         raise ncc_exc.SSHError('SSH error')
     rc_emul.edit_config(config)
     print(rc_emul.get_config())
     return ok_xml_obj
Exemplo n.º 2
0
 def test_device_ConnectTimeoutError(self, mock_datetime, mock_manager):
     mock_manager.connect.side_effect = NcErrors.SSHError(
         "Could not open socket to 1.1.1.1:830")
     from datetime import timedelta, datetime
     currenttime = datetime.now()
     mock_datetime.datetime.now.side_effect = [currenttime,
                                               currenttime + timedelta(minutes=4)]
     self.assertRaises(EzErrors.ConnectTimeoutError, self.dev.open)
Exemplo n.º 3
0
 def get_running_config(source):
     if not _fake_is_pingable(rc_emul.host_ip):
         raise ncc_exc.SSHError('SSH error')
     head = ('<?xml version="1.0" encoding="UTF-8"?><rpc-reply '
             'message-id="urn:uuid:ec8bab72-a500-11e5-a92f'
             '-74a2e6d55908" xmlns="urn:ietf:params:xml:ns:netconf:'
             'base:1.0"><data><cli-config-data-block>!')
     tail = '</cli-config-data-block></data></rpc-reply>'
     raw_rc = rc_emul.get_config()
     return cisco_ios_xe.FakeRunningConfig(head + raw_rc + tail)