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 ElanInterfaceManager method bindElanService.
private void bindElanService(long elanTag, String elanInstanceName, String interfaceName, int lportTag, WriteTransaction tx) {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
List<Action> actions = new ArrayList<>();
actions.add(new ActionRegLoad(0, NxmNxReg1.class, 0, ElanConstants.INTERFACE_TAG_LENGTH - 1, lportTag).buildAction());
actions.add(new ActionRegLoad(1, ElanConstants.ELAN_REG_ID, 0, ElanConstants.ELAN_TAG_LENGTH - 1, elanTag).buildAction());
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, ++instructionKey));
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ARP_CHECK_TABLE, ++instructionKey));
short elanServiceIndex = ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX);
BoundServices serviceInfo = ElanUtils.getBoundServices(String.format("%s.%s.%s", "elan", elanInstanceName, interfaceName), elanServiceIndex, NwConstants.ELAN_SERVICE_INDEX, NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
InstanceIdentifier<BoundServices> bindServiceId = ElanUtils.buildServiceId(interfaceName, elanServiceIndex);
Optional<BoundServices> existingElanService = ElanUtils.read(broker, LogicalDatastoreType.CONFIGURATION, bindServiceId);
if (!existingElanService.isPresent()) {
tx.put(LogicalDatastoreType.CONFIGURATION, bindServiceId, serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
}
}
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 EgressCountersServiceImpl method bind.
@Override
public void bind(String interfaceId) {
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_COUNTERS_TABLE, ++instructionKey));
BoundServices serviceInfo = CountersServiceUtils.getBoundServices(String.format("%s.%s", "counters-egress", interfaceId), CountersServiceUtils.EGRESS_COUNTERS_SERVICE_INDEX, CountersServiceUtils.EGRESS_COUNTERS_DEFAULT_FLOW_PRIORITY, CountersServiceUtils.COOKIE_COUNTERS_BASE, instructions);
InstanceIdentifier<BoundServices> serviceId = CountersServiceUtils.buildServiceId(interfaceId, CountersServiceUtils.EGRESS_COUNTERS_SERVICE_INDEX, ServiceModeEgress.class);
MDSALUtil.syncWrite(db, LogicalDatastoreType.CONFIGURATION, serviceId, 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 VPNServiceChainHandlerTest method stubScfIsBoundOnIface.
private void stubScfIsBoundOnIface(long scfTag, String ifName) throws Exception {
CheckedFuture chkdFuture = mock(CheckedFuture.class);
BoundServices boundService = InterfaceServiceUtil.getBoundServices(ifName, NwConstants.SCF_SERVICE_INDEX, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, CloudServiceChainConstants.COOKIE_SCF_BASE, null);
when(chkdFuture.checkedGet()).thenReturn(Optional.of(boundService));
when(readTx.read(eq(LogicalDatastoreType.CONFIGURATION), eq(VpnServiceChainUtils.buildBoundServicesIid(NwConstants.SCF_SERVICE_INDEX, ifName)))).thenReturn(chkdFuture);
}
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 VPNServiceChainHandler method bindScfOnVpnInterface.
public void bindScfOnVpnInterface(String ifName, int scfTag) {
LOG.debug("bind SCF tag {} on iface {}", scfTag, ifName);
if (isServiceBoundOnInterface(NwConstants.SCF_SERVICE_INDEX, ifName)) {
LOG.info("SCF is already bound on Interface {} for Ingress. Binding aborted", ifName);
return;
}
Action loadReg2Action = new ActionRegLoad(1, NxmNxReg2.class, 0, 31, scfTag).buildAction();
List<Instruction> instructions = Arrays.asList(MDSALUtil.buildApplyActionsInstruction(Collections.singletonList(loadReg2Action)), MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE, 1));
BoundServices boundServices = InterfaceServiceUtil.getBoundServices(ifName, NwConstants.SCF_SERVICE_INDEX, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, CloudServiceChainConstants.COOKIE_SCF_BASE, instructions);
interfaceManager.bindService(ifName, ServiceModeIngress.class, boundServices);
}
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 QosNeutronUtils method bindservice.
public void bindservice(String ifName) {
int priority = QosConstants.QOS_DEFAULT_FLOW_PRIORITY;
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.QOS_DSCP_TABLE, ++instructionKey));
short qosServiceIndex = ServiceIndex.getIndex(NwConstants.QOS_SERVICE_NAME, NwConstants.QOS_SERVICE_INDEX);
BoundServices serviceInfo = getBoundServices(String.format("%s.%s", "qos", ifName), qosServiceIndex, priority, NwConstants.COOKIE_QOS_TABLE, instructions);
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, buildServiceId(ifName, qosServiceIndex), serviceInfo);
}
Aggregations