public class InterfaceInfo implements Serializable {
- /**
- *
- */
private static final long serialVersionUID = 1L;
- public enum InterfaceType {
+ public enum InterfaceType {
VLAN_INTERFACE,
VXLAN_TRUNK_INTERFACE,
GRE_TRUNK_INTERFACE,
}
public enum InterfaceAdminState {
- ENABLED,
- DISABLED
+ ENABLED, DISABLED
}
public enum InterfaceOpState {
- UP,
- DOWN,
- UNKNOWN
+ UP, DOWN, UNKNOWN
}
protected InterfaceType interfaceType;
protected boolean isUntaggedVlan;
protected String macAddress;
- public String getInterfaceName() {
- return interfaceName;
- }
-
- public void setInterfaceName(String interfaceName) {
- this.interfaceName = interfaceName;
- }
-
public InterfaceInfo(BigInteger dpId, String portName) {
this.dpId = dpId;
this.portName = portName;
this.portName = portName;
}
+ public String getInterfaceName() {
+ return interfaceName;
+ }
+
+ public void setInterfaceName(String interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
public boolean isOperational() {
return adminState == InterfaceAdminState.ENABLED && opState == InterfaceOpState.UP;
}
public InterfaceType getInterfaceType() {
return interfaceType;
}
+
public void setInterfaceType(InterfaceType lportType) {
this.interfaceType = lportType;
}
+
public int getInterfaceTag() {
return interfaceTag;
}
+
public void setInterfaceTag(int interfaceTag) {
this.interfaceTag = interfaceTag;
}
+
public void setUntaggedVlan(boolean isUntaggedVlan) {
this.isUntaggedVlan = isUntaggedVlan;
}
+
public boolean isUntaggedVlan() {
- return isUntaggedVlan;
+ return isUntaggedVlan;
}
+
public BigInteger getDpId() {
return dpId;
}
+
public void setDpId(BigInteger dpId) {
this.dpId = dpId;
}
+
public InterfaceAdminState getAdminState() {
return adminState;
}
+
public void setAdminState(InterfaceAdminState adminState) {
this.adminState = adminState;
}
+
public InterfaceOpState getOpState() {
return opState;
}
+
public void setOpState(InterfaceOpState opState) {
this.opState = opState;
}
+
public long getGroupId() {
return groupId;
}
+
public void setGroupId(long groupId) {
this.groupId = groupId;
}
+
public long getL2domainGroupId() {
return l2domainGroupId;
}
+
public void setL2domainGroupId(long l2domainGroupId) {
this.l2domainGroupId = l2domainGroupId;
}
public void setPortName(String portName) {
this.portName = portName;
}
- public String getPortName(){
+
+ public String getPortName() {
return this.portName;
}
package org.opendaylight.genius.interfacemanager.globals;
+import com.google.common.base.Optional;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.mdsalutil.FlowInfoKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceTypeFlowBased;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceTypeFlowBased;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
-
-import com.google.common.base.Optional;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class InterfaceServiceUtil {
public static ServicesInfo buildServiceInfo(String serviceName, short serviceIndex, int servicePriority,
BigInteger cookie, List<Instruction> instructions) {
- List<BoundServices> boundService = new ArrayList<>();
- boundService.add(new BoundServicesBuilder().setServicePriority((short)servicePriority).setServiceName(serviceName).build());
- return new ServicesInfoBuilder().setBoundServices(boundService).setKey(new ServicesInfoKey(serviceName, ServiceModeIngress.class)).build();
- }
-
- public static BoundServices getBoundServices(String serviceName, short servicePriority, int flowPriority,
- BigInteger cookie, List<Instruction> instructions) {
- StypeOpenflowBuilder augBuilder = new StypeOpenflowBuilder().setFlowCookie(cookie).setFlowPriority(flowPriority).setInstruction(instructions);
- return new BoundServicesBuilder().setKey(new BoundServicesKey(servicePriority))
- .setServiceName(serviceName).setServicePriority(servicePriority)
- .setServiceType(ServiceTypeFlowBased.class).addAugmentation(StypeOpenflow.class, augBuilder.build()).build();
+ List<BoundServices> boundService = new ArrayList<>();
+ boundService.add(new BoundServicesBuilder().setServicePriority((short) servicePriority)
+ .setServiceName(serviceName).build());
+ return new ServicesInfoBuilder().setBoundServices(boundService)
+ .setKey(new ServicesInfoKey(serviceName, ServiceModeIngress.class)).build();
}
public static ServicesInfo buildServiceInfo(String serviceName, short serviceIndex, int servicePriority,
BigInteger cookie) {
- List<BoundServices> boundService = new ArrayList<>();
- boundService.add(new BoundServicesBuilder().setServicePriority((short)servicePriority).setServiceName(serviceName).build());
- return new ServicesInfoBuilder().setBoundServices(boundService).setKey(new ServicesInfoKey(serviceName, ServiceModeIngress.class)).build();
+ List<BoundServices> boundService = new ArrayList<>();
+ boundService.add(new BoundServicesBuilder().setServicePriority((short) servicePriority)
+ .setServiceName(serviceName).build());
+ return new ServicesInfoBuilder().setBoundServices(boundService)
+ .setKey(new ServicesInfoKey(serviceName, ServiceModeIngress.class)).build();
}
- public static List<MatchInfo> getMatchInfoForVlanLPort(BigInteger dpId, long portNo, long vlanId, boolean isVlanTransparent) {
+ public static BoundServices getBoundServices(String serviceName, short servicePriority, int flowPriority,
+ BigInteger cookie, List<Instruction> instructions) {
+ StypeOpenflowBuilder augBuilder = new StypeOpenflowBuilder().setFlowCookie(cookie).setFlowPriority(flowPriority)
+ .setInstruction(instructions);
+ return new BoundServicesBuilder().setKey(new BoundServicesKey(servicePriority)).setServiceName(serviceName)
+ .setServicePriority(servicePriority).setServiceType(ServiceTypeFlowBased.class)
+ .addAugmentation(StypeOpenflow.class, augBuilder.build()).build();
+ }
+
+ public static List<MatchInfo> getMatchInfoForVlanLPort(BigInteger dpId, long portNo, long vlanId,
+ boolean isVlanTransparent) {
List<MatchInfo> matches = new ArrayList<>();
- matches.add(new MatchInfo(MatchFieldType.in_port, new BigInteger[] {dpId, BigInteger.valueOf(portNo)}));
+ matches.add(new MatchInfo(MatchFieldType.in_port, new BigInteger[] { dpId, BigInteger.valueOf(portNo) }));
if (vlanId != 0 && !isVlanTransparent) {
matches.add(new MatchInfo(MatchFieldType.vlan_vid, new long[] { vlanId }));
}
.child(Interface.class, new InterfaceKey(interfaceName)).build();
Optional<Interface> ifInstance = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, id, broker);
if (ifInstance.isPresent()) {
- IfL2vlan vlanIface =ifInstance.get().getAugmentation(IfL2vlan.class);
- short vlanId = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue().shortValue();
- return vlanId;
+ IfL2vlan vlanIface = ifInstance.get().getAugmentation(IfL2vlan.class);
+ return vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue().shortValue();
}
return -1;
}
- public static Set<Object> getStatRequestKeys(BigInteger dpId, short tableId, List<MatchInfo> matches, String flowId, long groupId) {
+ public static Set<Object> getStatRequestKeys(BigInteger dpId, short tableId, List<MatchInfo> matches, String flowId,
+ long groupId) {
Set<Object> statRequestKeys = new HashSet<>();
statRequestKeys.add(getFlowStatisticsKey(dpId, tableId, matches, flowId));
statRequestKeys.add(getGroupStatisticsKey(dpId, groupId));
return new GroupInfoKey(dpId, groupId);
}
- public static FlowInfoKey getFlowStatisticsKey(BigInteger dpId, short tableId, List<MatchInfo> matches, String flowId) {
+ public static FlowInfoKey getFlowStatisticsKey(BigInteger dpId, short tableId, List<MatchInfo> matches,
+ String flowId) {
return new FlowInfoKey(dpId, tableId, MDSALUtil.buildMatches(matches), flowId);
}
public static List<MatchInfo> getLPortDispatcherMatches(short serviceIndex, int interfaceTag) {
List<MatchInfo> mkMatches = new ArrayList<>();
- mkMatches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
- MetaDataUtil.getMetaDataForLPortDispatcher(interfaceTag, serviceIndex),
- MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
+ mkMatches.add(new MatchInfo(MatchFieldType.metadata,
+ new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(interfaceTag, serviceIndex),
+ MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
return mkMatches;
}
-
}
import java.math.BigInteger;
import java.util.List;
-
import org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExistsException;
import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
public interface IInterfaceManager {
@Deprecated
Long getPortForInterface(String ifName);
+ @Deprecated
+ Long getPortForInterface(Interface intf);
+
@Deprecated
BigInteger getDpnForInterface(String ifName);
@Deprecated
List<ActionInfo> getInterfaceEgressActions(String ifName);
- @Deprecated
- Long getPortForInterface(Interface intf);
-
InterfaceInfo getInterfaceInfo(String intInfo);
InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName,
InterfaceInfo.InterfaceType interfaceType);
+
InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName);
Interface getInterfaceInfoFromConfigDataStore(String interfaceName);
- void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId,
- String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
+ void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId, String description,
+ IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
- void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId,
- String description, IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal) throws InterfaceAlreadyExistsException;
+ void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId, String description,
+ IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal) throws InterfaceAlreadyExistsException;
void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
+
void unbindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
+
List<Interface> getVlanInterfaces();
+
List<Interface> getVxlanInterfaces();
boolean isExternalInterface(String interfaceName);
-}
\ No newline at end of file
+}