use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project genius by opendaylight.
the class FlowBasedIngressServicesConfigBindHelper method bindServiceOnVlan.
private void bindServiceOnVlan(List<ListenableFuture<Void>> futures, BoundServices boundServiceNew, List<BoundServices> allServices, BoundServicesState boundServiceState) {
BigInteger dpId = boundServiceState.getDpid();
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
LOG.info("binding ingress service {} for vlan port: {}", boundServiceNew.getServiceName(), boundServiceState.getInterfaceName());
if (allServices.size() == 1) {
// calling LportDispatcherTableForService with current service index
// as 0 and next service index as some value since this is the only
// service bound.
FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, boundServiceState.getInterfaceName(), tx, boundServiceState.getIfIndex(), NwConstants.DEFAULT_SERVICE_INDEX, (short) (boundServiceNew.getServicePriority() + 1));
return;
}
allServices.remove(boundServiceNew);
BoundServices[] highLowPriorityService = FlowBasedServicesUtils.getHighAndLowPriorityService(allServices, boundServiceNew);
BoundServices low = highLowPriorityService[0];
BoundServices high = highLowPriorityService[1];
BoundServices highest = FlowBasedServicesUtils.getHighestPriorityService(allServices);
short currentServiceIndex = NwConstants.DEFAULT_SERVICE_INDEX;
// dummy
short nextServiceIndex = (short) (boundServiceNew.getServicePriority() + 1);
// index
if (low != null) {
nextServiceIndex = low.getServicePriority();
if (low.equals(highest)) {
// In this case the match criteria of existing service should be
// changed.
BoundServices lower = FlowBasedServicesUtils.getHighAndLowPriorityService(allServices, low)[0];
short lowerServiceIndex = (short) (lower != null ? lower.getServicePriority() : low.getServicePriority() + 1);
LOG.trace("Installing ingress dispatcher table entry for existing service {} service match on " + "service index {} update with service index {}", low, low.getServicePriority(), lowerServiceIndex);
FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, low, boundServiceState.getInterfaceName(), tx, boundServiceState.getIfIndex(), low.getServicePriority(), lowerServiceIndex);
} else {
currentServiceIndex = boundServiceNew.getServicePriority();
}
}
if (high != null) {
currentServiceIndex = boundServiceNew.getServicePriority();
if (high.equals(highest)) {
LOG.trace("Installing ingress dispatcher table entry for existing service {} service match on " + "service index {} update with service index {}", high, NwConstants.DEFAULT_SERVICE_INDEX, currentServiceIndex);
FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, high, boundServiceState.getInterfaceName(), tx, boundServiceState.getIfIndex(), NwConstants.DEFAULT_SERVICE_INDEX, currentServiceIndex);
} else {
LOG.trace("Installing ingress dispatcher table entry for existing service {} service match on " + "service index {} update with service index {}", high, high.getServicePriority(), currentServiceIndex);
FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, high, boundServiceState.getInterfaceName(), tx, boundServiceState.getIfIndex(), high.getServicePriority(), currentServiceIndex);
}
}
LOG.trace("Installing ingress dispatcher table entry for new service match on service index {} update with " + "service index {}", currentServiceIndex, nextServiceIndex);
FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, boundServiceState.getInterfaceName(), tx, boundServiceState.getIfIndex(), currentServiceIndex, nextServiceIndex);
}));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project genius by opendaylight.
the class InterfaceServiceUtil method buildServiceInfo.
public static ServicesInfo buildServiceInfo(String serviceName, int servicePriority) {
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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project netvirt by opendaylight.
the class VpnUtil method bindService.
static void bindService(final String vpnInstanceName, final String interfaceName, DataBroker dataBroker, boolean isTunnelInterface, JobCoordinator jobCoordinator) {
jobCoordinator.enqueueJob(interfaceName, () -> {
WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
BoundServices serviceInfo = isTunnelInterface ? VpnUtil.getBoundServicesForTunnelInterface(vpnInstanceName, interfaceName) : getBoundServicesForVpnInterface(dataBroker, vpnInstanceName, interfaceName);
writeTxn.put(LogicalDatastoreType.CONFIGURATION, InterfaceUtils.buildServiceId(interfaceName, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)), serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
return Collections.singletonList(writeTxn.submit());
}, SystemPropertyReader.getDataStoreJobCoordinatorMaxRetries());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project netvirt by opendaylight.
the class VpnUtil method getBoundServicesForTunnelInterface.
static BoundServices getBoundServicesForTunnelInterface(String vpnName, String interfaceName) {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.L3VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, ++instructionKey));
BoundServices serviceInfo = InterfaceUtils.getBoundServices(String.format("%s.%s.%s", "vpn", vpnName, interfaceName), ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VNI_EXTERNAL_TUNNEL_DEMUX_TABLE), VpnConstants.DEFAULT_FLOW_PRIORITY, NwConstants.COOKIE_VM_INGRESS_TABLE, instructions);
return serviceInfo;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project netvirt by opendaylight.
the class VpnUtil method getBoundServicesForVpnInterface.
static BoundServices getBoundServicesForVpnInterface(DataBroker broker, String vpnName, String interfaceName) {
List<Instruction> instructions = new ArrayList<>();
int instructionKey = 0;
final long vpnId = VpnUtil.getVpnId(broker, vpnName);
List<Action> actions = Collections.singletonList(new ActionRegLoad(0, VpnConstants.VPN_REG_ID, 0, VpnConstants.VPN_ID_LENGTH, vpnId).buildAction());
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, ++instructionKey));
instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID, ++instructionKey));
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.L3_GW_MAC_TABLE, ++instructionKey));
BoundServices serviceInfo = InterfaceUtils.getBoundServices(String.format("%s.%s.%s", "vpn", vpnName, interfaceName), ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX), VpnConstants.DEFAULT_FLOW_PRIORITY, NwConstants.COOKIE_VM_INGRESS_TABLE, instructions);
return serviceInfo;
}
Aggregations