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;
}
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());
}
Aggregations