use of org.onosproject.net.provider.ProviderId 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.net.provider.ProviderId in project onos by opennetworkinglab.
the class TunnelManager method borrowTunnel.
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, TunnelEndPoint dst, Annotations... annotations) {
Collection<Tunnel> tunnels = store.borrowTunnel(consumerId, src, dst, annotations);
if (tunnels == null || tunnels.isEmpty()) {
Tunnel tunnel = new DefaultTunnel(null, src, dst, null, null, null, null, null, annotations);
Set<ProviderId> ids = getProviders();
for (ProviderId providerId : ids) {
TunnelProvider provider = getProvider(providerId);
provider.setupTunnel(tunnel, null);
}
}
return tunnels;
}
use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.
the class TunnelManager method updateTunnel.
@Override
public void updateTunnel(Tunnel tunnel, Path path) {
store.createOrUpdateTunnel(tunnel);
if (tunnel.providerId() != null) {
TunnelProvider provider = getProvider(tunnel.providerId());
if (provider != null) {
provider.updateTunnel(tunnel, path);
}
} else {
Set<ProviderId> ids = getProviders();
for (ProviderId providerId : ids) {
TunnelProvider provider = getProvider(providerId);
provider.updateTunnel(tunnel, path);
}
}
}
use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.
the class HostEventTest method createHost.
private Host createHost() {
MacAddress mac = MacAddress.valueOf("00:00:11:00:00:01");
VlanId vlan = VlanId.vlanId((short) 10);
HostLocation loc = new HostLocation(DeviceId.deviceId("of:foo"), PortNumber.portNumber(100), 123L);
Set<IpAddress> ipset = Sets.newHashSet(IpAddress.valueOf("10.0.0.1"), IpAddress.valueOf("10.0.0.2"));
HostId hid = HostId.hostId(mac, vlan);
return new DefaultHost(new ProviderId("of", "foo"), hid, mac, vlan, loc, ipset);
}
use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.
the class HostServiceAdapter method getHost.
@Override
public Host getHost(HostId hostId) {
ProviderId providerId = ProviderId.NONE;
MacAddress mac = MacAddress.valueOf("fa:12:3e:56:ee:a2");
VlanId vlan = VlanId.NONE;
HostLocation location = HostLocation.NONE;
Set<IpAddress> ips = Sets.newHashSet();
Annotations annotations = null;
return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations);
}
Aggregations