Search in sources :

Example 16 with TunnelId

use of org.onosproject.incubator.net.tunnel.TunnelId in project onos by opennetworkinglab.

the class TunnelManager method setupTunnel.

@Override
public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) {
    // TODO: producerId to check if really required to consider while setup the tunnel.
    checkNotNull(tunnel, TUNNNEL_NULL);
    TunnelId tunnelId = store.createOrUpdateTunnel(tunnel, State.INIT);
    if (tunnelId != null) {
        Set<ProviderId> ids = getProviders();
        Tunnel newT = queryTunnel(tunnelId);
        for (ProviderId providerId : ids) {
            TunnelProvider provider = getProvider(providerId);
            provider.setupTunnel(srcElementId, newT, path);
        }
    }
    return tunnelId;
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) TunnelProvider(org.onosproject.incubator.net.tunnel.TunnelProvider) Tunnel(org.onosproject.incubator.net.tunnel.Tunnel) DefaultTunnel(org.onosproject.incubator.net.tunnel.DefaultTunnel) TunnelId(org.onosproject.incubator.net.tunnel.TunnelId)

Example 17 with TunnelId

use of org.onosproject.incubator.net.tunnel.TunnelId in project onos by opennetworkinglab.

the class VirtualNetworkManagerTest method testAddTunnelId.

/**
 * Tests the addTunnelId, getTunnelIds(), removeTunnelId() methods with the store.
 */
@Test
public void testAddTunnelId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    ConnectPoint cp1 = new ConnectPoint(DID1, P1);
    ConnectPoint cp2 = new ConnectPoint(DID2, P1);
    VirtualNetworkIntent virtualIntent = VirtualNetworkIntent.builder().networkId(virtualNetwork.id()).key(Key.of("Test", APP_ID)).appId(APP_ID).ingressPoint(cp1).egressPoint(cp2).build();
    TunnelId tunnelId = TunnelId.valueOf("virtual tunnel");
    // Add the intent to tunnelID mapping to the store.
    manager.store.addTunnelId(virtualIntent, tunnelId);
    assertEquals("The tunnels size should match.", 1, manager.store.getTunnelIds(virtualIntent).size());
    // Remove the intent to tunnelID mapping from the store.
    manager.store.removeTunnelId(virtualIntent, tunnelId);
    assertTrue("The tunnels should be empty.", manager.store.getTunnelIds(virtualIntent).isEmpty());
}
Also used : DefaultVirtualNetwork(org.onosproject.incubator.net.virtual.DefaultVirtualNetwork) VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualNetworkIntent(org.onosproject.incubator.net.virtual.VirtualNetworkIntent) ConnectPoint(org.onosproject.net.ConnectPoint) TunnelId(org.onosproject.incubator.net.tunnel.TunnelId) Test(org.junit.Test)

Aggregations

TunnelId (org.onosproject.incubator.net.tunnel.TunnelId)17 Tunnel (org.onosproject.incubator.net.tunnel.Tunnel)15 DefaultTunnel (org.onosproject.incubator.net.tunnel.DefaultTunnel)10 ProviderId (org.onosproject.net.provider.ProviderId)7 HashSet (java.util.HashSet)5 DefaultOpticalTunnelEndPoint (org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint)5 IpTunnelEndPoint (org.onosproject.incubator.net.tunnel.IpTunnelEndPoint)5 OpticalTunnelEndPoint (org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint)5 TunnelEndPoint (org.onosproject.incubator.net.tunnel.TunnelEndPoint)5 TunnelProvider (org.onosproject.incubator.net.tunnel.TunnelProvider)5 TunnelService (org.onosproject.incubator.net.tunnel.TunnelService)4 DefaultTunnelDescription (org.onosproject.incubator.net.tunnel.DefaultTunnelDescription)3 TunnelDescription (org.onosproject.incubator.net.tunnel.TunnelDescription)3 TunnelEvent (org.onosproject.incubator.net.tunnel.TunnelEvent)3 TunnelSubscription (org.onosproject.incubator.net.tunnel.TunnelSubscription)3 SparseAnnotations (org.onosproject.net.SparseAnnotations)3 ArrayList (java.util.ArrayList)2 ApplicationId (org.onosproject.core.ApplicationId)2 DefaultApplicationId (org.onosproject.core.DefaultApplicationId)2 TunnelName (org.onosproject.incubator.net.tunnel.TunnelName)2