Search in sources :

Example 1 with ServiceModeBase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase in project netvirt by opendaylight.

the class AclServiceUtils method buildMatchesForLPortTagAndRemoteAclTag.

public static List<MatchInfoBase> buildMatchesForLPortTagAndRemoteAclTag(Integer lportTag, Integer remoteAclTag, Class<? extends ServiceModeBase> serviceMode) {
    List<MatchInfoBase> matches = new ArrayList<>();
    if (serviceMode != null && serviceMode.isAssignableFrom(ServiceModeEgress.class)) {
        matches.add(AclServiceUtils.buildLPortTagMatch(lportTag, serviceMode));
        matches.add(AclServiceUtils.buildRemoteAclTagMetadataMatch(remoteAclTag));
    } else {
        // In case of ingress service mode, only metadata is used for
        // matching both lportTag and aclTag. Hence performing "or"
        // operation on both lportTag and aclTag metadata.
        BigInteger metaData = MetaDataUtil.getLportTagMetaData(lportTag).or(getRemoteAclTagMetadata(BigInteger.valueOf(remoteAclTag)));
        BigInteger metaDataMask = MetaDataUtil.METADATA_MASK_LPORT_TAG.or(MetaDataUtil.METADATA_MASK_REMOTE_ACL_TAG);
        matches.add(new MatchMetadata(metaData, metaDataMask));
    }
    return matches;
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ServiceModeEgress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 2 with ServiceModeBase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase in project genius by opendaylight.

the class FlowBasedServicesUtils method buildBoundServicesState.

public static BoundServicesState buildBoundServicesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState, Class<? extends ServiceModeBase> serviceMode) {
    NodeConnectorId nodeConnectorId = IfmUtil.getNodeConnectorIdFromInterface(interfaceState);
    BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
    long portNo = IfmUtil.getPortNumberFromNodeConnectorId(nodeConnectorId);
    BoundServicesStateKey boundServicesStateKey = new BoundServicesStateKey(interfaceState.getName(), serviceMode);
    return new BoundServicesStateBuilder().setDpid(dpId).setIfIndex(interfaceState.getIfIndex()).setInterfaceName(interfaceState.getName()).setInterfaceType(interfaceState.getType()).setPortNo(portNo).setServiceMode(serviceMode).setKey(boundServicesStateKey).build();
}
Also used : BoundServicesStateKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesStateKey) BoundServicesStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesStateBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) BigInteger(java.math.BigInteger)

Example 3 with ServiceModeBase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase in project genius by opendaylight.

the class FlowBasedServicesUtils method getServicesInfoForInterface.

public static ServicesInfo getServicesInfoForInterface(ReadTransaction tx, String interfaceName, Class<? extends ServiceModeBase> serviceMode) throws ReadFailedException {
    ServicesInfoKey servicesInfoKey = new ServicesInfoKey(interfaceName, serviceMode);
    InstanceIdentifier.InstanceIdentifierBuilder<ServicesInfo> servicesInfoIdentifierBuilder = InstanceIdentifier.builder(ServiceBindings.class).child(ServicesInfo.class, servicesInfoKey);
    return tx.read(LogicalDatastoreType.CONFIGURATION, servicesInfoIdentifierBuilder.build()).checkedGet().orNull();
}
Also used : ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey) ServiceBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ServicesInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo)

Example 4 with ServiceModeBase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase in project netvirt by opendaylight.

the class AclServiceUtils method buildMatchesForLPortTagAndConntrackClassifierType.

public static Collection<? extends MatchInfoBase> buildMatchesForLPortTagAndConntrackClassifierType(int lportTag, AclConntrackClassifierType conntrackClassifierType, Class<? extends ServiceModeBase> serviceMode) {
    List<MatchInfoBase> matches = new ArrayList<>();
    if (serviceMode != null && serviceMode.isAssignableFrom(ServiceModeEgress.class)) {
        matches.add(AclServiceUtils.buildLPortTagMatch(lportTag, serviceMode));
        matches.add(AclServiceUtils.buildAclConntrackClassifierTypeMatch(conntrackClassifierType));
    } else {
        // In case of ingress service mode, only metadata is used for
        // matching both lportTag and conntrackClassifierType. Hence performing "or"
        // operation on both lportTag and conntrackClassifierType metadata.
        BigInteger metaData = MetaDataUtil.getLportTagMetaData(lportTag).or(MetaDataUtil.getAclConntrackClassifierTypeFromMetaData(conntrackClassifierType.getValue()));
        BigInteger metaDataMask = MetaDataUtil.METADATA_MASK_LPORT_TAG.or(MetaDataUtil.METADATA_MASK_ACL_CONNTRACK_CLASSIFIER_TYPE);
        matches.add(new MatchMetadata(metaData, metaDataMask));
    }
    return matches;
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ServiceModeEgress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Aggregations

BigInteger (java.math.BigInteger)3 ArrayList (java.util.ArrayList)2 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)2 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)2 ServiceModeEgress (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress)2 ServiceBindings (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings)1 BoundServicesStateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesStateBuilder)1 BoundServicesStateKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesStateKey)1 ServicesInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo)1 ServicesInfoKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey)1 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1