Update an existing vlan.
967583
def update(cls, id, params):
        """"""
        cls.echo('Updating your vlan.')
        result = cls.call('hosting.vlan.update', cls.usable_id(id), params)
        return result
204250
def _update_service_profile(self, handle, service_profile,
                                vlan_id, ucsm_ip):
        
        virtio_port_list = (
            CONF.ml2_cisco_ucsm.ucsms[ucsm_ip].ucsm_virtio_eth_ports)

        eth_port_paths = ["%s%s" % (service_profile, ep)
            for ep in virtio_port_list]

        vlan_name = self.make_vlan_name(vlan_id)

        try:
            handle.StartTransaction()
            obj = handle.GetManagedObject(
                None,
                self.ucsmsdk.LsServer.ClassId(),
                {self.ucsmsdk.LsServer.DN: service_profile})

            if not obj:
                LOG.debug('UCS Manager network driver could not find '
                          'Service Profile %s in UCSM %s',
                          service_profile, ucsm_ip)
                return False

            for eth_port_path in eth_port_paths:
                eth = handle.GetManagedObject(
                    obj, self.ucsmsdk.VnicEther.ClassId(),
                    {self.ucsmsdk.VnicEther.DN: eth_port_path}, True)

                if eth:
                    vlan_path = (eth_port_path + const.VLAN_PATH_PREFIX +
                                 vlan_name)

                    eth_if = handle.AddManagedObject(eth,
                        self.ucsmsdk.VnicEtherIf.ClassId(),
                        {self.ucsmsdk.VnicEtherIf.DN: vlan_path,
                        self.ucsmsdk.VnicEtherIf.NAME: vlan_name,
                        self.ucsmsdk.VnicEtherIf.DEFAULT_NET: "no"}, True)

                    if not eth_if:
                        LOG.debug('UCS Manager network driver could not '
                                  'update Service Profile %s with vlan %d',
                                  service_profile, vlan_id)
                        return False
                else:
                    LOG.debug('UCS Manager network driver did not find '
                              'ethernet port at %s', eth_port_path)

            handle.CompleteTransaction()
            return True

        except Exception as e:
            return self._handle_ucsm_exception(e, 'Service Profile',
                                               vlan_name, ucsm_ip)
1259029
def update(cls, domain, source, dest_add, dest_del):
        """"""
        result = None

        if dest_add or dest_del:
            current_destinations = cls.get_destinations(domain, source)
            fwds = current_destinations[:]
            if dest_add:
                for dest in dest_add:
                    if dest not in fwds:
                        fwds.append(dest)
            if dest_del:
                for dest in dest_del:
                    if dest in fwds:
                        fwds.remove(dest)

            if ((len(current_destinations) != len(fwds))
                    or (current_destinations != fwds)):
                cls.echo('Updating mail forward %s@%s' % (source, domain))
                options = {'destinations': fwds}
                result = cls.call('domain.forward.update', domain, source,
                                  options)

        return result
814105
def update(self):
        """"""
        if self.client_mode == 'glances':
            return self.update_glances()
        elif self.client_mode == 'snmp':
            return self.update_snmp()
        else:
            self.end()
            logger.critical("Unknown server mode: {}".format(self.client_mode))
            sys.exit(2)
107325
def update_subnet(self, subnet, body=None):
        """"""
        return self.put(self.subnet_path % (subnet), body=body)
462210
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)

                mo = handle.query_dn(vnic_template_full_path)
                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 = self.ucsmsdk.vnicEtherIf(
                    parent_mo_or_dn=mo,
                    name=vlan_name,
                    default_net="no")
                handle.add_mo(eth_if)
                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.commit()
                return True
            except Exception as e:
                return self._handle_ucsm_exception(e, 'VNIC Template',
                    vlan_id, ucsm_ip)
1251225
def update_platform(self):
        """"""
        self.chain.connection.log("Detecting hw platform")
        platform = self.driver.get_hw_platform(self.udi)
        if platform:
            self.chain.connection.log("HW Platform: {}".format(platform))
            self.platform = platform
903750
def update(self, *args, **kwargs):
        """"""
        self._call_helper("Updating", self.real.update, *args, **kwargs)
1279115
def update_payload(self, fields=None):
        """"""
        payload = super(Subnet, self).update_payload(fields)
        if 'from_' in payload:
            payload['from'] = payload.pop('from_')
        return {u'subnet': payload}
95824
def update(self, networkipv4s):
        

        data = {'networks': networkipv4s}
        networkipv4s_ids = [str(networkipv4.get('id'))
                            for networkipv4 in networkipv4s]

        return super(ApiNetworkIPv4, self).put('api/v3/networkv4/%s/' %
                                               ';'.join(networkipv4s_ids), data)
832800
def update_port_postcommit(self, context):
        
        vlan_id = self._get_vlanid(context)

        if not vlan_id:
            LOG.warning('Vlan_id is None. Ignoring this port.')
            return

        if (not self._is_supported_deviceowner(context.current) or
            not self._is_status_active(context.current)):
            LOG.debug("Unsupported device_owner '%(owner)s' or port not"
                      " active (vlan_id '%(vlan)d', status %(status)s)."
                      "   Nothing to do.",
                      {'owner': context.current['device_owner'],
                       'vlan': vlan_id,
                       'status': context.current['status']})
            return

        # Checks to perform before UCS Manager can create a Port Profile.
        # 1. Make sure this host is on a known UCS Manager.
        host_id = self._get_host_id(
            context.current.get(bc.portbindings.HOST_ID))
        if not host_id:
            LOG.warning('Host id from port context is None. '
                'Ignoring this port')
            return

        ucsm_ip = self.driver.get_ucsm_ip_for_host(host_id)
        if not ucsm_ip:
            LOG.info('Host_id %s is not controlled by any known UCS '
                'Manager', str(host_id))
            return

        profile = context.current.get(bc.portbindings.PROFILE, {})
        vnic_type = context.current.get(bc.portbindings.VNIC_TYPE,
                                        bc.portbindings.VNIC_NORMAL)

        # 2. Make sure this is a vm_fex_port.(Port profiles are created
        # only for VM-FEX ports.)
        if (self.driver.check_vnic_type_and_vendor_info(vnic_type, profile) and
            self.driver.is_vmfex_port(profile)):

            # 3. Make sure update_port_precommit added an entry in the DB
            # for this port profile
            profile_name = self.ucsm_db.get_port_profile_for_vlan(vlan_id,
                ucsm_ip)

            # 4. Make sure that the Port Profile hasn't already been created
            # on the UCS Manager
            if profile_name and self.ucsm_db.is_port_profile_created(vlan_id,
                ucsm_ip):
                LOG.debug('Port Profile %s for vlan_id %d already exists '
                          'on UCSM %s.', profile_name, vlan_id, ucsm_ip)
                return

            # Multi VLAN trunk support
            # Check if this network is a trunk network. If so pass the
            # additional VLAN ids to the UCSM driver.
            network = context.network.current['name']
            trunk_vlans = (
                CONF.sriov_multivlan_trunk.network_vlans.get(network, []))

            # All checks are done. Ask the UCS Manager driver to create the
            # above Port Profile.
            if self.driver.create_portprofile(profile_name, vlan_id,
                                              vnic_type, host_id, trunk_vlans):
                # Port profile created on UCS, record that in the DB.
                self.ucsm_db.set_port_profile_created(vlan_id, profile_name,
                    ucsm_ip)
            return
        else:
            # Enable vlan-id for this Neutron virtual port.
            LOG.debug('Host_id is %s', host_id)
            physnet = self._get_physnet(context)

            ucsm = CONF.ml2_cisco_ucsm.ucsms[ucsm_ip]
            vnic_template = ucsm.vnic_template_list.get(physnet)

            if vnic_template:
                LOG.debug('Update VNIC Template for physnet: %s', physnet)
                LOG.debug('vnic_template %s', vnic_template)
                if (self.driver.update_vnic_template(
                        host_id, vlan_id, physnet, vnic_template.path,
                        vnic_template.name)):
                    LOG.debug('Setting ucsm_updated flag for '
                              'vlan : %(vlan)d, '
                              'vnic_template : %(vnic_template)s '
                              'on ucsm_ip: %(ucsm_ip)s',
                              {'vlan': vlan_id,
                              'vnic_template': vnic_template.name,
                              'ucsm_ip': ucsm_ip})
                    self.ucsm_db.set_vnic_template_updated(
                        vlan_id, ucsm_ip, vnic_template.name, physnet)
                return

            if (CONF.ml2_cisco_ucsm.ucsms[ucsm_ip].sp_template_list and
                self.driver.update_service_profile_template(
                    vlan_id, host_id, ucsm_ip)):
                sp_template_info = (CONF.ml2_cisco_ucsm.ucsms[
                    ucsm_ip].sp_template_list.get(host_id))
                if not sp_template_info:
                    sp_template = None
                else:
                    sp_template = sp_template_info.name
                LOG.debug('Setting ucsm_updated flag for vlan : %(vlan)d, '
                          'sp_template : %(sp_template)s on ucsm_ip: '
                          '%(ucsm_ip)s', {'vlan': vlan_id,
                          'sp_template': sp_template, 'ucsm_ip': ucsm_ip})
                self.ucsm_db.set_sp_template_updated(vlan_id, sp_template,
                                                     ucsm_ip)
            else:
                self.driver.update_serviceprofile(host_id, vlan_id)
472395
def update(self):
        """"""
        node = self._fritz.get_device_element(self.ain)
        self._update_from_node(node)
600726
def update_configuration(self, **kwargs):
        
        updated = False
        if 'announced_networks' in kwargs:
            kwargs.update(announced_ne_setting=kwargs.pop('announced_networks'))
        if 'bgp_profile' in kwargs:
            kwargs.update(bgp_profile_ref=kwargs.pop('bgp_profile'))
        if 'autonomous_system' in kwargs:
            kwargs.update(bgp_as_ref=kwargs.pop('autonomous_system'))
        
        announced_ne = kwargs.pop('announced_ne_setting', None)
        
        for name, value in kwargs.items():
            _value = element_resolver(value)
            if self.data.get(name) != _value:
                self.data[name] = _value
                updated = True
        
        if announced_ne is not None:
            s = self.data.get('announced_ne_setting')
            ne = self._unwrap(announced_ne)
            
            if len(announced_ne) != len(s) or not self._equal(ne, s):
                self.data.update(announced_ne_setting=ne)
                updated = True
            
        return updated
481482
def update_port_precommit(self, context):
        """"""
        vlan_segment, vxlan_segment = self._get_segments(
            context.top_bound_segment, context.bottom_bound_segment)
        orig_vlan_segment, orig_vxlan_segment = self._get_segments(
            context.original_top_bound_segment,
            context.original_bottom_bound_segment)

        if (self._is_vm_migrating(context, vlan_segment, orig_vlan_segment) or
            self._is_status_down(context.current)):
            vni = (self._port_action_vxlan(
                context.original, orig_vxlan_segment, self._delete_nve_db)
                if orig_vxlan_segment else 0)
            self._port_action_vlan(context.original, orig_vlan_segment,
                                   self._delete_nxos_db, vni)
        elif self._is_supported_deviceowner(context.current):
            vni = self._port_action_vxlan(context.current, vxlan_segment,
                        self._configure_nve_db) if vxlan_segment else 0
            self._port_action_vlan(context.current, vlan_segment,
                                   self._configure_nxos_db, vni)
768736
def process_update(self, update):
        """"""
        data = json.loads(update)
        NetworkTables.getEntry(data["k"]).setValue(data["v"])
386971
def create_vlan(self, nexus_host, vlanid, vni):
        """"""

        starttime = time.time()
        path_snip, body_snip = self.start_create_vlan()
        body_snip = self.get_create_vlan(nexus_host, vlanid, vni, body_snip)
        body_snip = self.end_create_vlan(body_snip)

        self.send_edit_string(nexus_host, path_snip, body_snip)

        self.capture_and_print_timeshot(
            starttime, "create_vlan_seg",
            switch=nexus_host)
916892
def add_vxlan_port(self, name, remote_ip,
                       local_ip=None, key=None, ofport=None):
        
        self.add_tunnel_port(name, 'vxlan', remote_ip,
                             local_ip=local_ip, key=key, ofport=ofport)