def preprovision_olt(self): logging.info('Do PROVISIONING') testCaseUtils.send_command_to_voltha_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_preprovision_olt.log', 'preprovision_olt -t %s -H %s:%s' % (self.__oltType, self.__oltIpAddress, self.__oltPort)) time.sleep(5)
def onu_discovery(self): logging.info('Onu Discovery') statusLines = testCaseUtils.get_fields_from_grep_command( self, self.__onuType, 'voltha_devices_after_enable.log') assert statusLines, 'No Onu listed under devices' lines = statusLines.splitlines() assert len( lines ) == self.__onuCount, 'Onu count mismatch found: %s, should be: %s' % ( len(lines), self.__onuCount) for line in lines: self.__fields = testCaseUtils.parse_fields(line, '|') onuDeviceId = self.__fields[1].strip() self.__onuDeviceIds.append(onuDeviceId) testCaseUtils.send_command_to_voltha_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_onu_device_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'device ' + onuDeviceId, 'voltha_onu_ports_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'ports', 'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'flows') testCaseUtils.print_log_file( self, 'voltha_onu_ports_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log') testCaseUtils.print_log_file( self, 'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
def preprovisionOlt(self): print('Do PROVISIONING') testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'), 'preprovision_olt -t ponsim_olt -H %s:%s' % (self.__oltIpAddress, self.__oltPort), 'voltha_preprovision_olt.log') time.sleep(5)
def query_devices_before_enable(self): testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'), 'devices', 'voltha_devices_before_enable.log') time.sleep(5) grepCommand =\ "grep PREPROVISIONED %s/voltha_devices_before_enable.log " % testCaseUtils.getDir(self, 'log') self.__statusLine = commands.getstatusoutput(grepCommand)[1] self.__fields = testCaseUtils.parseFields(self.__statusLine) self.__oltDeviceId = self.__fields[1].strip() print ("OLT device id = %s" % self.__oltDeviceId)
def olt_discovery(self): logging.info('Olt Discovery') statusLines = testCaseUtils.get_fields_from_grep_command( self, self.__oltType, 'voltha_devices_after_enable.log') assert statusLines, 'No Olt listed under devices' self.__fields = testCaseUtils.parse_fields(statusLines, '|') self.__oltDeviceId = self.__fields[1].strip() testCaseUtils.send_command_to_voltha_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_olt_device.log', 'device ' + self.__oltDeviceId, 'voltha_olt_ports.log', 'ports', 'voltha_olt_flows.log', 'flows') testCaseUtils.print_log_file(self, 'voltha_olt_ports.log') testCaseUtils.print_log_file(self, 'voltha_olt_flows.log')
def proceed(self): logging.info('Pre-provisioning hold') onuOnline = 0 portType = None if self.__oltType == 'ponsim_olt': portType = 'PON_OLT' elif self.__oltType == 'openolt': portType = 'ETHERNET_UNI' while onuOnline < self.__onuCount: testCaseUtils.send_command_to_voltha_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_olt_device.log', 'device ' + self.__oltDeviceId, 'voltha_olt_ports.log', 'ports') statusLines = testCaseUtils.get_fields_from_grep_command( self, portType, 'voltha_olt_ports.log') lines = statusLines.splitlines() onuOnline = len(lines) time.sleep(5) logging.info('All ONUs now Online!')
def logical_device(self): logging.info('Logical Device Info') testCaseUtils.send_command_to_voltha_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_logical_devices.log', 'logical_devices') testCaseUtils.print_log_file(self, 'voltha_logical_devices.log') statusLines = testCaseUtils.get_fields_from_grep_command( self, '-i olt', 'voltha_logical_devices.log') assert statusLines, 'No Logical Device listed under logical devices' self.__fields = testCaseUtils.parse_fields(statusLines, '|') self.__logicalDeviceId = self.__fields[1].strip() testCaseUtils.send_command_to_voltha_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_logical_device.log', 'logical_device ' + self.__logicalDeviceId, 'voltha_logical_device_ports.log', 'ports', 'voltha_logical_device_flows.log', 'flows') assert os.path.exists(testCaseUtils.get_dir(self, 'log') + '/voltha_logical_device.log') and \ (os.path.getsize(testCaseUtils.get_dir(self, 'log') + '/voltha_logical_device.log') is 0), \ 'voltha_logical_device.log is not 0 length' testCaseUtils.print_log_file(self, 'voltha_logical_device_ports.log') testCaseUtils.print_log_file(self, 'voltha_logical_device_flows.log')
def onuDiscovery(self): logging.info('Onu Discovery') statusLines = testCaseUtils.get_fields_from_grep_command( self, self.__onuType, 'voltha_devices_after_enable.log') assert statusLines, 'No Onu listed under devices' lines = statusLines.splitlines() for line in lines: self.__fields = testCaseUtils.parseFields(line) onuDeviceId = self.__fields[1].strip() self.__onuDeviceIds.append(onuDeviceId) testCaseUtils.send_command_to_voltha_cli( testCaseUtils.getDir(self, 'log'), 'voltha_onu_device_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'device ' + onuDeviceId, 'voltha_onu_ports_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'ports', 'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'flows') testCaseUtils.printLogFile( self, 'voltha_onu_ports_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log') testCaseUtils.printLogFile( self, 'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
def query_devices_before_enabling(self): testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'), 'voltha_devices_before_enable.log', 'devices') testCaseUtils.print_log_file(self, 'voltha_devices_before_enable.log') time.sleep(5)
def enable(self): logging.info('Enable %s OLT device' % self.__oltDeviceId) testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'), 'voltha_enable.log', 'enable ' + self.__oltDeviceId)
def query_devices_after_enabling(self): testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'), 'devices', 'voltha_devices_after_enable.log')
def enable(self): print('Enable %s OLT device' % self.__oltDeviceId) testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'), 'enable ' + self.__oltDeviceId, 'voltha_enable.log')