def get_machines(self, unix_machines=None):
     """
     Discover the Machines that the domain servers are mapped to. Remove any machines from the domain machine list
     that are contained in the unix machines dictionary. These machines are represented in a separate unix machine
     section of the model.
     :return: model name of the machine section:dictionary containing the discovered node manager information
     """
     _method_name = 'get_machines'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     if unix_machines is None:
         # did not like a mutable default value in method signature
         unix_machines = OrderedDict()
     result = OrderedDict()
     model_top_folder_name = model_constants.MACHINE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     machines = self._find_names_in_folder(location)
     if machines is not None:
         name_token = self._alias_helper.get_name_token(location)
         for unix_machine in unix_machines:
             if unix_machine in machines:
                 machines.remove(unix_machine)
         _logger.info('WLSDPLY-06611',
                      len(machines),
                      class_name=_class_name,
                      method_name=_method_name)
         for machine in machines:
             _logger.info('WLSDPLY-06612',
                          machine,
                          class_name=_class_name,
                          method_name=_method_name)
             location.add_name_token(name_token, machine)
             result[machine] = OrderedDict()
             self._populate_model_parameters(result[machine], location)
             self._discover_subfolders(result[machine], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result
    def _get_named_resources(self, folder_name):
        """
        Discover each resource of the specified type in the domain.
        :return: model name and dictionary for the discovered resources
        """
        _method_name = '_get_named_resources'
        _logger.entering(folder_name,
                         class_name=_class_name,
                         method_name=_method_name)

        result = OrderedDict()
        model_top_folder_name = folder_name
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        resource_names = self._find_names_in_folder(location)
        if resource_names is not None:
            _logger.info('WLSDPLY-06364',
                         len(resource_names),
                         folder_name,
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._aliases.get_name_token(location)
            for resource_name in resource_names:
                _logger.info('WLSDPLY-06365',
                             folder_name,
                             resource_name,
                             class_name=_class_name,
                             method_name=_method_name)
                location.add_name_token(name_token, resource_name)
                result[resource_name] = OrderedDict()
                self._populate_model_parameters(result[resource_name],
                                                location)
                self._discover_subfolders(result[resource_name], location)
                location.remove_name_token(name_token)
        _logger.exiting(class_name=_class_name,
                        method_name=_method_name,
                        result=model_top_folder_name)
        return model_top_folder_name, result
예제 #3
0
 def _get_foreign_servers(self, location):
     """
     Discover the foreign servers for the JMS resource from the domain.
     :param location: context containing the current location information
     :return: model folder name: dictionary containing the discovered foreign servers for the JMS resource
     """
     _method_name = 'get_foreign_servers'
     _logger.entering(str(location), class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.FOREIGN_SERVER
     location.append_location(model_top_folder_name)
     servers = self._find_names_in_folder(location)
     if servers is not None:
         name_token = self._alias_helper.get_name_token(location)
         for server in servers:
             _logger.finer('WLSDPLY-06480', server, self._alias_helper.get_model_folder_path(location),
                           class_name=_class_name, method_name=_method_name)
             result[server] = OrderedDict()
             location.add_name_token(name_token, server)
             self._populate_model_parameters(result[server], location)
             if model_constants.CONNECTION_URL in result[server]:
                 _logger.finer('WLSDPLY-06494', server, class_name=_class_name, method_name=_method_name)
                 result[server][model_constants.CONNECTION_URL] = \
                     self._add_foreign_server_binding(server, model_constants.CONNECTION_URL,
                                                      result[server][model_constants.CONNECTION_URL])
             wlst_subfolders = self._find_subfolders(location)
             if wlst_subfolders is not None:
                 for wlst_subfolder in wlst_subfolders:
                     model_subfolder_name = self._get_model_name(location, wlst_subfolder)
                     if model_subfolder_name and model_subfolder_name == model_constants.JNDI_PROPERTY:
                         model_subfolder_name, subfolder_result = self._get_foreign_server_properties(location)
                         discoverer.add_to_model_if_not_empty(result[server], model_subfolder_name, subfolder_result)
                     else:
                         self._discover_subfolder(model_subfolder_name, location, result[server])
             location.remove_name_token(name_token)
     location.pop_location()
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #4
0
 def __init__(self, model_files, model_context, logger, output_dir=None):
     self.model_files = model_files
     self.output_dir = output_dir
     self.model_context = model_context
     self._aliases = Aliases(model_context=model_context,
                             wlst_mode=WlstModes.OFFLINE)
     self._alias_helper = AliasHelper(self._aliases, logger,
                                      ExceptionType.COMPARE)
     self._logger = logger
     self._name_tokens_location = LocationContext()
     self._name_tokens_location.add_name_token('DOMAIN', "testdomain")
     self.current_dict = None
     self.cache = OrderedDict()
     self.secrets_to_generate = sets.Set()
    def testValues(self):
        my_ordered_dict = OrderedDict()
        my_ordered_dict['nba_player'] = 'Steph Curry'
        my_ordered_dict['nba_mvp_count'] = 1
        my_ordered_dict['is_retired'] = False
        my_ordered_dict['nba_finals_years'] = ['2015', '2016', '2017']

        expected_values = ['Steph Curry', 1, False, ['2015', '2016', '2017']]
        values = my_ordered_dict.values()
        self.assertEqual(len(expected_values), len(values),
                         'expected the ordered dict values to be the same length as the expected values')
        for i, value in enumerate(values):
            self.assertEqual(value, expected_values[i],
                             'expected value at position %s to be %s' % (str(i), str(expected_values[i])))
예제 #6
0
    def _get_clusters_and_members_map(self):
        """
        Get a map keyed by cluster name with values that are a list of member server names
        :return: the cluster name to member server names map
        :raises: BundleAwareException of the specified type: is an error occurs reading from the aliases or WLST
        """
        _method_name = '_get_clusters_and_members_map'

        self.logger.entering(class_name=self.__class_name, method_name=_method_name)
        server_location = LocationContext().append_location(SERVER)
        server_list_path = self.alias_helper.get_wlst_list_path(server_location)
        server_names = self.wlst_helper.get_existing_object_list(server_list_path)
        server_token = self.alias_helper.get_name_token(server_location)
        cluster_map = OrderedDict()
        for server_name in server_names:
            server_location.add_name_token(server_token, server_name)
            server_attributes_path = self.alias_helper.get_wlst_attributes_path(server_location)
            self.wlst_helper.cd(server_attributes_path)

            server_attributes_map = self.wlst_helper.lsa()
            cluster_name = dictionary_utils.get_element(server_attributes_map, CLUSTER)
            if string_utils.is_empty(cluster_name):
                # if server is not part of a cluster, continue with the next server
                continue

            if cluster_name not in cluster_map:
                cluster_map[cluster_name] = list()
            cluster_map[cluster_name].append(server_name)

        clusters_location = LocationContext().append_location(CLUSTER)
        cluster_list_path = self.alias_helper.get_wlst_list_path(clusters_location)
        cluster_names = self.wlst_helper.get_existing_object_list(cluster_list_path)
        cluster_token = self.alias_helper.get_name_token(clusters_location)
        # Add the cluster with dynamic servers, if not already in the cluster member list.
        # A cluster may contain both dynamic and configured servers (referred to as mixed cluster).
        # Add a token marking DYNAMIC SERVERS in the member list.
        for cluster_name in cluster_names:
            cluster_location = LocationContext(clusters_location)
            cluster_location.add_name_token(cluster_token, cluster_name)
            cluster_attributes_path = self.alias_helper.get_wlst_attributes_path(cluster_location)
            self.wlst_helper.cd(cluster_attributes_path)
            cluster_location.append_location(DYNAMIC_SERVERS)
            wlst_subfolder_name = self.alias_helper.get_wlst_mbean_type(cluster_location)
            if self.wlst_helper.subfolder_exists(wlst_subfolder_name):
                if cluster_name not in cluster_map:
                    cluster_map[cluster_name] = list()
                cluster_map[cluster_name].append(DYNAMIC_SERVERS)

        self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=cluster_map)
        return cluster_map
예제 #7
0
 def get_path_services(self):
     """
     Discover the path services for weblogic message grouping.
     :return: model file name: dictionary containing discovered path services
     """
     _method_name = 'get_path_services'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.PATH_SERVICE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     path_services = self._find_names_in_folder(location)
     if path_services is not None:
         _logger.info('WLSDPLY-06355', len(path_services), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for path_service in path_services:
             _logger.info('WLSDPLY-06356', path_service, class_name=_class_name, method_name=_method_name)
             result[path_service] = OrderedDict()
             location.add_name_token(name_token, path_service)
             self._populate_model_parameters(result[path_service], location)
             location.remove_name_token(name_token.PATHSERVICE)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #8
0
 def get_jms_bridge_destinations(self):
     """
     Discover the JMS bridge destinations from the domain.
     :return: model folder name: dictionary containing the discovered bridge destinations
     """
     _method_name = 'get_jms_bridge_destinations'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.JMS_BRIDGE_DESTINATION
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     destinations = self._find_names_in_folder(location)
     if destinations is not None:
         _logger.info('WLSDPLY-06474', len(destinations), class_name=_class_name, method_name=_method_name)
         name_token = self._aliases.get_name_token(location)
         for destination in destinations:
             _logger.info('WLSDPLY-06475', destination, class_name=_class_name, method_name=_method_name)
             result[destination] = OrderedDict()
             location.add_name_token(name_token, destination)
             self._populate_model_parameters(result[destination], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
 def _discover_subfolder(self, model_subfolder_name, location, result=None):
     """
     Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
     current location context, and pop that location before return
     :param result: dictionary to store the discovered information
     :param location: context containing the current subfolder information
     :return: discovered dictionary
     """
     _method_name = '_discover_subfolder'
     _logger.entering(model_subfolder_name,
                      class_name=_class_name,
                      method_name=_method_name)
     location.append_location(model_subfolder_name)
     _logger.finer('WLSDPLY-06115',
                   model_subfolder_name,
                   self._alias_helper.get_model_folder_path(location),
                   class_name=_class_name,
                   method_name=_method_name)
     # handle null model_subfolder name which should never happen in discover. throw exception about version
     if result is None:
         result = OrderedDict()
     name_token = self._alias_helper.get_name_token(location)
     _logger.finest('WLSDPLY-06116',
                    model_subfolder_name,
                    self._alias_helper.get_model_folder_path(location),
                    name_token,
                    class_name=_class_name,
                    method_name=_method_name)
     if name_token is not None:
         if self._alias_helper.requires_unpredictable_single_name_handling(
                 location):
             subfolder_result = self._discover_subfolder_with_single_name(
                 model_subfolder_name, location, name_token)
         elif self._alias_helper.requires_artificial_type_subfolder_handling(
                 location):
             subfolder_result = self._discover_artificial_folder(
                 model_subfolder_name, location, name_token)
         else:
             subfolder_result = self._discover_subfolder_with_names(
                 model_subfolder_name, location, name_token)
     else:
         subfolder_result = self._discover_subfolder_singleton(
             model_subfolder_name, location)
     add_to_model_if_not_empty(result, model_subfolder_name,
                               subfolder_result)
     location.pop_location()
     _logger.exiting(class_name=_class_name,
                     method_name=_method_name,
                     result=result)
     return result
예제 #10
0
 def get_jms_bridges(self):
     """
     Discover the JMS Bridges from the domain.
     :return: model folder name: dictionary containing the discovered JMS bridges
     """
     _method_name = 'get_jms_bridges'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.MESSAGING_BRIDGE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     bridges = self._find_names_in_folder(location)
     if bridges is not None:
         _logger.info('WLSDPLY-06476', len(bridges), class_name=_class_name, method_name=_method_name)
         name_token = self._aliases.get_name_token(location)
         for bridge in bridges:
             _logger.info('WLSDPLY-06477', bridge, class_name=_class_name, method_name=_method_name)
             result[bridge] = OrderedDict()
             location.add_name_token(name_token, bridge)
             self._populate_model_parameters(result[bridge], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #11
0
    def get_applications(self):
        """
        Discover application deployment information from the domain. Collect the application deployment binaries into
        the discovery archive file. If an application binary cannot be collected into the archive file, remove
        the application source path from the model and un-target the application.
        :return: model name for the dictionary and the dictionary containing the applications information
        """
        _method_name = 'get_applications'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.APPLICATION
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        applications = self._find_names_in_folder(location)
        if applications:
            _logger.info('WLSDPLY-06391',
                         len(applications),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for application in applications:
                _logger.info('WLSDPLY-06392',
                             application,
                             class_name=_class_name,
                             method_name=_method_name)
                location.add_name_token(name_token, application)
                result[application] = OrderedDict()
                self._populate_model_parameters(result[application], location)
                self._add_application_to_archive(application,
                                                 result[application])
                self._discover_subfolders(result[application], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name,
                        method_name=_method_name,
                        result=result)
        return model_top_folder_name, result
    def get_datasources(self):
        """
        Discover JDBC datasource information from the domain.
        :return: model name for the dictionary and the dictionary containing the datasources information
        """
        _method_name = 'get_datasources'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.JDBC_SYSTEM_RESOURCE
        model_second_folder = model_constants.JDBC_RESOURCE
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        datasources = self._find_names_in_folder(location)
        if datasources is not None:
            _logger.info('WLSDPLY-06340', len(datasources), class_name=_class_name, method_name=_method_name)
            typedef = self._model_context.get_domain_typedef()
            name_token = self._alias_helper.get_name_token(location)
            for datasource in datasources:
                if typedef.is_system_datasource(datasource):
                    _logger.info('WLSDPLY-06361', typedef.get_domain_type(), datasource, class_name=_class_name,
                                 method_name=_method_name)
                else:
                    _logger.info('WLSDPLY-06341', datasource, class_name=_class_name, method_name=_method_name)
                    result[datasource] = OrderedDict()
                    location.add_name_token(name_token, datasource)
                    self._populate_model_parameters(result[datasource], location)

                    location.append_location(model_second_folder)
                    if self.wlst_cd(self._alias_helper.get_wlst_attributes_path(location), location):
                        result[datasource][model_second_folder] = OrderedDict()
                        resource_result = result[datasource][model_second_folder]
                        self._populate_model_parameters(resource_result, location)
                        self._discover_subfolders(resource_result, location)
                        location.remove_name_token(name_token)
                        location.pop_location()
        _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
        return model_top_folder_name, result
예제 #13
0
    def _get_server_to_server_groups_map(self, admin_server_name, server_names,
                                         dynamic_cluster_names, server_groups,
                                         sg_targeting_limits):
        """
        Get the map of server names to the list of server groups to target to that server.
        :param admin_server_name: the admin server name
        :param server_names: the list of server names
        :param server_groups: the complete list of server groups that will, by default, be targeted to
                              all managed servers unless the server is listed in the targeting limits map
        :param sg_targeting_limits: the targeting limits map
        :return: the map of server names to the list of server groups to target to that server
        """
        _method_name = '_get_server_to_server_groups_map'

        self.logger.entering(admin_server_name,
                             str(server_names),
                             str(server_groups),
                             str(sg_targeting_limits),
                             class_name=self.__class_name,
                             method_name=_method_name)
        result = OrderedDict()
        for server_name in server_names:
            server_groups_for_server = self.__get_server_groups_for_entity(
                server_name, sg_targeting_limits)
            if server_groups_for_server is not None:
                result[server_name] = server_groups_for_server
            elif server_name != admin_server_name:
                # By default, we only target managed servers unless explicitly listed in the targeting limits
                result[server_name] = list(server_groups)
            else:
                result[admin_server_name] = list()
        for cluster_name in dynamic_cluster_names:
            server_groups_for_cluster = self.__get_server_groups_for_entity(
                cluster_name, sg_targeting_limits)
            if server_groups_for_cluster is not None:
                result[cluster_name] = server_groups_for_cluster
            else:
                result[cluster_name] = list(server_groups)
            self.logger.finer('WLSDPLY-12239',
                              result[cluster_name],
                              cluster_name,
                              class_name=self.__class_name,
                              method_name=_method_name)
        if admin_server_name not in result:
            result[admin_server_name] = list()
        self.logger.exiting(class_name=self.__class_name,
                            method_name=_method_name,
                            result=result)
        return result
예제 #14
0
 def get_saf_agents(self):
     """
     Discover the SAF agents from the domain.
     :return: model folder name: dictionary containing the discovered SAF agents
     """
     _method_name = 'get_saf_agents'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.SAF_AGENT
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     agents = self._find_names_in_folder(location)
     if agents is not None:
         _logger.info('WLSDPLY-06472', len(agents), class_name=_class_name, method_name=_method_name)
         name_token = self._aliases.get_name_token(location)
         for agent in agents:
             _logger.info('WLSDPLY-06473', agent, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, agent)
             result[agent] = OrderedDict()
             self._populate_model_parameters(result[agent], location)
             self._discover_subfolders(result[agent], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #15
0
    def _get_foreign_server_properties(self, location):
        """
        This is a private method.

        Discover the foreign server properties for the foreign server from the domain. Special handling of
        the properties is necessary to convert into the model format. The Key value of the Property is used
        as the Property name in the model in place of the Property name returned by wlst. In offline, this
        property name is a NO_NAME string value.
        :param location: context containing current location information
        :return: model name for the properties: dictionary containing the discovered foreign server properties
        """
        _method_name = 'get_foreign_server_properties'
        _logger.entering(str(location), class_name=_class_name, method_name=_method_name)
        model_subfolder_name = model_constants.JNDI_PROPERTY
        subfolder_result = OrderedDict()
        location.append_location(model_subfolder_name)
        folder_names = self._find_names_in_folder(location)
        if folder_names is not None:
            name_token = self._aliases.get_name_token(location)
            for folder_name in folder_names:
                location.add_name_token(name_token, folder_name)
                wlst_key = self._aliases.get_wlst_attribute_name(location, model_constants.KEY)
                attributes = self._get_attributes_for_current_location(location)
                if wlst_key is None or wlst_key not in attributes:
                    _logger.warning('WLSDPLY-06488', folder_name, self._aliases.get_model_folder_path(location),
                                    class_name=_class_name, method_name=_method_name)
                else:
                    property_name = attributes[wlst_key]
                    _logger.finer('WLSDPLY-06489', property_name, self._aliases.get_model_folder_path(location),
                                  class_name=_class_name, method_name=_method_name)
                    subfolder_result[property_name] = OrderedDict()
                    self._populate_model_parameters(subfolder_result[property_name], location)
                location.remove_name_token(name_token)
        location.pop_location()
        _logger.exiting(class_name=_class_name, method_name=_method_name, result=subfolder_result)
        return model_subfolder_name, subfolder_result
예제 #16
0
 def _get_jms_templates(self, location):
     """
     Discover the JMS templates for the JMS resource from the domain.
     :param location: context containing the current location information
     :return: model folder name: dictionary containing the discovered JMS template
     """
     _method_name = 'get_jms_templates'
     _logger.entering(str(location), class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.TEMPLATE
     location.append_location(model_top_folder_name)
     templates = self._find_names_in_folder(location)
     if templates is not None:
         name_token = self._aliases.get_name_token(location)
         for template in templates:
             _logger.finer('WLSDPLY-06481', template, self._aliases.get_model_folder_path(location),
                           class_name=_class_name, method_name=_method_name)
             result[template] = OrderedDict()
             location.add_name_token(name_token, template)
             self._populate_model_parameters(result[template], location)
             wlst_subfolders = self._find_subfolders(location)
             if wlst_subfolders is not None:
                 for wlst_subfolder in wlst_subfolders:
                     model_subfolder_name = self._aliases.get_model_subfolder_name(location, wlst_subfolder)
                     _logger.finer('WLSDPLY-06485', model_subfolder_name, template, class_name=_class_name,
                                   method_name=_method_name)
                     if model_subfolder_name == model_constants.GROUP_PARAMS:
                         model_subfolder_name, subfolder_result = self._get_group_params(location)
                         discoverer.add_to_model_if_not_empty(result[template], model_subfolder_name,
                                                              subfolder_result)
                     else:
                         self._discover_subfolder(model_subfolder_name, location, result[template])
             location.remove_name_token(name_token)
     location.pop_location()
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #17
0
 def get_file_stores(self):
     """
     Discover the file stores used for weblogic persistence
     :return: model folder name: dictionary with the discovered file stores
     """
     _method_name = 'get_file_stores'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.FILE_STORE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     file_stores = self._find_names_in_folder(location)
     if file_stores is not None:
         _logger.info('WLSDPLY-06346', len(file_stores), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for file_store in file_stores:
             _logger.info('WLSDPLY-06347', file_store, class_name=_class_name, method_name=_method_name)
             result[file_store] = OrderedDict()
             location.add_name_token(name_token, file_store)
             self._populate_model_parameters(result[file_store], location)
             self.archive_file_store_directory(file_store, result[file_store])
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #18
0
 def get_jdbc_stores(self):
     """
     Discover the JDBC stores used for weblogic persistence
     :return: model file name: dictionary containing discovered JDBC stores
     """
     _method_name = 'get_jdbc_stores'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.JDBC_STORE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     jdbc_stores = self._find_names_in_folder(location)
     if jdbc_stores is not None:
         _logger.info('WLSDPLY-06350', len(jdbc_stores), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for jdbc_store in jdbc_stores:
             _logger.info('WLSDPLY-06351', jdbc_store, class_name=_class_name, method_name=_method_name)
             result[jdbc_store] = OrderedDict()
             location.add_name_token(name_token, jdbc_store)
             self._populate_model_parameters(result[jdbc_store], location)
             self.archive_jdbc_create_script(jdbc_store, result[jdbc_store])
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #19
0
 def get_foreign_jndi_providers(self):
     """
     Discover Foreign JNDI providers from the domain.
     :return: model name for the dictionary and the dictionary containing the foreign JNDI provider information
     """
     _method_name = 'get_foreign_jndi_providers'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.FOREIGN_JNDI_PROVIDER
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     providers = self._find_names_in_folder(location)
     if providers is not None:
         _logger.info('WLSDPLY-06342', len(providers), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for provider in providers:
             _logger.info('WLSDPLY-06343', provider, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, provider)
             result[provider] = OrderedDict()
             self._populate_model_parameters(result[provider], location)
             self._discover_subfolders(result[provider], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
     return model_top_folder_name, result
예제 #20
0
 def get_wldf_system_resources(self):
     """
     Discover each WLDF system resource in the domain.
     :return: model name for the WLDF system resource:dictionary containing the discovered WLDF system resources
     """
     _method_name = 'get_wldf_system_resources'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.WLDF_SYSTEM_RESOURCE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     wldf_resources = self._find_names_in_folder(location)
     if wldf_resources is not None:
         _logger.info('WLSDPLY-06357', len(wldf_resources), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for wldf_resource in wldf_resources:
             _logger.info('WLSDPLY-06358', wldf_resource, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, wldf_resource)
             result[wldf_resource] = OrderedDict()
             self._populate_model_parameters(result[wldf_resource], location)
             self._discover_subfolders(result[wldf_resource], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
     return model_top_folder_name, result
예제 #21
0
파일: model.py 프로젝트: flaviomi87/myOra
 def get_model(self):
     """
     Get the model.
     :return: the model dictionary
     """
     model = OrderedDict()
     if len(self._domain_info):
         model['domainInfo'] = self._domain_info
     if len(self._topology) > 0:
         model['topology'] = self._topology
     if len(self._resources) > 0:
         model['resources'] = self._resources
     if len(self._deployments) > 0:
         model['appDeployments'] = self._deployments
     return model
    def _get_reliable_delivery_policies(self):
        """
        Discover the reliable delivery policies that are used for soap message delivery in the servers.
        :return: model name for the folder: dictionary containing the discovered ws reliable delivery policies
        """
        _method_name = '_get_reliable_delivery_policies'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.WS_RELIABLE_DELIVERY_POLICY
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        policies = self._find_names_in_folder(location)
        if policies is not None:
            _logger.info('WLSDPLY-06630', len(policies), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for policy in policies:
                _logger.info('WLSDPLY-06631', policy, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, policy)
                result[policy] = OrderedDict()
                self._populate_model_parameters(result[policy], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
    def _get_log_filters(self):
        """
        Discover the log filters that are used in the different types of Logs in the domain.
        :return: model name for the folder: dictionary containing the discovered log filters
        """
        _method_name = '_get_log_filters'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.LOG_FILTER
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        filters = self._find_names_in_folder(location)
        if filters is not None:
            _logger.info('WLSDPLY-06628', len(filters), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for logfilter in filters:
                _logger.info('WLSDPLY-06629', logfilter, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, logfilter)
                result[logfilter] = OrderedDict()
                self._populate_model_parameters(result[logfilter], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
 def get_server_templates(self):
     """
     Discover Server Templates in the domain.
     :return: model name for the dictionary and the dictionary containing the server template information
     """
     _method_name = 'get_server_templates'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.SERVER_TEMPLATE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     templates = self._find_names_in_folder(location)
     if templates is not None:
         _logger.info('WLSDPLY-06605', len(templates), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for template in templates:
             _logger.info('WLSDPLY-06606', template, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, template)
             result[template] = OrderedDict()
             self._populate_model_parameters(result[template], location)
             self._discover_subfolders(result[template], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
예제 #25
0
def merge_model_files(model_file_value):
    """
    Merge the model files specified by the model file value.
    It may be a single file, or a comma-separated list of files.
    :param model_file_value: the value specified as a command argument
    :return: the merge model dictionary
    """
    merged_model = OrderedDict()
    model_files = cla_utils.get_model_files(model_file_value)

    for model_file in model_files:
        model = FileToPython(model_file, True).parse()
        _merge_dictionaries(merged_model, model)

    return merged_model
    def _get_xml_registries(self):
        """
        Discover the XML registries that are used by the servers.
        :return: model name for the folder: dictionary containing the discovered log xml registries
        """
        _method_name = '_get_xml_registries'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.XML_REGISTRY
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        registries = self._find_names_in_folder(location)
        if registries is not None:
            _logger.info('WLSDPLY-06634', len(registries), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for registry in registries:
                _logger.info('WLSDPLY-06635', registry, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, registry)
                result[registry] = OrderedDict()
                self._populate_model_parameters(result[registry], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
예제 #27
0
    def get_singleton_service(self):
        """
        Discover the SingletonService global resource settings
        :return: model name for the folder: dictionary containing the discovered SingletonService
        """
        _method_name = 'get_singleton_service'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.SINGLETON_SERVICE
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        singleton_services = self._find_names_in_folder(location)
        if singleton_services is not None:
            _logger.info('WLSDPLY-06445', len(singleton_services), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for singleton_service in singleton_services:
                _logger.info('WLSDPLY-06446', singleton_service, class_name=_class_name, method_name=_method_name)
                result[singleton_service] = OrderedDict()
                location.add_name_token(name_token, singleton_service)
                self._populate_model_parameters(result[singleton_service], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
 def _get_virtual_targets(self):
     """
     Discover the virtual targets used for targeting partition resources.
     :return: model name for virtual targets:dictionary with the discovered virtual targets
     """
     _method_name = '_get_virtual_targets'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.VIRTUAL_TARGET
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     targets = self._find_names_in_folder(location)
     if targets:
         _logger.info('WLSDPLY-06710', len(targets), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for target in targets:
             _logger.info('WLSDPLY-06711', target, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, target)
             result[target] = OrderedDict()
             self._populate_model_parameters(result[target], location)
             self._discover_subfolders(result[target], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
     return model_top_folder_name, result
    def _get_xml_entity_caches(self):
        """
        Discover the XML entity caches that are used by the servers in the domain.
        :return: model name for the folder: dictionary containing the discovered xml entity caches
        """
        _method_name = '_get_xml_entity_caches'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.XML_ENTITY_CACHE
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        caches = self._find_names_in_folder(location)
        if caches is not None:
            _logger.info('WLSDPLY-06632', len(caches), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for cache in caches:
                _logger.info('WLSDPLY-06633', cache, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, cache)
                result[cache] = OrderedDict()
                self._populate_model_parameters(result[cache], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
예제 #30
0
 def get_embedded_ldap_configuration(self):
     """
     Get the Embedded LDAP server configuration for the domain and only return the configuration
     when there are non-default settings other than the credential value.
     :return: name for the model:dictionary containing the discovered Embedded LDAP configuration
     """
     _method_name = 'get_embedded_ldap_configuration'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.EMBEDDED_LDAP
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     embedded_ldap_configuration = self._find_singleton_name_in_folder(
         location)
     if embedded_ldap_configuration is not None:
         location.add_name_token(
             self._alias_helper.get_name_token(location),
             embedded_ldap_configuration)
         self._populate_model_parameters(result, location)
         # IFF credential is the only attribute, skip adding the Embedded LDAP server configuration
         if len(result
                ) == 1 and model_constants.CREDENTIAL_ENCRYPTED in result:
             injector = self._get_variable_injector()
             if injector is not None:
                 injector.remove_from_cache(
                     location, model_constants.CREDENTIAL_ENCRYPTED)
             result = OrderedDict()
             _logger.info('WLSDPLY-06639',
                          class_name=_class_name,
                          method_name=_method_name)
         else:
             _logger.info('WLSDPLY-06640',
                          class_name=_class_name,
                          method_name=_method_name)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result