def create_custom_service(self,
                              csar_file,
                              vgw_template_file,
                              vgw_gra_template_file,
                              preload_dict=None):
        name_suffix = datetime.now().strftime('%Y%m%d%H%M')
        brg_mac = self.vcpecommon.get_brg_mac_from_sdnc()
        brg_mac_enc = brg_mac.replace(':', '-')
        # get name index
        self.vgw_vfmod_name_index = self.vcpecommon.load_object(
            self.vcpecommon.vgw_vfmod_name_index_file)
        self.vgw_vfmod_name_index = self.vgw_vfmod_name_index + 1
        self.vcpecommon.save_object(self.vgw_vfmod_name_index,
                                    self.vcpecommon.vgw_vfmod_name_index_file)
        # preload vGW
        if preload_dict:
            preloader = preload.Preload(self.vcpecommon)
            parameters_to_change = [
                'vgw_private_ip_0', 'vgw_private_ip_1', 'vgw_private_ip_2',
                'vg_vgmux_tunnel_vni'
            ]
            self.vcpecommon.increase_ip_address_or_vni_in_template(
                vgw_template_file, parameters_to_change)
            preloader.preload_vgw(vgw_template_file, brg_mac, preload_dict,
                                  name_suffix)
            # preload vGW-GRA
            preloader.preload_vgw_gra(vgw_gra_template_file, brg_mac_enc,
                                      preload_dict, name_suffix,
                                      str(self.vgw_vfmod_name_index))

        # create service
        so = soutils.SoUtils(self.vcpecommon, 'v5')
        if so.create_custom_service(csar_file, brg_mac, name_suffix):
            self.print_success_info()
Example #2
0
def create_one_service(vcpecommon,
                       csar_file,
                       vnf_template_file,
                       preload_dict,
                       suffix,
                       heatbridge=False):
    """
    :return:  service instance UUID
    """
    so = soutils.SoUtils(vcpecommon, 'v4')
    return so.create_entire_service(csar_file, vnf_template_file, preload_dict,
                                    suffix, heatbridge)