use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project genius by opendaylight.
the class ActionInfoBuilderTest method groupActionWithSingleIntegerInStringValueWithActionKey.
@Test
public void groupActionWithSingleIntegerInStringValueWithActionKey() {
ActionInfo actionInfo = new ActionGroup(69, 123);
assertEquals("(new ActionGroupBuilder => [" + System.lineSeparator() + " groupId = 123L" + System.lineSeparator() + "]).build()", generator.getExpression(actionInfo));
}
use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.
the class ElanInterfaceManager method removeElanBroadcastGroup.
public void removeElanBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
int bucketId = 0;
int actionKey = 0;
Long elanTag = elanInfo.getElanTag();
List<Bucket> listBuckets = new ArrayList<>();
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(++actionKey, ElanUtils.getElanLocalBCGId(elanTag)).buildAction());
listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, elanTag));
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getElanRemoteBCGId(elanInfo.getElanTag());
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleting the remoteBroadCast group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.
the class ElanInterfaceManager method getInstructionsForOutGroup.
private List<InstructionInfo> getInstructionsForOutGroup(long groupId) {
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionWriteActions(Collections.singletonList(new ActionGroup(groupId))));
return mkInstructions;
}
use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.
the class ElanInterfaceManager method removeLeavesEtreeBroadcastGroup.
private void removeLeavesEtreeBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
long etreeTag = etreeInstance.getEtreeLeafTagVal().getValue();
int bucketId = 0;
int actionKey = 0;
List<Bucket> listBuckets = new ArrayList<>();
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeTag)).buildAction(++actionKey));
listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, etreeTag));
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleting the remoteBroadCast group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
}
use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.
the class ExternalRoutersListener method buildSnatFlowEntityWithUpdatedVpnId.
public FlowEntity buildSnatFlowEntityWithUpdatedVpnId(BigInteger dpId, String routerName, long groupId, long changedVpnId) {
LOG.debug("buildSnatFlowEntityWithUpdatedVpnId : called for dpId {}, routerName {} groupId {} " + "changed VPN ID {}", dpId, routerName, groupId, changedVpnId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
List<ActionInfo> actionsInfo = new ArrayList<>();
long tunnelId = NatUtil.getTunnelIdForNonNaptToNaptFlow(dataBroker, elanManager, idManager, changedVpnId, routerName);
actionsInfo.add(new ActionSetFieldTunnelId(BigInteger.valueOf(tunnelId)));
LOG.debug("buildSnatFlowEntityWithUpdatedVpnId : Setting the tunnel to the list of action infos {}", actionsInfo);
actionsInfo.add(new ActionGroup(groupId));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfo));
String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
LOG.debug("buildSnatFlowEntityWithUpdatedVpnId : Returning SNAT Flow Entity {}", flowEntity);
return flowEntity;
}
Aggregations