本文整理匯總了Java中org.onosproject.incubator.net.tunnel.TunnelEndPoint類的典型用法代碼示例。如果您正苦於以下問題:Java TunnelEndPoint類的具體用法?Java TunnelEndPoint怎麽用?Java TunnelEndPoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TunnelEndPoint類屬於org.onosproject.incubator.net.tunnel包,在下文中一共展示了TunnelEndPoint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTunnelAdded
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Test
public void testTunnelAdded() {
TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.1"));
TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.3"));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set("bandwidth", "1024").build();
List<Link> links = new ArrayList<Link>();
links.add(link);
TunnelDescription tunnel = new DefaultTunnelDescription(
TunnelId.valueOf("1234"),
src,
dst,
Tunnel.Type.VXLAN,
new DefaultGroupId(0),
this.provider.id(),
TunnelName.tunnelName("tunnel12"),
new DefaultPath(this.provider.id(), links, 0.3),
annotations);
provider.tunnelAdded(tunnel);
assertEquals(1, providerService.tunnelSet.size());
}
示例2: testTunnelRemoved
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Test
public void testTunnelRemoved() {
TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.1"));
TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.3"));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set("bandwidth", "1024").build();
List<Link> links = new ArrayList<Link>();
links.add(link);
TunnelDescription tunnel = new DefaultTunnelDescription(
TunnelId.valueOf("1234"),
src,
dst,
Tunnel.Type.VXLAN,
new DefaultGroupId(0),
this.provider.id(),
TunnelName.tunnelName("tunnel1"),
new DefaultPath(this.provider.id(), links, 0.3),
annotations);
provider.tunnelRemoved(tunnel);
assertEquals(0, providerService.tunnelSet.size());
}
示例3: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@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.size() == 0) {
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;
}
示例4: process
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public void process(long sid, ObjectNode payload) {
String srcId = string(payload, SRCID);
ElementId src = elementId(srcId);
String dstId = string(payload, DSTID);
ElementId dst = elementId(dstId);
Device srcDevice = deviceService.getDevice((DeviceId) src);
Device dstDevice = deviceService.getDevice((DeviceId) dst);
TunnelEndPoint tunSrc = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf(srcDevice.annotations().value("lsrId")));
TunnelEndPoint tunDst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf(dstDevice.annotations().value("lsrId")));
Collection<Tunnel> tunnelSet = tunnelService.queryTunnel(tunSrc, tunDst);
ObjectNode result = objectNode();
ArrayNode arrayNode = arrayNode();
for (Tunnel tunnel : tunnelSet) {
if (tunnel.type() == MPLS) {
arrayNode.add(tunnel.tunnelId().toString());
}
}
result.putArray(BUFFER_ARRAY).addAll(arrayNode);
sendMessage(PCEWEB_SHOW_TUNNEL, sid, result);
}
示例5: testTunnelAdded
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Test
public void testTunnelAdded() {
TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.1"));
TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.3"));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set("bandwidth", "1024").build();
List<Link> links = new ArrayList<Link>();
links.add(link);
TunnelDescription tunnel = new DefaultTunnelDescription(
TunnelId.valueOf("1234"),
src,
dst,
Tunnel.Type.VXLAN,
new GroupId(0),
this.provider.id(),
TunnelName.tunnelName("tunnel12"),
new DefaultPath(this.provider.id(), links, 0.3),
annotations);
provider.tunnelAdded(tunnel);
assertEquals(1, providerService.tunnelSet.size());
}
示例6: testTunnelRemoved
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Test
public void testTunnelRemoved() {
TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.1"));
TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf("192.168.1.3"));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set("bandwidth", "1024").build();
List<Link> links = new ArrayList<Link>();
links.add(link);
TunnelDescription tunnel = new DefaultTunnelDescription(
TunnelId.valueOf("1234"),
src,
dst,
Tunnel.Type.VXLAN,
new GroupId(0),
this.provider.id(),
TunnelName.tunnelName("tunnel1"),
new DefaultPath(this.provider.id(), links, 0.3),
annotations);
provider.tunnelRemoved(tunnel);
assertEquals(0, providerService.tunnelSet.size());
}
示例7: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@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;
}
示例8: queryTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) {
Collection<Tunnel> result = new HashSet<>();
Tunnel tunnel = null;
for (TunnelId tunnelId : tunnelIdAsKeyStore.keySet()) {
tunnel = tunnelIdAsKeyStore.get(tunnelId);
if ((null != tunnel) && (src.equals(tunnel.src())) && (dst.equals(tunnel.dst()))) {
result.add(tunnel);
}
}
return result.isEmpty() ? Collections.emptySet() : ImmutableSet.copyOf(result);
}
示例9: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId appId,
TunnelEndPoint src,
TunnelEndPoint dst,
Annotations... annotations) {
Set<TunnelSubscription> orderSet = orderRelationship.get(appId);
if (orderSet == null) {
orderSet = new HashSet<TunnelSubscription>();
}
TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, null, null, annotations);
boolean isExist = orderSet.contains(order);
if (!isExist) {
orderSet.add(order);
}
orderRelationship.put(appId, orderSet);
TunnelKey key = TunnelKey.tunnelKey(src, dst);
Set<TunnelId> idSet = srcAndDstKeyMap.get(key);
if (idSet == null || idSet.size() == 0) {
return Collections.emptySet();
}
Collection<Tunnel> tunnelSet = new HashSet<Tunnel>();
for (TunnelId tunnelId : idSet) {
Tunnel result = tunnelIdAsKeyStore.get(tunnelId);
if (Tunnel.State.ACTIVE.equals(result.state())) {
tunnelSet.add(result);
}
}
return tunnelSet;
}
示例10: returnTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public boolean returnTunnel(ApplicationId appId, TunnelEndPoint src,
TunnelEndPoint dst, Type type,
Annotations... annotations) {
TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, type, null, annotations);
return deleteOrder(order);
}
示例11: queryTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) {
Collection<Tunnel> result = new HashSet<Tunnel>();
TunnelKey key = TunnelKey.tunnelKey(src, dst);
Set<TunnelId> tunnelIds = srcAndDstKeyMap.get(key);
if (tunnelIds == null) {
return Collections.emptySet();
}
for (TunnelId id : tunnelIds) {
result.add(tunnelIdAsKeyStore.get(id));
}
return result.size() == 0 ? Collections.emptySet() : ImmutableSet
.copyOf(result);
}
示例12: queryTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) {
Collection<Tunnel> result = new HashSet<Tunnel>();
Tunnel tunnel = null;
for (TunnelId tunnelId : tunnelIdAsKeyStore.keySet()) {
tunnel = tunnelIdAsKeyStore.get(tunnelId);
if ((null != tunnel) && (src.equals(tunnel.src())) && (dst.equals(tunnel.dst()))) {
result.add(tunnel);
}
}
return result.size() == 0 ? Collections.emptySet() : ImmutableSet.copyOf(result);
}
示例13: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId appId,
TunnelEndPoint src,
TunnelEndPoint dst,
Annotations... annotations) {
Set<TunnelSubscription> orderSet = orderRelationship.get(appId);
if (orderSet == null) {
orderSet = new HashSet<TunnelSubscription>();
}
TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, null, null, annotations);
boolean isExist = orderSet.contains(order);
if (!isExist) {
orderSet.add(order);
}
orderRelationship.put(appId, orderSet);
TunnelKey key = TunnelKey.tunnelKey(src, dst);
Set<TunnelId> idSet = srcAndDstKeyMap.get(key);
if (idSet == null || idSet.isEmpty()) {
return Collections.emptySet();
}
Collection<Tunnel> tunnelSet = new HashSet<Tunnel>();
for (TunnelId tunnelId : idSet) {
Tunnel result = tunnelIdAsKeyStore.get(tunnelId);
if (Tunnel.State.ACTIVE.equals(result.state())) {
tunnelSet.add(result);
}
}
return tunnelSet;
}
示例14: queryTunnel
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) {
Collection<Tunnel> result = new HashSet<Tunnel>();
TunnelKey key = TunnelKey.tunnelKey(src, dst);
Set<TunnelId> tunnelIds = srcAndDstKeyMap.get(key);
if (tunnelIds == null) {
return Collections.emptySet();
}
for (TunnelId id : tunnelIds) {
result.add(tunnelIdAsKeyStore.get(id));
}
return result.isEmpty() ? Collections.emptySet() : ImmutableSet
.copyOf(result);
}
示例15: process
import org.onosproject.incubator.net.tunnel.TunnelEndPoint; //導入依賴的package包/類
@Override
public void process(ObjectNode payload) {
String srcId = string(payload, SRCID);
ElementId src = elementId(srcId);
String dstId = string(payload, DSTID);
ElementId dst = elementId(dstId);
Device srcDevice = deviceService.getDevice((DeviceId) src);
Device dstDevice = deviceService.getDevice((DeviceId) dst);
TunnelEndPoint tunSrc = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf(srcDevice.annotations().value("lsrId")));
TunnelEndPoint tunDst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
.valueOf(dstDevice.annotations().value("lsrId")));
Collection<Tunnel> tunnelSet = tunnelService.queryTunnel(tunSrc, tunDst);
ObjectNode result = objectNode();
ArrayNode arrayNode = arrayNode();
for (Tunnel tunnel : tunnelSet) {
if (tunnel.type() == MPLS) {
if (tunnel.state().equals(ACTIVE)) {
arrayNode.add(tunnel.tunnelId().toString());
arrayNode.add(tunnel.tunnelName().toString());
}
}
}
result.putArray(BUFFER_ARRAY).addAll(arrayNode);
sendMessage(PCEWEB_SHOW_TUNNEL, result);
}