Example #1
0
    def __setup_system_common_bigip(self, job_input, act_sby, pod_id,
                                    msa_device_id, msa_config_for_common,
                                    msa_config_for_device):

        node_detail = {}

        # Create Instance(MSA Soap Client)
        msa = bigipordercmdws.BigIpOrderCommandWs(self.job_config,
                                                  self.nal_endpoint_config,
                                                  pod_id)

        # Create Partition(MSA)
        msa_res = self.execute_msa_command(msa_config_for_device, msa,
                                           'create_big_ip_partition',
                                           msa_device_id,
                                           job_input['partition_id'])
        node_detail['create_big_ip_partition'] = msa_res[msa.RES_KEY_IN]

        # Create RouteDomain(MSA)
        msa_res = self.execute_msa_command(msa_config_for_device, msa,
                                           'create_big_ip_route_domain',
                                           msa_device_id,
                                           job_input['partition_id'],
                                           job_input['route_domain_id'])
        node_detail['create_big_ip_route_domain'] = msa_res[msa.RES_KEY_IN]

        # Create DefaultRouteDomain(MSA)
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_big_ip_default_route_domain',
            msa_device_id, job_input['partition_id'],
            job_input['route_domain_id'])
        node_detail['create_big_ip_default_route_domain'] = msa_res[
            msa.RES_KEY_IN]

        # Create User Manager(MSA)
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_big_ip_user_manager',
            msa_device_id, job_input['partition_id'],
            job_input['mng_user_account_id'], 'manager',
            job_input['mng_account_password'])
        node_detail['create_big_ip_user_manager'] = msa_res[msa.RES_KEY_IN]

        # Create User Certificate Manager(MSA)
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa,
            'create_big_ip_user_certificate_manager', msa_device_id,
            job_input['partition_id'],
            job_input['certificate_user_account_id'], 'certificate-manager',
            job_input['certificate_account_password'])
        node_detail['create_big_ip_user_certificate_manager'] = msa_res[
            msa.RES_KEY_IN]

        # Update NAL_VNF_MNG(DB)
        self.__update_db_apl(job_input, act_sby, node_detail)
Example #2
0
    def get_msa_instance(self):

        job_input = {
            'type': 2,
            'device_type': 1,
            'operation_id': 'TestSoapUser'
        }

        job_instance = routingpod.RoutingPod()
        ret = job_instance.routing_pod(job_input)

        pod_id = ret['pod_id']

        msa_instance = bigipordercmdws.BigIpOrderCommandWs(
            job_instance.job_config, job_instance.nal_endpoint_config, pod_id)

        return msa_instance
Example #3
0
    def __unsetup_tenant_vlan_bigip(self, job_input, act_sby, pod_id,
                                    msa_device_id, partition_id,
                                    route_domain_id, msa_config_for_common,
                                    msa_config_for_device):

        # Get JOB Input Parameters
        nal_tenant_id = job_input['nal_tenant_id']
        node_id = job_input['node_id']
        job_cleaning_mode = job_input.get('job_cleaning_mode', '0')
        vim_iaas_with_flg = self.get_vim_iaas_with_flg(job_input)
        route_name = 'defaultGWv6'
        route = '0.0.0.0/0'
        self_ipv6_end_number = 1

        # List NAL_VNF_MNG(DB Client)
        db_endpoint_port = self.get_db_endpoint(self.job_config.REST_URI_PORT)
        db_endpoint_vlan = self.get_db_endpoint(self.job_config.REST_URI_VLAN)
        db_endpoint_pnf_vlan = self.get_db_endpoint(
            self.job_config.REST_URI_PNF_VLAN)
        db_list = list.ListClient(self.job_config)

        params = {}
        params['delete_flg'] = 0
        params['tenant_id'] = nal_tenant_id
        params['node_id'] = node_id
        db_list.set_context(db_endpoint_port, params)
        db_list.execute()
        port_list = db_list.get_return_param()

        ip_address_v6 = port_list[0].get('ip_address_v6', '')

        params = {}
        params['delete_flg'] = 0
        params['tenant_id'] = nal_tenant_id
        params['network_id'] = port_list[0]['network_id']
        db_list.set_context(db_endpoint_vlan, params)
        db_list.execute()
        vlan_list = db_list.get_return_param()
        iaas_network_type = vlan_list[0]['IaaS_network_type']

        # Get VLAN_ID
        if vim_iaas_with_flg == 1 and \
                iaas_network_type.upper() == self.job_config.NW_TYPE_VXLAN:
            # List NAL_PNF_VLAN_MNG(DB Client)
            params = {}
            params['delete_flg'] = 0
            params['status'] = 1
            params['network_id'] = port_list[0]['network_id']
            db_list.set_context(db_endpoint_pnf_vlan, params)
            db_list.execute()
            pnf_vlan_list = db_list.get_return_param()
            vlan_id = pnf_vlan_list[0]['vlan_id']
        else:
            vlan_id = vlan_list[0]['vlan_id']

        # Create Instance(MSA Soap Client)
        msa = bigipordercmdws.BigIpOrderCommandWs(self.job_config,
                                                  self.nal_endpoint_config,
                                                  pod_id)
        if ip_address_v6 != '':
            try:
                # Delete IPv6Staticroute(MSA Soap Client)
                self.execute_msa_command(msa_config_for_device, msa,
                                         'delete_f5_big_ip_ipv6_static_route',
                                         msa_device_id, partition_id,
                                         route_name)
            except:
                if job_cleaning_mode == '1':
                    self.output_log_fatal(__name__, traceback.format_exc())
                else:
                    raise
        else:
            pass

        try:
            # Delete IPv4Staticroute(MSA Soap Client)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_route', msa_device_id,
                                     partition_id, route)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        if ip_address_v6 != '':
            try:
                # Delete F5BigipVipIpv6(MSA Soap Client)
                self.execute_msa_command(
                    msa_config_for_device,
                    msa,
                    'delete_f5_big_ip_ipv6',
                    msa_device_id,
                    partition_id + '_' + vlan_id + '_VIP',
                    partition_id,
                    self_ipv6_end_number,
                )
            except:
                if job_cleaning_mode == '1':
                    self.output_log_fatal(__name__, traceback.format_exc())
                else:
                    raise
        else:
            pass

        if ip_address_v6 != '':
            try:
                # Delete F5BigipPhysicalIpv6(MSA Soap Client)
                self.execute_msa_command(msa_config_for_device, msa,
                                         'delete_f5_big_ip_physical_ipv6',
                                         msa_device_id,
                                         partition_id + '_' + vlan_id + '_IP',
                                         partition_id, self_ipv6_end_number)
            except:
                if job_cleaning_mode == '1':
                    self.output_log_fatal(__name__, traceback.format_exc())
                else:
                    raise
        else:
            pass

        try:
            # Delete VIP(MSA Soap Client)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_vip', msa_device_id,
                                     partition_id,
                                     partition_id + '_' + vlan_id + '_VIP')
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        try:
            # Delete PhysicalIP(MSA Soap Client)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_physical_ip',
                                     msa_device_id, partition_id,
                                     partition_id + '_' + vlan_id + '_IP')
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        try:
            # Delete VIP(MSA Soap Client)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_vlan', msa_device_id,
                                     partition_id,
                                     partition_id + '_' + vlan_id)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise
Example #4
0
    def __unsetup_system_common_bigip(self, job_input, act_sby, pod_id,
                                      msa_device_id, partition_id,
                                      route_domain_id, msa_config_for_common,
                                      msa_config_for_device,
                                      mng_user_account_id,
                                      certificate_user_account_id):

        # Create Instance(MSA Soap Client)
        msa = bigipordercmdws.BigIpOrderCommandWs(self.job_config,
                                                  self.nal_endpoint_config,
                                                  pod_id)

        job_cleaning_mode = job_input.get('job_cleaning_mode', '0')

        try:
            # Delete User Certificate Manager(MSA)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_user_certificate_manager',
                                     msa_device_id, partition_id,
                                     certificate_user_account_id)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        try:
            # Delete User Manager(MSA)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_user_manager',
                                     msa_device_id, partition_id,
                                     mng_user_account_id)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        try:
            # Delete DefaultRouteDomain(MSA)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_default_route_domain',
                                     msa_device_id, partition_id)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        try:
            # Delete RouteDomain(MSA)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_route_domain',
                                     msa_device_id, partition_id)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise

        try:
            # Delete Partition(MSA)
            self.execute_msa_command(msa_config_for_device, msa,
                                     'delete_big_ip_partition', msa_device_id,
                                     partition_id)
        except:
            if job_cleaning_mode == '1':
                self.output_log_fatal(__name__, traceback.format_exc())
            else:
                raise
Example #5
0
    def __setup_tenant_vlan_bigip(self, job_input, act_sby, pod_id,
                                  msa_device_id, partition_id,
                                  msa_config_for_common, msa_config_for_device,
                                  nic_tenant):

        msa_info = {}

        # Get JOB Input Parameters
        nal_tenant_id = job_input['nal_tenant_id']
        port_id4 = job_input['port_id4']
        gateway = job_input['fw_ip_address']
        iaas_network_type = job_input['IaaS_network_type']
        vim_iaas_with_flg = self.get_vim_iaas_with_flg(job_input)
        route = '0.0.0.0/0'

        # List NAL_VNF_MNG(DB Client)
        db_endpoint_port = self.get_db_endpoint(self.job_config.REST_URI_PORT)
        db_endpoint_vlan = self.get_db_endpoint(self.job_config.REST_URI_VLAN)
        db_endpoint_pnf_vlan = self.get_db_endpoint(
            self.job_config.REST_URI_PNF_VLAN)
        db_list = list.ListClient(self.job_config)

        params = {}
        params['delete_flg'] = 0
        params['tenant_id'] = nal_tenant_id
        params['port_id'] = port_id4
        db_list.set_context(db_endpoint_port, params)
        db_list.execute()
        port_list = db_list.get_return_param()

        params = {}
        params['delete_flg'] = 0
        params['tenant_id'] = nal_tenant_id
        params['network_id'] = port_list[0]['network_id']
        db_list.set_context(db_endpoint_vlan, params)
        db_list.execute()
        vlan_list = db_list.get_return_param()

        # Get VLAN_ID
        if vim_iaas_with_flg == 1 and \
                iaas_network_type.upper() == self.job_config.NW_TYPE_VXLAN:
            # List NAL_PNF_VLAN_MNG(DB Client)
            params = {}
            params['delete_flg'] = 0
            params['status'] = 1
            params['network_id'] = port_list[0]['network_id']
            db_list.set_context(db_endpoint_pnf_vlan, params)
            db_list.execute()
            pnf_vlan_list = db_list.get_return_param()
            vlan_id = pnf_vlan_list[0]['vlan_id']
        else:
            vlan_id = vlan_list[0]['vlan_id']

        # Create Instance(MSA Soap Client)
        msa = bigipordercmdws.BigIpOrderCommandWs(self.job_config,
                                                  self.nal_endpoint_config,
                                                  pod_id)

        port_dict = json.loads(port_list[0]['port_info'])

        vip_ip_address = port_dict['IaaS_port_info']['vip']['ip_address']
        vip_netmask = port_dict['IaaS_port_info']['vip']['netmask']

        if act_sby == 'act':
            ip_address = port_dict['IaaS_port_info']['act']['ip_address']
            netmask = port_dict['IaaS_port_info']['act']['netmask']
        else:
            ip_address = port_dict['IaaS_port_info']['sby']['ip_address']
            netmask = port_dict['IaaS_port_info']['sby']['netmask']

        # Create VLAN(MSA Soap Client)
        msa_res = self.execute_msa_command(msa_config_for_device, msa,
                                           'create_big_ip_vlan', msa_device_id,
                                           partition_id,
                                           partition_id + '_' + vlan_id,
                                           nic_tenant, vlan_id)
        msa_info['create_big_ip_vlan'] = msa_res[msa.RES_KEY_IN]

        # Create PhysicalIP(MSA Soap Client)
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_big_ip_physical_ip',
            msa_device_id, partition_id, partition_id + '_' + vlan_id + '_IP',
            ip_address, self.utils.get_subnet_mask_from_cidr_len(netmask),
            partition_id + '_' + vlan_id)
        msa_info['create_big_ip_physical_ip'] = msa_res[msa.RES_KEY_IN]

        # Create VIP(MSA Soap Client)
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_big_ip_vip', msa_device_id,
            partition_id, partition_id + '_' + vlan_id + '_VIP',
            vip_ip_address,
            self.utils.get_subnet_mask_from_cidr_len(vip_netmask),
            partition_id + '_' + vlan_id, 'traffic-group-1')
        msa_info['create_big_ip_vip'] = msa_res[msa.RES_KEY_IN]

        # Set Staticroute(BIGIP_route)
        msa_res = self.execute_msa_command(msa_config_for_device, msa,
                                           'create_big_ip_route',
                                           msa_device_id, partition_id, route,
                                           gateway)
        msa_info['create_big_ip_route'] = msa_res[msa.RES_KEY_IN]

        # Update NAL_PORT_MNG(DB)
        self.__update_db_port(job_input, act_sby, port_id4, msa_info)
Example #6
0
    def __setup_add_ipv6_bigip(self, job_input, act_sby, pod_id, msa_device_id,
                               partition_id, msa_config_for_device):

        # Get JOB Input Parameters
        nal_tenant_id = job_input['nal_tenant_id']
        port_id = job_input['port_id']
        ipv6_route = '::/0'
        gateway_ipv6_address = job_input['fw_ip_v6_address']
        vim_iaas_with_flg = self.get_vim_iaas_with_flg(job_input)
        is_default_gateway = 'yes'
        route_name = 'defaultGWv6'
        destination_ipv6_address = '::'
        destination_ipv6_netmask = '0'

        # List NAL_PORT_MNG(DB Client)
        db_endpoint_port = self.get_db_endpoint(self.job_config.REST_URI_PORT)
        db_endpoint_vlan = self.get_db_endpoint(self.job_config.REST_URI_VLAN)
        db_endpoint_pnf_vlan = self.get_db_endpoint(
            self.job_config.REST_URI_PNF_VLAN)
        db_list = list.ListClient(self.job_config)

        params = {}
        params['delete_flg'] = 0
        params['tenant_id'] = nal_tenant_id
        params['port_id'] = port_id
        db_list.set_context(db_endpoint_port, params)
        db_list.execute()

        port_list = db_list.get_return_param()

        params = {}
        params['delete_flg'] = 0
        params['tenant_id'] = nal_tenant_id
        params['network_id'] = port_list[0]['network_id']
        db_list.set_context(db_endpoint_vlan, params)
        db_list.execute()
        vlan_list = db_list.get_return_param()
        iaas_network_type = vlan_list[0]['IaaS_network_type']

        # Get VLAN_ID
        if vim_iaas_with_flg == 1 and \
                iaas_network_type.upper() == self.job_config.NW_TYPE_VXLAN:
            # List NAL_PNF_VLAN_MNG(DB Client)
            params = {}
            params['delete_flg'] = 0
            params['status'] = 1
            params['network_id'] = port_list[0]['network_id']
            db_list.set_context(db_endpoint_pnf_vlan, params)
            db_list.execute()
            pnf_vlan_list = db_list.get_return_param()
            vlan_id = pnf_vlan_list[0]['vlan_id']
        else:
            vlan_id = vlan_list[0]['vlan_id']

        msa_info = json.loads(port_list[0]['msa_info'])
        port_dict = json.loads(port_list[0]['port_info'])

        vip_ip_address_v6 = port_dict['IaaS_port_info']['vip']['ip_address_v6']
        vip_netmask_v6 = port_dict['IaaS_port_info']['vip']['netmask_v6']

        if act_sby == 'act':
            ip_address_v6 = port_dict['IaaS_port_info']['act']['ip_address_v6']
            netmask_v6 = port_dict['IaaS_port_info']['act']['netmask_v6']
        else:
            ip_address_v6 = port_dict['IaaS_port_info']['sby']['ip_address_v6']
            netmask_v6 = port_dict['IaaS_port_info']['sby']['netmask_v6']

        # Create Instance(MSA Soap Client)
        msa = bigipordercmdws.BigIpOrderCommandWs(self.job_config,
                                                  self.nal_endpoint_config,
                                                  pod_id)
        # Setting F5BigipPhysicalIpv6
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_f5_big_ip_physical_ipv6',
            msa_device_id, partition_id + '_' + vlan_id + '_IP', partition_id,
            ip_address_v6, netmask_v6, partition_id + '_' + vlan_id)
        msa_info['create_f5_big_ip_physical_ipv6'] = msa_res[msa.RES_KEY_IN]

        # Setting F5BigipVipIpv6
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_f5_big_ip_ipv6', msa_device_id,
            partition_id + '_' + vlan_id + '_VIP', partition_id,
            vip_ip_address_v6, vip_netmask_v6, partition_id + '_' + vlan_id,
            'traffic-group-1')
        msa_info['create_f5_big_ip_ipv6'] = msa_res[msa.RES_KEY_IN]

        # Setting F5BigipIpv6Staticroute
        msa_res = self.execute_msa_command(
            msa_config_for_device, msa, 'create_f5_big_ip_ipv6_static_route',
            msa_device_id, partition_id, ipv6_route, gateway_ipv6_address,
            is_default_gateway, route_name, destination_ipv6_address,
            destination_ipv6_netmask)
        msa_info['create_f5_big_ip_ipv6_static_route'] = msa_res[
            msa.RES_KEY_IN]

        # Update NAL_PORT_MNG(DB)
        self.__update_db_port(job_input, act_sby, port_id, msa_info)