import org.opendaylight.genius.mdsalutil.MatchInfoBase;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.utils.ServiceIndex;
import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
import org.opendaylight.netvirt.aclservice.utils.AclConstants;
import org.opendaylight.netvirt.aclservice.utils.AclServiceOFFlowBuilder;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_ACL_TABLE, ++instructionKey));
BoundServices serviceInfo = AclServiceUtils.getBoundServices(
- String.format("%s.%s.%s", "vpn", "ingressacl", interfaceName), NwConstants.EGRESS_ACL_SERVICE_INDEX,
+ String.format("%s.%s.%s", "vpn", "ingressacl", interfaceName),
+ ServiceIndex.getIndex(NwConstants.EGRESS_ACL_SERVICE_NAME, NwConstants.EGRESS_ACL_SERVICE_INDEX),
flowPriority, AclConstants.COOKIE_ACL_BASE, instructions);
InstanceIdentifier<BoundServices> path = AclServiceUtils.buildServiceId(interfaceName,
- NwConstants.EGRESS_ACL_SERVICE_INDEX, ServiceModeEgress.class);
+ ServiceIndex.getIndex(NwConstants.EGRESS_ACL_SERVICE_NAME,
+ NwConstants.EGRESS_ACL_SERVICE_INDEX), ServiceModeEgress.class);
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, path, serviceInfo);
}
@Override
protected void unbindService(String interfaceName) {
InstanceIdentifier<BoundServices> path = AclServiceUtils.buildServiceId(interfaceName,
- NwConstants.EGRESS_ACL_SERVICE_INDEX, ServiceModeEgress.class);
+ ServiceIndex.getIndex(NwConstants.EGRESS_ACL_SERVICE_NAME, NwConstants.EGRESS_ACL_SERVICE_INDEX),
+ ServiceModeEgress.class);
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, path);
}
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.mdsalutil.AbstractDataChangeListener;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
import org.opendaylight.genius.mdsalutil.MatchFieldType;
+import org.opendaylight.genius.mdsalutil.MatchInfo;
import org.opendaylight.genius.mdsalutil.MetaDataUtil;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.utils.ServiceIndex;
import org.opendaylight.netvirt.cloudservicechain.CloudServiceChainConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
logger.debug("Installing L3VPN to ELAN default Fallback flow in LPortDispatcher table");
BigInteger[] metadataToMatch = new BigInteger[] {
- MetaDataUtil.getServiceIndexMetaData(NwConstants.L3VPN_SERVICE_INDEX),
+ MetaDataUtil.getServiceIndexMetaData(ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)),
MetaDataUtil.METADATA_MASK_SERVICE_INDEX
};
List<MatchInfo> matches = Arrays.asList(new MatchInfo(MatchFieldType.metadata, metadataToMatch));
- BigInteger metadataToWrite = MetaDataUtil.getServiceIndexMetaData(NwConstants.ELAN_SERVICE_INDEX);
+ BigInteger metadataToWrite = MetaDataUtil.getServiceIndexMetaData(ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX));
int instructionKey = 0;
List<Instruction> instructions =
Arrays.asList(MDSALUtil.buildAndGetWriteMetadaInstruction(metadataToWrite,
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.utils.ServiceIndex;
import org.opendaylight.genius.mdsalutil.MatchFieldType;
import org.opendaylight.genius.mdsalutil.MatchInfo;
import java.util.Arrays;
List<MatchInfo> matches = Arrays.asList(
new MatchInfo(MatchFieldType.metadata,
new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
- NwConstants.SCF_SERVICE_INDEX),
+ ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX)),
MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
int instructionKey = 0;
List<Instruction> instructions = Arrays.asList(
List<MatchInfo> matches = Arrays.asList(
new MatchInfo(MatchFieldType.metadata,
new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
- NwConstants.ELAN_SERVICE_INDEX),
+ ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX)),
MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
int instructionKey = 0;
List<Instruction> instructions = Arrays.asList(
public static List<Instruction> buildSetLportTagAndGotoLportDispInstructions(long lportTag) {
int instructionKey = 0;
BigInteger metadata = MetaDataUtil.getMetaDataForLPortDispatcher((int) lportTag,
- NwConstants.SCF_SERVICE_INDEX);
+ ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX));
List<Instruction> result =
Arrays.asList(MDSALUtil.buildAndGetWriteMetadaInstruction(metadata,
MetaDataUtil.getMetaDataMaskForLPortDispatcher(),
import org.opendaylight.genius.mdsalutil.MetaDataUtil;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.utils.ServiceIndex;
import org.opendaylight.netvirt.cloudservicechain.CloudServiceChainConstants;
import org.opendaylight.netvirt.vpnmanager.VpnConstants;
import org.opendaylight.netvirt.vpnmanager.VpnUtil;
int addOrRemove) {
logger.info("buildLPortDispFlowForScf vpnId={} dpId={} lportTag={} addOrRemove={} ",
vpnId, dpId, lportTag, addOrRemove);
- List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, NwConstants.L3VPN_SERVICE_INDEX);
+ List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX));
List<Instruction> instructions = buildSetVrfTagAndGotoFibInstructions(vpnId.intValue());
String flowRef = getScfToL3VpnLportDispatcherFlowRef(lportTag);
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionInfo(InstructionType.write_metadata,
new BigInteger[]{
- MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, NwConstants.SCF_SERVICE_INDEX),
+ MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX)),
MetaDataUtil.getMetaDataMaskForLPortDispatcher()
}));
*/
public static FlowEntity buildLportFlowDispForVpnToScf(BigInteger dpId, Integer lportTag, int scfTag,
short gotoTableId) {
- List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, NwConstants.SCF_SERVICE_INDEX);
+ List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX));
List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] {
VpnServiceChainUtils.getMetadataSCF(scfTag), CloudServiceChainConstants.METADATA_MASK_SCF_WRITE
* @return
*/
public static Flow buildLPortDispFlowForVpntoVpn(Integer dstLportTag, Integer vpnTag) {
- List<MatchInfo> matches = buildMatchOnLportTagAndSI(dstLportTag, NwConstants.L3VPN_SERVICE_INDEX);
+ List<MatchInfo> matches = buildMatchOnLportTagAndSI(dstLportTag, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX));
List<Instruction> instructions = buildSetVrfTagAndGotoFibInstructions(vpnTag);
String flowRef = getL3VpnToL3VpnLportDispFlowRef(dstLportTag, vpnTag);
Flow result = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
*/
public static String getL3VpnToScfLportDispatcherFlowRef(Integer lportTag) {
return new StringBuffer(64).append(CloudServiceChainConstants.VPN_PSEUDO_VPN2SCF_FLOWID_PREFIX).append(lportTag)
- .append(NwConstants.FLOWID_SEPARATOR).append(NwConstants.SCF_SERVICE_INDEX)
+ .append(NwConstants.FLOWID_SEPARATOR).append(ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX))
.append(NwConstants.FLOWID_SEPARATOR)
.append(CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY).toString();
}
*/
public static String getScfToL3VpnLportDispatcherFlowRef(Integer lportTag) {
return new StringBuffer().append(CloudServiceChainConstants.VPN_PSEUDO_SCF2VPN_FLOWID_PREFIX).append(lportTag)
- .append(NwConstants.FLOWID_SEPARATOR).append(NwConstants.L3VPN_SERVICE_INDEX)
+ .append(NwConstants.FLOWID_SEPARATOR).append(ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX))
.append(NwConstants.FLOWID_SEPARATOR)
.append(CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY).toString();
}
BoundServices
serviceInfo =
InterfaceUtils.getBoundServices(String.format("%s.%s.%s", "vpn",vpnInstanceName, vpnInterfaceName),
- NwConstants.L3VPN_SERVICE_INDEX, priority,
+ ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX), priority,
NwConstants.COOKIE_VM_INGRESS_TABLE, instructions);
writeTxn.put(LogicalDatastoreType.CONFIGURATION,
- InterfaceUtils.buildServiceId(vpnInterfaceName, NwConstants.L3VPN_SERVICE_INDEX), serviceInfo, true);
+ InterfaceUtils.buildServiceId(vpnInterfaceName, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)), serviceInfo, true);
List<ListenableFuture<Void>> futures = new ArrayList<ListenableFuture<Void>>();
futures.add(writeTxn.submit());
return futures;
}
});
- makeArpFlow(dpId, NwConstants.L3VPN_SERVICE_INDEX, lPortTag, vpnInterfaceName,
+ makeArpFlow(dpId, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX), lPortTag, vpnInterfaceName,
vpnId, ArpReplyOrRequest.REQUEST, NwConstants.ADD_FLOW, writeInvTxn);
- makeArpFlow(dpId, NwConstants.L3VPN_SERVICE_INDEX, lPortTag, vpnInterfaceName,
+ makeArpFlow(dpId, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX), lPortTag, vpnInterfaceName,
vpnId, ArpReplyOrRequest.REPLY, NwConstants.ADD_FLOW, writeInvTxn);
}
WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
writeTxn.delete(LogicalDatastoreType.CONFIGURATION,
InterfaceUtils.buildServiceId(vpnInterfaceName,
- NwConstants.L3VPN_SERVICE_INDEX));
+ ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)));
List<ListenableFuture<Void>> futures = new ArrayList<ListenableFuture<Void>>();
futures.add(writeTxn.submit());