Source ports for this blacklist entry. If no ports are specified (i.e. ALL
        ports), 'ANY' is returned.
        
        :rtype: str
170711
def source_ports(self):
        
        start_port = self.blacklist.get('BlacklistEntrySourcePort')
        if start_port is not None:
            return '{}-{}'.format(
                start_port, self.blacklist.get('BlacklistEntrySourcePortRange'))
        return 'ANY'
1062252
def verify_ports(port_list):
    
    result = True  # empty list is ok
    for item in port_list:
        try:
            (port, protocol) = item.split(PORT_SEPARATOR)
            port_num = int(port)
        except ValueError:
            result = False
            break
        result &= protocol in ALLOWED_PROTOCOLS
        result &= port == str(port_num)
    return result
958967
def _parse_ports(self, ports):
        
        if not ports:
            return []

        return [tuple(port_pair.split("::")) for port_pair in ports.strip(";").split(";")]
258243
def available_ports(low=1024, high=65535, exclude_ranges=None):
    
    if exclude_ranges is None:
        exclude_ranges = []
    available = utils.ranges_to_set(UNASSIGNED_RANGES)
    exclude = utils.ranges_to_set(
        ephemeral.port_ranges() + exclude_ranges +
        [
            SYSTEM_PORT_RANGE,
            (SYSTEM_PORT_RANGE[1], low),
            (high, 65536)
        ]
    )
    return available.difference(exclude)
1066831
def check_port(helper, port):
    
    try:
        int(port)
    except ValueError:
        helper.exit(summary="Port (-p) must be a integer value.", exit_code=unknown, perfdata='')
970612
def ports(self):
        

        if not self.get_objects_by_type('port'):
            self.inventory()
        return {int(p.index.split('/')[1]): p for p in self.get_objects_by_type('port')}
646096
def filter_inactive_ports(query):
    
    port_model = models_v2.Port
    query = (query
             .filter(port_model.status == n_const.PORT_STATUS_ACTIVE))
    return query
33347
def get_active_ports(self):
        

        if not self.resource_groups:
            return self.ports
        else:
            active_ports = OrderedDict()
            for resource_group in self.resource_groups.values():
                for active_port in resource_group.active_ports:
                    active_ports[active_port] = self.ports[active_port]
            return active_ports
785086
def select_random(ports=None, exclude_ports=None):
    
    if ports is None:
        ports = available_good_ports()

    if exclude_ports is None:
        exclude_ports = set()

    ports.difference_update(set(exclude_ports))

    for port in random.sample(ports, min(len(ports), 100)):
        if not port_is_used(port):
            return port
    raise PortForException("Can't select a port")
1118718
def p_ports(self, p):
        ''
        wid = None
        port = Port(name=p[3], width=wid, type=None, lineno=p.lineno(1))
        p[0] = p[1] + (port,)
        p.set_lineno(0, p.lineno(1))
1141801
def p_portlist_io(self, p):
        ''
        p[0] = Portlist(ports=p[2], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
668448
def get_reachable_ports(self, id_or_uri, start=0, count=-1, filter='', query='', sort='', networks=[]):
        
        uri = self._client.build_uri(id_or_uri) + "/reachable-ports"

        if networks:
            elements = "\'"
            for n in networks:
                elements += n + ','
            elements = elements[:-1] + "\'"
            uri = uri + "?networks=" + elements

        return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
                                                             sort=sort, uri=uri))
348868
def port(self, name):
        
        for p in self.ports:
            if p.name == name:
                return p
971177
def findport(self, port):
        
        for p in self.ports:
            if p[0] == p:
                return p
        p = (port, [])
        self.ports.append(p)
        return p
787501
def find_available_local_port():
	
	infos = socket.getaddrinfo(None, 0, socket.AF_UNSPEC, socket.SOCK_STREAM)
	family, proto, _, _, addr = next(iter(infos))
	sock = socket.socket(family, proto)
	sock.bind(addr)
	addr, port = sock.getsockname()[:2]
	sock.close()
	return port
405329
def find_interconnect_ports(self):
        

        phy_port_list = self.ext_br_obj.get_port_name_list()
        int_port_list = self.integ_br_obj.get_port_name_list()
        for port in phy_port_list:
            # Use get Interface  xxx type
            is_patch = ovs_lib.is_patch(self.root_helper, port)
            if is_patch:
                # Get the peer for this patch
                peer_port = ovs_lib.get_peer(self.root_helper, port)
                if peer_port in int_port_list:
                    return port, peer_port
        # A solution is needed for veth pairs also, fixme(padkrish)
        # ip_wrapper.get_devices() returns all the devices
        # Pick the ones whose type is veth (?) and get the other pair
        # Combination of "ethtool -S xxx" command and "ip tool" command.
        return None, None
1023896
def calc_device_links(self):
        
        for connection in self.interfaces:
            int_type = connection['from'][0]
            int_name = connection['from'].replace(int_type,
                                                  PORT_TYPES[int_type.upper()])
            # Get the source port id
            src_port = None
            for port in self.node['ports']:
                if int_name == port['name']:
                    src_port = port['id']
                    break
            dest_temp = connection['to'].split(' ')

            if len(dest_temp) == 2:
                conn_to = {'device': dest_temp[0],
                           'port': dest_temp[1]}
            else:
                conn_to = {'device': 'NIO',
                           'port': dest_temp[0]}

            self.calc_link(self.node['id'], src_port, int_name, conn_to)