+ Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
+ logger.trace("deleting the remoteBroadCast group:{}", group);
+ mdsalManager.syncRemoveGroup(dpnId, group);
+ }
+
+ /**
+ * Installs a flow in the External Tunnel table consisting in translating
+ * the VNI retrieved from the packet that came over a tunnel with a TOR into
+ * elanTag that will be used later in the ELANs pipeline.
+ *
+ * @param dpnId
+ * the dpn id
+ * @param elanInfo
+ * the elan info
+ */
+ public void setExternalTunnelTable(BigInteger dpnId, ElanInstance elanInfo) {
+ long elanTag = elanInfo.getElanTag();
+ FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId,
+ NwConstants.EXTERNAL_TUNNEL_TABLE,
+ getFlowRef(NwConstants.EXTERNAL_TUNNEL_TABLE, elanTag),
+ 5, // prio
+ elanInfo.getElanInstanceName(), // flowName
+ 0, // idleTimeout
+ 0, // hardTimeout
+ ITMConstants.COOKIE_ITM_EXTERNAL.add(BigInteger.valueOf(elanTag)),
+ buildMatchesForVni(elanInfo.getVni()),
+ getInstructionsExtTunnelTable(elanTag) );
+
+ mdsalManager.installFlow(flowEntity);
+ }
+
+ /**
+ * Removes, from External Tunnel table, the flow that translates from VNI to elanTag.
+ * Important: ensure this method is only called whenever there is no other ElanInterface in the specified DPN
+ *
+ * @param dpnId DPN whose Ext Tunnel table is going to be modified
+ * @param elanInfo holds the elanTag needed for selecting the flow to be removed
+ */
+ public void unsetExternalTunnelTable(BigInteger dpnId, ElanInstance elanInfo) {
+ // TODO (eperefr): Use DataStoreJobCoordinator in order to avoid that removing the last ElanInstance plus
+ // adding a new one does (almost at the same time) are executed in that exact order
+
+ String flowId = getFlowRef(NwConstants.EXTERNAL_TUNNEL_TABLE, elanInfo.getElanTag());
+ FlowEntity flowEntity = new FlowEntity(dpnId);
+ flowEntity.setFlowId(flowId);
+ mdsalManager.removeFlow(flowEntity);