Package controller.util

Examples of controller.util.JSONArray


    // Get the string IDs of all the switches and create switch summary
    // objects for each one
    try {
      Future<Object> devices = Deserializer.readJsonArrayFromURL("http://" + IP
          + ":" + PORT + "/wm/device/");
      JSONArray json = (JSONArray) devices.get(5, TimeUnit.SECONDS);
      for (int i = 0; i < json.length(); i++) {
        obj = json.getJSONObject(i);
        DeviceSummary temp = new DeviceSummary(obj.getJSONArray("mac")
            .getString(0));
        if (!obj.getJSONArray("ipv4").isNull(0))
          temp.setIpv4(obj.getJSONArray("ipv4").getString(0));
        if (!obj.getJSONArray("attachmentPoint").isNull(0)) {
View Full Code Here


               
                // Flow Stats
                sw.setFlows(FlowJSON.getFlows(dpid));
               
                // Port and Features stats
                JSONArray json = portObj.getJSONArray(sw.getDpid());
                JSONObject objtwo = featuresObj.getJSONObject(sw.getDpid());
                JSONArray jsontwo = objtwo.getJSONArray("ports");
                for(int i = 0; i < json.length(); i++)
                {
                    obj = (JSONObject)json.get(i);
                    Port port = new Port(String.valueOf(obj.getInt("portNumber")));
                    port.setReceivePackets(FormatLong.formatPackets(obj.getLong("receivePackets"), false, false));
                    port.setTransmitPackets(FormatLong.formatPackets(obj.getLong("transmitPackets"), false, false));
                    port.setReceiveBytes(FormatLong.formatBytes(obj.getLong("receiveBytes"), true, false));
                    port.setTransmitBytes(FormatLong.formatBytes(obj.getLong("transmitBytes"), true, false));
                    port.setReceiveDropped(String.valueOf(obj.getLong("receiveDropped")));
                    port.setTransmitDropped(String.valueOf(obj.getLong("transmitDropped")));
                    port.setReceiveErrors(String.valueOf(obj.getLong("receiveErrors")));
                    port.setTransmitErrors(String.valueOf(obj.getLong("transmitErrors")));
                    port.setReceieveFrameErrors(String.valueOf(obj.getInt("receiveFrameErrors")));
                    port.setReceieveOverrunErrors(String.valueOf(obj.getInt("receiveOverrunErrors")));
                    port.setReceiveCRCErrors(String.valueOf(obj.getInt("receiveCRCErrors")));
                    port.setCollisions(String.valueOf(obj.getInt("collisions")));
                    if(!jsontwo.isNull(i))
                    {
                        obj = (JSONObject)jsontwo.get(i);
                        port.setAdvertisedFeatures(String.valueOf(obj.getInt("advertisedFeatures")));
                        port.setConfig(String.valueOf(obj.getInt("config")));
                        port.setCurrentFeatures(String.valueOf(obj.getInt("currentFeatures")));
                        port.setHardwareAddress(obj.getString("hardwareAddress"));
                        port.setName(obj.getString("name"));
View Full Code Here

      // TODO Auto-generated catch block
      e.printStackTrace();
    }
       
     // Port and Features stats
        JSONArray json = portObj.getJSONArray(sw.getDpid());
        JSONObject objtwo = featuresObj.getJSONObject(sw.getDpid());
        JSONArray jsontwo = objtwo.getJSONArray("ports");
        for(int i = 0; i < json.length(); i++)
        {
            obj = (JSONObject)json.get(i);
            Port port = new Port(String.valueOf(obj.getInt("portNumber")));
            port.setReceivePackets(FormatLong.formatPackets(obj.getLong("receivePackets"), false, false));
            port.setTransmitPackets(FormatLong.formatPackets(obj.getLong("transmitPackets"), false, false));
            port.setReceiveBytes(FormatLong.formatBytes(obj.getLong("receiveBytes"), true, false));
            port.setTransmitBytes(FormatLong.formatBytes(obj.getLong("transmitBytes"), true, false));
            port.setReceiveDropped(String.valueOf(obj.getLong("receiveDropped")));
            port.setTransmitDropped(String.valueOf(obj.getLong("transmitDropped")));
            port.setReceiveErrors(String.valueOf(obj.getLong("receiveErrors")));
            port.setTransmitErrors(String.valueOf(obj.getLong("transmitErrors")));
            port.setReceieveFrameErrors(String.valueOf(obj.getInt("receiveFrameErrors")));
            port.setReceieveOverrunErrors(String.valueOf(obj.getInt("receiveOverrunErrors")));
            port.setReceiveCRCErrors(String.valueOf(obj.getInt("receiveCRCErrors")));
            port.setCollisions(String.valueOf(obj.getInt("collisions")));
            if(!jsontwo.isNull(i))
            {
                obj = (JSONObject)jsontwo.get(i);
                port.setAdvertisedFeatures(String.valueOf(obj.getInt("advertisedFeatures")));
                port.setConfig(String.valueOf(obj.getInt("config")));
                port.setCurrentFeatures(String.valueOf(obj.getInt("currentFeatures")));
                port.setHardwareAddress(obj.getString("hardwareAddress"));
                port.setName(obj.getString("name"));
View Full Code Here

TOP

Related Classes of controller.util.JSONArray

Copyright © 2018 www.massapicom. 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.