本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId类的典型用法代码示例。如果您正苦于以下问题:Java TpId类的具体用法?Java TpId怎么用?Java TpId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TpId类属于org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021包,在下文中一共展示了TpId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildTerminationPointForPhysicalSwitch
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
public static TerminationPoint buildTerminationPointForPhysicalSwitch(InstanceIdentifier<Node> switchIid,
String portName, WriteTransaction transaction,
Map<Long, String> vlanBindingData) {
TerminationPointKey tpKey = new TerminationPointKey(new TpId(portName));
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setKey(tpKey);
tpBuilder.setTpId(tpKey.getTpId());
switchIid.firstKeyOf(Node.class);
InstanceIdentifier<TerminationPoint> tpPath = switchIid.child(TerminationPoint.class,
new TerminationPointKey(new TpId(portName)));
HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder =
new HwvtepPhysicalPortAugmentationBuilder();
buildTerminationPoint(tpAugmentationBuilder, portName, vlanBindingData);
tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
return tpBuilder.build();
}
示例2: buildTerminationPoint
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
public static TerminationPoint buildTerminationPoint(InstanceIdentifier<Node> nodeIid, String ip) {
TerminationPointKey tpKey = new TerminationPointKey(new TpId("vxlan_over_ipv4:" + ip));
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
if (nodeIid != null && tpKey != null) {
tpBuilder.setKey(tpKey);
tpBuilder.setTpId(tpKey.getTpId());
InstanceIdentifier<TerminationPoint> tpPath =
buildTpId(nodeIid, ip);
HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder =
new HwvtepPhysicalLocatorAugmentationBuilder();
tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
}
return tpBuilder.build();
}
示例3: findGWLink
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
private Link findGWLink(ReadWriteTransaction trans, FabricId fabricid, TpId tpid, NodeId routerid) {
InstanceIdentifier<Link> linkIId = InstanceIdentifier.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(new TopologyId(fabricid)))
.child(Link.class, new LinkKey(this.createGatewayLink(routerid, tpid)));
CheckedFuture<Optional<Link>,ReadFailedException> readFuture = trans.read(LogicalDatastoreType.OPERATIONAL,
linkIId);
try {
Optional<Link> optional = readFuture.get();
Link link = optional.get();
return link;
} catch (InterruptedException | ExecutionException e) {
LOG.error("", e);
}
return null;
}
示例4: createLogicLink
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
private void createLogicLink(FabricId fabricid, NodeId routeId, NodeId swId, WriteTransaction trans, TpId tpid1,
TpId tpid2, LinkId lid) {
final LinkId linkid = lid == null ? new LinkId(UUID.randomUUID().toString()) : lid;
LinkBuilder linkBuilder = new LinkBuilder();
linkBuilder.setLinkId(linkid);
linkBuilder.setKey(new LinkKey(linkid));
SourceBuilder srcBuilder = new SourceBuilder();
srcBuilder.setSourceNode(routeId);
srcBuilder.setSourceTp(tpid1);
linkBuilder.setSource(srcBuilder.build());
DestinationBuilder destBuilder = new DestinationBuilder();
destBuilder.setDestNode(swId);
destBuilder.setDestTp(tpid2);
linkBuilder.setDestination(destBuilder.build());
InstanceIdentifier<Link> linkIId = MdSalUtils.createLinkIId(fabricid, linkid);
trans.put(LogicalDatastoreType.OPERATIONAL,linkIId, linkBuilder.build());
}
示例5: createGWPortOnSwitch
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
private TpId createGWPortOnSwitch(FabricId fabricid, NodeId swId, WriteTransaction trans) {
final TpId tpid = new TpId(UUID.randomUUID().toString());
final InstanceIdentifier<TerminationPoint> tpIId = MdSalUtils.createLogicPortIId(fabricid, swId, tpid);
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setTpId(tpid);
tpBuilder.setKey(new TerminationPointKey(tpid));
LogicalPortAugmentBuilder lpCtx = new LogicalPortAugmentBuilder();
LportAttributeBuilder lpAttr = new LportAttributeBuilder();
lpCtx.setLportAttribute(lpAttr.build());
tpBuilder.addAugmentation(LogicalPortAugment.class, lpCtx.build());
trans.put(LogicalDatastoreType.OPERATIONAL,tpIId, tpBuilder.build(), true);
return tpid;
}
示例6: addPortFunction
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
@Override
public Future<RpcResult<Void>> addPortFunction(AddPortFunctionInput input) {
final PortFunction function = input.getPortFunction();
FabricId fabricId = input.getFabricId();
TpId tpid = input.getLogicalPort();
NodeId ldev = input.getLogicalDevice();
final FabricInstance fabricObj = FabricInstanceCache.INSTANCE.retrieveFabric(fabricId);
if (fabricObj == null) {
return Futures.immediateFailedFuture(
new IllegalArgumentException(String.format("fabric %s does not exist", fabricId)));
}
final InstanceIdentifier<PortFunction> fncIId = MdSalUtils.createLogicPortIId(fabricId, ldev, tpid)
.augmentation(LogicalPortAugment.class)
.child(LportAttribute.class)
.child(PortFunction.class);
WriteTransaction trans = dataBroker.newWriteOnlyTransaction();
trans.merge(LogicalDatastoreType.OPERATIONAL,fncIId, function, false);
return Futures.transformAsync(trans.submit(), submitResult -> {
fabricObj.notifyPortFuncUpdated(fncIId, function, false);
return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}, executor);
}
示例7: convFabricPort2DevicePort
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static InstanceIdentifier<TerminationPoint> convFabricPort2DevicePort(
DataBroker broker, FabricId fabricid, TpId tpid) {
InstanceIdentifier<TerminationPoint> iidFPort = MdSalUtils.createFabricPortIId(fabricid, tpid);
ReadTransaction rt = broker.newReadOnlyTransaction();
Optional<TerminationPoint> opt = MdSalUtils.syncReadOper(rt, iidFPort);
if (opt.isPresent()) {
TerminationPoint tp = opt.get();
return (InstanceIdentifier<TerminationPoint>) tp.getAugmentation(FabricPortAugment.class)
.getFportAttribute()
.getDevicePort()
.getValue();
}
return null;
}
示例8: createBdPort
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
/**
* Create a new Bridge Domain Port.
* @param vni vni
* @param tpid physical termination point
* @param accessType access type
* @param seg access segment
* @return String name of Bridge Domain Port
*/
public String createBdPort(long vni, TpId tpid, AccessType accessType, long seg) {
String bdPortId = createBdPortId(tpid, seg);
BdPortBuilder builder = new BdPortBuilder();
builder.setBdPortId(bdPortId);
builder.setAccessType(accessType);
builder.setAccessTag(seg);
builder.setRefTpId(tpid);
builder.setBdid(this.createBdId(vni));
WriteTransaction trans = databroker.newWriteOnlyTransaction();
InstanceIdentifier<BdPort> bdIId = deviceIId.augmentation(FabricCapableDevice.class)
.child(Config.class).child(BdPort.class, new BdPortKey(bdPortId));
trans.put(LogicalDatastoreType.OPERATIONAL, bdIId, builder.build(), true);
MdSalUtils.wrapperSubmit(trans, executor);
return bdPortId;
}
示例9: renderRoute
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
private void renderRoute(RouteBuilder builder, NodeId routerId) {
NextHopOptions nexthop = builder.getNextHopOptions();
if (nexthop instanceof SimpleNextHop) {
SimpleNextHop simpleNh = (SimpleNextHop) nexthop;
TpId tpid = simpleNh.getOutgoingInterface();
if (tpid != null) {
IpAddress gwIp = new IpAddress(tpid.getValue().toCharArray());
GatewayPort gwport = fabricCtx.getLogicRouterCtx(routerId).getGatewayPort(gwIp);
long vni = gwport.getVni();
builder.addAugmentation(VxlanRouteAug.class, new VxlanRouteAugBuilder().setOutgoingVni(vni).build());
}
} else {
LOG.warn("nexthop is not simple. {}", nexthop.getClass().getName());
}
}
示例10: addIPMapping
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
/**
* Set up IP mapping between external IP and internal IP address.
* @param fabricId - fabric identifier.
* @param ld - logical switch Id
* @param tpid - logical port id
* @param ext - external IP address
* @param internal - private IP address.
*/
public void addIPMapping(FabricId fabricId, NodeId ld, TpId tpid, Ipv4Address ext, Ipv4Address internal)
{
AddPortFunctionInputBuilder inputb = new AddPortFunctionInputBuilder();
inputb.setFabricId(fabricId);
inputb.setLogicalDevice(ld);
inputb.setLogicalPort(tpid);
PortFunctionBuilder pfb = new PortFunctionBuilder();
IpMappingBuilder ipmb = new IpMappingBuilder();
ipmb.setIpMappingEntry(
Lists.newArrayList(new IpMappingEntryBuilder()
.setExternalIp(ext)
.setInternalIp(internal)
.build()));
pfb.setFunctionType(ipmb.build());
inputb.setPortFunction(pfb.build());
this.fabServiceService.addPortFunction(inputb.build());
}
示例11: createBasicVcLink
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
public static Link createBasicVcLink(Node ldNode, Node netNode) {
LinkId linkId = new LinkId(VC_LINK_NAME);
LinkKey linkKey = new LinkKey(linkId);
LinkBuilder linkBuilder = new LinkBuilder();
linkBuilder.setLinkId(linkId);
linkBuilder.setKey(linkKey);
DestinationBuilder destBuilder = new DestinationBuilder();
NodeId ldNodeId = ldNode.getNodeId();
destBuilder.setDestNode(ldNodeId);
TpId sourceTpId = new TpId(VC_NODE_TP_WEST);
destBuilder.setDestTp(sourceTpId);
linkBuilder.setDestination(destBuilder.build());
SourceBuilder sourceBuilder = new SourceBuilder();
NodeId netNodeId = netNode.getNodeId();
sourceBuilder.setSourceNode(netNodeId);
TpId destTpId = new TpId(VC_NODE_TP_EAST);
sourceBuilder.setSourceTp(destTpId);
linkBuilder.setSource(sourceBuilder.build());
return linkBuilder.build();
}
示例12: getPhyLocation
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
public static Location getPhyLocation(TopologyId fabricId, String inventoryNodeIdStr,
String inventoryNodeConnectorIdStr) {
LocationBuilder locBuilder = new LocationBuilder();
/*
* TODO: For now inventory nodeId and node connector id are directly mapped
* to topology. This is a kludge. A formal approach would involve an
* inventory-to-topology lookup.
*/
NodeId nodeId = new NodeId(inventoryNodeIdStr);
TpId tpId = new TpId(inventoryNodeConnectorIdStr);
locBuilder.setNodeRef(new NodeRef(createNodePath(fabricId, nodeId)));
locBuilder.setTpRef(new TpRef(createTpPath(fabricId, nodeId, tpId)));
return locBuilder.build();
}
示例13: getBorderInfo
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
/**
* To get the border Fabric and its port connects to the External network
* for now we only only return the first one.
* @return
*/
private Entry<FabricId, TpId> getBorderInfo()
{
Topology fabricTopo = this.getFabricTopology();
if (fabricTopo == null) {
LOG.error("Fabric Topology is NULL!");
return null;
}
for (Link l : fabricTopo.getLink()) {
if ("external".equalsIgnoreCase(l.getSource().getSourceNode().getValue())) {
return new AbstractMap.SimpleEntry(l.getDestination().getDestNode(), l.getDestination().getDestTp());
}
if ("external".equalsIgnoreCase(l.getDestination().getDestNode().getValue())) {
return new AbstractMap.SimpleEntry(l.getSource().getSourceNode(), l.getSource().getSourceTp());
}
}
LOG.error("No Fabric Topology found!");
return null;
}
示例14: getLogicalPortIPAddress
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
private IpAddress getLogicalPortIPAddress(TenantId tenantId, TpId tpID)
{
List<IpAddress> pips = new ArrayList<>();
PortMappingInfo pmi = ulnStore.get(toUuid(tenantId)).getPortStore().get(tpID);
for (PrivateIps ip : pmi.getPort().getPrivateIps())
{
pips.add(ip.getIpAddress());
}
if (!pips.isEmpty()) {
//TODO, using the first one for now.
return pips.get(0);
}
return null;
}
示例15: createTP
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId; //导入依赖的package包/类
private InstanceIdentifier<TerminationPoint> createTP(final IpAddress addr, final InstanceIdentifier<Node> sni,
final Boolean inControl, final ReadWriteTransaction trans) {
final String url = "ip://" + addr.toString();
final TerminationPointKey tpk = new TerminationPointKey(new TpId(url));
final TerminationPointBuilder tpb = new TerminationPointBuilder();
tpb.setKey(tpk).setTpId(tpk.getTpId());
tpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(
new IgpTerminationPointAttributesBuilder().setTerminationPointType(
new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
final NodeKey nk = new NodeKey(new NodeId(url));
final NodeBuilder nb = new NodeBuilder();
nb.setKey(nk).setNodeId(nk.getNodeId());
nb.setTerminationPoint(Lists.newArrayList(tpb.build()));
if (sni != null) {
nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(),
inControl)));
}
final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.getKey());
trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build());
return nid.child(TerminationPoint.class, tpb.getKey());
}