def getUniqueSrcIps(self, protocol=6):
        uniqueIps = HashSet()
        srcAddrSqlBuilder = SelectSqlBuilder('Agg_V5', 'srcAddr as ip', distinct=1)
        srcAddrSqlBuilder.where('prot=%d' % protocol)
        srcIps = self._sqlClient.execute(srcAddrSqlBuilder)
        if srcIps:
            uniqueIps.addAll(Arrays.asList([ipEntry.ip for ipEntry in srcIps]))

        return uniqueIps.toArray()
    def getUniqueSrcIps(self, protocol=6):
        uniqueIps = HashSet()
        srcAddrSqlBuilder = SelectSqlBuilder('Agg_V5',
                                             'srcAddr as ip',
                                             distinct=1)
        srcAddrSqlBuilder.where('prot=%d' % protocol)
        srcIps = self._sqlClient.execute(srcAddrSqlBuilder)
        if srcIps:
            uniqueIps.addAll(Arrays.asList([ipEntry.ip for ipEntry in srcIps]))

        return uniqueIps.toArray()
    def getConnections(self, srcIps=None, hostId=None, protocol=6):
        srcIps = srcIps or []

        selectBuilder = SelectSqlBuilder('Agg_V5', 'hostId',
                                            'srcAddr as srcIp', 'srcPort',
                                            'dstAddr as dstIp', 'dstPort',
                                            'prot as protocol',
                                            'dPkts as packetCount',
                                            'dOctets as octetCount',
                                            dataObjectClass=ConnectionDetails)
        andClauses = []

        ipsClause = ','.join(["'%s'" % ip for ip in srcIps])
        srcIps and andClauses.append('srcAddr in (%s)' % ipsClause)
        andClauses.append('prot=%d' % protocol)
        hostId and andClauses.append("hostId='%s'" % hostId)

        selectBuilder.where(and_(*andClauses))

        connectionDetails = self._sqlClient.execute(selectBuilder)
        return connectionDetails
    def getConnections(self, srcIps=None, hostId=None, protocol=6):
        srcIps = srcIps or []

        selectBuilder = SelectSqlBuilder('Agg_V5',
                                         'hostId',
                                         'srcAddr as srcIp',
                                         'srcPort',
                                         'dstAddr as dstIp',
                                         'dstPort',
                                         'prot as protocol',
                                         'dPkts as packetCount',
                                         'dOctets as octetCount',
                                         dataObjectClass=ConnectionDetails)
        andClauses = []

        ipsClause = ','.join(["'%s'" % ip for ip in srcIps])
        srcIps and andClauses.append('srcAddr in (%s)' % ipsClause)
        andClauses.append('prot=%d' % protocol)
        hostId and andClauses.append("hostId='%s'" % hostId)

        selectBuilder.where(and_(*andClauses))

        connectionDetails = self._sqlClient.execute(selectBuilder)
        return connectionDetails