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));
}
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;
}
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);
}
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;
}
Aggregations