Adds an entry for a vlan_id on a SP template to the table.
199566
def add_vnic_template(self, vlan_id, ucsm_ip, vnic_template, physnet):
        """"""
        if not self.get_vnic_template_vlan_entry(vlan_id, vnic_template,
            ucsm_ip, physnet):
            vnic_t = ucsm_model.VnicTemplate(vlan_id=vlan_id,
                                             vnic_template=vnic_template,
                                             device_id=ucsm_ip,
                                             physnet=physnet,
                                             updated_on_ucs=False)
            with self.session.begin(subtransactions=True):
                self.session.add(vnic_t)
            return vnic_t
611286
def insert_local_var(self, vname, vtype, position):
        ""
        index = self.insert_id(vname, SharedData.KINDS.LOCAL_VAR, [SharedData.KINDS.LOCAL_VAR, SharedData.KINDS.PARAMETER], vtype)
        self.table[index].attribute = position
879339
def update_vnic_template(self, host_id, vlan_id, physnet,
        vnic_template_path, vnic_template):
        """"""
        ucsm_ip = self.get_ucsm_ip_for_host(host_id)

        if not ucsm_ip:
            LOG.info('UCS Manager network driver does not have UCSM IP '
                     'for Host_id %s', str(host_id))
            return False

        vlan_name = self.make_vlan_name(vlan_id)

        with self.ucsm_connect_disconnect(ucsm_ip) as handle:
            # Create Vlan Profile
            if not self._create_vlanprofile(handle, vlan_id, ucsm_ip):
                LOG.error('UCS Manager network driver failed to create '
                          'Vlan Profile for vlan %s', vlan_id)
                return False

            try:
                LOG.debug('VNIC Template Path: %s', vnic_template_path)
                vnic_template_full_path = (vnic_template_path +
                   const.VNIC_TEMPLATE_PREFIX + str(vnic_template))
                LOG.debug('VNIC Template Path: %s for physnet %s',
                    vnic_template_full_path, physnet)

                handle.StartTransaction()
                mo = handle.GetManagedObject(
                    None,
                    self.ucsmsdk.VnicLanConnTempl.ClassId(),
                    {self.ucsmsdk.VnicLanConnTempl.DN:
                    vnic_template_full_path}, True)
                if not mo:
                    LOG.error('UCS Manager network driver could '
                              'not find VNIC template %s',
                        vnic_template_full_path)
                    return False

                vlan_dn = (vnic_template_full_path + const.VLAN_PATH_PREFIX +
                    vlan_name)
                LOG.debug('VNIC Template VLAN path: %s', vlan_dn)
                eth_if = handle.AddManagedObject(mo,
                    self.ucsmsdk.VnicEtherIf.ClassId(),
                    {self.ucsmsdk.VnicEtherIf.DN: vlan_dn,
                    self.ucsmsdk.VnicEtherIf.NAME: vlan_name,
                    self.ucsmsdk.VnicEtherIf.DEFAULT_NET: "no"}, True)
                if not eth_if:
                    LOG.error('UCS Manager network driver could '
                              'not add VLAN %(vlan_name)s to VNIC '
                              'template %(vnic_template_full_path)s',
                        {'vlan_name': vlan_name,
                        'vnic_template_full_path': vnic_template_full_path})
                    return False

                handle.CompleteTransaction()
                return True
            except Exception as e:
                return self._handle_ucsm_exception(e, 'VNIC Template',
                    vlan_id, ucsm_ip)
271207
def update(self, vlans):
        

        data = {'vlans': vlans}
        vlans_ids = [str(vlan.get('id')) for vlan in vlans]

        return super(ApiVlan, self).put('api/v3/vlan/%s/' %
                                        ';'.join(vlans_ids), data)
693844
static void add(DeviceProxy dev) {
        //	Get full device name (with tango host) to manage multi tango_host
        String fullDeviceName = dev.url.toString();

        //	Get it if already exists
        DeviceProxy tmp_dev = proxy_table.get(fullDeviceName);
        if (tmp_dev == null) {
            //System.out.println("Create " + fullDeviceName);
            proxy_table.put(fullDeviceName, dev);    //	else add it
        }
    }
832938
def apply_template_to_network(template_id, network_id, **kwargs):
    

    net_i = db.DBSession.query(Network).filter(Network.id==network_id).one()
    #There should only ever be one matching type, but if there are more,
    #all we can do is pick the first one.
    try:
        network_type_id = db.DBSession.query(TemplateType.id).filter(TemplateType.template_id==template_id,
                                                                       TemplateType.resource_type=='NETWORK').one()
        assign_type_to_resource(network_type_id.id, 'NETWORK', network_id,**kwargs)
    except NoResultFound:
        log.debug("No network type to set.")
        pass

    for node_i in net_i.nodes:
        templates = get_types_by_attr(node_i, template_id)
        if len(templates) > 0:
            assign_type_to_resource(templates[0].id, 'NODE', node_i.id,**kwargs)
    for link_i in net_i.links:
        templates = get_types_by_attr(link_i, template_id)
        if len(templates) > 0:
            assign_type_to_resource(templates[0].id, 'LINK', link_i.id,**kwargs)

    for group_i in net_i.resourcegroups:
        templates = get_types_by_attr(group_i, template_id)
        if len(templates) > 0:
            assign_type_to_resource(templates[0].id, 'GROUP', group_i.id,**kwargs)

    db.DBSession.flush()
959347
def send_enable_vlan_on_trunk_int(self, nexus_host, vlanid, intf_type,
                                      interface, is_native, add_mode=False):
        """"""

        path_snip, body_snip = self._get_vlan_body_on_trunk_int(
            nexus_host, vlanid, intf_type, interface,
            is_native, False, add_mode)
        self.send_edit_string(nexus_host, path_snip, body_snip)
812069
def vhost_add(cls, resource, params):
        
        try:
            oper = cls.call(
                'hosting.rproxy.vhost.create', cls.usable_id(resource), params)
            cls.echo('Adding your virtual host (%s) into %s' %
                     (params['vhost'], resource))
            cls.display_progress(oper)
            cls.echo('Your virtual host habe been added')
            return oper
        except Exception as err:
            if err.code == 580142:
                dc = cls.info(resource)
                dns_entry = cls.call('hosting.rproxy.vhost.get_dns_entries',
                                     {'datacenter': dc['datacenter']['id'],
                                      'vhost': params['vhost']})
                txt_record = "%s 3600 IN TXT \"%s=%s\"" % (dns_entry['key'],
                                                           dns_entry['key'],
                                                           dns_entry['txt'])

                cname_record = "%s 3600 IN CNAME %s" % (dns_entry['key'],
                                                        dns_entry['cname'])

                cls.echo('The domain don\'t use Gandi DNS or you have not'
                         ' sufficient right to alter the zone file. '
                         'Edit your zone file adding this TXT and CNAME '
                         'record and try again :')
                cls.echo(txt_record)
                cls.echo(cname_record)
                cls.echo('\nOr add a file containing %s at :\n'
                         'http://%s/%s.txt\n' % (dns_entry['txt'],
                                                 dns_entry['domain'],
                                                 dns_entry['txt']))

            else:
                cls.echo(err)
967583
def update(cls, id, params):
        """"""
        cls.echo('Updating your vlan.')
        result = cls.call('hosting.vlan.update', cls.usable_id(id), params)
        return result
465908
def _add(self, ctx, table_name, record_id, column_values):
        
        vsctl_table = self._get_table(table_name)
        ovsrec_row = ctx.must_get_row(vsctl_table, record_id)
        for column, value in column_values:
            ctx.add_column(ovsrec_row, column, value)
        ctx.invalidate_cache()
154561
def add_entry(id, title, updated, link, options={})
      entries << {
        :id => id,
        :title => title,
        :updated => updated,
        :link => link
        }.merge(options)
    end
572943
def add_vpp_xml(xdoc)
      doc_root = xdoc.root
      vpp = doc_root.add_element 'vpp'
      vpp.add_element('assign_vpp_device_based_licenses').text = @assign_vpp_device_based_licenses
    end
686104
def delete_sp_template_for_vlan(self, vlan_id):
        """"""
        with self.session.begin(subtransactions=True):
            try:
                self.session.query(
                    ucsm_model.ServiceProfileTemplate).filter_by(
                    vlan_id=vlan_id).delete()
            except orm.exc.NoResultFound:
                return
535315
def add_service_profile_template(self, vlan_id, sp_template, ucsm_ip):
        """"""
        if not self.get_sp_template_vlan_entry(vlan_id, sp_template, ucsm_ip):
            entry = ucsm_model.ServiceProfileTemplate(vlan_id=vlan_id,
                                                      sp_template=sp_template,
                                                      device_id=ucsm_ip,
                                                      updated_on_ucs=False)
            self.session.add(entry)
22559
def add_table(self, t):
        
        self.push_element()
        self._page.append(t.node)
        self.cur_element = t
19561
def add_rule_entry(self, rule_info):
        """"""

        new_rule = IpMacPort(rule_info.get('ip'), rule_info.get('mac'),
                             rule_info.get('port'))
        LOG.debug('Added rule info %s to the list', rule_info)
        self.rule_info.append(new_rule)
875384
def add(self, plm, device, stateType, stateName, group, defaultValue=None):
        """"""
        self._stateList[group] = stateType(plm, device, stateName, group,
                                           defaultValue=defaultValue)