Search in sources :

Example 1 with AclserviceConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig in project netvirt by opendaylight.

the class AclServiceTestModule method configure.

@Override
protected void configure() {
    bind(DataBroker.class).toInstance(DataBrokerTestModule.dataBroker());
    bind(AclserviceConfig.class).toInstance(aclServiceConfig());
    bind(AclClusterUtil.class).toInstance(() -> true);
    TestIMdsalApiManager singleton = TestIMdsalApiManager.newInstance();
    bind(IMdsalApiManager.class).toInstance(singleton);
    bind(TestIMdsalApiManager.class).toInstance(singleton);
    bind(IdManagerService.class).toInstance(Mockito.mock(TestIdManagerService.class, realOrException()));
    bind(OpendaylightDirectStatisticsService.class).toInstance(Mockito.mock(TestOdlDirectStatisticsService.class, realOrException()));
    bind(JobCoordinatorEventsWaiter.class).to(TestableJobCoordinatorEventsWaiter.class);
    bind(AclInterfaceCache.class).toInstance(new AclInterfaceCacheImpl());
    bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
}
Also used : JobCoordinatorEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter) TestableJobCoordinatorEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.TestableJobCoordinatorEventsWaiter) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) OpendaylightDirectStatisticsService(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.OpendaylightDirectStatisticsService) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) TestOdlDirectStatisticsService(org.opendaylight.netvirt.aclservice.stats.TestOdlDirectStatisticsService) AclserviceConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) AclInterfaceCache(org.opendaylight.netvirt.aclservice.api.AclInterfaceCache) ServiceRecoveryRegistry(org.opendaylight.genius.srm.ServiceRecoveryRegistry) AclInterfaceCacheImpl(org.opendaylight.netvirt.aclservice.AclInterfaceCacheImpl) AclClusterUtil(org.opendaylight.netvirt.aclservice.utils.AclClusterUtil)

Example 2 with AclserviceConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig in project netvirt by opendaylight.

the class AclServiceUtils method getHardTimoutForApplyStatefulChangeOnExistingTraffic.

/**
 * Returns the hard timeout based on the protocol when a ACL rule removed from the instance.
 * It will returns the timeout configured in the {@link AclserviceConfig} class.
 *
 * @param ace the ace
 * @param aclServiceUtils acl service utils
 * @return the hard time out
 */
public static Integer getHardTimoutForApplyStatefulChangeOnExistingTraffic(Ace ace, AclServiceUtils aclServiceUtils) {
    int hardTimeout = AclConstants.SECURITY_GROUP_ICMP_IDLE_TIME_OUT;
    Matches matches = ace.getMatches();
    AceIp acl = (AceIp) matches.getAceType();
    Short protocol = acl.getProtocol();
    if (protocol == null) {
        return hardTimeout;
    } else if (protocol == NwConstants.IP_PROT_TCP) {
        hardTimeout = aclServiceUtils.getConfig().getSecurityGroupTcpIdleTimeout();
    } else if (protocol == NwConstants.IP_PROT_UDP) {
        hardTimeout = aclServiceUtils.getConfig().getSecurityGroupUdpIdleTimeout();
    }
    return hardTimeout;
}
Also used : Matches(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches) AceIp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp)

Example 3 with AclserviceConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig in project netvirt by opendaylight.

the class AclNodeListener method add.

@Override
protected void add(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode dataObjectModification) {
    NodeKey nodeKey = key.firstKeyOf(Node.class);
    BigInteger dpId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
    LOG.info("Received ACL node [{}] add event", dpId);
    if (securityGroupMode != null && securityGroupMode != SecurityGroupMode.Stateful) {
        LOG.error("Invalid security group mode ({}) obtained from AclserviceConfig. dpId={}", securityGroupMode, dpId);
        return;
    }
    jobCoordinator.enqueueJob(String.valueOf(dpId), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
        new AclNodeDefaultFlowsTxBuilder(dpId, mdsalManager, config, tx).build();
        LOG.info("Adding default ACL flows for dpId={}", dpId);
    })), AclConstants.JOB_MAX_RETRIES);
    LOG.trace("FlowCapableNode (dpid: {}) add event is processed.", dpId);
}
Also used : BigInteger(java.math.BigInteger) AclNodeDefaultFlowsTxBuilder(org.opendaylight.netvirt.aclservice.utils.AclNodeDefaultFlowsTxBuilder) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 4 with AclserviceConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig in project netvirt by opendaylight.

the class AclServiceTestModule method aclServiceConfig.

private AclserviceConfig aclServiceConfig() {
    AclserviceConfig aclServiceConfig = mock(AclserviceConfig.class);
    Mockito.when(aclServiceConfig.getSecurityGroupMode()).thenReturn(securityGroupMode);
    return aclServiceConfig;
}
Also used : AclserviceConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig)

Aggregations

AclserviceConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig)2 BigInteger (java.math.BigInteger)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 JobCoordinatorEventsWaiter (org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter)1 TestableJobCoordinatorEventsWaiter (org.opendaylight.genius.datastoreutils.testutils.TestableJobCoordinatorEventsWaiter)1 IMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager)1 TestIMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager)1 ServiceRecoveryRegistry (org.opendaylight.genius.srm.ServiceRecoveryRegistry)1 AclInterfaceCacheImpl (org.opendaylight.netvirt.aclservice.AclInterfaceCacheImpl)1 AclInterfaceCache (org.opendaylight.netvirt.aclservice.api.AclInterfaceCache)1 TestOdlDirectStatisticsService (org.opendaylight.netvirt.aclservice.stats.TestOdlDirectStatisticsService)1 AclClusterUtil (org.opendaylight.netvirt.aclservice.utils.AclClusterUtil)1 AclNodeDefaultFlowsTxBuilder (org.opendaylight.netvirt.aclservice.utils.AclNodeDefaultFlowsTxBuilder)1 Matches (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches)1 AceIp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp)1 OpendaylightDirectStatisticsService (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.OpendaylightDirectStatisticsService)1 IdManagerService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1