def test_0000_setup(self): """Add the sub allocated ip pools to gateway. This sub allocated ip pools required by the Nat Rule Invokes the add_sub_allocated_ip_pools of the gateway. """ TestNatRule._client = Environment.get_sys_admin_client() TestNatRule._config = Environment.get_config() gateway = Environment. \ get_test_gateway(TestNatRule._client) gateway_obj = Gateway(TestNatRule._client, TestNatRule._name, href=gateway.get('href')) ip_allocations = gateway_obj.list_configure_ip_settings() ip_allocation = ip_allocations[0] ext_network = ip_allocation.get('external_network') config = TestNatRule._config['external_network'] gateway_sub_allocated_ip_range = \ config['gateway_sub_allocated_ip_range'] ip_range_list = [gateway_sub_allocated_ip_range] task = gateway_obj.add_sub_allocated_ip_pools(ext_network, ip_range_list) result = TestNatRule._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value) gateway_obj = Gateway(TestNatRule._client, TestNatRule._name, href=gateway.get('href')) subnet_participation = self.__get_subnet_participation( gateway_obj.get_resource(), ext_network) ip_ranges = gateway_obj.get_sub_allocate_ip_ranges_element( subnet_participation) self.__validate_ip_range(ip_ranges, gateway_sub_allocated_ip_range)
def test_0013_add_sub_allocated_ip_pools(self): """It adds the sub allocated ip pools to gateway. Invokes the add_sub_allocated_ip_pools of the gateway. """ gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) ip_allocations = gateway_obj.list_configure_ip_settings() ip_allocation = ip_allocations[0] ext_network = ip_allocation.get('external_network') config = TestGateway._config['external_network'] gateway_sub_allocated_ip_range = \ config['gateway_sub_allocated_ip_range'] ip_range_list = [gateway_sub_allocated_ip_range] task = gateway_obj.add_sub_allocated_ip_pools(ext_network, ip_range_list) result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value) gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) subnet_participation = self.__get_subnet_participation( gateway_obj.get_resource(), ext_network) ip_ranges = gateway_obj.get_sub_allocate_ip_ranges_element( subnet_participation) self.__validate_ip_range(ip_ranges, gateway_sub_allocated_ip_range)
def test_0040_add_sub_allocated_ip_pools(self): """It adds the sub allocated ip pools to gateway. Invokes the add_sub_allocated_ip_pools of the gateway. """ gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) ip_allocations = gateway_obj.list_configure_ip_settings() ip_allocation = ip_allocations[0] ext_network = ip_allocation.get('external_network') config = TestGateway._config['external_network'] gateway_sub_allocated_ip_range = \ config['gateway_sub_allocated_ip_range'] ip_range_list = [gateway_sub_allocated_ip_range] task = gateway_obj.add_sub_allocated_ip_pools(ext_network, ip_range_list) result = TestGateway._client.get_task_monitor().wait_for_success( task=task) self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value) gateway_obj = Gateway(TestGateway._client, self._name, TestGateway._gateway.get('href')) subnet_participation = self.__get_subnet_participation( gateway_obj.get_resource(), ext_network) ip_ranges = gateway_obj.get_sub_allocate_ip_ranges_element( subnet_participation) self.__validate_ip_range(ip_ranges, gateway_sub_allocated_ip_range)
def __add_sub_allocate_ip_pool(self): gateway = Environment. \ get_test_gateway(TestExtNet._sys_admin_client) gateway_obj = Gateway(TestExtNet._sys_admin_client, href=gateway.get('href')) ext_net = TestExtNet._config['external_network']['name'] task = gateway_obj.add_sub_allocated_ip_pools( ext_net, [TestExtNet._gateway_sub_allocate_ip_pool_range]) TestExtNet._sys_admin_client.get_task_monitor(). \ wait_for_success(task=task)