Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  • Config subclasses implement the tunables for a subject as a set of getters and setters (attribute accessors) to JSON object constructs (ObjectNodes). Example: An OpticalPortConfig is defined as:


    Code Block
    public class OpticalPortConfig extends Config<ConnectPoint>


    meaning that it manipulates the configurations associated with ConnectPoint subjects (optical ports). Some of its attribute accessors include the port’s string and numeric names, and the number of channels that the port supports.

  • SubjectFactory ties a subject to its subject key, and generates objects that represent the subject. Example: the factory that generates ConnectPoints is instantiated as:


    Code Block
    public static final SubjectFactory<ConnectPoint> CONNECT_POINT_SUBJECT_FACTORY = 
    		new SubjectFactory<ConnectPoint>(ConnectPoint.class, "ports") { 
    			@Override public ConnectPoint createSubject(String key) {
                		 return ConnectPoint.deviceConnectPoint(key); 


    meaning that the key for the JSON field containing port information is keyed on string “ports”, and the factory can create ConnectPoints from a “deviceId:port” string (the argument to createSubject).


Using Network Configuration Services

  • Via CLI or REST API
  • By loading a file from a fixed location using the
  • ConfigFactory required for what needs to be parsed
  • ConfigFactory registered with NetworkConfigManager, either by adding it to BasicNetworkConfigs which will load it when it starts up, or by manually invoking NetworkConfigManager.registerConfigFactory() from the application
  • Register application as a NetworkConfigListener
  • Via CLI or REST API
  • By loading a file from a fixed location using the Network Configuration Loader


The NetworkConfigWebResource implements the REST calls for the network configuration subsystem. Its functionalities will eventually replace that of ConfigWebResource.

The following example uses the REST API to upload a configuration file:


Code Block
curl --user onos:rocks -X POST -H "Content-Type: application/json" -d @/tmp/cfg.json

The above assumes a running instance at, and a configuration file at /tmp/cfg.json. They should be replaced with appropriate values.

Likewise, the user:password vaues may differ with your setup; Other common values are karaf:karaf and onos:onos.


Network Configuration Loader

The NetworkConfigLoader reads JSON files from a known location and attempts to load them as network configurations.

Currently, a file named network-cfg.json is picked up from ${ONOS_ROOT}/tools/package/config/ and placed in ${KARAF_ROOT}../config/ (currently fixed) at deployment. When the remote instance boots, its network configuration loader runtime will read this file.

The Network Configuration Loader is implemented as a listener for Network Configuration events (NetworkConfigEvents). It attempts to use the knwon Configs in order to generate or update entities in the network model once it is notified that the Configs are available.