use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action in project netvirt by opendaylight.
the class ElanInterfaceManager method bindElanService.
private void bindElanService(long elanTag, String elanInstanceName, String interfaceName, int lportTag, WriteTransaction tx) {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
List<Action> actions = new ArrayList<>();
actions.add(new ActionRegLoad(0, NxmNxReg1.class, 0, ElanConstants.INTERFACE_TAG_LENGTH - 1, lportTag).buildAction());
actions.add(new ActionRegLoad(1, ElanConstants.ELAN_REG_ID, 0, ElanConstants.ELAN_TAG_LENGTH - 1, elanTag).buildAction());
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, ++instructionKey));
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ARP_CHECK_TABLE, ++instructionKey));
short elanServiceIndex = ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX);
BoundServices serviceInfo = ElanUtils.getBoundServices(String.format("%s.%s.%s", "elan", elanInstanceName, interfaceName), elanServiceIndex, NwConstants.ELAN_SERVICE_INDEX, NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
InstanceIdentifier<BoundServices> bindServiceId = ElanUtils.buildServiceId(interfaceName, elanServiceIndex);
Optional<BoundServices> existingElanService = ElanUtils.read(broker, LogicalDatastoreType.CONFIGURATION, bindServiceId);
if (!existingElanService.isPresent()) {
tx.put(LogicalDatastoreType.CONFIGURATION, bindServiceId, serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action in project netvirt by opendaylight.
the class ElanInterfaceManager method setBCGrouponOtherDpns.
@SuppressWarnings("checkstyle:IllegalCatch")
private void setBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId, int elanTag, long groupId) {
int bucketId = 0;
ElanDpnInterfacesList elanDpns = elanUtils.getElanDpnInterfacesList(elanInfo.getElanInstanceName());
if (elanDpns != null) {
List<DpnInterfaces> dpnInterfaces = elanDpns.getDpnInterfaces();
for (DpnInterfaces dpnInterface : dpnInterfaces) {
List<Bucket> remoteListBucketInfo = new ArrayList<>();
if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpId) && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
List<Action> listAction = new ArrayList<>();
int actionKey = 0;
listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
remoteListBucketInfo.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
for (DpnInterfaces otherFes : dpnInterfaces) {
if (elanUtils.isDpnPresent(otherFes.getDpId()) && !Objects.equals(otherFes.getDpId(), dpnInterface.getDpId()) && otherFes.getInterfaces() != null && !otherFes.getInterfaces().isEmpty()) {
try {
List<Action> remoteListActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnInterface.getDpId(), otherFes.getDpId(), elanUtils.isOpenstackVniSemanticsEnforced() ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
if (!remoteListActionInfo.isEmpty()) {
remoteListBucketInfo.add(MDSALUtil.buildBucket(remoteListActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
}
} catch (Exception ex) {
LOG.error("setElanBCGrouponOtherDpns failed due to Exception caught; " + "Logical Group Interface not found between source Dpn - {}, " + "destination Dpn - {} ", dpnInterface.getDpId(), otherFes.getDpId(), ex);
return;
}
}
}
List<Bucket> elanL2GwDevicesBuckets = elanL2GatewayMulticastUtils.getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnInterface.getDpId(), bucketId);
remoteListBucketInfo.addAll(elanL2GwDevicesBuckets);
if (remoteListBucketInfo.isEmpty()) {
LOG.debug("No ITM is present on Dpn - {} ", dpnInterface.getDpId());
continue;
}
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(remoteListBucketInfo));
LOG.trace("Installing remote bc group {} on dpnId {}", group, dpnInterface.getDpId());
mdsalManager.syncInstallGroup(dpnInterface.getDpId(), group);
}
}
try {
Thread.sleep(WAIT_TIME_FOR_SYNC_INSTALL);
} catch (InterruptedException e1) {
LOG.warn("Error while waiting for remote BC group on other DPNs for ELAN {} to install", elanInfo);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action in project netvirt by opendaylight.
the class ElanInterfaceManager method createDropBucket.
private void createDropBucket(List<Bucket> listBucket) {
List<Action> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionDrop().buildAction());
Bucket dropBucket = MDSALUtil.buildBucket(actionsInfos, MDSALUtil.GROUP_WEIGHT, 0, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP);
listBucket.add(dropBucket);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action in project netvirt by opendaylight.
the class OpenFlow13Utils method createActionNxLoadNsi.
public static Action createActionNxLoadNsi(short value, int order) {
ActionBuilder ab = createActionBuilder(order);
ab.setAction(nxLoadRegAction(new DstNxNsiCaseBuilder().setNxNsiDst(Boolean.TRUE).build(), BigInteger.valueOf(value), 7, false));
return ab.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action in project netvirt by opendaylight.
the class OpenFlow13Utils method createActionNxLoadNshMdtype.
public static Action createActionNxLoadNshMdtype(short value, int order) {
ActionBuilder ab = createActionBuilder(order);
ab.setAction(nxLoadRegAction(new DstNxNshMdtypeCaseBuilder().setNxNshMdtype(Boolean.TRUE).build(), BigInteger.valueOf(value), 7, false));
return ab.build();
}
Aggregations