def find_uptime(self): ''' String in show version will be similar to the following: Uptime: 5 weeks, 4 days, 23 hours and 8 minutes ''' match = re.search(r'Uptime: +(\w.*)', self.output) if match: time_str = match.group(1) self.net_device.uptime_seconds = parse_uptime(time_str)
def find_uptime(self): ''' String in show version will be similar to the following: hostname uptime is 8 weeks, 2 days, 23 hours, 22 minutes ''' match = re.search(r'uptime is (.*)', self.output) if match: time_str = match.group(1) self.net_device.uptime_seconds = parse_uptime(time_str)