use of Nodes.Node in project netvirt by opendaylight.
the class VrfEntryListener method createTerminatingServiceActions.
public void createTerminatingServiceActions(BigInteger destDpId, int label, List<ActionInfo> actionsInfos, WriteTransaction tx) {
List<MatchInfo> mkMatches = new ArrayList<>();
LOG.debug("create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}", destDpId, label, actionsInfos);
// Matching metadata
// FIXME vxlan vni bit set is not working properly with OVS.need to revisit
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, getTableMissFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, label), 5, String.format("%s:%d", "TST Flow Entry ", label), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, mkInstructions);
FlowKey flowKey = new FlowKey(new FlowId(terminatingServiceTableFlowEntity.getFlowId()));
FlowBuilder flowbld = terminatingServiceTableFlowEntity.getFlowBuilder();
Node nodeDpn = FibUtil.buildDpnNode(terminatingServiceTableFlowEntity.getDpnId());
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(terminatingServiceTableFlowEntity.getTableId())).child(Flow.class, flowKey).build();
tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flowbld.build(), WriteTransaction.CREATE_MISSING_PARENTS);
}
use of Nodes.Node in project netvirt by opendaylight.
the class VrfEntryListener method removeTunnelTableEntry.
private void removeTunnelTableEntry(BigInteger dpId, long label, WriteTransaction tx) {
FlowEntity flowEntity;
LOG.debug("remove terminatingServiceActions called with DpnId = {} and label = {}", dpId, label);
List<MatchInfo> mkMatches = new ArrayList<>();
// Matching metadata
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, getTableMissFlowRef(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, (int) label), 5, String.format("%s:%d", "TST Flow Entry ", label), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, null);
Node nodeDpn = FibUtil.buildDpnNode(flowEntity.getDpnId());
FlowKey flowKey = new FlowKey(new FlowId(flowEntity.getFlowId()));
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(flowEntity.getTableId())).child(Flow.class, flowKey).build();
tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
LOG.debug("Terminating service Entry for dpID {} : label : {} removed successfully", dpId, label);
}
use of Nodes.Node in project netvirt by opendaylight.
the class ElanServiceTestBase method getFlowIid.
protected InstanceIdentifier<Flow> getFlowIid(short tableId, FlowId flowid, BigInteger dpnId) {
FlowKey flowKey = new FlowKey(new FlowId(flowid));
NodeId nodeId = new NodeId("openflow:" + dpnId);
Node nodeDpn = new NodeBuilder().setId(nodeId).setKey(new NodeKey(nodeId)).build();
return InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId)).child(Flow.class, flowKey).build();
}
use of Nodes.Node in project openflowplugin by opendaylight.
the class LearningSwitchHandlerSimpleImpl method onSwitchAppeared.
@Override
public synchronized void onSwitchAppeared(InstanceIdentifier<Table> appearedTablePath) {
if (isLearning) {
LOG.debug("already learning a node, skipping {}", nodeId.getValue());
return;
}
LOG.debug("expected table acquired, learning ..");
// disable listening - simple learning handles only one node (switch)
if (registrationPublisher != null) {
LOG.debug("closing dataTreeChangeListenerRegistration");
registrationPublisher.getDataTreeChangeListenerRegistration().close();
}
isLearning = true;
tablePath = appearedTablePath;
nodePath = tablePath.firstIdentifierOf(Node.class);
nodeId = nodePath.firstKeyOf(Node.class, NodeKey.class).getId();
mac2portMapping = new HashMap<>();
// start forwarding all packages to controller
FlowId flowId = new FlowId(String.valueOf(flowIdInc.getAndIncrement()));
FlowKey flowKey = new FlowKey(flowId);
InstanceIdentifier<Flow> flowPath = InstanceIdentifierUtils.createFlowPath(tablePath, flowKey);
int priority = 0;
// create flow in table with id = 0, priority = 4 (other params are
// defaulted in OFDataStoreUtil)
FlowBuilder allToCtrlFlow = FlowUtils.createFwdAllToControllerFlow(InstanceIdentifierUtils.getTableId(tablePath), priority, flowId);
LOG.debug("writing packetForwardToController flow");
dataStoreAccessor.writeFlowToConfig(flowPath, allToCtrlFlow.build());
}
use of Nodes.Node in project openflowplugin by opendaylight.
the class MultipleLearningSwitchHandlerFacadeImpl method onSwitchAppeared.
@Override
public synchronized void onSwitchAppeared(InstanceIdentifier<Table> appearedTablePath) {
LOG.debug("expected table acquired, learning ..");
/**
* appearedTablePath is in form of /nodes/node/node-id/table/table-id
* so we shorten it to /nodes/node/node-id to get identifier of switch.
*/
InstanceIdentifier<Node> nodePath = InstanceIdentifierUtils.getNodePath(appearedTablePath);
/**
* We check if we already initialized dispatcher for that node,
* if not we create new handler for switch.
*/
if (!packetInDispatcher.getHandlerMapping().containsKey(nodePath)) {
// delegate this node (owning appearedTable) to SimpleLearningSwitchHandler
LearningSwitchHandlerSimpleImpl simpleLearningSwitch = new LearningSwitchHandlerSimpleImpl(dataStoreAccessor, packetProcessingService, null);
/**
* We propagate table event to newly instantiated instance of learning switch
*/
simpleLearningSwitch.onSwitchAppeared(appearedTablePath);
/**
* We update mapping of already instantiated LearningSwitchHanlders
*/
packetInDispatcher.getHandlerMapping().put(nodePath, simpleLearningSwitch);
}
}
Aggregations