use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class VpnManagerImpl method removeGwMac.
private void removeGwMac(String srcMacAddress, WriteTransaction tx, long vpnId, BigInteger dpId, long subnetVpnId) {
FlowEntity flowEntity = VpnUtil.buildL3vpnGatewayFlow(dpId, srcMacAddress, vpnId, subnetVpnId);
mdsalManager.removeFlowToTx(flowEntity, tx);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class VpnUtil method setupGwMacIfExternalVpn.
public static void setupGwMacIfExternalVpn(DataBroker dataBroker, IMdsalApiManager mdsalManager, BigInteger dpnId, String interfaceName, long vpnId, WriteTransaction writeInvTxn, int addOrRemove, String gwMac) {
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance.VpnIds> vpnIdsInstanceIdentifier = getVpnIdToVpnInstanceIdentifier(vpnId);
Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance.VpnIds> vpnIdsOptional = read(dataBroker, LogicalDatastoreType.CONFIGURATION, vpnIdsInstanceIdentifier);
if (vpnIdsOptional.isPresent() && vpnIdsOptional.get().isExternalVpn()) {
if (gwMac == null) {
LOG.error("setupGwMacIfExternalVpn: Failed to get gwMacAddress for interface {} on dpn {} vpn {}", interfaceName, dpnId.toString(), vpnIdsOptional.get().getVpnInstanceName());
return;
}
FlowEntity flowEntity = VpnUtil.buildL3vpnGatewayFlow(dpnId, gwMac, vpnId, VpnConstants.INVALID_ID);
if (addOrRemove == NwConstants.ADD_FLOW) {
mdsalManager.addFlowToTx(flowEntity, writeInvTxn);
} else if (addOrRemove == NwConstants.DEL_FLOW) {
mdsalManager.removeFlowToTx(flowEntity, writeInvTxn);
}
}
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class VpnNodeListener method programTableMissForVpnVniDemuxTable.
private void programTableMissForVpnVniDemuxTable(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
List<ActionInfo> actionsInfos = Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
List<MatchInfo> matches = new ArrayList<>();
String flowRef = getTableMissFlowRef(dpnId, NwConstants.L3VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, NwConstants.TABLE_MISS_FLOW);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, flowRef, NwConstants.TABLE_MISS_PRIORITY, "VPN-VNI Demux Table Miss", 0, 0, new BigInteger("1080000", 16), matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
mdsalManager.addFlowToTx(flowEntity, writeFlowTx);
} else {
mdsalManager.removeFlowToTx(flowEntity, writeFlowTx);
}
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class VpnNodeListener method createL3GwMacArpFlows.
private void createL3GwMacArpFlows(WriteTransaction writeFlowTx, BigInteger dpId) {
FlowEntity arpReqGwMacTbl = ArpResponderUtil.createArpDefaultFlow(dpId, NwConstants.L3_GW_MAC_TABLE, NwConstants.ARP_REQUEST, () -> Arrays.asList(MatchEthernetType.ARP, MatchArpOp.REQUEST), () -> Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE)));
LOG.trace("Invoking MDSAL to install Arp Rquest Match Flow for table {}", NwConstants.L3_GW_MAC_TABLE);
mdsalManager.addFlowToTx(arpReqGwMacTbl, writeFlowTx);
FlowEntity arpRepGwMacTbl = ArpResponderUtil.createArpDefaultFlow(dpId, NwConstants.L3_GW_MAC_TABLE, NwConstants.ARP_REPLY, () -> Arrays.asList(MatchEthernetType.ARP, MatchArpOp.REPLY), () -> Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE)));
LOG.trace("Invoking MDSAL to install Arp Reply Match Flow for Table {} ", NwConstants.L3_GW_MAC_TABLE);
mdsalManager.addFlowToTx(arpRepGwMacTbl, writeFlowTx);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class VpnNodeListener method makeL3IntfTblMissFlow.
private void makeL3IntfTblMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
List<InstructionInfo> instructions = new ArrayList<>();
List<MatchInfo> matches = new ArrayList<>();
final BigInteger cookieTableMiss = new BigInteger("1030000", 16);
// Instruction to goto L3 InterfaceTable
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
// instructions.add(new InstructionGotoTable(NwConstants.LPORT_DISPATCHER_TABLE));
FlowEntity flowEntityL3Intf = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_INTERFACE_TABLE, getTableMissFlowRef(dpnId, NwConstants.L3_INTERFACE_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "L3 Interface Table Miss", 0, 0, cookieTableMiss, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("Invoking MDSAL to install L3 interface Table Miss Entries");
mdsalManager.addFlowToTx(flowEntityL3Intf, writeFlowTx);
} else {
mdsalManager.removeFlowToTx(flowEntityL3Intf, writeFlowTx);
}
}
Aggregations