Versions Compared

Key

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

...

You should drop into the cli. Now in another cli window let's start mininet.

 

Code Block
distributed@mininet-vm:~$ cd onos-byon && ./startmn.sh
mininet>

...

Code Block
languagejava
...
public class NetworkManager implements NetworkService {
...

 

We will need to implement all of the methods contained in NetworkService. For now, we can leave most of them empty. However, to be able to test the CLI, you should have implement getNetworks() return Lists.of("test"), and and implement getHosts() return Collections.emptyList().

...

Code Block
languagejava
    private Set<Intent> addToMesh(HostId src, Set<HostId> existing) {
    if (existing.isEmpty()) {
        return Collections.emptySet();
    }
    Set<Intent> submitted = new HashSet<>();
    existing.forEach(dst -> {
        if (!src.equals(dst)) {
            Intent intent = new HostToHostIntent(appId, src, dst);
            submitted.add(intent);
            intentService.submit(intent);
        }
    });
    return submitted;
}

private void removeFromMesh(Set<Intent> intents) {
    intents.forEach(i -> intentService.withdraw(i));
}

 

Verify that everything works

...

Code Block
languagejava
	@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
	protected EventDeliveryService eventDispatcher;

    private ApplicationId appId;
    private final AbstractListenerRegistry<NetworkEvent, NetworkListener>
            listenerRegistry = new AbstractListenerRegistry<>();

    private final NetworkStoreDelegate delegate = new InternalStoreDelegate();


Then we need to add a couple lines in the activate in order to register our Event type for our listeners and set our delegate.

...

To test this you will need to complete the extra credit section (big grin). 

Part 5: Distributed Store

...