本文整理汇总了Java中org.opendaylight.controller.samples.simpleforwarding.HostNodePair类的典型用法代码示例。如果您正苦于以下问题:Java HostNodePair类的具体用法?Java HostNodePair怎么用?Java HostNodePair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HostNodePair类属于org.opendaylight.controller.samples.simpleforwarding包,在下文中一共展示了HostNodePair类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uninstallPerHostRules
import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //导入依赖的package包/类
/**
* Cleanup all the host rules for a given host
*
* @param host Host for which the host rules need to be cleaned
* up, the host could be null in that case it match all the hosts
*
* @return a return code that convey the programming status of the HW
*/
private RulesProgrammingReturnCode uninstallPerHostRules(
HostNodeConnector host) {
RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
Map<NodeConnector, FlowEntry> pos;
FlowEntry po;
// Now program every single switch
for (HostNodePair key : this.rulesDB.keySet()) {
if (host == null || key.getHost().equals(host)) {
pos = this.rulesDB.get(key);
for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
po = e.getValue();
if (po != null) {
// Uninstall the policy
this.frm.uninstallFlowEntry(po);
}
}
this.rulesDB.remove(key);
}
}
return retCode;
}
示例2: uninstallPerNodeRules
import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //导入依赖的package包/类
/**
* Cleanup all the host rules for a given node, triggered when the
* switch disconnects, so there is no reason for Hw cleanup
* because it's disconnected anyhow
* TBD - Revisit above stmt in light of CSCus88743
* @param targetNode Node for which we want to do cleanup
*
*/
private void uninstallPerNodeRules(Node targetNode) {
//RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
Map<NodeConnector, FlowEntry> pos;
FlowEntry po;
// Now program every single switch
for (HostNodePair key : this.rulesDB.keySet()) {
Node node = key.getNode();
if (targetNode == null || node.equals(targetNode)) {
log.debug("Work on {} host {}", node, key.getHost());
pos = this.rulesDB.get(key);
for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
po = e.getValue();
if (po != null) {
// Uninstall the policy
this.frm.uninstallFlowEntry(po);
}
}
log.debug("Remove {}", key);
this.rulesDB.remove(key);
}
}
}
示例3: retrieveCaches
import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "deprecation" })
private void retrieveCaches() {
if (this.clusterContainerService == null) {
log.info("un-initialized clusterContainerService, can't retrieve cache");
return;
}
rulesDB = (ConcurrentMap<HostNodePair, HashMap<NodeConnector, FlowEntry>>) clusterContainerService
.getCache("forwarding.ipswitch.rules");
if (rulesDB == null) {
log.error("\nFailed to get rulesDB handle");
}
}
示例4: installPerHostRules
import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //导入依赖的package包/类
/**
* Routine that fetch the per-Host rules from the rulesDB and
* install in HW, the one having the same match rules will be
* overwritten silently.
*
* @param host host for which we want to install in HW the per-Host rules
* @param switchesToProgram list of switches to be programmed in
* HW, usually are them all, but better to be explicit, that list
* may change with time based on new switch addition/removal
*
* @return a return code that convey the programming status of the HW
*/
private RulesProgrammingReturnCode installPerHostRules(
HostNodeConnector host, Set<Node> switchesToProgram) {
RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
if (host == null || switchesToProgram == null) {
return RulesProgrammingReturnCode.FAILED_WRONG_PARAMS;
}
Map<NodeConnector, FlowEntry> pos;
FlowEntry po;
// Now program every single switch
log.debug("Inside installPerHostRules");
for (Node swId : switchesToProgram) {
HostNodePair key = new HostNodePair(host, swId);
pos = this.rulesDB.get(key);
if (pos == null) {
continue;
}
for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
po = e.getValue();
if (po != null) {
// Populate the Policy field now
Status poStatus = this.frm.installFlowEntry(po);
if (!poStatus.isSuccess()) {
log.error("Failed to install policy: "
+ po.getGroupName() + " ("
+ poStatus.getDescription() + ")");
retCode = RulesProgrammingReturnCode.FAILED_FEW_SWITCHES;
// Remove the entry from the DB, it was not installed!
this.rulesDB.remove(key);
} else {
log.debug("Successfully installed policy "
+ po.toString() + " on switch " + swId);
}
} else {
log.error("Cannot find a policy for SW:({}) Host: ({})",
swId, host);
/* // Now dump every single rule */
/* for (HostNodePair dumpkey : this.rulesDB.keySet()) { */
/* po = this.rulesDB.get(dumpkey); */
/* log.debug("Dumping entry H{" + dumpkey.getHost() + "} S{" + dumpkey.getSwitchId() + "} = {" + (po == null ? "null policy" : po)); */
/* } */
}
}
}
log.debug("Leaving installPerHostRules");
return retCode;
}