def deactivate_dhcp_server_in_onos(self): logging.info('Deactivating DHCP server on Onos') testCaseUtils.send_command_to_onos_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_dhcp_server_deactivate.log', 'app deactivate dhcp') statusLines = testCaseUtils.get_fields_from_grep_command( self, 'Deactivated', 'voltha_dhcp_server_deactivate.log') assert statusLines, 'DHCP server failed to be Deactivated'
def deactivate_aaa_app_in_onos(self): logging.info('Deactivating AAA Application on Onos') testCaseUtils.send_command_to_onos_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_aaa_application_deactivate.log', 'app deactivate aaa') statusLines = testCaseUtils.get_fields_from_grep_command( self, 'Deactivated', 'voltha_aaa_application_deactivate.log') assert statusLines, 'AAA Application failed to be Deactivated'
def should_have_all_onus_authenticated(self): testCaseUtils.send_command_to_onos_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_onu_auth.log', 'aaa-users') statusLines = testCaseUtils.get_fields_from_grep_command( self, 'AUTHORIZED', 'voltha_onu_auth.log') lines = statusLines.splitlines() auth_count = len(lines) assert self.__onuCount == auth_count, 'There are only %s ONUS Authenticated' % auth_count
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'
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'
def proceed(self): logging.info('Pre-provisioning hold') onuOnline = 0 if self.__oltType == 'ponsim_olt': portType = 'PON_OLT' 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!') elif self.__oltType == 'openolt': while onuOnline < self.__onuCount: testCaseUtils.send_command_to_onos_cli(testCaseUtils.get_dir(self, 'log'), 'voltha_onu_auth.log', 'aaa-users') statusLines = testCaseUtils.get_fields_from_grep_command(self, 'AUTHORIZED', 'voltha_onu_auth.log') lines = statusLines.splitlines() onuOnline = len(lines) time.sleep(5) logging.info('All ONUs now AUTHORIZED')
def add_subscriber_access(self): testCaseUtils.send_command_to_onos_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_add_subscriber_access.log', 'volt-add-subscriber-access %s %s' % (self.__deviceId, self.__portNumber))
def discover_authorized_users(self): testCaseUtils.send_command_to_onos_cli( testCaseUtils.get_dir(self, 'log'), 'voltha_onos_users.log', 'aaa-users')