Class UCentralClient


  • public class UCentralClient
    extends Object
    uCentral OpenAPI client. This implementation supports both public and private endpoints.

    For public endpoint communication:

    • Hardcode owsec URL and use "/systemendpoints" endpoint since Kafka may be inaccessible; access to Kafka is a hack for development only, but could be secured in production with SASL/MTLS
    • Exchange username/password for an oauth token to pass to other services
    For private endpoint communication:
    • Use Kafka "system_endpoints" topic to find the private endpoint and API key for each service
    • Constructor Detail

      • UCentralClient

        public UCentralClient​(String rrmEndpoint,
                              boolean usePublicEndpoints,
                              String uCentralSecPublicEndpoint,
                              String username,
                              String password,
                              int connectTimeoutMs,
                              int socketTimeoutMs,
                              int wifiScanTimeoutMs)
        Constructor.
        Parameters:
        rrmEndpoint - advertise this RRM endpoint to the SDK
        usePublicEndpoints - whether to use public or private endpoints
        uCentralSecPublicEndpoint - the uCentralSec public endpoint (if needed)
        username - uCentral username (for public endpoints only)
        password - uCentral password (for public endpoints only)
        connectTimeoutMs - connection timeout for all requests, in ms
        socketTimeoutMs - socket timeout for all requests, in ms
        wifiScanTimeoutMs - socket timeout for wifi scan requests, in ms
    • Method Detail

      • verifySsl

        public static void verifySsl​(boolean enable)
        Toggle verifying SSL/TLS certificates. This should be set only during initialization, otherwise it may NOT take effect.
      • login

        public boolean login()
        Perform login and uCentralGw endpoint retrieval.
      • isInitialized

        public boolean isInitialized()
        Return true if this service has learned the endpoints of all essential dependent services, along with API keys (if necessary).
      • isProvInitialized

        public boolean isProvInitialized()
        Return true if this service has learned the owprov endpoint, along with API keys (if necessary).
      • getSystemInfo

        public SystemInfoResults getSystemInfo()
        Get uCentralGw system info.
      • wifiScan

        public CommandInfo wifiScan​(String serialNumber,
                                    boolean verbose)
        Launch a wifi scan for a device (by serial number).

        An AP can conduct a wifiscan, which can be either active or passive. In an active wifiscan, the AP sends out a wifiscan request and listens for responses from other APs. In a passive wifiscan, the AP does not send out a wifiscan request but instead just waits for periodic beacons from the other APs. (Note that neither the responses to requests (in active mode) or the periodic beacons are guaranteed to happen at any particular time (and it depends on network traffic)).

        The AP conducting the wifiscan goes through every channel and listens for responses/beacons. However, the responding/beaconing APs only send responses on channels they are currently using.

      • configure

        public CommandInfo configure​(String serialNumber,
                                     String configuration)
        Configure a device (by serial number).
      • getLatestStats

        public StatisticsRecords getLatestStats​(String serialNumber,
                                                int limit)
        Return the given number of latest statistics from a device (by serial number).
      • getCapabilities

        public DeviceCapabilities getCapabilities​(String serialNumber)
        Launch a get capabilities command for a device (by serial number).
      • runScript

        public CommandInfo runScript​(String serialNumber,
                                     String script,
                                     int timeoutSec,
                                     String type)
        Run a script on a device and return the result, or null upon error.
        Parameters:
        serialNumber - the device
        script - the script contents
        timeoutSec - the timeout in seconds
        type - the script type (either "shell" or "ucode")
        See Also:
        UCentralUtils.getScriptOutput(CommandInfo)
      • getProvInventory

        public InventoryTagList getProvInventory()
        Retrieve a list of inventory from owprov.
      • getProvInventoryForRRM

        public SerialNumberList getProvInventoryForRRM()
        Retrieve a list of inventory with RRM enabled from owprov.
      • getProvInventoryRRMDetails

        public RRMDetails getProvInventoryRRMDetails​(String serialNumber)
        Retrieve the RRM config and schedule for a specific AP
        Parameters:
        serialNumber - the serial number of the AP
        Returns:
        RRMDetails, containing information about the RRM schedule and parameters
      • getProvVenues

        public VenueList getProvVenues()
        Retrieve a list of venues from owprov.
      • getProvEntities

        public EntityList getProvEntities()
        Retrieve a list of entities from owprov.
      • setServiceEndpoint

        public void setServiceEndpoint​(String service,
                                       ServiceEvent event)
        System endpoints and API keys come from the service_event Kafka topic.