def connect_bulk(self, context, request): results = self.command_wrapper.execute_command_with_connection( context, self.connection_orchestrator.connect_bulk, request) driver_response = DriverResponse() driver_response.actionResults = results driver_response_root = DriverResponseRoot() driver_response_root.driverResponse = driver_response return set_command_result(result=driver_response_root, unpicklable=False)
def test_set_command_result(self): action_result = ActionResult() action_result.actionId = 'A' action_result.errorMessage = '' action_result.infoMessage = '' action_result.success = True action_result.type = 'setVlan' action_result.updatedInterface = 'AA-BB' driver_response = DriverResponse() driver_response.actionResults = [action_result] driver_response_root = DriverResponseRoot() driver_response_root.driverResponse = driver_response result = set_command_result(driver_response_root) self.assertEqual(result, '{"driverResponse": {"actionResults": [{"success": true, "updatedInterface": "AA-BB", "errorMessage": "", "infoMessage": "", "actionId": "A", "type": "setVlan"}]}}')
def test_set_command_result(self): action_result = ActionResult() action_result.actionId = 'A' action_result.errorMessage = '' action_result.infoMessage = '' action_result.success = True action_result.type = 'setVlan' action_result.updatedInterface = 'AA-BB' driver_response = DriverResponse() driver_response.actionResults = [action_result] driver_response_root = DriverResponseRoot() driver_response_root.driverResponse = driver_response result = set_command_result(driver_response_root) self.assertEqual( result, '{"driverResponse": {"actionResults": [{"success": true, "updatedInterface": "AA-BB", "errorMessage": "", "infoMessage": "", "actionId": "A", "type": "setVlan"}]}}' )