org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState =
InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceName, dataBroker);
if (ifState == null || ifState.getOperStatus() == OperStatus.Down) {
- LOG.info("Not Binding Service since for Interface: {}", interfaceName);
+ LOG.warn("Interface not up, not Binding Service for Interface: {}", interfaceName);
return futures;
}
// Get the Parent ServiceInfo
+
ServicesInfo servicesInfo = FlowBasedServicesUtils.getServicesInfoForInterface(interfaceName, dataBroker);
if (servicesInfo == null) {
LOG.error("Reached Impossible part 1 in the code during bind service for: {}", boundServiceNew);
}
if (matches != null) {
- FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, vlanId, boundServiceNew,
+ FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew,
dataBroker, t, matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
}
if (matches != null) {
FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, dataBroker, t);
- FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, vlanId, boundServiceNew, dataBroker, t,
+ FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew, dataBroker, t,
matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
}
}
Long lportTag = FlowBasedServicesUtils.getLPortTag(iface, dataBroker);
int vlanId = 0;
if (iface.getType().isAssignableFrom(L2vlan.class)) {
- vlanId = iface.getAugmentation(IfL2vlan.class).getVlanId().getValue();
+ IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
+ if(l2vlan != null) {
+ vlanId = iface.getAugmentation(IfL2vlan.class).getVlanId().getValue();
+ }
}
List<BoundServices> boundServices = servicesInfo.getBoundServices();
if (boundServices.isEmpty()) {
BoundServices toBeMoved = tmpServicesMap.get(highestPriority);
FlowBasedServicesUtils.removeIngressFlow(iface, boundServiceOld, dpId, dataBroker, t);
- FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, vlanId, toBeMoved, dataBroker, t,
+ FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, toBeMoved, dataBroker, t,
matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, toBeMoved, dataBroker, t);
int vlanId = 0;
List<MatchInfo> matches = null;
if (iface.getType().isAssignableFrom(L2vlan.class)) {
- vlanId = iface.getAugmentation(IfL2vlan.class).getVlanId().getValue();
+ IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
+ if(l2vlan != null) {
+ vlanId = l2vlan.getVlanId().getValue();
+ }
matches = FlowBasedServicesUtils.getMatchInfoForVlanPortAtIngressTable(dpId, portNo, vlanId);
} else if (iface.getType().isAssignableFrom(Tunnel.class)){
matches = FlowBasedServicesUtils.getMatchInfoForTunnelPortAtIngressTable (dpId, portNo, iface);
}
if (matches != null) {
- FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, vlanId, highestPriorityBoundService,
+ FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, highestPriorityBoundService,
dataBroker, t, matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
}
import org.opendaylight.vpnservice.interfacemgr.IfmConstants;
import org.opendaylight.vpnservice.interfacemgr.IfmUtil;
import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceManagerCommonUtils;
-import org.opendaylight.vpnservice.mdsalutil.MDSALUtil;
-import org.opendaylight.vpnservice.mdsalutil.MatchFieldType;
-import org.opendaylight.vpnservice.mdsalutil.MatchInfo;
-import org.opendaylight.vpnservice.mdsalutil.MetaDataUtil;
+import org.opendaylight.vpnservice.mdsalutil.*;
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.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
return 0L;
}
- public static void installInterfaceIngressFlow(BigInteger dpId, int vlanId,
+ public static void installInterfaceIngressFlow(BigInteger dpId, String interfaceName, int vlanId,
BoundServices boundServiceNew,
DataBroker dataBroker, WriteTransaction t,
List<MatchInfo> matches, int lportTag, short tableId) {
}
String serviceRef = boundServiceNew.getServiceName();
+ String flowRef = getFlowRef(dpId, interfaceName, boundServiceNew);
StypeOpenflow stypeOpenflow = boundServiceNew.getAugmentation(StypeOpenflow.class);
- Flow ingressFlow = MDSALUtil.buildFlowNew(tableId, serviceRef,
+ Flow ingressFlow = MDSALUtil.buildFlowNew(tableId, flowRef,
stypeOpenflow.getFlowPriority(), serviceRef, 0, 0,
stypeOpenflow.getFlowCookie(), matches, instructionSet);
installFlow(dpId, ingressFlow, dataBroker, t);
}
// build the flow and install it
- Flow ingressFlow = MDSALUtil.buildFlowNew(stypeOpenFlow.getDispatcherTableId(), serviceRef,
+ String flowRef = getFlowRef(dpId, iface.getName(), boundService);
+ Flow ingressFlow = MDSALUtil.buildFlowNew(stypeOpenFlow.getDispatcherTableId(), flowRef,
boundService.getServicePriority(), serviceRef, 0, 0, stypeOpenFlow.getFlowCookie(), matches, instructions);
installFlow(dpId, ingressFlow, dataBroker, t);
}
public static void removeIngressFlow(Interface iface, BoundServices serviceOld, BigInteger dpId,
DataBroker dataBroker, WriteTransaction t) {
LOG.debug("Removing Ingress Flows");
- String flowKeyStr = iface.getName() + serviceOld.getServicePriority() +
- serviceOld.getServiceName() + IfmConstants.VLAN_INTERFACE_INGRESS_TABLE;
+ String flowKeyStr = getFlowRef(dpId, iface.getName(), serviceOld);
FlowKey flowKey = new FlowKey(new FlowId(flowKeyStr));
Node nodeDpn = buildInventoryDpnNode(dpId);
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
t.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
}
- public static String getInterfaceRefInfo(String dpId, String portName) {
- String portRefInfo = "";
- if (!"".equals(dpId)) {
- portRefInfo = dpId.toString() + ":";
- }
- portRefInfo = portRefInfo + portName;
- return portRefInfo;
+ private static String getFlowRef(BigInteger dpnId, String iface, BoundServices service) {
+ return new StringBuffer().append(dpnId).append(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE).append(NwConstants.FLOWID_SEPARATOR)
+ .append(iface).append(NwConstants.FLOWID_SEPARATOR).append(service.getServiceName()).append(NwConstants.FLOWID_SEPARATOR)
+ .append(service.getServicePriority()).toString();
}
}
\ No newline at end of file