Examples of IResultSet


Examples of net.floodlightcontroller.storage.IResultSet

        try {
            Map<String, Object> row;

            // (..., null, null) for no predicate, no ordering
            IResultSet resultSet = storageSource.executeQuery(TABLE_NAME,
                    ColumnNames, null, null);

            // put retrieved rows into FirewallRules
            for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
                row = it.next().getRow();
                // now, parse row
                FirewallRule r = new FirewallRule();
                if (!row.containsKey(COLUMN_RULEID)
                        || !row.containsKey(COLUMN_DPID)) {
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

    @Override
    public List<Map<String, Object>> getStorageRules() {
        ArrayList<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
        try {
            // null1=no predicate, null2=no ordering
            IResultSet resultSet = storageSource.executeQuery(TABLE_NAME,
                    ColumnNames, null, null);
            for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
                l.add(it.next().getRow());
            }
        } catch (StorageException e) {
            logger.error("failed to access storage: {}", e.getMessage());
            // if the table doesn't exist, then wait to populate later via
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

     * Read switch properties from storage and set switch attributes accordingly
     */
    private void readPropertyFromStorage() {
        // At this time, also set other switch properties from storage
        boolean is_core_switch = false;
        IResultSet resultSet = null;
        try {
            String swid = sw.getStringId();
            resultSet = this.controller.getStorageSourceService()
                    .getRow(Controller.SWITCH_CONFIG_TABLE_NAME, swid);
            for (Iterator<IResultSet> it =
                    resultSet.iterator(); it.hasNext();) {
                is_core_switch = it.next()
                        .getBoolean(Controller.SWITCH_CONFIG_CORE_SWITCH);
                if (log.isDebugEnabled()) {
                    log.debug("Reading SWITCH_IS_CORE_SWITCH " +
                            "config for switch={}, is-core={}",
                            sw, is_core_switch);
                }
            }
        }
        finally {
            if (resultSet != null)
                resultSet.close();
        }
        if (is_core_switch) {
            sw.setAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH,
                            Boolean.valueOf(true));
        }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        String[] cols = {CONTROLLER_ID,
                         CONTROLLER_SYNC_ID,
                         CONTROLLER_SYNC_DOMAIN_ID,
                         CONTROLLER_SYNC_PORT};
        IResultSet res = null;
        try {
            res = storageSource.executeQuery(CONTROLLER_TABLE_NAME,
                                             cols, null, null);
            while (res.next()) {
                String controllerId = res.getString(CONTROLLER_ID);
                if (!res.containsColumn(CONTROLLER_SYNC_ID) ||
                    !res.containsColumn(CONTROLLER_SYNC_DOMAIN_ID) ||
                    !res.containsColumn(CONTROLLER_SYNC_PORT)) {
                    logger.debug("No sync data found for {}", controllerId);
                    continue;
                }

                short nodeId = res.getShort(CONTROLLER_SYNC_ID);
                short domainId = res.getShort(CONTROLLER_SYNC_DOMAIN_ID);
                int port = res.getInt(CONTROLLER_SYNC_PORT);
                String syncIp = getNodeIP(controllerId);
                if (syncIp == null) {
                    logger.debug("No sync IP found for {}", controllerId);
                    continue;
                }
                Node node = new Node(syncIp, port, nodeId, domainId);
                nodes.add(node);

                if (thisControllerID.equals(controllerId))
                    thisNodeId = nodeId;
            }
        } finally {
            if (res != null) res.close();
        }

        if (nodes.size() == 0)
            throw new SyncException("No valid nodes found");
        if (thisNodeId < 0)
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        String[] cols = {CONTROLLER_INTERFACE_CONTROLLER_ID,
                         CONTROLLER_INTERFACE_TYPE,
                         CONTROLLER_INTERFACE_NUMBER,
                         CONTROLLER_INTERFACE_DISCOVERED_IP};
        IResultSet res = null;
        try {
            res = storageSource.executeQuery(CONTROLLER_INTERFACE_TABLE_NAME,
                                             cols, null, null);
            while (res.next()) {
                logger.debug("{} {} {} {}",
                             new Object[] {res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID),
                                           res.getString(CONTROLLER_INTERFACE_TYPE),
                                           res.getIntegerObject(CONTROLLER_INTERFACE_NUMBER),
                                           res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP)});
                if ("Ethernet".equals(res.getString(CONTROLLER_INTERFACE_TYPE)) &&
                    Integer.valueOf(0).equals(res.getIntegerObject(CONTROLLER_INTERFACE_NUMBER)) &&
                    controllerID.equals(res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID)))
                    return res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP);
            }
            return null;

        } finally {
            if (res != null) res.close();
        }

    }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

            explanation="Could not retrieve forwarding configuration",
            recommendation=LogMessageDoc.CHECK_CONTROLLER)
    private void readFlowPriorityConfigurationFromStorage() {
        try {
            Map<String, Object> row;
            IResultSet resultSet = storageSource.executeQuery(
                FLOW_PRIORITY_TABLE_NAME, FLOW_COLUMN_NAMES, null, null);
            if (resultSet == null)
                return;

            for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
                row = it.next().getRow();
                if (row.containsKey(FLOW_COLUMN_PRIMARY_KEY)) {
                    String primary_key = (String) row.get(FLOW_COLUMN_PRIMARY_KEY);
                    if (primary_key.equals(FLOW_VALUE_PRIMARY_KEY)) {
                        if (row.containsKey(FLOW_COLUMN_ACCESS_PRIORITY)) {
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

            // controller interface. Might change.
            // We could (should?) implement this using
            // predicates, but creating the individual and compound predicate
            // seems more overhead then just checking every row. Particularly,
            // since the number of rows is small and changes infrequent
            IResultSet res = storageSource.executeQuery(CONTROLLER_INTERFACE_TABLE_NAME,
                    colNames,null, null);
            while (res.next()) {
                if (res.getString(CONTROLLER_INTERFACE_TYPE).equals("Ethernet") &&
                        res.getInt(CONTROLLER_INTERFACE_NUMBER) == 0) {
                    String controllerID = res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID);
                    String discoveredIP = res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP);
                    String curIP = controllerNodeIPsCache.get(controllerID);

                    curControllerNodeIPs.put(controllerID, discoveredIP);
                    if (curIP == null) {
                        // new controller node IP
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        resultSet.close();
    }
   
    @Test
    public void testInsertRows() {
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
        checkExpectedResults(resultSet, PERSON_COLUMN_LIST, PERSON_INIT_DATA);
    }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

        Object[][] expectedResults = {
                {"John", "Smith", 40},
                {"Jim", "White", 24},
        };
        String[] columnList = {PERSON_FIRST_NAME,PERSON_LAST_NAME,PERSON_AGE};
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, columnList,
                new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "Sm"),
                new RowOrdering(PERSON_SSN));
        checkExpectedResults(resultSet, columnList, expectedResults);
    }
View Full Code Here

Examples of net.floodlightcontroller.storage.IResultSet

                {"Susan", "Jones"},
                {"Jose", "Garcia"},
                {"Abigail", "Johnson"},
                {"John", "McEnroe"}
        };
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, columnList,
                new CompoundPredicate(CompoundPredicate.Operator.AND, false,
                        new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "G"),
                        new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.LT, "N")
                ),
                new RowOrdering(PERSON_SSN));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.