Search in sources :

Example 1 with PiPipeconfEvent

use of org.onosproject.net.pi.service.PiPipeconfEvent in project onos by opennetworkinglab.

the class PiPipeconfManager method register.

@Override
public void register(PiPipeconf pipeconf) throws IllegalStateException {
    checkNotNull(pipeconf);
    if (pipeconfs.containsKey(pipeconf.id())) {
        throw new IllegalStateException(format("Pipeconf %s is already registered", pipeconf.id()));
    }
    pipeconfs.put(pipeconf.id(), pipeconf);
    log.info("New pipeconf registered: {} (fingerprint={})", pipeconf.id(), HexString.toHexString(pipeconf.fingerprint()));
    executor.execute(() -> attemptMergeAll(pipeconf.id()));
    post(new PiPipeconfEvent(PiPipeconfEvent.Type.REGISTERED, pipeconf));
}
Also used : PiPipeconfEvent(org.onosproject.net.pi.service.PiPipeconfEvent)

Example 2 with PiPipeconfEvent

use of org.onosproject.net.pi.service.PiPipeconfEvent in project onos by opennetworkinglab.

the class PiPipeconfManager method unregister.

@Override
public void unregister(PiPipeconfId pipeconfId) throws IllegalStateException {
    checkNotNull(pipeconfId);
    // TODO add mechanism to remove from device.
    if (!pipeconfs.containsKey(pipeconfId)) {
        throw new IllegalStateException(format("Pipeconf %s is not registered", pipeconfId));
    }
    // TODO remove the binding from the distributed Store when the lifecycle of a pipeconf is defined.
    // pipeconfMappingStore.removeBindings(pipeconfId);
    final PiPipeconf pipeconf = pipeconfs.remove(pipeconfId);
    log.info("Unregistered pipeconf: {} (fingerprint={})", pipeconfId, HexString.toHexString(pipeconf.fingerprint()));
    post(new PiPipeconfEvent(PiPipeconfEvent.Type.UNREGISTERED, pipeconfId));
}
Also used : PiPipeconf(org.onosproject.net.pi.model.PiPipeconf) PiPipeconfEvent(org.onosproject.net.pi.service.PiPipeconfEvent)

Aggregations

PiPipeconfEvent (org.onosproject.net.pi.service.PiPipeconfEvent)2 PiPipeconf (org.onosproject.net.pi.model.PiPipeconf)1