Versions Compared

Key

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

...

  • ConfigFactory ties a subject to its config and config key, and generates Configs. Example: The ConfigFactory for OpticalPortConfig is defined as:

     

    Code Block
    languagejava
    // ConfigFactory<S, C extends Config<S>> 
    new ConfigFactory<ConnectPoint, OpticalPortConfig>(CONNECT_POINT_SUBJECT_FACTORY, OpticalPortConfig.class, "basic") {
    		@Override public OpticalPortConfig createConfig() {
    return new OpticalPortConfig(); 
    } 
    }

     

    indicating that the ConfigFactory can generate OpticalPortConfigs, and the configuration information for a given optical port can be fetched from the subsystem’s manager using its associated subject (a ConnectPoint in this case). In the JSON structure, the key “basic” can be used to fetch out the values set by the OpticalPortConfig.

Syntax

The relationship between the subject, config, subject key, and config key are summarized by the following JSON tree:

Code Block
  {
      subject key 1 : {
          subject 1 : {
              config key : {
                  config fields
              }
          },
          subject 2 : {
            ...
      },
      subject key 2 {
      ...        
  }

where config fields above are key:value entries following the JSON format. Each field in a Config with an attribute accessor is represented by such a key:value pair.

For example, a configuration for a single device might look like the following:

Code Block
  {
     "devices" : {
        "of:0000ffffffffff0a" : {
            "basic": {
                "driver": "linc-oe",
                "type": "ROADM",
                "latitude": 33.8,
                "name": "ATL-S10",
                "longitude": -84.1
            }
        }
     }
  }

 

Indeed, if you were to take a look at BasicDeviceConfig and its superclass, you will find all of the fields within the “basic” clause above defined amongst the two classes.

Using Network Configuration Services

...

REST API

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
languagebash
curl --user onos:rocks -X POST -H "Content-Type: application/json" http://192.168.56.111:8181/onos/v1/network/configuration/ -d @/tmp/cfg.json

 

The above assumes a running instance at 192.168.56.111, 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.

 

...