本文整理汇总了Java中net.floodlightcontroller.routing.Link.getDstPort方法的典型用法代码示例。如果您正苦于以下问题:Java Link.getDstPort方法的具体用法?Java Link.getDstPort怎么用?Java Link.getDstPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.routing.Link
的用法示例。
在下文中一共展示了Link.getDstPort方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateBroadcastNodePortsInClusters
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
protected void calculateBroadcastNodePortsInClusters() {
clusterBroadcastTrees.clear();
calculateBroadcastTreeInClusters();
for (Cluster c : clusters) {
// c.id is the smallest node that's in the cluster
BroadcastTree tree = clusterBroadcastTrees.get(c.id);
//log.info("Broadcast Tree {}", tree);
Set<NodePortTuple> nptSet = new HashSet<NodePortTuple>();
Map<DatapathId, Link> links = tree.getLinks();
if (links == null) continue;
for (DatapathId nodeId : links.keySet()) {
Link l = links.get(nodeId);
if (l == null) continue;
NodePortTuple npt1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple npt2 = new NodePortTuple(l.getDst(), l.getDstPort());
nptSet.add(npt1);
nptSet.add(npt2);
}
clusterBroadcastNodePorts.put(c.id, nptSet);
}
}
示例2: addLinkToStructure
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
/**
* Add the given link to the data structure.
* @param s
* @param l
*/
private void addLinkToStructure(Map<NodePortTuple, Set<Link>> s, Link l) {
NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort());
if (s.get(n1) == null) {
s.put(n1, new HashSet<Link>());
}
if (s.get(n2) == null) {
s.put(n2, new HashSet<Link>());
}
/*
* Since we don't include latency in .equals(), we need
* to explicitly remove the existing link (if present).
* Otherwise, new latency values for existing links will
* never be accepted.
*/
s.get(n1).remove(l);
s.get(n2).remove(l);
s.get(n1).add(l);
s.get(n2).add(l);
}
示例3: removeLinkFromStructure
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
/**
* Delete the given link from the data structure. Returns true if the
* link was deleted.
* @param s
* @param l
* @return
*/
private boolean removeLinkFromStructure(Map<NodePortTuple, Set<Link>> s, Link l) {
boolean result1 = false, result2 = false;
NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort());
if (s.get(n1) != null) {
result1 = s.get(n1).remove(l);
if (s.get(n1).isEmpty()) s.remove(n1);
}
if (s.get(n2) != null) {
result2 = s.get(n2).remove(l);
if (s.get(n2).isEmpty()) s.remove(n2);
}
return result1 || result2;
}
示例4: removeLinkFromStructure
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
/**
* Delete the given link from the data strucure. Returns true if the
* link was deleted.
* @param s
* @param l
* @return
*/
private boolean removeLinkFromStructure(Map<NodePortTuple,
Set<Link>> s, Link l) {
boolean result1 = false, result2 = false;
NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort());
if (s.get(n1) != null) {
result1 = s.get(n1).remove(l);
if (s.get(n1).isEmpty()) s.remove(n1);
}
if (s.get(n2) != null) {
result2 = s.get(n2).remove(l);
if (s.get(n2).isEmpty()) s.remove(n2);
}
return result1 || result2;
}
示例5: calculateBroadcastNodePortsInClusters
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
protected void calculateBroadcastNodePortsInClusters() {
clusterBroadcastTrees.clear();
calculateBroadcastTreeInClusters();
for(Cluster c: clusters) {
// c.id is the smallest node that's in the cluster
BroadcastTree tree = clusterBroadcastTrees.get(c.id);
//log.info("Broadcast Tree {}", tree);
Set<NodePortTuple> nptSet = new HashSet<NodePortTuple>();
Map<DatapathId, Link> links = tree.getLinks();
if (links == null) continue;
for(DatapathId nodeId: links.keySet()) {
Link l = links.get(nodeId);
if (l == null) continue;
NodePortTuple npt1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple npt2 = new NodePortTuple(l.getDst(), l.getDstPort());
nptSet.add(npt1);
nptSet.add(npt2);
}
clusterBroadcastNodePorts.put(c.id, nptSet);
}
}
示例6: LinkWithType
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
public LinkWithType(Link link,
LinkType type,
LinkDirection direction) {
this.srcSwDpid = link.getSrc();
this.srcPort = link.getSrcPort();
this.dstSwDpid = link.getDst();
this.dstPort = link.getDstPort();
this.type = type;
this.direction = direction;
}
示例7: removeLink
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
public void removeLink(Link link) {
linksUpdated = true;
dtLinksUpdated = removeLinkFromStructure(directLinks, link);
removeLinkFromStructure(portBroadcastDomainLinks, link);
removeLinkFromStructure(switchPortLinks, link);
NodePortTuple srcNpt =
new NodePortTuple(link.getSrc(), link.getSrcPort());
NodePortTuple dstNpt =
new NodePortTuple(link.getDst(), link.getDstPort());
// Remove switch ports if there are no links through those switch ports
if (switchPortLinks.get(srcNpt) == null) {
if (switchPorts.get(srcNpt.getNodeId()) != null)
switchPorts.get(srcNpt.getNodeId()).remove(srcNpt.getPortId());
}
if (switchPortLinks.get(dstNpt) == null) {
if (switchPorts.get(dstNpt.getNodeId()) != null)
switchPorts.get(dstNpt.getNodeId()).remove(dstNpt.getPortId());
}
// Remove the node if no ports are present
if (switchPorts.get(srcNpt.getNodeId())!=null &&
switchPorts.get(srcNpt.getNodeId()).isEmpty()) {
switchPorts.remove(srcNpt.getNodeId());
}
if (switchPorts.get(dstNpt.getNodeId())!=null &&
switchPorts.get(dstNpt.getNodeId()).isEmpty()) {
switchPorts.remove(dstNpt.getNodeId());
}
}
示例8: retrieve
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
@Get("json")
public Set<LinkWithType> retrieve() {
ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
get(ILinkDiscoveryService.class.getCanonicalName());
Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();
if (ld != null) {
links.putAll(ld.getLinks());
for (Link link: links.keySet()) {
LinkInfo info = links.get(link);
LinkType type = ld.getLinkType(link, info);
if (type == LinkType.DIRECT_LINK || type == LinkType.TUNNEL) {
LinkWithType lwt;
DatapathId src = link.getSrc();
DatapathId dst = link.getDst();
OFPort srcPort = link.getSrcPort();
OFPort dstPort = link.getDstPort();
Link otherLink = new Link(dst, dstPort, src, srcPort, U64.ZERO /* not important in lookup */);
LinkInfo otherInfo = links.get(otherLink);
LinkType otherType = null;
if (otherInfo != null)
otherType = ld.getLinkType(otherLink, otherInfo);
if (otherType == LinkType.DIRECT_LINK ||
otherType == LinkType.TUNNEL) {
// This is a bi-direcitonal link.
// It is sufficient to add only one side of it.
if ((src.getLong() < dst.getLong()) || (src.getLong() == dst.getLong()
&& srcPort.getPortNumber() < dstPort.getPortNumber())) {
lwt = new LinkWithType(link,
type,
LinkDirection.BIDIRECTIONAL);
returnLinkSet.add(lwt);
}
} else {
// This is a unidirectional link.
lwt = new LinkWithType(link,
type,
LinkDirection.UNIDIRECTIONAL);
returnLinkSet.add(lwt);
}
}
}
}
return returnLinkSet;
}
示例9: retrieve
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
@Get("json")
public Set<LinkWithType> retrieve() {
ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
get(ILinkDiscoveryService.class.getCanonicalName());
Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();
if (ld != null) {
links.putAll(ld.getLinks());
for (Link link: links.keySet()) {
LinkInfo info = links.get(link);
LinkType type = ld.getLinkType(link, info);
if (type == LinkType.MULTIHOP_LINK) {
LinkWithType lwt;
DatapathId src = link.getSrc();
DatapathId dst = link.getDst();
OFPort srcPort = link.getSrcPort();
OFPort dstPort = link.getDstPort();
Link otherLink = new Link(dst, dstPort, src, srcPort, U64.ZERO /* not important in lookup */);
LinkInfo otherInfo = links.get(otherLink);
LinkType otherType = null;
if (otherInfo != null)
otherType = ld.getLinkType(otherLink, otherInfo);
if (otherType == LinkType.MULTIHOP_LINK) {
// This is a bi-direcitonal link.
// It is sufficient to add only one side of it.
if ((src.getLong() < dst.getLong()) || (src.getLong() == dst.getLong()
&& srcPort.getPortNumber() < dstPort.getPortNumber())) {
lwt = new LinkWithType(link,
type,
LinkDirection.BIDIRECTIONAL);
returnLinkSet.add(lwt);
}
} else {
// This is a unidirectional link.
lwt = new LinkWithType(link,
type,
LinkDirection.UNIDIRECTIONAL);
returnLinkSet.add(lwt);
}
}
}
}
return returnLinkSet;
}
示例10: isBlockedLink
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
/** Returns true if a link has either one of its switch ports
* blocked.
* @param l
* @return
*/
protected boolean isBlockedLink(Link l) {
NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort());
return (isBlockedPort(n1) || isBlockedPort(n2));
}
示例11: isTunnelLink
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
protected boolean isTunnelLink(Link l) {
NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort());
return (isTunnelPort(n1) || isTunnelPort(n2));
}
示例12: isBroadcastDomainLink
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
public boolean isBroadcastDomainLink(Link l) {
NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort());
NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort());
return (isBroadcastDomainPort(n1) || isBroadcastDomainPort(n2));
}
示例13: retrieve
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
@Get("json")
public Set<LinkWithType> retrieve() {
ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
get(ILinkDiscoveryService.class.getCanonicalName());
Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();
if (ld != null) {
links.putAll(ld.getLinks());
for (Link link: links.keySet()) {
LinkInfo info = links.get(link);
LinkType type = ld.getLinkType(link, info);
if (type == LinkType.MULTIHOP_LINK) {
LinkWithType lwt;
DatapathId src = link.getSrc();
DatapathId dst = link.getDst();
OFPort srcPort = link.getSrcPort();
OFPort dstPort = link.getDstPort();
Link otherLink = new Link(dst, dstPort, src, srcPort);
LinkInfo otherInfo = links.get(otherLink);
LinkType otherType = null;
if (otherInfo != null)
otherType = ld.getLinkType(otherLink, otherInfo);
if (otherType == LinkType.MULTIHOP_LINK) {
// This is a bi-direcitonal link.
// It is sufficient to add only one side of it.
if ((src.getLong() < dst.getLong()) || (src.getLong() == dst.getLong()
&& srcPort.getPortNumber() < dstPort.getPortNumber())) {
lwt = new LinkWithType(link,
type,
LinkDirection.BIDIRECTIONAL);
returnLinkSet.add(lwt);
}
} else {
// This is a unidirectional link.
lwt = new LinkWithType(link,
type,
LinkDirection.UNIDIRECTIONAL);
returnLinkSet.add(lwt);
}
}
}
}
return returnLinkSet;
}
示例14: getLinkId
import net.floodlightcontroller.routing.Link; //导入方法依赖的package包/类
/**
* Gets the storage key for a LinkTuple
*
* @param lt
* The LinkTuple to get
* @return The storage key as a String
*/
private String getLinkId(Link lt) {
return lt.getSrc().toString() + "-" + lt.getSrcPort()
+ "-" + lt.getDst().toString() + "-"
+ lt.getDstPort();
}