import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.servicebinding.rev151015.service.bindings.ServicesInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.servicebinding.rev151015.service.bindings.ServicesInfoKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.servicebinding.rev151015.service.bindings.services.info.BoundServices;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.rev150331.IfL2vlan;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
return null;
}
- public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, long vlanId) {
+ public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, Interface iface) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchInfo(MatchFieldType.in_port, new BigInteger[] {dpId, BigInteger.valueOf(portNo)}));
+ int vlanId = 0;
+ IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
+ if(l2vlan != null){
+ vlanId = l2vlan.getVlanId().getValue();
+ }
if (vlanId > 0) {
LOG.error("VlanId matching support is not fully available in Be.");
matches.add(new MatchInfo(MatchFieldType.vlan_vid, new long[]{vlanId}));
return 0L;
}
- public static void installInterfaceIngressFlow(BigInteger dpId, String interfaceName, int vlanId,
+ public static void installInterfaceIngressFlow(BigInteger dpId, Interface iface,
BoundServices boundServiceNew,
- DataBroker dataBroker, WriteTransaction t,
+ WriteTransaction t,
List<MatchInfo> matches, int lportTag, short tableId) {
List<Instruction> instructions = boundServiceNew.getAugmentation(StypeOpenflow.class).getInstruction();
int serviceInstructionsSize = instructions.size();
List<Instruction> instructionSet = new ArrayList<Instruction>();
+ int vlanId = 0;
+ IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
+ if(l2vlan != null){
+ vlanId = l2vlan.getVlanId().getValue();
+ }
if (vlanId != 0) {
// incrementing instructionSize and using it as actionKey. Because it won't clash with any other instructions
int actionKey = ++serviceInstructionsSize;
}
String serviceRef = boundServiceNew.getServiceName();
- String flowRef = getFlowRef(dpId, interfaceName, boundServiceNew);
+ String flowRef = getFlowRef(dpId, iface.getName(), boundServiceNew);
StypeOpenflow stypeOpenflow = boundServiceNew.getAugmentation(StypeOpenflow.class);
Flow ingressFlow = MDSALUtil.buildFlowNew(tableId, flowRef,
stypeOpenflow.getFlowPriority(), serviceRef, 0, 0,
Node nodeDpn = buildInventoryDpnNode(dpId);
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
- .child(Table.class, new TableKey(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build();
+ .child(Table.class, new TableKey(NwConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build();
t.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
}
}
public static void installLPortDispatcherFlow(BigInteger dpId, BoundServices boundService, Interface iface,
- DataBroker dataBroker, WriteTransaction t, int interfaceTag) {
+ WriteTransaction t, int interfaceTag) {
LOG.debug("Installing LPort Dispatcher Flows {}, {}", dpId, iface);
short serviceIndex = boundService.getServicePriority();
String serviceRef = boundService.getServiceName();
installFlow(dpId, ingressFlow, t);
}
- public static void removeIngressFlow(Interface iface, BoundServices serviceOld, BigInteger dpId,
- DataBroker dataBroker, WriteTransaction t) {
+ public static void removeIngressFlow(Interface iface, BoundServices serviceOld, BigInteger dpId, WriteTransaction t) {
LOG.debug("Removing Ingress Flows");
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)
.child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
- .child(Table.class, new TableKey(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build();
+ .child(Table.class, new TableKey(NwConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build();
t.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
}
- public static void removeLPortDispatcherFlow(BigInteger dpId, Interface iface, BoundServices boundServicesOld,
- DataBroker dataBroker, WriteTransaction t) {
+ public static void removeLPortDispatcherFlow(BigInteger dpId, Interface iface, BoundServices boundServicesOld, WriteTransaction t) {
LOG.debug("Removing LPort Dispatcher Flows {}, {}", dpId, iface);
- Long interfaceTag = FlowBasedServicesUtils.getLPortTag(iface, dataBroker);
StypeOpenflow stypeOpenFlow = boundServicesOld.getAugmentation(StypeOpenflow.class);
- String flowKeyStr = iface.getName() + boundServicesOld.getServicePriority() +
- boundServicesOld.getServiceName() + stypeOpenFlow.getDispatcherTableId();
- FlowKey flowKey = new FlowKey(new FlowId(flowKeyStr));
+ // build the flow and install it
+ String flowRef = getFlowRef(dpId, iface.getName(), boundServicesOld);
+ FlowKey flowKey = new FlowKey(new FlowId(flowRef));
Node nodeDpn = buildInventoryDpnNode(dpId);
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
}
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)
+ return new StringBuffer().append(dpnId).append( NwConstants.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();
}