return self.con.in_waiting
+ def line_in_buffer(self):
+ if b"\n" in self.buffer:
+ return True
+
+ return False
def readline2(self, pattern=None):
string = ""
print("We are not logged in")
return False
+ def print_lines_in_buffer(self):
+ while True:
+ self.log.debug("Fill buffer ...")
+ self.peek(len(self.buffer) + self.in_waiting)
+ self.log.debug("Current buffer length: {}".format(len(self.buffer)))
+ if self.line_in_buffer() == True:
+ while self.line_in_buffer() == True:
+ data = self.readline()
+ self.log_console_line(data.decode())
+ else:
+ self.log.debug("We have printed all lines in the buffer")
+ break
+
def login(self, password):
if self.username == None:
self.log.error("Username cannot be blank")
return False
+ self.print_lines_in_buffer()
+
# Hit enter to see what we get
self.con.write(b'\n')
# We get two new lines \r\n ?
data = self.readline()
self.log_console_line(data.decode())
+ self.print_lines_in_buffer()
if self.back_at_prompt():
self.log.debug("We are already logged in.")
self.log.debug(_machine)
machines.setdefault(_machine, vm(
os.path.normpath(self.path + "/" + self.config[_machine]["xml_file"]),
- os.path.normpath(self.path + "/" + self.config[_machine]["snapshot_xml_file"])))
+ os.path.normpath(self.path + "/" + self.config[_machine]["snapshot_xml_file"]),
+ self.config[_machine]["image"],
+ self.config[_machine]["root_uid"],
+ self.config[_machine]["username"],
+ self.config[_machine]["password"]))
return machines
+ @property
+ def machine_names(self):
+ return self.machines
+
+ @property
+ def network_names(self):
+ return self.networks
+
if __name__ == "__main__":
import argparse
args = parser.parse_args()
- _recipe = recipe("/home/jonatan/python-testing-kvm/test/recipe")
currenttest = test(args.dir)
currenttest.read_settings()
- currenttest.virtual_environ_setup()
\ No newline at end of file
+ currenttest.virtual_environ_setup()
+ currenttest.load_recipe()
+ currenttest.virtual_environ_start()
+ currenttest.run_recipe()
+ currenttest.virtual_environ_stop()
\ No newline at end of file