Disonnect nic device with network.

        :param str userid: the user's name who owns the nic
        :param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
        :param bool active: whether make the change on active guest system
770036
def guest_nic_uncouple_from_vswitch(self, userid, nic_vdev,
                                        active=False):
        
        self._networkops.uncouple_nic_from_vswitch(userid, nic_vdev,
                                                   active=active)
308772
def connectNetToMs(Facility_presence=0, ProgressIndicator_presence=0,
                   ConnectedNumber_presence=0, ConnectedSubaddress_presence=0,
                   UserUser_presence=0):
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x7)  # 00000111
    packet = a / b
    if Facility_presence is 1:
        c = FacilityHdr(ieiF=0x1C, eightBitF=0x0)
        packet = packet / c
    if ProgressIndicator_presence is 1:
        d = ProgressIndicatorHdr(ieiPI=0x1E, eightBitPI=0x0)
        packet = packet / d
    if ConnectedNumber_presence is 1:
        e = ConnectedNumberHdr(ieiCN=0x4C, eightBitCN=0x0)
        packet = packet / e
    if ConnectedSubaddress_presence is 1:
        f = ConnectedSubaddressHdr(ieiCS=0x4D, eightBitCS=0x0)
        packet = packet / f
    if UserUser_presence is 1:
        g = UserUserHdr(ieiUU=0x7F, eightBitUU=0x0)
        packet = packet / g
    return packet
756462
def devid(self):
        
        d = self.device
        vend_id = d.get('ID_VENDOR_ID')
        model_id = d.get('ID_MODEL_ID')
        return (vend_id, model_id)
149289
def set_identifier(identifier, conf)
      network_name, self.name = identifier.split('/', 2) if identifier
      set_network(network_name, conf)
    end
1123729
def get_device_spec(vnic, set_connected):
        
        nic_spec = VNicService.create_vnic_spec(vnic)
        VNicService.set_vnic_connectivity_status(nic_spec, to_connect=set_connected)
        return nic_spec
983685
def set_system_id(self, system_id):
        

        yield from self._hypervisor.send('{platform} set_system_id "{name}" {system_id}'.format(platform=self._platform,
                                                                                                name=self._name,
                                                                                                system_id=system_id))

        log.info('Router "{name}" [{id}]: system ID updated from {old_id} to {new_id}'.format(name=self._name,
                                                                                              id=self._id,
                                                                                              old_id=self._system_id,
                                                                                              new_id=system_id))
        self._system_id = system_id
376375
def guest_reset(self, userid):
        """"""
        LOG.info("Begin to reset vm %s", userid)
        self._smtclient.guest_reset(userid)
        LOG.info("Complete reset vm %s", userid)
953615
def _on_namreply(self, connection, event):
        

        ch_type, channel, nick_list = event.arguments

        if channel == '*':
            # User is not in any visible channel
            # http://tools.ietf.org/html/rfc2812#section-3.2.5
            return

        for nick in nick_list.split():
            nick_modes = []

            if nick[0] in self.connection.features.prefix:
                nick_modes.append(self.connection.features.prefix[nick[0]])
                nick = nick[1:]

            for mode in nick_modes:
                self.channels[channel].set_mode(mode, nick)

            self.channels[channel].add_user(nick)
452060
def _get_merged_nics(hypervisor, profile, interfaces=None, dmac=None):
    '''
    
    '''
    nicp = _nic_profile(profile, hypervisor, dmac=dmac) if profile else []
    log.debug('NIC profile is %s', nicp)
    if interfaces:
        users_nics = _complete_nics(interfaces, hypervisor)
        for unic in users_nics:
            found = [nic for nic in nicp if nic['name'] == unic['name']]
            if found:
                found[0].update(unic)
            else:
                nicp.append(unic)
        log.debug('Merged NICs: %s', nicp)
    return nicp
458692
def get_networkid(vm_):
    '''
    
    '''
    networkid = config.get_cloud_config_value('networkid', vm_, __opts__)

    if networkid is not None:
        return networkid
    else:
        return False
316117
def add_nexusnve_binding(vni, switch_ip, device_id, mcast_group):
    """"""
    LOG.debug("add_nexusnve_binding() called")
    session = bc.get_writer_session()
    binding = nexus_models_v2.NexusNVEBinding(vni=vni,
                                              switch_ip=switch_ip,
                                              device_id=device_id,
                                              mcast_group=mcast_group)
    session.add(binding)
    session.flush()
    return binding
503936
def guest_reboot(self, userid):
        
        action = "reboot guest '%s'" % userid
        with zvmutils.log_and_reraise_sdkbase_error(action):
            self._vmops.guest_reboot(userid)
763913
def _dev_by_id(self, device_type):
        
        dir = os.path.join("/dev", device_type, "by-id")
        if os.path.isdir(dir):
            to_ret = dict(
                self._hex_ids([os.path.join(dir, f) for f in os.listdir(dir)])
            )
            return to_ret
        else:
            logger.error(
                "Could not get %s devices by id. "
                "This could be because your Linux distribution "
                "does not use udev, or does not create /dev/%s/by-id "
                "symlinks. Please submit an issue to github.com/"
                "armmbed/mbed-ls.",
                device_type,
                device_type,
            )
            return {}
514734
def network_delete_notif(self, tenant_id, tenant_name, net_id):
        
        for ip in self.obj_dict:
            drvr_obj = self.obj_dict.get(ip).get('drvr_obj')
            ret = drvr_obj.network_delete_notif(tenant_id, tenant_name,
                                                net_id)
            LOG.info("Driver with IP %(ip)s return %(ret)s for network "
                     "delete notification", {'ip': ip, 'ret': ret})
19996
def _get_nics(dom):
    '''
    
    '''
    nics = {}
    doc = ElementTree.fromstring(dom.XMLDesc(0))
    for iface_node in doc.findall('devices/interface'):
        nic = {}
        nic['type'] = iface_node.get('type')
        for v_node in iface_node:
            if v_node.tag == 'mac':
                nic['mac'] = v_node.get('address')
            if v_node.tag == 'model':
                nic['model'] = v_node.get('type')
            if v_node.tag == 'target':
                nic['target'] = v_node.get('dev')
            # driver, source, and match can all have optional attributes
            if re.match('(driver|source|address)', v_node.tag):
                temp = {}
                for key, value in six.iteritems(v_node.attrib):
                    temp[key] = value
                nic[v_node.tag] = temp
            # virtualport needs to be handled separately, to pick up the
            # type attribute of the virtualport itself
            if v_node.tag == 'virtualport':
                temp = {}
                temp['type'] = v_node.get('type')
                for key, value in six.iteritems(v_node.attrib):
                    temp[key] = value
                nic['virtualport'] = temp
        if 'mac' not in nic:
            continue
        nics[nic['mac']] = nic
    return nics
1226653
def iter_user_identities(user):
    """"""
    from indico_vc_vidyo.plugin import VidyoPlugin
    providers = authenticators_re.split(VidyoPlugin.settings.get('authenticators'))
    done = set()
    for provider in providers:
        for _, identifier in user.iter_identifiers(check_providers=True, providers={provider}):
            if identifier in done:
                continue
            done.add(identifier)
            yield identifier
883467
def set_network_status(network_id,status,**kwargs):
    
    user_id = kwargs.get('user_id')
    #check_perm(user_id, 'delete_network')
    try:
        net_i = db.DBSession.query(Network).filter(Network.id == network_id).one()
        net_i.check_write_permission(user_id)
        net_i.status = status
    except NoResultFound:
        raise ResourceNotFoundError("Network %s not found"%(network_id))
    db.DBSession.flush()
    return 'OK'