Versions Compared

Key

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

...

Now, you should have a fairly complete implementation of the BYON app, but it will only work from one instance. (Try running list-networks on another instance! It will not show you any networks.)

Lab 5:

...

Upgrading the store to make it distributed

The starter implementation of the DistributedNetworkStore uses a ConcurrentMap to store information about the virtual networks. This map only stores the data locally, and it knows nothing about other instances in the cluster. We will be replacing the map with a ConsistentMap which is cluster-aware, and one of the distributed primitives provided by ONOS.

Before we can instantiate a ConsistentMap, we need to get a reference to the StorageService; you can do this by uncommented in the StorageService reference near the top of the DistributedNetworkStore class.

Once you change the ConcurrentMap to a ConsistentMap, we will need to update the way the map is created in the activate() method. Here is how we can ask the storage service for a ConcurrentMap:

Code Block
networks = storageService.<String, Set<HostId>>consistentMapBuilder()
                         .withSerializer(Serializer.using(KryoNamespaces.API))
                         .withName("byon-networks")
                         .build();

You will notice a few compilation errors after making this change. This is because the ConcurrentMap returns a Versioned<Value>, rather than just a Value. You should fix the compilation errors marked by Lab 5 TODOs.

Next, let's recompile your application and push it to the ONOS cluster. You should now be able to create, update, and delete networks from any node, and your distributed store will the application running on all instances in sync. Open a few terminals and test this on the different instances. 

Lab 6: Network Events

 


In

...

Lab 5: Network Events

 In order to be able to communicate between ONOS instances we are going to make use of events. These events will be fired by the distributed store and caught by the manager in the peer ONOS instance. At this point the peer manager will notify any local listeners of the network event. 

...