Exemplo n.º 1
0
 def stag_and_ctag_should_match_sadis_entry(self):
     logging.info('Evaluating sTag and cTag in each packet')
     statusLines = testCaseUtils.get_fields_from_grep_command(
         self, '802.1Q', self.TCPDUMP_FILENAME)
     assert statusLines, 'tcpdump contains no 802.1Q tagged packets'
     lines = statusLines.splitlines()
     for line in lines:
         header, tagId, after = line.partition('802.1Q')
         self.__fields = testCaseUtils.parse_fields(after, ',')
         stag = self.__fields[1].strip().split(
             ':')[1].strip().split()[1].strip()
         before, tagId, after = line.rpartition('802.1Q')
         self.__fields = testCaseUtils.parse_fields(after, ',')
         ctag = self.__fields[1].strip().split()[1].strip()
         self.stag_and_ctag_should_match_sadis_file(ctag, stag)
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 def check_onu_fields_after_enabling(self):        
     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()
     lenLines = len(lines)
     assert lenLines == self.__onuCount, ' Discovered onu(s) does not match, ONU Count was %d' % lenLines
     for line in lines:
         self.__fields = testCaseUtils.parse_fields(line, '|')
         assert (self.check_states(self.__onuType) is True), 'States of %s does match expected' % self.__onuType
Exemplo n.º 4
0
 def logical_device_ports_should_exist(self):
     statusLines = testCaseUtils.get_fields_from_grep_command(
         self, self.__oltDeviceId, 'voltha_logical_device_ports.log')
     assert statusLines, 'No Olt ports listed under logical device ports'
     self.__fields = testCaseUtils.parse_fields(statusLines, '|')
     portType = self.__fields[1].strip()
     assert portType.count(
         'nni'
     ) == 1, 'Port type for %s does not match expected nni' % self.__oltDeviceId
     for onuDeviceId in self.__onuDeviceIds:
         statusLines = testCaseUtils.get_fields_from_grep_command(
             self, onuDeviceId, 'voltha_logical_device_ports.log')
         assert statusLines, 'No Onu device %s listed under logical device ports' % onuDeviceId
         self.__fields = testCaseUtils.parse_fields(statusLines, '|')
         portType = self.__fields[1].strip()
         assert portType.count(
             'uni'
         ) == 1, 'Port type for %s does not match expected uni' % onuDeviceId
Exemplo n.º 5
0
 def check_olt_fields_after_enabling(self):
     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, '|')
     assert self.check_states(self.__oltType), 'States of %s does match expected' % self.__oltType
     for field in self.__fields:
         if field.strip() == self.__oltIpAddress + ':' + str(self.__oltPort):
             hostPortCount = True
     assert hostPortCount, 'hostPort field is empty or Olt IP and/or Port does not match'
Exemplo n.º 6
0
 def retrieve_authorized_users_device_id_and_port_number(self):
     statusLines = testCaseUtils.get_fields_from_grep_command(
         self, 'AUTHORIZED', 'voltha_onos_users.log')
     assert statusLines, 'No Users Authorized'
     self.__fields = testCaseUtils.parse_fields(statusLines, ',')
     deviceField = self.__fields[2].strip()
     deviceStr, equal, deviceId = deviceField.partition('=')
     self.__deviceId = deviceId
     portField = self.__fields[4].strip()
     portNumStr, equal, portNum = portField.partition('=')
     self.__portNumber = portNum
Exemplo n.º 7
0
 def check_olt_fields_before_enabling(self):
     statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__oltType, 'voltha_devices_before_enable.log')
     assert statusLines, 'No Olt listed under devices'
     self.__fields = testCaseUtils.parse_fields(statusLines, '|')
     self.__oltDeviceId = self.__fields[1].strip()
     logging.debug("OLT device id = %s" % self.__oltDeviceId)
     adminState = self.__fields[3].strip()
     assert adminState == 'PREPROVISIONED', 'Admin State not PREPROVISIONED'
     hostPort = self.__fields[4].strip()
     assert hostPort, 'hostPort field is empty'
     hostPortFields = hostPort.split(":")
     assert hostPortFields[0].strip() == self.__oltIpAddress or hostPortFields[1] == str(self.__oltPort), \
         'Olt IP or Port does not match'
Exemplo n.º 8
0
 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')
Exemplo n.º 9
0
 def retrieve_onu_serial_numbers(self):
     logging.info('Onu Serial Number 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, '|')
         onuSerialNum = self.__fields[5].strip()
         self.__onuSerialNum.append(onuSerialNum)
Exemplo n.º 10
0
 def should_now_have_two_dhcp_flows(self):
     testCaseUtils.send_command_to_onos_cli(
         testCaseUtils.get_dir(self, 'log'), 'voltha_onos_flows.log',
         'flows -s')
     statusLines = testCaseUtils.get_fields_from_grep_command(
         self, 'IP_PROTO:17', 'voltha_onos_flows.log')
     assert statusLines, 'No DHCP Detection flows'
     lines = statusLines.splitlines()
     assert len(
         lines
     ) >= 2, 'Expected at least 2 DHCP Detection Flows but result was %s' % len(
         lines)
     for line in lines:
         self.__fields = testCaseUtils.parse_fields(line, ',')
         inPortStr = self.__fields[5].strip()
         selector, delimiter, inPort = inPortStr.partition('=[')
         assert (
             inPort == 'IN_PORT:2' or inPort == 'IN_PORT:128'
         ), 'DHCP detection flows not associated with expected ports'
Exemplo n.º 11
0
 def should_have_ips_assigned_to_all_onus(self):
     logging.info('Verifying IP Address assignment on all ONUs')
     testCaseUtils.send_command_to_onos_cli(
         testCaseUtils.get_dir(self, 'log'),
         '_voltha_onos_dhcpl2relay_allocations.log',
         'dhcpl2relay-allocations')
     statusLines = testCaseUtils.get_fields_from_grep_command(
         self, 'DHCPACK', '_voltha_onos_dhcpl2relay_allocations.log')
     assert statusLines, 'No DHCP addresses allocated'
     lines = statusLines.splitlines()
     assert len(
         lines
     ) == self.__onuCount, 'Allocated IPs does not match ONU count but result was %s' % len(
         lines)
     for line in lines:
         self.__fields = testCaseUtils.parse_fields(line, ',')
         allocIp = self.__fields[5].strip()
         allocated, delimiter, ipAddr = allocIp.partition('=')
         assert ipAddr != '0.0.0.0', 'Invalid IP Address Allocated'
Exemplo n.º 12
0
 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')
Exemplo n.º 13
0
 def olt_ports_should_be_enabled_and_active(self):
     statusLines = testCaseUtils.get_fields_from_grep_command(
         self, self.__oltDeviceId, 'voltha_olt_ports.log')
     assert statusLines, 'No Olt device listed under ports'
     lines = statusLines.splitlines()
     for line in lines:
         self.__fields = testCaseUtils.parse_fields(line, '|')
         assert (self.check_states(self.__oltDeviceId) is True
                 ), 'States of %s does match expected ' % self.__oltDeviceId
         portType = self.__fields[3].strip()
         assert (portType == 'ETHERNET_NNI' or portType == 'PON_OLT' or portType == 'ETHERNET_UNI'),\
             'Port type for %s does not match expected ETHERNET_NNI or PON_OLT' % self.__oltDeviceId
         if portType == 'PON_OLT':
             self.__peers = self.__fields[7].strip()
             peerFields = self.__peers.split(',')
             peerDevices = peerFields[1::2]
             for peerDevice in peerDevices:
                 deviceFields = peerDevice.split(':')
                 deviceId = deviceFields[1].replace("'", "").replace(
                     'u', '').rstrip("}]").strip()
                 assert deviceId in self.__onuDeviceIds, 'ONU Device %s not found as Peer' % deviceId