<commit_before>/*
 * Copyright (c) 2015 <NAME>, Inc. All rights reserved.
 */

define([
    'underscore',
    'contrail-config-model'
], function (_, ContrailConfigModel) {

    var fipCfgModel = ContrailConfigModel.extend({

        defaultConfig: {
            'name': '',
            'fq_name': null, //[]
            'display_name': '',
            'parent_type': 'floating-ip-pool',
            'uuid': null,
            'floating_ip_address': null,
            'project_refs': null, //[]
            'virtual_machine_interface_refs': null, //[]
            'user_created_alloc_type': 'dynamic', //dynamic/specific
            'user_created_alloc_count': 1,
            'user_created_floating_ip_pool': null,
            'is_specific_ip': false, //flag to map selected fixed ip to fip
            'floating_ip_fixed_ip_address': null
        },

        formatModelConfig: function (modelConfig) {
            var vmiRef = getValueByJsonPath(modelConfig,
                      'virtual_machine_interface_refs;0', null),
                floatingIPFixedIP = getValueByJsonPath(modelConfig,
                    'floating_ip_fixed_ip_address', null),
                fixedIP;
            if(floatingIPFixedIP) {
                modelConfig["is_specific_ip"] = true;
                fixedIP = floatingIPFixedIP;
            } else {
                modelConfig["is_specific_ip"] = false;
                fixedIP = getValueByJsonPath(vmiRef,
                    "instance_ip_back_refs;0;fixedip;ip", "");
            }

            if (vmiRef) {
                var fqName = getValueByJsonPath(vmiRef,'to', []);
                fqName = fqName.join(":");
                fqName = fqName + cowc.DROPDOWN_VALUE_SEPARATOR + fixedIP;
                modelConfig['virtual_machine_interface_refs'] = fqName;
            } else {
                modelConfig['virtual_machine_interface_refs'] = null;
            }
            //permissions
            this.formatRBACPermsModelConfig(modelConfig);
            return modelConfig;<commit_msg>Closes-bug: #1662420 - Web-UI : Config - FIP : Map Fixed IP should be set by Default in Associate FIP to Port<commit_after>/*
 * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
 */

define([
    'underscore',
    'contrail-config-model'
], function (_, ContrailConfigModel) {

    var fipCfgModel = ContrailConfigModel.extend({

        defaultConfig: {
            'name': '',
            'fq_name': null, //[]
            'display_name': '',
            'parent_type': 'floating-ip-pool',
            'uuid': null,
            'floating_ip_address': null,
            'project_refs': null, //[]
            'virtual_machine_interface_refs': null, //[]
            'user_created_alloc_type': 'dynamic', //dynamic/specific
            'user_created_alloc_count': 1,
            'user_created_floating_ip_pool': null,
            'is_specific_ip': true, //flag to map selected fixed ip to fip
            'floating_ip_fixed_ip_address': null
        },

        formatModelConfig: function (modelConfig) {
            var vmiRef = getValueByJsonPath(modelConfig,
                      'virtual_machine_interface_refs;0', null),
                floatingIPFixedIP = getValueByJsonPath(modelConfig,
                    'floating_ip_fixed_ip_address', null),
                fixedIP;

            if (vmiRef) {
                var fqName = getValueByJsonPath(vmiRef,'to', []);
                if(floatingIPFixedIP) {
                    modelConfig["is_specific_ip"] = true;
                    fixedIP = floatingIPFixedIP;
                } else {
                    modelConfig["is_specific_ip"] = false;
                    fixedIP = getValueByJsonPath(vmiRef,
                        "instance_ip_back_refs;0;fixedip;ip", "");
                }
                fqName = fqName.join(":");
                fqName = fqName + cowc.DROPDOWN_VALUE_SEPARATOR + fixedIP;
                modelConfig['virtual_machine_interface_refs'] = fqName;
            } else {
                modelConfig['virtual_machine_interface_refs'] = null;
            }
            //permissions
            this.formatRBACPermsModelConfig(modelConfig);
            return modelConfig;
{'fraction_non_alphanumeric': 0.10563882940756603, 'fraction_numerical': 0.004996431120628123, 'mean_word_length': 1.830976430976431, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '825164', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1158, 'n_words': 207}