本文整理汇总了Java中org.onosproject.incubator.net.tunnel.TunnelName类的典型用法代码示例。如果您正苦于以下问题:Java TunnelName类的具体用法?Java TunnelName怎么用?Java TunnelName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TunnelName类属于org.onosproject.incubator.net.tunnel包,在下文中一共展示了TunnelName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTunnelAdded
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的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.TunnelName; //导入依赖的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: testTunnelAdded
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的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());
}
示例4: testTunnelRemoved
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的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());
}
示例5: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId appId,
TunnelName tunnelName,
Annotations... annotations) {
Set<TunnelSubscription> orderSet = orderRelationship.get(appId);
if (orderSet == null) {
orderSet = new HashSet<TunnelSubscription>();
}
TunnelSubscription order = new TunnelSubscription(appId, null, null, null, null, tunnelName,
annotations);
boolean isExist = orderSet.contains(order);
Set<TunnelId> idSet = tunnelNameAsKeyMap.get(tunnelName);
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);
}
}
if (!tunnelSet.isEmpty() && !isExist) {
orderSet.add(order);
orderRelationship.put(appId, orderSet);
}
return tunnelSet;
}
示例6: returnTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public boolean returnTunnel(ApplicationId appId, TunnelName tunnelName,
Annotations... annotations) {
TunnelSubscription order = new TunnelSubscription(appId, null, null, null, null, tunnelName,
annotations);
return deleteOrder(order);
}
示例7: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId appId,
TunnelName tunnelName,
Annotations... annotations) {
Set<TunnelSubscription> orderSet = orderRelationship.get(appId);
if (orderSet == null) {
orderSet = new HashSet<TunnelSubscription>();
}
TunnelSubscription order = new TunnelSubscription(appId, null, null, null, null, tunnelName,
annotations);
boolean isExist = orderSet.contains(order);
Set<TunnelId> idSet = tunnelNameAsKeyMap.get(tunnelName);
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);
}
}
if (!tunnelSet.isEmpty() && !isExist) {
orderSet.add(order);
orderRelationship.put(appId, orderSet);
}
return tunnelSet;
}
示例8: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName,
Annotations... annotations) {
return null;
}
示例9: returnTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, Annotations... annotations) {
return false;
}
示例10: tunnelProviderAddedTest2
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
/**
* Tests updating an existing tunnel on receiving asynchronous PCRpt msg,
* i.e. without any SRP id.
*/
@Test
public void tunnelProviderAddedTest2() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x50,
0x21, 0x10, 0x00, 0x14, //SRP object
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x04, // PATH-SETUP-TYPE TLV
0x00, 0x00, 0x00, 0x02,
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x19, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path TLV
0x00, 0x12, 0x00, 0x10, // IPv4-LSP-IDENTIFIER-TLV
0x4e, 0x1f, 0x04, 0x00,
0x00, 0x01, 0x00, 0x01,
0x4e, 0x1f, 0x04, 0x00,
0x4e, 0x20, 0x04, 0x00,
0x07, 0x10, 0x00, 0x14, //ERO object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // ERO IPv4 sub objects
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = reader.readFrom(buffer);
// create an existing tunnel.
IpTunnelEndPoint tunnelEndPointSrc = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(0x4e1f0400));
IpTunnelEndPoint tunnelEndPointDst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(0x4e200400));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set(BANDWIDTH, (new Integer(1)).toString())
.set(LSP_SIG_TYPE, WITHOUT_SIGNALLING_AND_WITHOUT_SR.name())
.set(PCC_TUNNEL_ID, String.valueOf(1))
.set(PLSP_ID, String.valueOf(1))
.set(LOCAL_LSP_ID, String.valueOf(1))
.set(DELEGATE, String.valueOf("true"))
.build();
Tunnel tunnel = new DefaultTunnel(null, tunnelEndPointSrc, tunnelEndPointDst, MPLS, INIT, null, null,
TunnelName.tunnelName("T123"), null, annotations);
tunnelService.setupTunnel(null, null, tunnel, null);
PccId pccId = PccId.pccId(IpAddress.valueOf(0x4e1f0400));
PcepClientAdapter pc = new PcepClientAdapter();
pc.init(pccId, PcepVersion.PCEP_1);
masterShipService.setMaster(true);
controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
controller.getClient(pccId).setLspDbSyncStatus(SYNCED);
// Process update message.
controller.processClientMessage(pccId, message);
assertThat(tunnelService.queryAllTunnels().size(), is(1));
}
示例11: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId,
TunnelName tunnelName,
Annotations... annotations) {
return store.borrowTunnel(consumerId, tunnelName, annotations);
}
示例12: returnTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public boolean returnTunnel(ApplicationId consumerId,
TunnelName tunnelName,
Annotations... annotations) {
return store.returnTunnel(consumerId, tunnelName, annotations);
}
示例13: borrowTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName,
Annotations... annotations) {
// TODO Auto-generated method stub
return null;
}
示例14: returnTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, Annotations... annotations) {
// TODO Auto-generated method stub
return false;
}
示例15: createTeTunnel
import org.onosproject.incubator.net.tunnel.TunnelName; //导入依赖的package包/类
@Override
public TunnelId createTeTunnel(TeTunnel teTunnel) {
if (!store.addTeTunnel(teTunnel)) {
log.error("can not add teTunnel: {}", teTunnel);
return null;
}
TunnelId tunnelId = TunnelId.valueOf(teTunnel.teTunnelKey().toString());
Tunnel tunnel = new DefaultTunnel(ProviderId.NONE,
new TeTunnelEndpoint(teTunnel.srcNode(),
teTunnel.srcTp()),
new TeTunnelEndpoint(teTunnel.dstNode(),
teTunnel.dstTp()),
Tunnel.Type.MPLS, new GroupId(0),
tunnelId,
TunnelName.tunnelName(teTunnel.name()),
null,
DefaultAnnotations.builder().build());
store.setTunnelId(teTunnel.teTunnelKey(), tunnelId);
TeTopology srcTopology = teTopologyService.teTopology(
teTopologyService.teNode(teTunnel.srcNode())
.underlayTeTopologyId());
if (srcTopology == null) {
srcTopology = teTopologyService.teTopology(teTunnel.srcNode()
.teTopologyKey());
}
DeviceId domainId = srcTopology.ownerId();
TunnelId id = tunnelService.setupTunnel(appId, domainId, tunnel, null);
if (id == null) {
log.error("can not create tunnel for te {}",
teTunnel.teTunnelKey());
store.removeTeTunnel(teTunnel.teTunnelKey());
return null;
}
if (!id.equals(tunnelId)) {
//this should not happen
log.error("tunnelId changed, oldId:{}, newId:{}", tunnelId, id);
store.setTunnelId(teTunnel.teTunnelKey(), id);
}
return id;
}