コード例 #1
0
def test_split_ip_with_route_domain():
    """Test proper behavior of split_ip_with_route_domain."""

    tests = [["1.2.3.4%1", "1.2.3.4", 1], ["1.2.3.4", "1.2.3.4", None],
             ["64:ff9b::%2", "64:ff9b::", 2], ["64:ff9b::", "64:ff9b::", None]]
    for test in tests:
        results = split_ip_with_route_domain(test[0])
        assert results[0] == test[1]
        assert results[1] == test[2]
コード例 #2
0
ファイル: test_route_domain.py プロジェクト: russokj/f5-cccl
def test_split_ip_with_route_domain():
    """Test proper behavior of split_ip_with_route_domain."""

    tests = [
        ["1.2.3.4%1", "1.2.3.4", 1],
        ["1.2.3.4", "1.2.3.4", None],
        ["64:ff9b::%2", "64:ff9b::", 2],
        ["64:ff9b::", "64:ff9b::", None]
    ]
    for test in tests:
        results = split_ip_with_route_domain(test[0])
        assert results[0] == test[1]
        assert results[1] == test[2]
コード例 #3
0
    def _pre_deploy_legacy_ltm_cleanup(self):
        """Remove legacy named resources (pre Route Domain support)

           We now create node resources with  names that include the route
           domain whether the end user specified them or not.  This prevents
           inconsistent behavior when the default route domain is changed for
           the managed partition.

           This function can be removed when the cccl version >= 2.0
        """

        # Detect legacy names (nodes do not include the route domain)
        self._bigip.refresh_ltm()
        existing_nodes = self._bigip.get_nodes()
        node_list = list(existing_nodes.keys())
        for node_name in node_list:
            route_domain = split_ip_with_route_domain(node_name)[1]
            if route_domain is None:
                break
        else:
            return

        existing_iapps = self._bigip.get_app_svcs()
        existing_virtuals = self._bigip.get_virtuals()
        existing_policies = self._bigip.get_l7policies()
        existing_irules = self._bigip.get_irules()
        existing_internal_data_groups = self._bigip.get_internal_data_groups()
        existing_pools = self._bigip.get_pools()

        delete_iapps = self._get_resource_tasks(existing_iapps, {})[2]
        delete_virtuals = self._get_resource_tasks(existing_virtuals, {})[2]
        delete_policies = self._get_resource_tasks(existing_policies, {})[2]
        delete_irules = self._get_resource_tasks(existing_irules, {})[2]
        delete_internal_data_groups = self._get_resource_tasks(
            existing_internal_data_groups, {})[2]
        delete_pools = self._get_resource_tasks(existing_pools, {})[2]
        delete_monitors = self._get_monitor_tasks({})[2]
        delete_nodes = self._get_resource_tasks(existing_nodes, {})[2]

        delete_tasks = delete_iapps + delete_virtuals + delete_policies + \
            delete_irules + delete_internal_data_groups + delete_pools + \
            delete_monitors + delete_nodes
        taskq_len = len(delete_tasks)

        finished = False
        LOGGER.debug("Removing legacy resources...")
        while not finished:
            LOGGER.debug("Legacy cleanup service task queue length: %d",
                         taskq_len)

            # Must remove all resources that depend on nodes (vs, pools, ???)
            delete_tasks = self._delete_resources(delete_tasks)

            tasks_remaining = len(delete_tasks)

            # Did the task queue shrink?
            if tasks_remaining >= taskq_len or tasks_remaining == 0:
                # No, we have stopped making progress.
                finished = True

            # Reset the taskq length.
            taskq_len = tasks_remaining
コード例 #4
0
ファイル: manager.py プロジェクト: russokj/f5-cccl
    def _pre_deploy_legacy_ltm_cleanup(self):
        """Remove legacy named resources (pre Route Domain support)

           We now create node resources with  names that include the route
           domain whether the end user specified them or not.  This prevents
           inconsistent behavior when the default route domain is changed for
           the managed partition.

           This function can be removed when the cccl version >= 2.0
        """

        # Detect legacy names (nodes do not include the route domain)
        self._bigip.refresh_ltm()
        existing_nodes = self._bigip.get_nodes()
        node_list = list(existing_nodes.keys())
        for node_name in node_list:
            route_domain = split_ip_with_route_domain(node_name)[1]
            if route_domain is None:
                break
        else:
            return

        existing_iapps = self._bigip.get_app_svcs()
        existing_virtuals = self._bigip.get_virtuals()
        existing_policies = self._bigip.get_l7policies()
        existing_irules = self._bigip.get_irules()
        existing_internal_data_groups = self._bigip.get_internal_data_groups()
        existing_pools = self._bigip.get_pools()

        delete_iapps = self._get_resource_tasks(existing_iapps, {})[2]
        delete_virtuals = self._get_resource_tasks(existing_virtuals, {})[2]
        delete_policies = self._get_resource_tasks(existing_policies, {})[2]
        delete_irules = self._get_resource_tasks(existing_irules, {})[2]
        delete_internal_data_groups = self._get_resource_tasks(
            existing_internal_data_groups, {})[2]
        delete_pools = self._get_resource_tasks(existing_pools, {})[2]
        delete_monitors = self._get_monitor_tasks({})[2]
        delete_nodes = self._get_resource_tasks(existing_nodes, {})[2]

        delete_tasks = delete_iapps + delete_virtuals + delete_policies + \
            delete_irules + delete_internal_data_groups + delete_pools + \
            delete_monitors + delete_nodes
        taskq_len = len(delete_tasks)

        finished = False
        LOGGER.debug("Removing legacy resources...")
        while not finished:
            LOGGER.debug("Legacy cleanup service task queue length: %d",
                         taskq_len)

            # Must remove all resources that depend on nodes (vs, pools, ???)
            delete_tasks = self._delete_resources(delete_tasks)

            tasks_remaining = len(delete_tasks)

            # Did the task queue shrink?
            if tasks_remaining >= taskq_len or tasks_remaining == 0:
                # No, we have stopped making progress.
                finished = True

            # Reset the taskq length.
            taskq_len = tasks_remaining