use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.
the class IfmUtil method getEgressActionInfosForInterface.
/**
* Returns the list of egress actions for a given interface.
*
* @param interfaceInfo the interface to look up
* @param portNo port number
* @param ifaceType the type of the interface
* @param tunnelKey the tunnel key
* @param actionKeyStart the start for the first key assigned for the new actions
* @param isDefaultEgress if it is the default egress
* @param ifIndex interface index
* @param groupId group Id
* @return list of actions for the interface
*/
// The following suppression is for javac, not for checkstyle
@SuppressWarnings("fallthrough")
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
public static List<ActionInfo> getEgressActionInfosForInterface(Interface interfaceInfo, String portNo, InterfaceInfo.InterfaceType ifaceType, Long tunnelKey, int actionKeyStart, boolean isDefaultEgress, int ifIndex, long groupId) {
List<ActionInfo> result = new ArrayList<>();
switch(ifaceType) {
case MPLS_OVER_GRE:
// fall through
case GRE_TRUNK_INTERFACE:
if (!isDefaultEgress) {
// stores the value coming from a VXLAN tunnel
if (tunnelKey == null) {
tunnelKey = 0L;
}
}
// fall through
case VXLAN_TRUNK_INTERFACE:
if (!isDefaultEgress) {
if (tunnelKey != null) {
result.add(new ActionSetFieldTunnelId(actionKeyStart++, BigInteger.valueOf(tunnelKey)));
}
} else {
// For OF Tunnels default egress actions need to set tunnelIps
IfTunnel ifTunnel = interfaceInfo.getAugmentation(IfTunnel.class);
if (BooleanUtils.isTrue(ifTunnel.isTunnelRemoteIpFlow() && ifTunnel.getTunnelDestination() != null)) {
result.add(new ActionSetTunnelDestinationIp(actionKeyStart++, ifTunnel.getTunnelDestination()));
}
if (BooleanUtils.isTrue(ifTunnel.isTunnelSourceIpFlow() && ifTunnel.getTunnelSource() != null)) {
result.add(new ActionSetTunnelSourceIp(actionKeyStart++, ifTunnel.getTunnelSource()));
}
}
// fall through
case VLAN_INTERFACE:
if (isDefaultEgress) {
IfL2vlan vlanIface = interfaceInfo.getAugmentation(IfL2vlan.class);
LOG.trace("get egress actions for l2vlan interface: {}", vlanIface);
boolean isVlanTransparent = false;
int vlanVid = 0;
if (vlanIface != null) {
vlanVid = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue();
isVlanTransparent = vlanIface.getL2vlanMode() == IfL2vlan.L2vlanMode.Transparent;
}
if (vlanVid != 0 && !isVlanTransparent) {
result.add(new ActionPushVlan(actionKeyStart++));
result.add(new ActionSetFieldVlanVid(actionKeyStart++, vlanVid));
}
result.add(new ActionOutput(actionKeyStart++, new Uri(portNo)));
} else {
addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
}
break;
case LOGICAL_GROUP_INTERFACE:
if (isDefaultEgress) {
result.add(new ActionGroup(groupId));
} else {
addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
}
break;
default:
LOG.warn("Interface Type {} not handled yet", ifaceType);
break;
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.
the class OvsInterfaceConfigAddHelper method createLogicalTunnelSelectGroup.
private long createLogicalTunnelSelectGroup(BigInteger srcDpnId, String interfaceName, int lportTag) {
long groupId = IfmUtil.getLogicalTunnelSelectGroupId(lportTag);
Group group = MDSALUtil.buildGroup(groupId, interfaceName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(Collections.emptyList()));
LOG.debug("MULTIPLE_VxLAN_TUNNELS: group id {} installed for {} srcDpnId {}", group.getGroupId().getValue(), interfaceName, srcDpnId);
mdsalApiManager.syncInstallGroup(srcDpnId, group);
return groupId;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.
the class GroupEntity method getGroupBuilder.
public GroupBuilder getGroupBuilder() {
if (groupBuilder == null) {
groupBuilder = new GroupBuilder();
GroupId groupId = new GroupId(getGroupId());
groupBuilder.setKey(new GroupKey(groupId));
groupBuilder.setGroupId(groupId);
groupBuilder.setGroupName(getGroupName());
groupBuilder.setGroupType(getGroupType());
groupBuilder.setBuckets(MDSALUtil.buildBuckets(getBucketInfoList()));
}
return groupBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.
the class MDSALManager method syncSetUpGroupInternal.
public void syncSetUpGroupInternal(GroupEntity groupEntity, boolean isRemove) {
if (LOG.isTraceEnabled()) {
LOG.trace("syncSetUpGroup for groupEntity {} ", groupEntity);
}
Group group = groupEntity.getGroupBuilder().build();
BigInteger dpId = groupEntity.getDpnId();
long groupId = groupEntity.getGroupId();
InstanceIdentifier<Group> groupInstanceId = buildGroupInstanceIdentifier(groupId, buildDpnNode(dpId));
if (isRemove) {
synchronized (getGroupKey(groupId, dpId)) {
if (groupExists(dpId, groupId)) {
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, groupInstanceId);
} else {
LOG.debug("Group {} does not exist for dpn {}", groupId, dpId);
}
}
} else {
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, groupInstanceId, group);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.
the class MDSALManager method removeGroupInternal.
public void removeGroupInternal(BigInteger dpnId, long groupId, WriteTransaction tx) {
Node nodeDpn = buildDpnNode(dpnId);
if (groupExists(nodeDpn, groupId)) {
InstanceIdentifier<Group> groupInstanceId = buildGroupInstanceIdentifier(groupId, nodeDpn);
tx.delete(LogicalDatastoreType.CONFIGURATION, groupInstanceId);
} else {
LOG.debug("Group {} does not exist for dpn {}", groupId, dpnId);
}
}
Aggregations