Search in sources :

Example 1 with IntentDomainService

use of org.onosproject.incubator.net.domain.IntentDomainService in project onos by opennetworkinglab.

the class AddTunnelCommand method doExecute.

@Override
protected void doExecute() {
    IntentDomainService service = get(IntentDomainService.class);
    ConnectPoint one = ConnectPoint.deviceConnectPoint(oneString);
    ConnectPoint two = ConnectPoint.deviceConnectPoint(twoString);
    TunnelPrimitive tunnel = new TunnelPrimitive(appId(), one, two);
    // get the first domain (there should only be one)
    final IntentDomainId domainId;
    try {
        domainId = service.getDomains().iterator().next().id();
    } catch (NoSuchElementException | NullPointerException e) {
        print("No domains found");
        return;
    }
    service.request(domainId, tunnel).forEach(r -> service.submit(domainId, r));
    print("Intent domain tunnel submitted:\n%s", tunnel);
}
Also used : TunnelPrimitive(org.onosproject.incubator.net.domain.TunnelPrimitive) IntentDomainId(org.onosproject.incubator.net.domain.IntentDomainId) IntentDomainService(org.onosproject.incubator.net.domain.IntentDomainService) ConnectPoint(org.onosproject.net.ConnectPoint) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

NoSuchElementException (java.util.NoSuchElementException)1 IntentDomainId (org.onosproject.incubator.net.domain.IntentDomainId)1 IntentDomainService (org.onosproject.incubator.net.domain.IntentDomainService)1 TunnelPrimitive (org.onosproject.incubator.net.domain.TunnelPrimitive)1 ConnectPoint (org.onosproject.net.ConnectPoint)1