use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class OpenFlow13Provider method createEgressClassifierNextHopNoC1C2Flow.
/*
* Egress Classifier NextHop No C1/C2 flow:
* Set C1/C2 accordingly
* Match [C1, C2] == [0, 0], Move [TunIpv4Dst, TunVnid] to [C1, C2],
* Move Reg0 (SFF IP) to TunIpv4Dst, and goto Egress Classifier
* Transport Egress table on match
*/
public Flow createEgressClassifierNextHopNoC1C2Flow(NodeId nodeId) {
MatchBuilder match = new MatchBuilder();
OpenFlow13Utils.addMatchNshNsc1(match, DEFAULT_NSH_CONTEXT_VALUE);
OpenFlow13Utils.addMatchNshNsc2(match, DEFAULT_NSH_CONTEXT_VALUE);
List<Action> actionList = new ArrayList<>();
actionList.add(OpenFlow13Utils.createActionNxMoveReg0ToNsc1Register(actionList.size()));
actionList.add(OpenFlow13Utils.createActionNxMoveTunIdToNsc2Register(actionList.size()));
actionList.add(OpenFlow13Utils.createActionNxMoveReg6ToNsc4Register(actionList.size()));
actionList.add(OpenFlow13Utils.createActionNxLoadTunId(SFC_TUNNEL_ID, actionList.size()));
InstructionsBuilder isb = OpenFlow13Utils.wrapActionsIntoApplyActionsInstruction(actionList);
OpenFlow13Utils.appendGotoTableInstruction(isb, NwConstants.EGRESS_SFC_CLASSIFIER_EGRESS_TABLE);
String flowIdStr = EGRESS_CLASSIFIER_NEXTHOP_NOC1C2_FLOW_NAME + nodeId.getValue();
return OpenFlow13Utils.createFlowBuilder(NwConstants.EGRESS_SFC_CLASSIFIER_NEXTHOP_TABLE, EGRESS_CLASSIFIER_NEXTHOP_NOC1C2_PRIORITY, EGRESS_CLASSIFIER_NEXTHOP_COOKIE, EGRESS_CLASSIFIER_NEXTHOP_NOC1C2_FLOW_NAME, flowIdStr, match, isb).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class OpenFlow13Provider method createEgressClassifierNextHopC1C2Flow.
/*
* Egress Classifier NextHop with C1/C2 flow:
* Set C1/C2 accordingly
* MatchAny (C1, C2 already set) goto Egress Classifier
* Transport Egress table
*/
public Flow createEgressClassifierNextHopC1C2Flow(NodeId nodeId) {
MatchBuilder match = new MatchBuilder();
InstructionsBuilder isb = OpenFlow13Utils.appendGotoTableInstruction(new InstructionsBuilder(), NwConstants.EGRESS_SFC_CLASSIFIER_EGRESS_TABLE);
String flowIdStr = EGRESS_CLASSIFIER_NEXTHOP_C1C2_FLOW_NAME + nodeId.getValue();
return OpenFlow13Utils.createFlowBuilder(NwConstants.EGRESS_SFC_CLASSIFIER_NEXTHOP_TABLE, EGRESS_CLASSIFIER_NEXTHOP_C1C2_PRIORITY, EGRESS_CLASSIFIER_NEXTHOP_COOKIE, EGRESS_CLASSIFIER_NEXTHOP_C1C2_FLOW_NAME, flowIdStr, match, isb).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class ConfigurationClassifierImpl method buildEntries.
private Set<ClassifierRenderableEntry> buildEntries(String ruleName, @NonNull List<String> interfaces, @NonNull Matches matches, @NonNull RenderedServicePath rsp) {
String rspName = rsp.getName().getValue();
Long nsp = rsp.getPathId();
Short nsi = rsp.getStartingIndex();
Short nsl = rsp.getRenderedServicePathHop() == null ? null : (short) rsp.getRenderedServicePathHop().size();
if (nsp == null || nsi == null || nsl == null) {
LOG.warn("Ace {} RSP {} ignored: no valid NSI or NSP or length", ruleName, rspName);
return Collections.emptySet();
}
DpnIdType firstHopDpn = sfcProvider.getFirstHopIngressInterfaceFromRsp(rsp).flatMap(geniusProvider::getDpnIdFromInterfaceName).orElse(null);
if (firstHopDpn == null) {
LOG.warn("Ace {} RSP {} ignored: no valid first hop DPN", ruleName, rspName);
return Collections.emptySet();
}
String lastHopInterface = sfcProvider.getLastHopEgressInterfaceFromRsp(rsp).orElse(null);
if (lastHopInterface == null) {
LOG.warn("Ace {} RSP {} ignored: has no valid last hop interface", ruleName, rspName);
return Collections.emptySet();
}
DpnIdType lastHopDpn = geniusProvider.getDpnIdFromInterfaceName(lastHopInterface).orElse(null);
if (lastHopDpn == null) {
LOG.warn("Ace {} RSP {} ignored: has no valid last hop DPN", ruleName, rspName);
return Collections.emptySet();
}
Map<NodeId, List<InterfaceKey>> nodeToInterfaces = new HashMap<>();
for (String iface : interfaces) {
geniusProvider.getNodeIdFromLogicalInterface(iface).ifPresent(nodeId -> nodeToInterfaces.computeIfAbsent(nodeId, key -> new ArrayList<>()).add(new InterfaceKey(iface)));
}
LOG.trace("Ace {} RSP {}: got classifier nodes and interfaces: {}", ruleName, rspName, nodeToInterfaces);
String firstHopIp = geniusProvider.getIpFromDpnId(firstHopDpn).orElse(null);
Set<ClassifierRenderableEntry> entries = new HashSet<>();
nodeToInterfaces.forEach((nodeId, ifaces) -> {
// Get node info
DpnIdType nodeDpn = new DpnIdType(OpenFlow13Provider.getDpnIdFromNodeId(nodeId));
String nodeIp = geniusProvider.getIpFromDpnId(nodeDpn).orElse(LOCAL_HOST_IP);
if (firstHopIp == null && !nodeDpn.equals(firstHopDpn)) {
LOG.warn("Ace {} RSP {} classifier {} ignored: no IP to reach first hop DPN {}", ruleName, rspName, nodeId, firstHopDpn);
return;
}
// Add entries that are not based on ingress or egress interface
entries.add(ClassifierEntry.buildNodeEntry(nodeId));
entries.add(ClassifierEntry.buildPathEntry(nodeId, nsp, nsi, nsl, nodeDpn.equals(firstHopDpn) ? null : firstHopIp));
// Add entries based on ingress interface
ifaces.forEach(interfaceKey -> {
entries.add(ClassifierEntry.buildIngressEntry(interfaceKey));
entries.add(ClassifierEntry.buildMatchEntry(nodeId, geniusProvider.getNodeConnectorIdFromInterfaceName(interfaceKey.getName()).get(), matches, nsp, nsi));
});
// hand-off can happen through the dispatcher table
if (nodeDpn.equals(lastHopDpn)) {
entries.add(ClassifierEntry.buildIngressEntry(new InterfaceKey(lastHopInterface)));
}
// Egress services must bind to egress ports. Since we dont know before-hand what
// the egress ports will be, we will bind on all switch ports. If the packet
// doesnt have NSH, it will be returned to the the egress dispatcher table.
List<Interfaces> interfaceUuidStrList = geniusProvider.getInterfacesFromNode(nodeId);
interfaceUuidStrList.forEach(interfaceUuidStr -> {
InterfaceKey interfaceKey = new InterfaceKey(interfaceUuidStr.getInterfaceName());
Optional<String> remoteIp = geniusProvider.getRemoteIpAddress(interfaceUuidStr.getInterfaceName());
entries.add(ClassifierEntry.buildEgressEntry(interfaceKey, remoteIp.orElse(nodeIp)));
});
});
return entries;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project bgpcep by opendaylight.
the class NeighborStateCliUtils method printTimerState.
private static void printTimerState(final Timers timers, final ShellTable table) {
if (timers == null) {
return;
}
final NeighborTimersStateAugmentation state = timers.getState().getAugmentation(NeighborTimersStateAugmentation.class);
if (state == null) {
return;
}
addHeader(table, "Timer state");
table.addRow().addContent("Negotiated Hold Time", state.getNegotiatedHoldTime());
table.addRow().addContent("Uptime", state.getUptime().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project bgpcep by opendaylight.
the class PeerGroupStateCliUtils method displayState.
private static void displayState(final PeerGroup group, final ShellTable table) {
addHeader(table, "Peer Group state");
table.addRow().addContent("Peer Group Name", group.getPeerGroupName());
final State state = group.getState();
if (state == null) {
return;
}
final PeerGroupStateAugmentation aug = state.getAugmentation(PeerGroupStateAugmentation.class);
table.addRow().addContent("Total Prefixes", aug.getTotalPrefixes());
}
Aggregations